How do I show that if the product of idempotents is idempotent, then idempotents commute with other elements? I was not able to prove the following theorem. I would appreciate some help regarding it:

If the product of each two idempotent elements in a unity ring is an idempotent element itself, prove that the product of idempotent and a specifically non-idempotent element is commutative. (The ring $R$ is a unity ring).  In notation:
$$\forall a \in R \forall x \in R (a^2=a \land x^2 \neq x \longrightarrow xa=ax).$$

I'm very new to group theory in general, so I can't properly find an example to demonstrate my point. I'm not even aware exactly of terms such as "ideals" etc. I will however state the original theorem which this was a derivative of:

For a unity ring $R$, prove that if the product of two idempotent elements is also idempotent, then all idempotent elements of the ring are an element of its center.

Since one has to prove that for all elements of the ring $R$ multiplied by an arbitrary idempotent element such as $a$ have the commutative property, I divided the case for the arbitrary element $x$ in two cases: for $x$ which is idempotent, and for $x$ which is not. I was able to prove that if $x$ is idempotent, the commutative property holds for its product with $a$ (the arbitrary idempotent element of $a$), but I wasn't able to do it for when $x$ is strictly non-idempotent; and that's why I stated the theorem above. I'll be thankful if you provide a solution for the first theorem and not a different method to prove the original theorem in a different way.
 A: $\newcommand{\ma}[4]{\begin{pmatrix}#1 & #2 \\ #3 & #4\end{pmatrix}}$
It's really not helpful to specifically ask about the case where $x$ is not idempotent; the case where $x$ is not idempotent is just as hard as proving it for arbitrary $x$.  (The assumption that $x$ is not idempotent is not useful in any way, once you've already proved that it works in the case where $x$ is idempotent.)  The basic idea for how to prove it is that given an idempotent $a\in R$ and another element $x\in R$, you can build other idempotent elements from $a$ and $x$ such that the fact that $a$ commutes with those idempotents actually implies that $a$ commutes with $x$.
To understand why this would be true, it is helpful to consider the following example which is kind of the "canonical" example of an idempotent element of a ring.  Suppose $R$ is a subring of the $2\times 2$ matrix ring $M_2(k)$ for some commutative ring $k$ and let $a$ be the matrix $\ma1000$.  Suppose our other element $x\in R$ is some matrix $\ma rstu$.  Then $ax=\ma rs00$ and $xa=\ma r0t0$, so to show that $ax=xa$ we just want to show that $s=t=0$.  Now the trick is to notice that $b=\ma 1s00$ is also and idempotent matrix, $ab=b$, and $ba=a$, so if $b$ commutes with $a$, we must have $a=b$ so $s=0$.  So, as long as we can prove that $b$ has to be in our ring $R$ (by writing it as a combination of $a$ and $x$), we get to conclude that $s=0$.  Similarly, by considering the idempotent $c=\ma10t0$ we can show that $t=0$.
So, now it's just a matter of playing around with matrix multiplication to figure out how to express $b$ and $c$ in terms of $a$ and $x$.  Here there's another handy trick: you can isolate the individual entries of a matrix by multiplying by $a$ or $1-a$ on the left and right.  In particular, $ax(1-a)=\ma0s00$.  So, we see that $b=a+ax(1-a)$.  Similarly, $c=a+(1-a)xa$.
Now for the really magical part: all of this actually works in any ring $R$, not just our imagined example with $2\times 2$ matrices.  That is, suppose we have a ring $R$ with an idempotent $a\in R$ and an element $x\in R$.  Then the elements $b=a+ax(1-a)$ and $c=a+(1-a)xa$ are also idempotent.  If $a$ commutes with $b$, then $a$ commutes with $b-a=ax(1-a)$, so $a(ax(1-a))=(ax(1-a))a$.  But $a^2=a$ and $(1-a)a=0$, so this simplifies to just $ax(1-a)=0$.  Similarly, if $a$ commutes with $c$, that implies $(1-a)xa=0$.  Finally, we have $ax=axa+ax(1-a)=axa$ and $xa=axa+(1-a)xa=axa$, so this implies $ax=xa$, as desired.
(In fact, it's not just a magical coincidence that our formulas for $2\times 2$ matrices work in any ring.  Actually, whenever you have an idempotent element of a ring, this gives a way to consider your ring as consisting of certain $2\times 2$ matrices.  See this answer and this answer for some discussion of how this works, for instance.  You can also use a similar matrix method to directly prove the original statement without handling the case where $x$ is idempotent first.  Namely, using the same notation as above, note that $b(1-a)=\ma 0s00$ is a product of idempotents and thus idempotent, which implies $ax(1-a)=b(1-a)=0$, and similarly $(1-a)xa=(1-a)c=0$, from which you can directly conclude that $a$ and $x$ commute.)
