$x^2=x\iff x=0\lor x=1$. If $a,b\in A$ s.t. $ab=a+b\to ab=ba$ 
Let $A$ be a ring such that $x^2=x\iff x=0\lor x=1$. If $a,b\in A$ s.t. $ab=a+b$, prove that $ab=ba$

I have $ab=a+b\to(a-1)(b-1)=1$. I don't know what to do next. Can somebody help me, please?
 A: I will leave it to you to crank out that $(ab-ba)^2=ab-ba$ using the given relation.
At that point you have two possibilities:
If $ab-ba=0$ you are done, so the last thing to check is if it is possible for $ab-ba=1$.
By multiplying on the right by $b$ you can get to $a-ba=0$, then by multiplying on the left by $a$ you get to $ba=0$. Naturally you also have at the same time that $ab=1$.
Then $a+b=ab=1$. Multipying on the let with $b$, you get $b^2=b$. For $ab=1$ to hold, $b=1$. But then $b$ commutes with everything in the ring, including $a$, but this is a contradiction since $1=ab\neq ba=0$. So in fact the case $ab-ba=1$ is an impossible case.
I'm guessing this can be simplified somewhat. The above was just generated by experimentation in a few minutes with pen and paper.
A: We have $(a-1)(b-1)=1$. Therefore $(b-1)\bigg{(}(a-1)(b-1)\bigg{)}(a-1)=(b-1)\cdot1\cdot(a-1)=(b-1)(a-1)$. That is $((b-1)(a-1))^2=(b-1)(a-1)$. Therefore $(b-1)(a-1)=0$ or $1$. If $1$, then $ba-a-b+1=1$ hence $ba=a+b=ab$. If $0$, it is either $a=1$ or $b=1$, assuming that the ring is an integral domain, hence $ab=ba$.
edit: I cannot see what to do in the 2nd case in a non-integral domain case. I get $ba=ab-1$ which is of course not equal to $ab$..
