TITLE: Cancellation law in finitely generated modules
QUESTION [5 upvotes]: Let $R$ be a commutative ring with $1$ and let $S,T$ be $R$-modules such that $S$ is finitely generated and such that $S \cong S \oplus T$. Must $T=0$?
This is certainly true if $R$ is a PID, but what if $R$ is just a commutative ring with $1$? (if $R$ is a PID then the fact that $S \cong S \oplus T$ and $S$ is finitely generated implies $T$ is finitely generated as well, and then the result follows from the cancellation law for modules over a PID).

REPLY [7 votes]: Yes. Let $\mathfrak{m}$ be any maximal ideal of $R.$ Then 
$$S/{\mathfrak{m}S} \cong S\otimes_{R}  R/\mathfrak{m} \cong (S\oplus T) \otimes_{R}  R/\mathfrak{m} \cong (S\otimes_{R}  R/\mathfrak{m})\oplus (T \otimes_{R}  R/\mathfrak{m}) \cong S/{\mathfrak{m}S} \oplus T/{\mathfrak{m}T}.$$
It follows 
$$dim_{R/\mathfrak{m}}(T/\mathfrak{m}T) = 0.$$
Hence, 
$$T_{\mathfrak{m}}/\mathfrak{m}T_{\mathfrak{m}} =  T/\mathfrak{m}T = 0.$$ 
Therefore by Nakayama's lemma 
$$T_{\mathfrak{m}} = 0.$$
And as this is true for all maximal ideals of $R,$ it must be the case that $T = 0.$

REPLY [4 votes]: Here's a proof not using localization.
Suppose there is a maximal ideal $M$ of $R$ which contains the annihilator of $T$. Then $(R/M) \otimes_R T$ is a nonzero vector space over $R/M$. Moreover, since,
$$(R/M) \otimes_R S \cong [(R/M) \otimes_R S] \oplus [(R/M) \otimes_R T],$$
counting dimensions over $R/M$ shows that $(R/M) \otimes_R T=0$, for every maximal ideal $M$. Thus no maximal ideal of $R$ contains the annihilator of $T$, which implies of course that the annihilator of $T$ is all of $R$, i.e. $T=0$.