TITLE: A categorization of abelian groups
QUESTION [8 upvotes]: Suppose $G$ is a group such that for each $a$ and $b$ in $G$, $(ab)^3=a^3b^3$ and $(ab)^5=a^5b^5.$ We know that in such a condition, $G$ is an abelian group (the proof is here).
My question is this: is there any generalization for this? If so, what's the proof of that? more specifically, is there any rule for when $(ab)^p=a^p b^p$ and $(ab)^q= a^q b^q$ with a certain relation between $p$ and $q$ (possibly relating to their gcd) we can say $G$ is abelian?

REPLY [10 votes]: A group $G$ is $n$-abelian if $(ab)^n=a^nb^n$ for all $a,b\in G$.
Let $\mathcal{V}_n$ denote the class of all $n$-abelian group. Their structure was determined by Alperin.
Your question amounts to asking for conditions under which groups that are both $p$-abelian and $q$-abelian will necessarily be abelian; that is, when is $\mathcal{V}_p\cap\mathcal{V}_q = \mathcal{Ab}$, the class of abelian groups.
Theorem. Let $p,q\gt 1$. Then $\mathcal{V}_p\cap\mathcal{V}_q=\mathcal{Ab}$ if and only if $\gcd(p^2-p,q^2-q)=2$.
You can find a proof in this math.overflow post, together the statement of the result of Alperin and other facts.
The restriction to $p,q\gt 1$ is just technical. If $G$ is $n$-abelian, then it is also $(1-n)$-abelian, so you can always reduce to working with $p,q\gt 1$.