TITLE: Lifting idempotents modulo a nilpotent ideal
QUESTION [15 upvotes]: The problem is this: 

Suppose $I \subseteq R$ is a nilpotent ideal and there is $r \in R$ with $r \equiv r^2 \pmod I$. Show $r \equiv e \pmod I$ for some $e \in R$ idempotent.

I have spent a few hours rolling around in abstracta with no destination. I believe that if I could write down a concrete example of this, the example could guide me through the abstract definitions and show me where to look for an idempotent in $R$. I have looked at 2x2 matrices and could not find any such examples. Might anybody have one?

REPLY [6 votes]: Note that we may assume that $R$ is generated by $r$ (if not, just restrict the problem to the subring generated by $r$).  In particular, this lets us assume that $R$ is commutative, which makes the machinery of algebraic geometry available.  But this result is basically trivial in the language of algebraic geometry, using the correspondence between idempotents and clopen subsets.
In detail, since $I$ is contained in the nilradical of $R$, the quotient map $q:R\to R/I$ induces a homeomorphism $q^*:\operatorname{Spec} R/I\to \operatorname{Spec} R$.  Now, an idempotent element of a ring corresponds to a clopen subset of its spectrum, with the idempotent element being $1$ on the clopen subset and $0$ on the complement.  So there is some clopen subset $A\subseteq\operatorname{Spec} R/I$ such that $q(r)$ is $1$ on $A$ and $0$ on the complement of $A$.  But then $q^*(A)$ is a clopen subset of $\operatorname{Spec} R$, so there is some element $e\in R$ which is $1$ on $q^*(A)$ and $0$ on its complement.  This $e$ will then be idempotent, and $q(e)=q(r)$ (since they are both $1$ on $A$ and $0$ on its complement) and so $e-r\in I$.
(As is typical in this sort of argument, much of the real work is hidden in the proof that the structure sheaf of Spec of a ring really is a sheaf.  Indeed, that is what we are using to construct the element $e$, by gluing together sections of the structure sheaf of $\operatorname{Spec} R$ over $A$ and its complement.)