What follows is partially excerpted from my Historia Matematica post of 2005\01\04 on this topic, in reply to questions by Colin McLarty and Martin Davis.
Below is a proof by Gilmer from a Monthly Classroom Note[1].
Gilmer mentions it's also presented on p.58 of his textbook[2].$\:$
Remark that the use of Cramer's rule in Gilmer's proof is simply a special
case of the deduction of an equation of integral dependence over
an ideal (vs. ring), see Kaplansky, Commutative Rings, p.11 Exer.1.
or see his later Theorem 75, viz.
THEOREM $\rm\ 75.\ \ $ Let $\rm\:R\:$ be a ring, $\rm\:J\:$ an ideal in $\rm\:R,\ B\:$ an $\rm\:R$-module generated by $\rm\:n\:$ elements,$\ \ $ and $\rm\:r\:$ an element of $\rm\:R\:$ satisfying $\rm\ r\:B \subset JB\:.\ $ Then $\rm\ (r^n - j)\ B = 0\ $ for some $\rm\ j \in J\:.$
The desired proof now follows immediately, namely:
Specializing $\rm\ r=1,\ B=J\ $ yields $\rm\ (1-j)\ J = 0\ \Rightarrow\ J = (j),\ \ j^2 = j\:.\quad$ QED
Note that this may be viewed as a generalization of the simpler Dedekind domain case.
The above proof doesn't work in the noncommutative case
because the determinant trick no longer applies. However
one can prove Theorem 75 without using determinants by
instead appealing to Nakayama's Lemma. Namely, see Exercises 3.1, 3.2, p.43 in
Atiyah and Macdonald, Introduction to Commutative Algebra. Below is said direct proof of Gilmer - using Cramer's rule.
LEMMA $\ $ If $\rm\:B\:$ is a finitely generated idempotent ideal of a commutative
ring $\rm\:T\:$ then $\rm\:B\:$ is principal and is generated by an idempotent element.
Proof $\ $ We first assume that $\rm\:T\:$ has an identity and we let $\rm\:\{b_{\:i}\:\}\:$ be a finite set of generators for $\rm\:B\:.\:$ Then $\rm\:B = B^2 = \sum\: B\ b_{\:i}\:$ so that we obtain a system of equations $\rm\ b_k = \sum s_{\:k\:i}\ b_{\:i}\:,\ $ where $\rm\:s_{\:k\:i} \in B\:.\ $ This gives rise to a system of equations $\rm\ \sum\ (\delta_{\:k\:i}-s_{\:k\:i})\ b_{\:i} = 0\:,\:$ where $\delta =$ Kronecker delta.
By Cramer's rule $\rm\:d\ b_i = 0\:$ for all $\rm\:i\:,\:$ where $\rm\:d\:$ is the determinant of the matrix $\rm\ [\delta_{ki}-s_{ki}]\:.\ $ It is easy to see that $\rm\:d\:$ has the form $\rm\: 1-b\: $ for some $\rm\:b \in B\:.\ $ Since $\rm\ 0 = d\ b_i = b_i - b\ b_i\ $ for each $\rm\:i,\ B\ $ is the principal ideal generated by $\rm\:b\:.\ $ And since $\rm\:1-b\:$ kills $\rm\:B\:,\:$ we conclude $\rm\ (1-b)\ b = 0\:,\ $ or $\rm\ b = b^2\:.$
If $\rm\:T\:$ contains no identity element, we consider a commutative ring $\rm\:T'\:$ obtained by adjoining an identity element to $\rm\:T\:.\ $ Then $\rm\:B\:$ is a finitely
generated idempotent ideal of $\rm\:T',\:$ and hence is principal as an ideal of $\rm\:T',\:$ generated by an idempotent element $\rm\:v\:.\ $ Since $\rm\:T'$ is obtained by adjoining an identity element to $\rm\:T\:,\:$ it follows $\rm\:v\:$ also generates $\rm\:B\:$ as an ideal of $\rm\:T\:.\quad$ QED
[1] Robert Gilmer, An Existence Theorem for Non-Noetherian Rings
(in Classroom Notes),
The American Mathematical Monthly, Vol. 77, No. 6, pp. 621-623.
[2] Robert Gilmer, Multiplicative Ideal Theory,
Queens University, Kingston, Ontario, 1968. See p.58
Best Answer
This is a straightforward consequence of Nakayama's Lemma with $M=I$.
Once you have $r-1=i$ and $rI=\{0\}$, you have $r^2-r=ri=0$ so that $r^2=r$.
However, you are more interested in $e=1-r\in I$ which is then also an idempotent in $I$. We are going to be done if $eR=I$.
Fortunately, it is: since $1=e+(1-e)$ we can multiply by any $i\in I$ to get $i=ei+(1-e)i=ei+ri=ei$.