Here is the question I want to solve:
Let $M$ be a finitely generated $R$-module. Show that if $f \in \mathrm{End}_R(M)$ is surjective then it is also injective.
And here is the hint I got for the solution:
Let $R[X] \cong R^{[1]}$ and make $M$ into an $R[X]$-module by setting $X.m = f(m)$ for $m \in M.$ Show that $XM = M$ and apply Nakayama's Lemma.
My statement of Nakayama's Lemma is as follows:
If $M$ is a finitely generated $R$-module and $JM = M$ then there exists $r \in \operatorname{ann}(M)$ with $r \equiv 1 \pmod J.$
My question is:
How the hint will prove the injectivity? Any clarification of this will be appreciated.
Taking $J=\langle X\rangle$, let $r$ be as in the conclusion of Nakayama’s Lemma. Then $r=p(X)X + 1$ for some $p(X)\in R[X]$. If $m\in\mathrm{ker}(f)$, then $p(X)X\cdot m = 0$, so $$ m = 1\cdot m + p(X)X\cdot m = (1+p(X)X)\cdot m = r\cdot m = 0.$$