Let $R$ be a nonzero commutative ring, and let $n,m$ be integers. Let $f:R^n\rightarrow R^m$ be an injective homomorphism of $R$-modules.
I'm trying to show that $n\leq m$.
My idea: Assume that $n>m$, let $i:R^m\rightarrow R^n$ be the "embedding in the first $n$ coordinates", and take the composition $g:R^n\rightarrow R^n$ define by $g=i\circ f$.
First, $g$ is injective. Second, we can apply a version of Nakayama's lemma to get a monic polynomial $p(X)\in R[X]$ such that $p(g)=0$.
Now, I somehow want to use the fact that the image of $g$ consists of elements which are zero on the last coordinate (at least), but I'm circling around this with no success.
This is an exercise from Atiyah-Macdonald.