TITLE: Peirce decomposition of a ring: must the ideal generators be idempotent in characteristic 2?
QUESTION [6 upvotes]: I'm considering this particular statement of the Peirce decomposition of a ring:

If a commutative unital ring $R$ can be written as an internal direct sum of two of it's proper ideals $I$ and $J$, so $R = I \oplus J$, then there exists an idempotent element $e \in R$ such that $I = eR$ and $J = (1-e)R$. 

Since $R$ is an internal direct sum of $I$ and $J$, there is some $e \in I$ and $f \in J$ such that $e+f=1$ (then $f = 1-e$). How do you prove that $e$ is idempotent though? I've written out that
\begin{align*}
e+f &= 1
\\(e+f)^2 &= 1^2
\\e^2+f^2 &= 1 \qquad \text{since $ef=0$ because $IJ = 0$}
\\e^2 + (1-e)^2 &= 1
\\e^2 + 1 -2e + e^2 &= 1
\\2e^2 -2e &= 0
\end{align*}
And this implies that $e$ is idempotent if the characteristic of the ring is not $2$! Is there a way to prove $e$ is idempotent that avoids this tiny snag?

REPLY [8 votes]: Just observe that $ef=0$ means $e(1-e)=0$ so $e-e^2=0$ and $e^2=e$.

REPLY [6 votes]: No, it has nothing to do with characteristic $2$. The representations of elements as $i+j$ in a direct sum are necessarily unique (that is an equivalent way of saying it.)
So to continue from what you wrote, since $e^2\in I$ and $f^2\in J$, and $e+f=e^2+f^2$, we necessarily have $e=e^2$ and $f=f^2$.
That's another way, not as direct as Eric's but still useful to know.