$A$ is a commutative ring, and $f:M\rightarrow M$ is an endomorphism of $A$-modules which is surjective. If I know that $M$ is finitely generated, I want to prove that $f$ is also injective.
This is what I have. Let $N=\ker(f)$. Then we have that $N$ is finitely generated and moreover it is a submodule of $M$.I want to try to apply Nakayama's lemma to $N$. Meaning, I want to find an ideal $I$ of $A$ such that $I$ is contained in every maximal ideal and $IN=N$. This is where Im having trouble. For every ideal we obviously have that $IN\subset N$ ( because $f(in)=if(n)=i0=0)$, but I dont see what to make $I$ so that $N\subset IN$ and $I$ in every maximal ideal.