If $x, y \in G$ commute ($G$ being an arbitrary group) with $o(x) = m$ and $o(y) = n$ and $gcd(m,n) \neq 1$, is there a general formula for $o(xy)$?

I'm aware questions very similar to this one have been asked before, so I'd like to clarify I already know how to treat the cases where $$m$$ and $$n$$ are coprime or where $$G$$ is abelian, or to prove that the order of the product is at most the least common multiple of the orders. I'm not interested in that, I'd just like to know whether there actually is a general formula depending on $$m$$ and $$n$$.

But if there isn't, I'd really like to know what's the least we can impose on $$G$$ and $$m, n$$ so that we can find a formula (that doesn't fit what I said above, of course - I'd also like to know how flexible the order of the product is, in the sense of how bad does it get if we don't impose anything else other than what I wrote). I'm taking a group theory course this semester and this exercise is homework, but someone asked my professor whether or not the exercise was missing any hypothesis and she said it wasn't, that there is indeed a general formula and we just need to consider the cases where $$x, y$$ are generated by a single element and when they're not. I've been unable to verifiy this and I'm not even convinced it's true, so I'd appreciate some clarification.

• As a special case of reuns's comment (which is the complete answer in general): if $m=n$, then the order of $xy$ might be any divisor of $m$. Consider for example the additive group $G=(\Bbb Z/m\Bbb Z)^2$ and $x=(-1,0)$ and $y=(1,m/k)$ for any divisor $k$ of $m$: the orders of $x$ and $y$ are both $m$, while the order of $x+y=(0,m/k)$ is $k$. – Greg Martin Apr 3 at 0:42
• If you know how to treat the case where $G$ is abelian, then you know how to treat the general case; just restrict your attention to the subgroup of $G$ generated by $x$ and $y$, which is abelian. – Servaes Apr 3 at 2:37
• In general, if $x$ and $y$ commute, the best you can say is$$\left.\left.\frac{\mathrm{lcm}(m,n)}{\gcd(m,n)}\right| \frac{\mathrm{lcm}(a,b)}{|\langle x\rangle\cap\langle y\rangle|} \right| |xy| \Biggm| \mathrm{lcm}(m,n).$$ – Arturo Magidin Apr 3 at 5:21

• $$m = \prod_j p_j^{e_j}$$ find $$a_j \not \equiv 0 \bmod p_j$$ such that $$\sum_j \frac{a_j}{p_j^{e_j}} = \frac{1}{m}+l$$ then $$x =\prod_j x_j$$ where $$x_j= x^{a_j \frac{m}{p_j^{e_j}}}$$ is of order $$p_j^{e_j}$$.
• Do the same for $$n= \prod_j p_j^{f_j}$$ and $$y = \prod y_j$$ where $$y_j$$ is of order $$p_j^{f_j}$$ (the $$p_j$$ are the same for $$x,y$$ so some of the $$e_j,f_j$$ are $$0$$).
• Then the order of $$xy$$ is the lcm of the order of the $$x_jy_j$$.
• If $$e_j\ne f_j$$ then the order of $$x_jy_j$$ is $$p_j^{\max(e_j,f_j)}$$.
• If $$e_j = f_j$$ then the order of $$x_jy_j$$ is $$p_j^{d_j}$$ with $$0 \le d_j \le e_j$$ and any case is possible for $$d_j$$.
Thus the order of $$xy$$ is $$\prod_{j,e_j\ne f_j} p_j^{\max(e_j,f_j)} \prod_{i, e_i = f_i} p_i^{d_i}$$