Using Nakayama lemma to prove that surjective implies injective. 
$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. 
Thanks, 
 A: I would use the Cayley-Hamilton theorem for this problem. (If you are working over a Noetherian ring, then your kernel will be finitely generated. Otherwise I am not sure it has to be). I am basically going to give the argument which is Eisenbud's Commutative Algebra with a View Towards Algebraic Geometry (Corollary 4.4). You can also look at Proposition 2.4, Corollary 2.5 in Atiyah-Macdonald's Introduction to Commutative Algebra.
Let $t$ be an indeterminate. We can define an $A[t]$-module structure on $M$, by defining the action of $t$ as follows: $tm = f(m)$, where $f$ is your surjective map. Then note that because $f$ is surjective, $(t)M = M$. In particular, we can apply the Cayley-Hamilton Theorem to the $A[t]$-module $M$ with the identity map on $M$. Then there exists $a_1, \dots, a_n \in (t)$ such that $(1 + a_1 + \cdots +a_n)M = 0$. Since each $a_j = tq_j(t)$ for some $q_j(t) \in A[t]$, we get a polynomial $q(t)$ such that $(1 - q(t)t)M = 0.$ But this means that ${\rm Id}_M - q(f)f = 0$. Then $q(f)f ={\rm Id}_M$, so $f$ is injective, and hence an isomorphism.
