Extending homomorphism on subgroup to the whole group I was working on homomorphisms and related concepts and I was wondering whether there exist some good criteria involving $H$ and $G_{1}$ which guarantees that all homomorphism $\phi$ on the subgroup $H$ of $G_{1}$ into an arbitrary group $G_{2}$ can be extended to a homomorphism $\bar{\phi}$ from all of $G_{1}$ to $G_{2}$.
And just to be clear: When I speak of an extension, I mean that I require that $\bar{\phi}$ restricted to H reduces to $\phi$.
​
My current conjecture is that this is possible for all homomorphism on $H$ if and only if there exists a normal subgroup $N$ of $G_{1}$ such that $H$ is isomorphic to $G_{1}/N$
The criteria is certainly sufficient since then $G_{1}$ is the semidirect product of H and N and by mapping all elements in N to the identity in $G_{2}$ a homomorphism is constructed.
I've not been able to produce a proof that it is necessary also. Any ideas or arguments in favour or against the conjecture?
Edit: As stated in the answer below my criteria for it being a semidirect product is actually wrong. You need the canoncial projection h $\mapsto$ [h] to be an isomorphism. It then guarantees trivial intersection and G = NH
 A: Your conjecture is almost true. But you need more than just $G/N$ isomorphic to $H$. See below the line.
Explicitly:

The group $G_1$ and subgroup $H$ satisfy the stated property if and only if there exists a normal subgroup $N$ of $G_1$ such that $G_1=NH$ and $N\cap H=\{e\}$. That is, $H$ must be a retract of $G_1$ (h/t to Moishe Kohan).

Sufficiency follows as you indicate.
For necessity, as usual with this kind of statements, the key is to pick a particular (clever?) choice of $G_2$ and $\phi$ to force the desired conclusion.
Suppose $H$ and $G_1$, with $H\leq G_1$, has the property that for every group $G_2$ and every morphism $\phi\colon H\to G_2$ there exists a morphism $\psi\colon G_1\to G_2$ such that $\psi|_{H} = \phi$.
Take $G_2=H$, and $\phi=\mathrm{id}_H$. Then there exists $\psi\colon G_1\to H$ such that $\psi|_{H}=\mathrm{id}_H$. In particular, if we compose $\iota\colon H\hookrightarrow G_1$ with $\psi$, we get $\psi\circ\iota\colon H\to H$ and $\psi\circ\iota(h) = \psi(h) = h$ for all $h\in H$. That is, $\psi$ splits the embedding $\iota\colon H\hookrightarrow G_1$.
Let $N=\mathrm{ker}(\psi)$. Then $N\cap H=\{e\}$. Given $g\in G_1$, we have $g(\iota(\psi(g))^{-1}\in N$, since
$$\psi(g)\psi(\iota(\psi(g)))^{-1} = \psi(g)\psi(g)^{-1}=e;$$
thus, $g\in NH$. Hence, $G_1=NH$, $N\triangleleft G_1$, and $N\cap H=\{e\}$. Therefore, $G_1/N\cong H$, as desired.

The error in your argument for sufficiency is that you are asserting that $G/N\cong H$ implies that $G$ is an internal semidirect product of $N$ by $H$. This is not true in general.
For example, take $G=Q_8$, the quaternion group of order $8$, and let $H=\{1,-1\}$. Then $G$ contains four different normal subgroups $N$ with $G/N\cong H$, but we know that $G$ is not a semidirect product. You cannot extend the identity map of $H$ to a homomorphism $Q_8\to C_2$; you can map $Q_8$ to $C_2$, but it won't extend the identity map of $H$ because $H$ is contained in all the nontrivial normal subgroups of $Q_8$. You cannot decompose $Q_8$ as an internal semidirect product.
So you need more than just $G/N$ isomorphic to $H$; you need that projection to split. That is, you need $G$ to be the internal semidirect product of $N$ by $H$.
