Is the section of a surjective endomorphism again a morphism?

Let $R$ be a commutative ring with unit and let $M$ be an $R$-module (with $1\cdot m = m$ for all $m\in M$). Let $f:M\twoheadrightarrow M$ be a surjective morphism of $R$-modules of $M$ onto itself. Then, as a consequence of Zorn's lemma, one can construct a map $g$ such that $f\circ g = \mbox{id}_M$.

Does it follow that $g$ is also a morphism of $R$-modules? Or can one at least construt one such $g$ which is a morphism?

Thank you!

EDIT:

I should have made more clear what I'm looking for. So there are 2 questions:

• 1) Does $f\circ g=\mbox{id}_M$ (as set maps) imply that $g$ is a morphism?
• 2) Is there a morphism $g:M\rightarrow M$ such that $f\circ g = \mbox{id}_M$?

1) seems unlikely to me now, as we must have $g(0)=0$ if $g$ is a morphism. But in the construction of $g$ using Zorn's lemma, one could chose $g(0)$ to be any element of $\mbox{ker}(f)$ and still have $f\circ g=\mbox{id}_M$...

I'm really interested in an answer to 2) however...

• @YACP I think that is not what I asked. Epimorphism in categories are 'right cancellable', i.e. $h:a\rightarrow b$ is epi iff $g_1\circ h=g_2\circ h$ implies $g_1=g_2$. The lecture indeed shows that surjective morphisms are precisely the epis. What I asked was: if $f:M\rightarrow M$ has a section $g$ (i.e. a set map with $fg=\mbox{id}$), must $g$ be a morphism then? This seems to be false, as I've found out in the meantime... I will post the counterexample as an answer here soon. – Sh4pe Dec 4 '12 at 12:49
• Hmm - my counterexample seams to be wrong... – Sh4pe Dec 4 '12 at 13:12
• The answer to question 1 is obviously: no. Let M:=$R^{(\mathbb{N})}$ and let $f$ be the left-shift operator. Now $g$ is a right shift operator. If you want $g$ to be a morphism you have no choice but to define $g(m_1, m_2,\ldots)=(0,m_1,m_2,\ldots)$. But in general you could define it in whatever way you like. – Curufin Dec 4 '12 at 14:05
• On the other hand, if $M$ is finitely generated, then a surjective $R$-module map $M\rightarrow M$ is an isomorphism, so it is necessarily (uniquely!) split. – Keenan Kidwell Dec 4 '12 at 17:21

(2) If there is such $g$ then the exact sequence $0\to\ker f\to M\to M\to 0$ is split exact, i.e. $\ker f$ is a direct summand in $M$. This can't be always true as show the following example: $M=C_{p^{\infty}}$ and $f(x)=x^p$.
Edit. Let $U_{p^n}=\{z\in\mathbb C: z^{p^n}=1\}$. Then $C_{p^{\infty}}:=\bigcup_{n\ge 0}U_{p^n}$.
• @YACP: What is $C_{p^{\infty}}$? – Sh4pe Dec 7 '12 at 9:20