Associative operation on a set $S$
Solution 1:
We have $$ \tag1x^2 = (x^2)^{n+1}=x(x^2)^nx=x^2x^nx^2=xx^{n+1}x^2=x^4$$ and consequently $$\tag2 x = x^{n+1}=x^2x^{n-1}\stackrel{(1)}=x^4x^{n-1}=x^2x^{n+1}=x^3$$ and $$ \tag3x^n=x^{n-1}x\stackrel{(2)}=x^{n-1}x^3=x^{n+1}x=x^2$$ for all $x$.
Now $$\tag4 xy\cdot yx=xy^2x\stackrel{(3)}=xy^nx=yx^ny\stackrel{(3)}=yx^2y=yx\cdot xy$$ so that $xy$ and $yx$ commute for all $x,y$. Next, $$\tag5\begin{align} xy&\stackrel{(2)}=xy^3\stackrel{(2)}=(xy)^3y^2\stackrel{(2)}=(xy)^5y^2\\&=x(yx)^2\cdot y(xy)^2y\cdot y\\ &\stackrel{(4)}=x(yx)^2\cdot (xy)y^2(xy)\cdot y\\ &=x(yx)^2x\cdot y^3xy^2\stackrel{(3)}=x(yx)^2x\cdot yxy^2\\ &\stackrel{(4)}=(yx)x^2(yx)yxy^2\stackrel{(2)}=(yx)^3y^2\stackrel{(2)}=yxy^2\end{align}$$ and $$\tag6 xy\stackrel{(5)}=yxyy\stackrel{(5)}=yyxyyy\stackrel{(2)}=y^2xy$$ so that $y$ commutes with $yxy$ as well as with $xy^2$.
The operation $x*y:=yx$ has the same properties as "$\cdot$". Thus we obtain the corresponding result $$ yx = x*y\stackrel{(5^*)}=y*x*y*y = yyxy \stackrel{(6)}= xy.$$
If we are bored, we can as well translate the derivation of $(5)$ directly to one of $(5^*)$ and thus show: $$\begin{align} yx&\stackrel{(2)}=y^3x\stackrel{(2)}=y^2(yx)^3\stackrel{(2)}=y^2(yx)^5\\&= y\cdot y(yx)^2y\cdot (xy)^2x\\ &\stackrel{(4)}=y\cdot (yx)y^2(yx)\cdot(xy)^2x\\ &=y^2xy^3\cdot x(xy)^2x\stackrel{(3)}=y^2xy\cdot x(xy)^2x\\ &\stackrel{(4)}=y^2xy(xy)x^2(xy)\stackrel{(2)}=y^2(xy)^3\stackrel{(2)}=y^2xy\\ &\stackrel{(6)}=xy.\end{align}$$