Proving a semigroup to be abelian. If in a semigroup S,$ \ $ $ x^{k+1} = x $ for some  $k \ge 1$ and $xy^kx = yx^ky \quad  \forall x,y \in S$ then show that S is abelian.
I'm able to prove the following $\ x=x^3, \quad x^2y^2=y^2x^2=(xy^2)^2=(y^2x)^2 \ and \ x^k=x^2  \quad \forall x,y \in S$
I thought of proving  $x^2=y^2  \quad \forall x,y \in S$ and so S will have an identity element, but couldn't do it and don't know whether the approach is correct.
 A: I will use some of the properties that you are able to prove.
$x^2=x^k$ So $x^4=(x^2)^2=(x^2)^k=x^{k+1}x^{k-1}=xx^{k-1}=x^k$ and $x^6=x^{k+1}x^{k-1}x^k=x^kx^k=x^2x^2=x^4=x^k$
(1) Finally we can prove that $\forall n,x^{2n}=x^k$ (by induction)
Also $x^3=x$ So $x^5=x^3x^2=xx^k=x^{k+1}=x$
(2) So we have $\forall n,x^{2n+1}=x$ (by induction)
Case 1 : k is odd
With (1) and (2) we have $x=x^k$ and $\forall n, x^n=x $
$xyx=yxy\Rightarrow x^2yx=(xy)^2 \Rightarrow xyx=xy$
$xyx=yxy \Rightarrow (yx)^2=y^2xy \Rightarrow yx=yxy=xyx$
Finally $xy=yx$
Case 2 : k is even
I can't find a solution in this case, sorry.
A: Here is a sketch:
Argue, as you have, that $x^2$ is idempotent, $x^3 = x$ and $xy^2x = yx^2y$. Use these fact to show that $\mathcal{H} = \mathcal{D}$. $S$ is then a completely regular inverse semigroup so has central idempotents (you can also easily show idempotents are central, without knowledge of completely regular semigroups). Then \begin{align*} x^2y = yx^2 &\implies xy = xyx^2, yx = x^2yx \\ y^2x = xy^2 &\implies xy = y^2xy, yx = yxy^2\end{align*}
So \begin{align*}(xy)^2 &= (xy)(xy) \\ &= (y^2xy)(xyx^2) \\ &= y(yx)^3x \\ &=y(yx)x = y^2x^2\end{align*}
Then $$xy = (xy)^3 = (xy)^2xy = y^2x^2xy = y^2xyx^2 = y(yx)^2x = yx(yx)^2 = yx.$$
Alternatively we could continue to use the structure of completely regular inverse semigroups to show that $S$ is a strong semilattice of groups, each group isomorphic to $\mathbb{Z}_2$. It is then easy to show $S$ is  commutative.
