$R$ is a ring with unity, and for each $a \in R$, there exists $x \in R$ such that $a^2x=a$. Show that $ax=xa$. 
Let $R$ be a ring with unity. For each $a \in R$, there exists $x \in R$ such that $a^2x=a$. Show that $ax=xa$.

I know that $R$ has no nonzero nilpotent elements and $axa=a$.
Thus I tried to show that
$$(ax-xa)^2=0$$
but I failed to show that.
Thanks in advance.
 A: Step 1: convince yourself that $xaa=a$ as well. You can use the same strategy here: $(a-xaa)^2=0$.
Step 2: follow your idea leveraging the fact that the ring has no elements squaring to zero and get to $(ax-xa)^2=ax-axxa$
Step 3: $axxa=axx(aax)=axaaxx=axax=ax$
Step 4: rejoice, because this means the computation in step 2 ends as 0.
A: You already know that $R$ has no nonzero nilpotent elements and $axa=a$. 
Now since $axax=axa\cdot x=ax$, $ax$ is idempotent. We prove that $ax$ is in the center of $R$. 
For any $z\in R$, consider the nilpotent commutator of $ax$ and $axz$ (commutator of $a$ and $b$ is $ab-ba$) 
\begin{align}
(\underbrace{axaxz}_{axax=ax}-axzax)^2&=(axz-axzax)^2
\\
&=axzaxz-axzaxzax-\underbrace{axzaxaxz}_{axax=ax} +axzaxaxzax
\\
&=axzaxz-axzaxzax-axzaxz+axzaxzax
\\
&=0
\end{align}
Since $R$ has no nonzero nilpotent elements, $axz=axzax$. 
Again consider the nilpotent commutator of $ax$ and $zax$ 
\begin{align}
(zaxax-axzax)^2&=(zax-axzax)^2
\\
&=zaxzax-\underbrace{zaxaxzax}_{axax=ax}-axzaxzax+axzaxaxzax
\\
&=zaxzax-zaxzax-axzaxzax+axzaxzax
\\
&=0
\end{align}
So $zax-axzax=0$ and $zax=axzax=axz$, i.e. $ax$ is in the center of $R$. 
Moreover $xaxa=x\cdot axa=xa$. So $xa$ is idempotent. Similarly we can prove that $xa$ is in the center of $R$. 
Finally we have 
$$
(ax-xa)^2=axax-\underbrace{axxa}_{x\cdot xa=xa\cdot x}-\underbrace{xaax}_{aax=a}+xaxa=axax-axax-xa+xa=0
$$
So  $ax=xa$.
