Suppose that $f: M \to R$ is a $R$-morphism, where $R$ is a PID and $M$ is an $R$-module. Decompose $M=X \oplus \ker f$ for some $X \leq M$.
I have been staring at this for a bit and have yet to see how to decompose $M$. I feel the answer is obvious and I am just not seeing it. It is clear that $R$ is noetherian. I know if this were a map between vector spaces, we would try to produce a map $g: R \to M$ and decompose $M$ using this. But I don't see any useful maps from $R$ to $M$. Any hints on the obvious answer sitting in front of me?
Big hint: The exact sequence $0\rightarrow\ker(f)\rightarrow M \rightarrow f(M)\rightarrow 0$ splits because the right ideal $f(M)$ is a projective module (it is isomorphic to $R$ as an $R$ module since $R$ is a PID.)