Let $R$ be a commutative ring and $M$ a finitely generated $R$-module. Let $s$ be the maximum number of linearly independent elements of $M$, while $t$ is the minimum number of a system of generators of $M$. Show that $s\leq t$.
It is immediate in the case of vector spaces, but my first attempt (explicit computation) didn't work here due to the fact that there are coefficients (elements of $R$) without an inverse. I tried in so much other ways spending a lot of time, and I should be very glad if you cold give me a precise, complete and rigorous proof.
Thank you in advance.
Let $x_1,\dots,x_s\in M$ be linearly independent over $R$, and $y_1,\dots,y_t\in M$ a system of generators. Now define an injective homomorphism $\sigma:R^s\to M$ by $\sigma(e_i)=x_i$ (here $(e_i)_{i=1,\dots,s}$ is the canonical basis of $R^s$), and a surjective homomorphism $\pi:R^t\to M$ by $\pi(f_j)=y_j$ (here $(f_j)_{j=1,\dots,t}$ is the canonical basis of $R^t$). Now write $x_i=\sum_{j=1}^ta_{ij}y_j$ and define a homomorphism $\phi:R^s\to R^t$ by $\phi(e_i)=\sum_{j=1}^ta_{ij}f_j$. It's easily checked that $\pi\phi=\sigma$, so $\phi$ is injective. Now just use the famous exercise 2.11 from Atiyah and Macdonald.