TITLE: Elementary proof of Nakayama's lemma?
QUESTION [27 upvotes]: Nakayama's lemma is as follows:

Let $A$ be a ring, and $\frak{a}$ an ideal such that $\frak{a}$ is contained in every maximal ideal. Let $M$ be a finitely generated $A$-module. Then if $\frak{a}$$M=M$, we have that $M = 0$.

Most proofs of this result that I've seen in books use some non-trivial linear algebra results (like Cramer's rule), and I had come to believe that these were certainly necessary. However, in Lang's Algebraic Number Theory book, I came across a quick proof using only the definitions and induction. I felt initially like something must be wrong--I thought perhaps the proof is simpler because Lang is assuming throughout that all rings are integral domains, but he doesn't use this in the proof he gives, as far as I can see.
Here is the proof, verbatim: We do induction on the number of generators of $M$. Say M is generated by $w_1, \cdots, w_m$. There exists an expression $$w_1 = a_1w_1 + \cdots + a_mw_m$$ with $a_i \in \frak{a}$. Hence $$(1-a_1)w_1 = a_2w_2 + \cdots +a_mw_m$$ If $(1-a_1)$ is not a unit in A, then it is contained in a maximal ideal $\frak{p}$. Since $a_1 \in \frak{p}$ by hypothesis, we have a contradiction. Hence $1-a_1$ is a unit, and dividing by it shows that $M$ can be generated by $m-1$ elements, thereby concluding the proof.
Is the fact that $A$ is assumed to be a domain being smuggled in here in some way that I missed? Or is this really an elementary proof of Nakayama's lemma, in full generality?

REPLY [5 votes]: I think the following proof is valid and avoids both determinants and maximal ideals. The cost is induction over all $A$-modules generated by $n$ elements.
Nakayama. Let $J$ be the Jacobson radical. Let $M$ be a finitely generated $A$-module satisfying $M=JM$. Then $M=0$.
Proof. Induction on size of generating set. If $M$ is generated by zero elements then it is zero. Assume the assertion holds for modules generated by $n-1$ elements and let $M$ be generated by $n$ elements $m_1,\dots ,m_n$. Then $m_n=\sum _{i=1}^n \varepsilon _im_i$ with $\varepsilon _i\in J$ so $(1-\varepsilon _n)m_n=\sum_{i=1}^{n-1}m_i$. Dividing by the unit $1-\varepsilon _n$ we obtain $m_n$ as a linear combination of $m_1,\dots ,m_{n-1}$. Proceeding in this fashion we find $M=0$.