Existence of abelian group extension relative to group homomorphism Let $f: A \to B\ $ be an abelian group homomorphism. Are there abelian groups $G,\ H,\  K$ such that $K \subseteq H \subseteq G$ and the map
$$\pi \circ i: H \to G/K$$
which is the composition of projection and inclusion is isomorphic to $f$? By isomorphic to $f\ $I mean there exist isomorphisms $\tau: H \to A\ $ and $\sigma: G/K \to B$ such that $f = \sigma \circ \pi \circ i \circ \tau^{-1}$.
I think it is a quite natural question, since the case where $f$ is epimorphism is a consequence of the fundamental homomorphism theorem. However, I can't prove the existence nor the uniqueness of the group extension. I'm not familiar at all with the general theory of group extension, but maybe the case where $A,\ B\ $are abelian could be easier.
The question has been at MSE (link) for two days, but there was no answer.
 A: The factorization always exists, but in general is not unique.
Let me identify $A$ with $H$. Clearly, $K$ can be identified with $\ker(f)$. Let $f(A)$ be the image of $A$ in $B$. Then $A$ is an abelian extension of $f(A)$ by $K$. If I understand correctly, you are asking whether given an inclusion $f(A)\hookrightarrow B$, it is possible to find an extension of $B$ by $K$, extending the given extension of $f(A)$. Equivalently, you are asking if it is possible to construct a diagram of the following form, where the rows are short exact, and all the vertical homomorphisms are monomorphisms:
$$\require{AMScd}
\begin{CD}
K @>>> A @>f>> f(A)\\
@V=VV @VVV @VVV \\
K @>>> G @>>> B
\end{CD}
$$
The set of isomorphism classes of abelian extension of $B$ by $K$ is in bijective correspondence with $\operatorname{Ext}(B, K)$, where Ext is taken in the category of abelian groups. The inclusion of groups $f(A)\hookrightarrow B$ induces a surjective homomorphism $$\operatorname{Ext}(B, K)\twoheadrightarrow \operatorname{Ext}(f(A), K).$$ Because of the surjectivity, a group extension of $f(A)$ can always be extended to a group extension of $B$.
The reason that the homomorphism is surjective is that the cokernel would be a subgroup of $\operatorname{Ext}^2(B/f(A), K)$, but the category of abelian groups has projective dimension one, so Ext$^2$ is always zero.
On the other hand, the homomorphism of ext groups is not always injective. The kernel is a quotient of $\operatorname{Ext}(B/f(A), K)$. So the lift is not unique.
You can construct an extension of $B$ explicitly as follows. It is a standard result of homological algebra that you can construct a map of free resolutions of the inclusion $f(A)\hookrightarrow B$.
$$\require{AMScd}
\begin{CD}
0@>>> R_A @>>> F_A @>>> f(A)\\
@. @VVV @VVV @VVV \\
0 @>>> R_B @>>> F_B @>>> B
\end{CD}
$$
Such that the homomorphisms $R_A\to R_B$ and $F_A\to F_B$ are split injections. An extension of $f(A)$ by $K$ induces a homomorphism $R_A\to K$. Use the splitting to get a homomorphism $R_B\to K$. Now you have a surjective homomorphism $F_B \oplus_{R_B} K \twoheadrightarrow B$, whose kernel is $K$. This is the desired extension. In your notation, $G=F_B \oplus_{R_B} K$.
