How to prove a semigroup with properties $x^3=x$ and $x^2y^2=y^2x^2$ is commutative 
If $S$ is a semigroup such that $$(\forall x,y\in S)\quad x^3=x\quad\text{and}\quad x^2y^2=y^2x^2,$$prove that
$$(\forall x,y\in S)\quad xy=yx.$$

All I did is prove $$x^2y^2=(x^2y^2)^2\quad\text{and}\quad xy^2x=(xy^2x)^2.$$

*

*Proof of $x^2y^2=(x^2y^2)^2$:

From $x^2y^2=y^2x^2,$ we deduce $x^2x^2y^2y^2=x^2y^2x^2y^2=(x^2y^2)^2.$
Taking into account $x^4=x^2,$ the result follows.

*

*Proof of $xy^2x=(xy^2x)^2$:

$xy=x^3y^3=xx^2y^2y=xy^2x^2y=(xy^2x)(xy)$ hence $xyyx=(xy^2x)(xy)(yx) =(xy^2x) ^2,$ which was the claim.
 A: Here is a structural proof, which follows from an old result of Clifford [1]. There is certainly a direct proof only using the given identities, but it might be more artificial.
Let $S$ be a semigroup satisfying the two identities
\begin{align}
  (1) \quad &x^3 = x \\
  (2) \quad &x^2y^2 = y^2x^2
\end{align}
First observe that, for every $x \in S$, $x^2$ is idempotent. Indeed,
$$
x^2x^2 = x^3x = xx = x^2.
$$
It follows by (2) that idempotents commute in $S$. On the other hand, (1) shows that $S$ is a completely regular semigroup, that is, every element of $S$ belongs to some subgroup of $S$. Indeed, every element $x$ belongs to the subgroup $H(x) = \{x, x^2\}$ of $S$.
It follows that $S$ is the union of these subgroups and every $\mathcal{H}$-class of $S$ is a (maximal) subgroup of $S$. Moreover, (1) shows that these maximal groups have exponent $2$ and hence are commutative (see for instance this answer for a proof).
The structure of completely regular semigroups with commuting idempotents is described in Theorem 3 of [1]. It says that $S$ is a semilattice of groups, in the following sense. The idempotents of $S$ form a semilattice $E$ and $S$ is the disjoint union of groups $G_e$, $e \in E$. If $e > f$, there is a morphism $\varphi_{e,f}:G_e \to G_f$ such that, if $e > f > k$, then $\varphi_{f,k} \circ \varphi_{e,f} = \varphi_{e,k}$. Now, the product on $S$ is defined as follows. If $g_e \in G_e$ and $h_f \in G_f$ are two elements of $S$ and if $k = ef$, then the product $g_eh_f$ is in $G_k$ and is computed as follows:
$$
  g_eh_f = \varphi_{e,k}(g_e) \varphi_{f,k}(h_f)
$$
Now, in your case, since $ef = fe$ and since $G_k$ is a commutative group,
this product is commutative.
[1] A. H. Clifford, Semigroups admitting relative inverses, Ann. of Math. (2) 42 (1941), 1037--1049.
