My book says "it is easy to see that $A$ (a commutative ring) has an idempotent $e\neq 0,1$ if and only if it is a direct sum of rings $A=A_1\oplus A_2$ with $A_1=Ae$ and $A_2=A(1-e)$."
I know the $\implies$ implication, but if $A=Ae\oplus A(1-e)$, why is $e$ a nontrivial idempotent? I tried writing $e=ae+b(1-e)$ for $a,b\in A$ and squaring, but nothing cancels correctly. I also tried computing $e(1-e)$ with $1-e=1-ae-b(1-e)$, but again nothing cancels nicely.