TITLE: Prove that a semigroup satisfying $a^pb^q=ba$ is commutative
QUESTION [10 upvotes]: Let $(S, \cdot)$ be a semigroup. There are natural numbers $p,q \geq 2$ such that $a^pb^q=ba$ for all $a,b \in S$. Prove that $S$ is commutative.

I wrote 
$$\begin{align}
a^{p+1}b^{q+1} &=b^{(q+1)p}a^{(p+1)q} \\
 &=b^{p}\cdot(b^q)^p \cdot (a^p)^q\cdot a^q \\
 &=b^p\cdot a^p \cdot b^q \cdot a^q \\
 &= b^p\cdot b \cdot a \cdot a^q \\
 &=b^{p+1}a^{q+1}.
\end{align}$$
From the given identity I also got $a^{p+1}b^{q+1}=abab$. Using $a^{p+1}b^{q+1}=b^{p+1}a^{q+1}$ I then got $abab=baba$.
Making $a=b$ in the statement gives $a^{p+q}=a^2$. I don't know what to do from there.

REPLY [5 votes]: Let $a\in S$.  As you have observed, $a^2=a^{p+q}$.  In particular, this means that the powers of $a$ are eventually periodic, say with period $d$.  We additionally know that $d\mid p+q-2$.  But we also have $$a^3=\color{red}{a^2}\cdot \color{blue}{a}=\color{blue}{a^p}\color{red}{(a^2)^q}=a^{p+2q}$$ which means $d\mid p+2q-3$.  Thus $d$ divides $(p+2q-3)-(p+q-2)=q-1$.  Similarly, writing $a^3=a\cdot a^2$ we find that $d$ divides $p-1$.
Thus we have shown that for any $a\in S$, there exists $N$ such that for any $n\geq N$, $$a^n=a^{n+p-1}=a^{n+q-1}.$$
Now let $a,b\in S$; we will show that $ab=ba$.  Notice first that $$ba=a^pb^q=(b^q)^p(a^p)^q=b^{pq}a^{pq}.$$  Iterating this, we have $ba=b^{(pq)^k}a^{(pq)^k}$ for any $k$.  In particular, let us choose $k$ such that $n=(pq)^k$ is large enough such that $a^n=a^{n+p-1}$ and $b^n=b^{n+q-1}$.  Now observe that $$ba=b^na^n=(a^n)^p(b^n)^q=a^{np}b^{nq}.$$  But $a^{np}=a^n$, since $a^n=a^{n+p-1}$ and $np-n$ is divisible by $p-1$, and similarly $b^{nq}=b^n$.  Thus $$ba=a^nb^n,$$ where $n=(pq)^k$ for some $k$.  But swapping the roles of $a$ and $b$ from the start of the argument, we know $a^nb^n=ab$, and thus $$ba=ab.$$