Solution (source code)

= Solution

The <image of a group homomorphism> contains $e_{G_2}=\phi(e_{G_1})$. If $u=\phi(g)$ and $v=\phi(h)$ lie in the image, then $uv^{-1}=\phi(gh^{-1})$ also lies there. The <subgroup test> proves $\operatorname{im}\phi\leq G_2$.

The <kernel of a group homomorphism> is $K=\{g:\phi(g)=e_{G_2}\}$. It is nonempty and closed under $kh^{-1}$ for $k,h\in K$, so it is a subgroup. For any $g\in G_1$ and $k\in K$,
$$
\phi(gkg^{-1})=\phi(g)\phi(k)\phi(g)^{-1}=e_{G_2}.
$$
Thus $gKg^{-1}\subseteq K$. Replacing $g$ by $g^{-1}$ gives the reverse inclusion, proving
$$
\boxed{K\trianglelefteq G_1.}
$$
Finally, if $K=\{e\}$ and $\phi(g)=\phi(h)$, then $\phi(h^{-1}g)=e$. Thus $h^{-1}g\in K$ forces $g=h$, establishing injectivity. Conversely an injective homomorphism has trivial kernel, so
$$
\boxed{\phi\text{ injective}\quad\Longleftrightarrow\quad\ker\phi=\{e\}.}
$$
None of these arguments requires either group to be finite.