Order of $ab$ if $a$ and $b$ commute and $\langle a\rangle\cap\langle b\rangle=\{1\}$ So, one of the homework problems I am working on is

If $a$ and $b$ are elements of a group that commute and $\langle a\rangle\cap \langle b\rangle = \{1\}$, what is the order of $ab$ if the order of $a$ is $m$ and the order of $b$ is $n$? Prove your assertion. Show by example that your assertion is false in general, in the case that $a$ and $b$ do not commute.

What I'm thinking is that the order if $ab$ would be $mn$, because, $\langle ab\rangle$ would contain $a^1 b^1$, $a^1b^2,\ldots ,a^1b^n$, $a^2b^1$, $a^2b^2,\ldots,a^m b^n$. Because, for every $a$, there would be $n$ $b$'s, and there are $m$ $a$'s, so there should be $nm$ in $\langle ab\rangle$, right?
However, I don't think this is exactly correct, because what I have shown there has nothing to do with $a$ and $b$ being able to commute.
I would like some help, am I going in the right direction? What might I need to do in order to show that it is false in general when $a$ and $b$ do not commute?
 A: One way to show that the order of $ab$ is $mn$ is to show that the powers $(ab)^0$, $(ab)^1$, $\dots$, $(ab)^{mn-1}$ are distinct from $1$, and that $(ab)^{mn}=1$. Can you do this?
To show that you need commutativity, find a counter example. What is the smallest non-abelian group do you know? Can you find an example there?
A: There are indeed a couple of errors in your argument. In no particular order:


*

*I agree that the group $\langle ab\rangle$ contains $ab$, and $a^2b^2$, and $a^3b^3,\ldots,a^{n-1}b^{n-1}$... but I'm not so sure it contains $ab^2$. Does it? What if $m=n$? 

*Even assuming that the group contains all of the products you describe, you did not show that all these elements are distinct elements of $G$; that is, you did not show that if $a^ib^j = a^rb^s$, with $1\leq i\leq n$, $1\leq j\leq m$, then $i=r$ and $b=s$. (This is where the fact that $\langle a\rangle \cap \langle b\rangle = \{1\}$ will come into play).
Also, you might want to rethink your guess. Look at the Klein $4$-group, $\mathbb{Z}_2\oplus \mathbb{Z}_2$: if we take two distinct elements of order $2$, then they satisfy the hypothesis; your guess is that their product will have order $4$... but the Klein $4$-group does not have elements of order $4$. Think about what goes wrong there with your argument.
Now, it is easy to check that $(ab)^{nm}=1$, since $a$ and $b$ commute. You may want to try to show that if $(ab)^k = 1$, then you must separately have $a^k=1$ and $b^k=1$... that will help figure out what the right guess is (and, trying to prove that, make sure to use your hypothesis on $\langle a\rangle \cap \langle b\rangle$! It's not true otherwise... try to find an example to show that)
