gcd and order of elements of group

Suppose a and b are elements of group G and both a and b have finite order. How do I show if $ab = ba$, $gcd(|a|, |b|)= 1 \implies |ab| = |a||b|$


Write $|a|=d_a$. Since $(ab)^{d_a\cdot d_b}=(a^{d_a})^{d_b}(b^{d_b})^{d_a}=1$, we have $d_{ab}|d_a\cdot d_b$.

On the other hand assume that $(ab)^d=1$ for some $d$. Then also

$$1=(ab)^{d\cdot d_a}=(a^{d_a})^d b^{d\cdot d_a}=b^{d\cdot d_a}$$

Therefore $d_b | d\cdot d_a$. But $\gcd(d_a,d_b)=1$, so $d_b|d$. By the same argument also $d_a|d$ (just raise $(ab)^d=1$ to the power $d_b$ instead of $d_a$). Therefore $d_a\cdot d_b|d$. In particular this holds for $d=d_{ab}$.

We showed $d_{ab}|d_a d_b$ and $d_a d_b|d_{ab}$, therefore $|ab|=d_{ab}=d_a d_b=|a|\cdot |b|$.


To finish the solution suggested in the comments, if $(ab)^k=a^kb^k=1$ then $a^k \in <b>$, hence $|a^k|$, which is equal to $|a|/gcd(|a|,k)$, must divide $|b|$. Given that $gcd(|a|,|b|)=1$, we must have $gcd(|a|,k)=|a|$. Similarly, $gcd(|b|,k)=|b|$. The smallest $k$ with these properties ($gcd(|a|,|b|)=1$ included) is $|a||b|$.