Let $R$ be a commutative ring with unity. Prove or disprove: for $R$-modules $M$ and $N$, if $f:M \to N$ is $R$-linear, then $M= \ker(f) \oplus \operatorname{im}(f)$.
My attempt:
Let $f : \Bbb Z/4\Bbb Z \to \Bbb Z/2\Bbb Z$ be defined by $f(\bar{n}) = \overline{2n}$.
Then, $\operatorname{im}(f) = \Bbb Z/2\Bbb Z$ and $\ker(f) = \{\bar{0},\bar{2}\} \cong \Bbb Z/2\Bbb Z$ (as $\Bbb Z$-modules).
But clearly, $\Bbb Z/4\Bbb Z \not\cong \Bbb Z/2\Bbb Z \oplus \Bbb Z/ 2\Bbb Z$.
Is my answer correct? If there are any mistakes, please point out.
The example is sound, but the map should be written more carefully: you want $f(\bar{n})=\bar{n}$ or, better, $f(n+4\mathbb{Z})=n+2\mathbb{Z}$, so $f(\bar{1})=\bar{1}$ and $f(\bar{2})=\bar{0}$.
The fact that $$ \mathbb{Z}/4\mathbb{Z}\not\cong\mathbb{Z}/2\mathbb{Z}\oplus\mathbb{Z}/2\mathbb{Z} $$ is clear from the fact $\mathbb{Z}/4\mathbb{Z}$ has a single maximal submodule, whereas $\mathbb{Z}/2\mathbb{Z}\oplus\mathbb{Z}/2\mathbb{Z}$ has two.
Another example is the canonical projection $\pi\colon\mathbb{Q}\to\mathbb{Q}/\mathbb{Z}$, because $\mathbb{Q}$ is torsion-free, whereas $\mathbb{Z}\oplus\mathbb{Q}/\mathbb{Z}$ isn't.
By the way, the statement is true for a ring $R$ if and only if $R$ is semisimple. In particular, $R$ would be (left and right) artinian, so any nonartinian ring provides a counterexample.