Exercise 2.1 in Matsumura's Commutative Ring Theory reads as follows: "Let $A$ be a commutative ring and $I$ an ideal that is finitely generated and $I=I^2$. Then $I$ is generated by an idempotent."
In trying to solve it, i first followed a constructive approach, where e.g. for the case of two generators i tried to construct an idempotent generator. However, it seemed difficult. Then i realized that i could apply Nakayama's lemma to the $A$-module $I$ and the existence of the idempotent generator follows.
My question is: How could one go about finding this idempotent generator? Is there a systematic way?