Solution (source code)

= Solution

In the <direct sum of modules> $M=N\oplus P$, every $m\in M$ has a unique expression $m=n+p$, with $n\in N$ and $p\in P$. Define
$$
\boxed{\pi:M\to M,\qquad\pi(n+p)=p}.
$$
The uniqueness makes this well-defined. For $m=n+p$, $m'=n'+p'$ and $r\in R$,
$$
\pi(m+m')=p+p'=\pi(m)+\pi(m'),\qquad\pi(rm)=rp=r\pi(m),
$$
so $\pi$ is a <module homomorphism>. Finally, $\pi(n+p)=0$ exactly when $p=0$, equivalently $m\in N$. Therefore $\boxed{\ker\pi=N}$. Its image is $P$, and $\pi^2=\pi$, so it is the projection onto that <direct summand>.