Equivalent condition of the following group presentation to give a group of order $mn$; the other side Let $G$ be a group (not necessary abelian) generated by $a, b$ that has a group presentation: $$\langle a, b \mid a^m = 1, b^n = 1, ba = a^rb\rangle. $$In my question Equivalent condition of the following group presentation to give a group of order $mn$ , I was able to understand that if $G$ is of order $mn$ then $r^n = 1 \pmod{m}$. I thought that I have proven the opposite side (if $r^n = 1 \pmod{m}$, then $G$ is of order $mn$), but my proof was erroneous. Especially I'm having a difficulty proving that all $a^xb^y$s are distinct for distinct $(x,y)$s, so that $G$ will have $mn$ distinct elements(I know that all elements in $G$ can be written in the form of $a^xb^y$, because of $ba = a^rb$ and Prove that the following equality holds in a group). How can I prove this?

$\renewcommand{\phi}{\varphi}$$\newcommand{\Span}[1]{\left\langle #1 \right\rangle}$You can do it by bounding the group from below.
Construct the semidirect product $S$ of a cyclic group $\Span{\alpha}$ of order $m$ by a group $\Span{\beta}$ of order $n$, with $\beta$ acting on $\Span{\alpha}$ by raising to the $r$-th power. This is a group of order $m n$.
Let $G$ be your group. Now von Dyck's theorem yields that there is a unique homomorphism
\begin{align}
\phi :\ &G \to S
\end{align}
such that $\phi(a) = \alpha$ and $\phi(b) = \beta$, and $\phi$ is clearly surjective. Since the $\alpha^{x} \beta^{y}$ are distinct, for $0 \le x < m$ and $0 \le y < n$, so are the corresponding $a^{x} b^{y}$.
