Need help to understand a theorem about direct sums and regular morphism of R-modules i dont know how show that theorem is true
Definition: A morphism $F: M \longrightarrow N$ of $R$-modules is called regular if exist $G: N \longrightarrow M$ such that $F \circ G \circ F = F$.
Theorem: $F$ a morphism of $R$-modules $M$ and $N$, is regular if and only if $ker(F)$ is a direct summand of $M$ and $im(F)$ is a direct summand of $N$.
the only "tip" is: choice good exact sequences and see when it split.
 A: I shall work in $R-Mod$, the category of left $R$-modules.
Suppose $\exists \ G:N\rightarrow M$ such that $F\circ G\circ F=F $.
Consider the short exact sequence$$0 \rightarrow \operatorname{Ker}F\hookrightarrow M\xrightarrow{F} \operatorname {Im}F\rightarrow 0$$ Look at $G|_{\operatorname{Im}F}:\operatorname{Im}F\rightarrow M$. We have $F\circ G|_{\operatorname{Im}F}=id_{\operatorname{Im}F}$ by the condition. As such the above sequence is a split short exact sequence (it right splits and hence left splits as well). $\therefore \operatorname{Ker } F$ is a direct summand of $M$.
Consider the short exact sequence $$0\rightarrow \operatorname{Im}F\xrightarrow{j} N \rightarrow \operatorname{CoKer}F\rightarrow 0$$
Look a $F\circ G:N\rightarrow \operatorname{Im}F$. Once again, we have $G\circ F\circ j=id_{\operatorname{Im}F}$. So the above sequence left splits and hence is a split short exact sequence. $\therefore \operatorname{Im}F$ is a direct summand of $N$.
Now assume $\operatorname{Ker}F$ is a direct summand of $M$. Then $$0 \rightarrow \operatorname{Ker}F\hookrightarrow M\xrightarrow{F} \operatorname {Im}F\rightarrow 0$$ is a split short exact sequence. So we get $g:\operatorname {Im}F\rightarrow M$ such that $F\circ g=id_{\operatorname{Im}F}$. We also have a sub-module $N'$ of $N$ such that $N=\operatorname{Im}F\oplus N'$
Define $$G:N\rightarrow M$$ $$(x,y)\mapsto g(x)$$
Then $F\circ G\circ F(x)=F\circ G((F(x),0))=F\circ g(F(x))=F(x) $
