Given a commutative ring $R$ and an epimorphism of free modules $R^m \to R^n$ is then $m \geq n$?

If $\varphi:R^{m}\to R^{n}$ is an epimorphism of free modules over a nontrivial commutative ring, does it follow that $m \geq n$?

This is obviously true for vector spaces over a field, but how would one show this over just a commutative ring?

-----Edit

Is there any way to use the following?

If $\varphi : M \to M'$ is an epimorphism of left $S$-modules and $N$ is any right $S$-module then $id_N \otimes \varphi $ is an epimorphism.


As mentioned in the comments to the question, it’s the first part of Exercise 2.11 in Atiyah-MacDonald, and I refer to the comments for an answer.

The second part of Exercise 2.11 (which is perhaps more interesting) has been the subject of this MO question.

I especially like Balazs Strenner’s answer.

EDIT. Here is Exercise 2.11 of Atiyah-MacDonald. Let $A$ be a nonzero commutative ring and $\phi:A^m\to A^n$ an $A$-linear map. Then

(a) $m\ge n$ if $\phi$ is surjective,

(b) $m\le n$ if $\phi$ is injective,

As pointed out in the comments to the question, there is an obvious proof of (a) [tensor with $A/\mathfrak m$, $\mathfrak m$ maximal]. My favorite proof of (b) is Strenner's one mentioned above. A natural question is: Can one use Strenner's argument to prove (a) and (b) at one go? I'll try to do that below.

Lemma. Let $B$ be a commutative ring, $A$ a subring, $b$ a nonzero element of $B$ which is integral over $A$ and which is not a zero divisor. Then there is a nonzero $a$ in $A$ and a monic $f$ in $A[X]$ such that $a=bf(b)$.

Proof. Let $g\in A[X]$ be a least degree monic polynomial annihilating $b$. Such exists because $b$ is integral over $A$. The constant term $a$ of $g$ is nonzero because $b$ is nonzero and not a zero divisor. QED

Assume (a) [resp. (b)] is false. Then there is an $n$ and a surjective [resp. injective] endomorphism $b$ of $A^n$ satisfying $b(e_n)=0$ [resp. $b(A^n)\subseteq A^{n-1}$], where $e_n$ is the last vector of the canonical basis and $A^{n-1}$ is the span of all the other vectors of this basis. Then $b$ is integral over $A$ by Cayley-Hamilton, and we get a contradiction by using the lemma (with $B:=A[b]$) and applying $a=bf(b)$ to $e_n$.


I am answering this question just because it took me a while to figure out a good proof, so it may help other people as well.

If $\varphi: R^m\rightarrow R^n $ is your epimorphism then you can construct the exact sequence $$\text{Ker}(\varphi) \xrightarrow{\ \ \iota \ \ }R^m \xrightarrow{\ \ \varphi \ \ }R^n\longrightarrow 0.\quad (*)$$

Let $\mathfrak{m}$ a maximal ideal of $R$. Therefore $R/\mathfrak{m}$ is a field and a $R$-module. Appling right-exactness to $(*)$ (Proposition 2.18, Introduction to Commutative Algebra - Michael Atiyah), we conclude that $$R/\mathfrak{m}\otimes_R\text{Ker}(\varphi) \xrightarrow{\ 1\otimes\iota \ }R/\mathfrak{m}\otimes_R R^m \xrightarrow{\ 1\otimes\varphi \ }R/\mathfrak{m}\otimes_R R^n\longrightarrow 0,$$ is an exact sequence.

Therefore $1\otimes\varphi$ is surjective. Since, $R/\mathfrak{m}\otimes_R R^m$ and $R/\mathfrak{m}\otimes_R R^n$ are vector spaces over $R/\mathfrak{m}$ and $1\otimes\varphi$ is a linear map between $R/\mathfrak{m}\otimes_R R^m$ and $R/\mathfrak{m}\otimes_R R^n$ over $R/\mathfrak{m}$, we have that $m\geq n.$