# Detecting and counting free direct summands

If $M$ is a finitely generated module over a local ring $(R, \mathfrak{m})$, we can detect whether $M$ has a nonzero free direct summand as follows: Consider the natural map $$\phi_M\colon \mathrm{Hom}_R(M,\mathfrak{m}) \longrightarrow \mathrm{Hom}_R(M,R)$$ induced by the inclusion of $\mathfrak m$ into $R$. Then $M$ has a nonzero free direct summand if and only if $\\phi_m$ is not surjective. (If $M$ has no free direct summand, then the image of every homomorphism $M \longrightarrow R$ must be inside $\mathfrak m$, so $\phi_M$ is surjective. The converse is easy as well.)

I'd like a more precise statement to be true. The cokernel of $\phi_M$ is a submodule of $\mathrm{Hom}_R(M,R/\mathfrak{m})$, so is a finite-dimensional vector space.

Is the maximal rank of a free direct summand of $M$ equal to the dimension of $\mathrm{coker} \;\phi_M$?

One inequality is obvious -- a surjection $M \longrightarrow R^r$ will give a subspace of dimension $r$.

-
Isn't the other direction just Nakayama's lemma? – Eric Wofsey Mar 2 '13 at 17:15
Entirely possible I'm missing something silly. – Graham Leuschke Mar 2 '13 at 19:04

If $F$ is a free direct summand of $M$ of maximal rank, then $M=F\oplus N$, where $N$ has no free direct summand. So $\mathrm{coker} \;\phi_M\cong\mathrm{coker} \;\phi_F\oplus\mathrm{coker} \;\phi_N$, and, as you've pointed out, the dimension of $\mathrm{coker} \;\phi_F$ is the rank of $F$ and $\mathrm{coker} \;\phi_N=0$.