# If $M$ is a finitely generated module over a local ring, then $M$ is free.

Given a local ring $$A$$ and a finitely generated projective module $$M$$, show that $$M$$ is also free.

So I'm actually required to prove this question, although I believe that I managed to prove that $$M$$ is free without using projectivity. Here's my approach:

Let $$\mathfrak{m}$$ be the unique maximal ideal of $$R$$. First using Nakayama lemma to show that a basis $$e_1,...,e_n$$ of $$M/\mathfrak{m}M$$ generates $$M$$ too. I don't think that we need the projectivity for this step;

Next consider the following 2 exact sequences: $$\ker \psi \hookrightarrow A^{\oplus n} \twoheadrightarrow M$$ $$0\rightarrow \ker \hat{\psi} \rightarrow (A/\mathfrak{m})^{\oplus n} \rightarrow M/\mathfrak{m}M \rightarrow 0$$

So $$\psi$$ is a map that maps the basis $$a_1,...,a_n$$ to $$e_1,...,e_n$$ that generates $$M$$ and one can use the universal property of quotient to show that there exists $$\hat{\psi}:(A/\mathfrak{m})^{\oplus n} \rightarrow M/\mathfrak{m}M$$, which corresponds to the 2nd sequence. One can also show that $$\hat{\psi}$$ is in fact an isomorphism since it is surjective and by theorem of rank it must be bijective.

As last with some interpretations I think I can show that $$\ker \psi/\mathfrak{m}\ker \psi = \ker \hat{\psi} = 0$$ and this finishes the proof. However, I still didn't use the condition that $$M$$ is projective. I did some searching and find this interesting answer that seems to fit my solution,although there isn't an explicit proof. So can someone tell me if my approach is correct? Let me know if you need more details of my proof.

Edit: OK, now I think I know why my approach is false. One may have $$\ker \psi/\mathfrak{m}A^{\oplus n} = \ker \hat{\psi}$$ but $$\ker \psi/\mathfrak{m}A^{\oplus n} \neq \ker \psi/\mathfrak{m}\ker \psi$$ may happen and one cannot apply Nakayama lemma if the last equality does not hold.

For example, using the local ring $$R=\mathbb Z/4\mathbb Z$$, the (simple) finitely generated module $$R/I$$ where $$I$$ is the maximal ideal, has two elements, and obviously then cannot be free (since the f.g. free modules all have orders divisible by $$4$$.