Proof Verification Short Exact Sequence Rank Theorem

I am trying to prove the rank-nullity theorem for short exact sequences; if $$R$$ is an integral domain, and $$M',\,M,\,M''$$ are all $$R$$-modules with $$0\rightarrow M' \xrightarrow{\psi} M\xrightarrow{\phi} M''\rightarrow 0$$ being a short exact sequence then by the first isomorphism theorem: $$M/M'\simeq M'' \implies \mathrm{rank}(M/M')=\mathrm{rank}(M'')$$ Morover $$M'\simeq \ker \phi$$, and so it's clear from this that $$\mathrm{rank}(M)\geq\mathrm{rank}(M')+\mathrm{rank}(M'')$$.

I was having more difficulty with the other direction. Namely, if $$X\subseteq M$$ is maximally $$R$$-linearly dependent set, since we can write $$M=M'\sqcup M\backslash M'$$ we have that we can split $$X$$ into $$X_{M'}\sqcup X_{M\backslash M'}$$ where $$X_{M'}:=\{x\in X:x\in\ker\phi\}$$, and $$X_{M\backslash M'}:=\{x\in X:x\not\in\ker\phi\}$$. In particular since $$X$$ is $$R$$-linearly independent in $$M$$, it must be true that $$X_{M'}$$ be $$R$$-linearly independent in $$M'$$ -- so that $$\lvert X_{M'}\rvert \leq \mathrm{rank}(M')$$. Similarly, $$\lvert X_{M\backslash M'}\rvert\leq \mathrm{rank}(M'')$$. Thus we have: $$\mathrm{rank}(M) = \lvert X\rvert = \lvert X_{M'}\sqcup X_{M\backslash M'}\rvert = \lvert X_{m'}\rvert + \lvert X_{M\backslash M'}\rvert \leq \mathrm{rank}(M')+\mathrm{rank}(M'')$$ The only problem I see is that we could have $$\phi(X_{M\backslash M'})\subseteq M''$$ being $$R$$-linearly dependent since all we get from exactness is that $$\phi$$ is surjective -- but at the same time $$M/M'\simeq M''$$ by the first isomorphism theorem, so we should be okay? I looked at Short Exact Sequences & Rank Nullity, but those solutions seemed a little clunky or used tools I am not familiar enough with, and so I was wondering if there is a cleaner way to do it. Is there a way to justify $$\lvert X_{M\backslash M'}\rvert\leq \mathrm{rank}(M'')$$ using what I have or will my proof method not work?

• I'd say that the easy way to do this would be to tensor with $K$, the fraction field of $R$, which is a flat $R$-module. – Lord Shark the Unknown Apr 23 at 17:01