I'm studying Roman's Advanced Linear Algebra and I came across a theorem which states that given $R$-modules $M,M',N$ with $N\leq M$ (means that $N$ is a submodule of $M$) and any epimorphism $\sigma: N\to M'$, it can be extended to an unique epimorphism $\bar\sigma: M\to M'$ with $\mathrm{ker}(\bar\sigma) = \ker(\sigma)\oplus H$ where $H$ is such that $H$ and $N$ decompose $M$ in a direct sum, i.e. $M = N\oplus H$.
Now, when proving it does it suffice to prove that $\bar\sigma$ is well defined, unique and that $\mathrm{ker}(\bar\sigma) = \ker(\sigma)\oplus H$? Moreover, I don't quite get why it is necessary to restrict $\sigma$ and $\bar\sigma$ to an epimorphism, and not let them be any homomorphism, and I would also like to verify my proof of well definedness. Here's the proof:
Take $n_1,n_2\in N$ and $h_1,h_2\in H$. Define $\bar\sigma$ as such that $\bar\sigma(n+h) = \sigma(n)$ for any $n\in N\,,\,h\in H$ and state that $n_1+h_1 = n_2+h_2$. We wish to prove that $\bar\sigma(n_1+h_1) = \bar\sigma(n_2+h_2)$. We have that $h_1 = n_2 - n_1 + h_2$ and thus $\bar\sigma(n_2-n_1+h_2) = 0 = \sigma(n_2-n_1) \iff \sigma n_1 = \sigma n_2 \implies \bar\sigma(n_1+h_1) = \bar\sigma(n_2+h_2)$.
Any help is appreciated.
Sketch of the proof:
First keep in mind that every element of $M$ can be uniquely written as $n+h$, with $n \in N$ and $h \in H$. Indeed:
Therefore, we can define a function $\bar\sigma \colon M \to M'$ as follows: Given $m \in M$, let $n \in N$ and $h \in H$ be the unique elements such that $m=n+h$, and then define $\bar\sigma(m)$ to be $\sigma(n)$.
Now:
$\bar\sigma$ is an homomorphism:
For example, to show that $\bar\sigma$ is additive, let $m_1,m_2 \in M$ and let $n_1,n_2 \in N$ and $h_1,h_2 \in H$ be the unique elements such that $m_1=n_1+h_1$ and $m_2=n_2+h_2$. Then note that $n_1+n_2$ and $h_1+h_2$ are the unique elements of $N$ and $H$ such that $m_1+m_2 = (n_1+n_2)+(h_1+h_2)$. Thus, $$ \bar\sigma(m_1+m_2) = \sigma(n_1+n_2) = \sigma(n_1)+\sigma(n_2) = \bar\sigma(m_1)+\bar\sigma(m_2). $$
$\bar\sigma|_N = \sigma$:
If $n \in N$, then $n+0$ is the unique expression of $n$ as a sum of an element of $N$ with an element of $H$, so $\bar\sigma|_N(n) = \sigma(n)$.
$\bar\sigma$ is an epimorphism:
This follows from the latter and the fact that $\sigma$ is an epimorphism.
$\ker(\bar\sigma) = \ker(\sigma) \oplus H$:
If $m \in \ker(\bar\sigma)$, then $m=n+h$ with $n \in N$ and $h \in H$, and then $0 = \bar\sigma(m) = \sigma(n)$, meaning that $n \in \ker(\sigma)$. This shows that $\ker(\bar\sigma) \subseteq \ker(\sigma)+H$. The other inclusion follows once you prove that $\ker(\bar\sigma)$ contains $\ker(\sigma)$ and $H$.
Also, since $\ker(\sigma) \subseteq N$, $\ker(\sigma) \cap H \subseteq N \cap H = 0$. Thus, $\ker(\sigma) \cap H = 0$.
This finish the existence part.
For the uniqueness one, we need to prove that if $\rho \colon M \to M'$ is an epimorphism such that $\rho|_N = \sigma$ and $\ker(\rho) = \ker(\sigma) \oplus H$, then $\rho = \bar\sigma$.
But this is easy, since $\rho$ agrees with $\bar\sigma$ in $N$ by hypothesis, and they agree in $H$ because both are zero in there.
And yes, we can replace the word "epimorphism" by "homomorphism", as the above proof shows.