Direct Product iff Nontrivial Idempotent

Theorem
Let $R$ be a commutative ring with unity whose zero is $0_R$ and whose unity is $1_R$.

Then $R$ is the direct product of two non-trivial rings iff $R$ contains an idempotent element not equal to $0_R$ or $1_R$.

Proof
If $R$ has a nontrivial decomposition $R = R_1 \times R_2$ then $(1_R, 0_R)$ is a non-trivial idempotent element of $R$.

Conversely suppose there is $0_R, 1_R \ne e \in R$ with $e^2 = e$.

Let $R_1 = \langle e \rangle$, the ideal generated by $e$, and $R_2 = R / \langle e \rangle$.

Since $e \left({e - 1_R}\right) = 0_R$, it follows by definition that $e$ is a zero divisor.

So by Unit Not Zero Divisor it is not a unit.

Therefore, $1 \notin R_1$ and $\langle e \rangle \subsetneqq R$.

Also $R_1 \cap R_2 = \{ 0_R \}$ so the product is direct (that is, the Universal Property for Direct Products is satisfied)

Finally we define the "gluing homomorphism" $\phi : R \to R_1 \times R_2$ by


 * $ \phi : a \mapsto \left( a e, a + \langle e \rangle \right)$

which is easily shown to be an isomorphism.