TITLE: An elementary lemma of commutative algebra
QUESTION [12 upvotes]: Let $R$ be a commutative ring, $M$, $N$ $R$-modules, and $f: M\rightarrow N$ a homomorphism. It is known that $f$ is injective (surjective) if and only if $f_m$ is injective (surjective) for all maximal ideal $m$. But I don't know whether $f$ is split  if and only if $f_m$ is split? Maybe it is true for finitely generated modules over noetherian rings, I suspect.

REPLY [8 votes]: If you want to avoid the use of Ext-groups, you could prove it like this (which is basically the same proof):
Let $0\rightarrow A\rightarrow B\rightarrow C\rightarrow 0$ be a short exact sequence of $R-$modules with $C$ finitely presented and assume it splits after localisation at every maximal ideal.
Use the natural isomorphism $\operatorname{Hom}_{R_m}(C_m,A_m)=R_m\otimes\operatorname{Hom}_R(C,A)$ (which uses the flatness of localisation and the fact that $C$ is finitely presented) and the assumption to see that the map $\operatorname{Hom}_R(C,B)\rightarrow\operatorname{Hom}_R(C,C)$ is surjective since all of its localisations are.
Since the giving a splitting is equivalent to this map being surjective we are done.
P.S.: Of course one could prove "if and only if" in the statement like this.
Counterexample in the general case: Take $R=\prod_{\mathbb N} \mathbb F_2$, $I=\sum_{\mathbb N} \mathbb F_2$ and $C$ the cokernel of the inclusion.
Now I claim three things:
1.) $R$ has dimension zero
Proof: Every element of $R$ is an idempotent and every prime ideal in $R$ has to contain exactly one of $e$ or $1-e$ for every idempotent $e$ in R. If we had a chain of prime ideals, the larger one would necessarily have to contain $e$ and $1-e$ for one such idempotent and so couldn't exist.
2.) The localisation of $R$ at every maximal ideal is a field.
Proof: It is a zero-dimensional local ring by 1.) and reduced since $R$ doesn't contain nilpotent elements. Thus this localisation is a field.
3.) $I$ is not a direct summand of $R$.
Proof: Direct summands correspond to idempotents in $R$. Since every element in $R$ is idempotent we need to analyse all principal ideals. If an element has only finitely many non-zero entries the ideal created by it has only finitely many elements, thus can't be $I$.
If on the other hand it contains infinitely many non-zero entries, the ideal created by it has uncountably many elements.
Since $I$ contains countably many elements, it can't be a direct summand of $R$.
This establishes the counterexample, since the short exact sequence $0\rightarrow I\rightarrow R\rightarrow C\rightarrow 0$ splits in every localisation at a maximal ideal.