Let $A$ be a commutative ring and $I$ a finitely generated ideal satisfying $I=I^2$. Prove that $I$ is generated by a single idempotent element.
Attempt: I know it exist an element $x \in A$ such that $x \equiv 1$ mod $I$ and $xI = 0$. By this I know that for this element $x$ we have $xy=0$ for all $y \in I$, and I can write $x + y_1 = 1$ for some $y_1 \in I$, multiplying this with $x$ gives $x^2=x$, thus I have found what I believe is our idempotent element we are looking for. Now i cant argue that $I=(x)$, what am I missing?
$1-x \in I$ and because $x$ is idempotent, $1-x$ is also idempotent. Furthermore, $\langle 1-x\rangle=I$.
Now let $y \in I$. Then $y(1-x)=y-yx=y$ and by definition of the ideal generated by a single element , $y(1-x) \in \langle 1-x\rangle$. In order to prevent confusion I am denoting the ideal generated by $1-x$ by $\langle 1-x\rangle$ instead of $(1-x)$.