I'm having trouble trying to prove the following:
Let $G$ and $H$ be two groups and let $f:G\to H$, $g:H\to G$. Show that if $g$ is injective and $g$ and $g\circ f$ are homomorphisms, then $f$ too, is a homomorphism.
This is what I've done so far:
Suppose $g:H\to G$ is injective. Then,
$\forall h_1,h_2 \in H$, from $g(h_1)=g(h_2)\implies h_1=h_2$
Now, $\forall g_1,g_2 \in G$ we have:
$\begin{aligned} f(g_1g_2)&=f(g(h_1)g(h_2))\\ &=f(g(h_1h_2)) \\&=f\circ g (h_1h_2) \end{aligned}$
And this is where I'm stuck.