[proofplan]
The free product with amalgamation $G_1 *_H G_2$ is constructed as the quotient of the [free product](/theorems/1903) $G_1 * G_2$ by the normal subgroup $N$ generated by the relations $i_1(h) i_2(h)^{-1}$ for $h \in H$. We prove the universal property in three movements: first, existence of $f$ by descent through the quotient map, using the compatibility hypothesis $\phi_1 \circ i_1 = \phi_2 \circ i_2$ to verify that the pair $(\phi_1, \phi_2)$ kills $N$; second, uniqueness of $f$ from the fact that the images of $G_1$ and $G_2$ generate $G_1 *_H G_2$; third, uniqueness of $G_1 *_H G_2$ itself up to isomorphism as a standard consequence of the universal property.
[/proofplan]
[step:Set up the concrete model of $G_1 *_H G_2$ as a quotient of the free product]
Recall the [Universal Property of the Free Product](/theorems/1903): $G_1 * G_2$ is the group with canonical inclusions $\iota_k: G_k \to G_1 * G_2$ satisfying that, for any group $K$ and homomorphisms $\phi_1: G_1 \to K$ and $\phi_2: G_2 \to K$, there exists a unique homomorphism $\Phi: G_1 * G_2 \to K$ with $\Phi \circ \iota_k = \phi_k$ for $k = 1, 2$.
Let $N \trianglelefteq G_1 * G_2$ be the normal closure of the set
\begin{align*}
S = \{\iota_1(i_1(h)) \cdot \iota_2(i_2(h))^{-1} : h \in H\} \subseteq G_1 * G_2,
\end{align*}
so $N = \langle\langle S \rangle\rangle$. Define
\begin{align*}
G_1 *_H G_2 &:= (G_1 * G_2) / N,
\end{align*}
and let $\pi: G_1 * G_2 \to G_1 *_H G_2$ denote the quotient homomorphism. The canonical inclusions of the amalgamated product are
\begin{align*}
j_k: G_k &\to G_1 *_H G_2, & j_k &:= \pi \circ \iota_k, \quad k = 1, 2.
\end{align*}
By construction, $j_1 \circ i_1 = j_2 \circ i_2$: for every $h \in H$,
\begin{align*}
j_1(i_1(h)) \cdot j_2(i_2(h))^{-1} = \pi\big(\iota_1(i_1(h)) \cdot \iota_2(i_2(h))^{-1}\big) = \pi(e) = e,
\end{align*}
since the element in parentheses lies in $S \subseteq N = \ker \pi$.
[/step]
[step:Produce $f$ by factoring through the quotient]
Fix a group $K$ and homomorphisms $\phi_k: G_k \to K$ for $k = 1, 2$ with $\phi_1 \circ i_1 = \phi_2 \circ i_2$. By the universal property of the free product applied to $(\phi_1, \phi_2)$, there exists a unique homomorphism
\begin{align*}
\Phi: G_1 * G_2 &\to K, & \Phi \circ \iota_k &= \phi_k, \quad k = 1, 2.
\end{align*}
We claim $N \subseteq \ker \Phi$. Since $\ker \Phi$ is normal and $N$ is the normal closure of $S$, it suffices to check $S \subseteq \ker \Phi$. For each $h \in H$,
\begin{align*}
\Phi\big(\iota_1(i_1(h)) \cdot \iota_2(i_2(h))^{-1}\big) &= \Phi(\iota_1(i_1(h))) \cdot \Phi(\iota_2(i_2(h)))^{-1} \\
&= \phi_1(i_1(h)) \cdot \phi_2(i_2(h))^{-1} \\
&= e,
\end{align*}
the last equality by the compatibility hypothesis $\phi_1 \circ i_1 = \phi_2 \circ i_2$. Hence $S \subseteq \ker \Phi$, so $N \subseteq \ker \Phi$.
By the first isomorphism theorem for groups, $\Phi$ descends uniquely to a homomorphism
\begin{align*}
f: G_1 *_H G_2 &\to K, & f \circ \pi &= \Phi.
\end{align*}
We verify $f \circ j_k = \phi_k$: for $k = 1, 2$ and any $g \in G_k$,
\begin{align*}
(f \circ j_k)(g) = f(\pi(\iota_k(g))) = \Phi(\iota_k(g)) = \phi_k(g).
\end{align*}
[guided]
Our target $K$ is a group equipped with two homomorphisms $\phi_1, \phi_2$ from $G_1, G_2$ that agree on the image of $H$. We want to manufacture a single homomorphism $f$ out of $G_1 *_H G_2$ that recovers both $\phi_k$.
**Step 2a — use the free product first.** The pair $(\phi_1, \phi_2)$ is exactly the data needed to invoke the [Universal Property of the Free Product](/theorems/1903): we ignore the amalgamation condition for a moment and just produce a homomorphism $\Phi: G_1 * G_2 \to K$ with $\Phi \circ \iota_k = \phi_k$. Existence and uniqueness of $\Phi$ are guaranteed by Theorem 1903.
**Step 2b — check $\Phi$ kills $N$.** Now we remember the amalgamation. To factor $\Phi$ through the quotient $G_1 * G_2 \twoheadrightarrow (G_1 * G_2)/N$, we need $N \subseteq \ker \Phi$. Since $\ker \Phi$ is already normal (the kernel of any group homomorphism is normal), and $N = \langle\langle S \rangle\rangle$ is the *smallest* normal subgroup containing $S$, it suffices to check $S \subseteq \ker \Phi$. The generators of $S$ are the elements $\iota_1(i_1(h)) \cdot \iota_2(i_2(h))^{-1}$ for $h \in H$. We compute
\begin{align*}
\Phi(\iota_1(i_1(h)) \cdot \iota_2(i_2(h))^{-1}) = \phi_1(i_1(h)) \phi_2(i_2(h))^{-1} = \phi_1(i_1(h)) \phi_1(i_1(h))^{-1} = e,
\end{align*}
using $\Phi \circ \iota_k = \phi_k$ and the hypothesis $\phi_1 \circ i_1 = \phi_2 \circ i_2$. This is the entire role of the compatibility condition: without it, $\Phi$ would not descend.
**Step 2c — descend.** The first isomorphism theorem provides a unique induced map $f: (G_1 * G_2)/N \to K$ with $f \circ \pi = \Phi$. Setting this together with $\pi \circ \iota_k = j_k$ yields $f \circ j_k = f \circ \pi \circ \iota_k = \Phi \circ \iota_k = \phi_k$, as required.
[/guided]
[/step]
[step:Establish uniqueness of $f$ from generation]
Suppose $f': G_1 *_H G_2 \to K$ is another homomorphism satisfying $f' \circ j_k = \phi_k$ for $k = 1, 2$. Then $f$ and $f'$ agree on $j_1(G_1) \cup j_2(G_2)$, since
\begin{align*}
f(j_k(g)) = \phi_k(g) = f'(j_k(g)), \quad g \in G_k.
\end{align*}
The images $j_1(G_1), j_2(G_2)$ generate $G_1 *_H G_2$ as a group: indeed, every element of $G_1 * G_2$ is a word in $\iota_1(G_1) \cup \iota_2(G_2)$, and $\pi$ is surjective, so every element of $G_1 *_H G_2$ is a word in $j_1(G_1) \cup j_2(G_2)$. Two group homomorphisms agreeing on a generating set agree everywhere, so $f = f'$.
[/step]
[step:Deduce uniqueness of $G_1 *_H G_2$ up to isomorphism]
Suppose $(P, j'_1, j'_2)$ is another triple consisting of a group $P$ with homomorphisms $j'_k: G_k \to P$ satisfying $j'_1 \circ i_1 = j'_2 \circ i_2$, and enjoying the same universal property as $(G_1 *_H G_2, j_1, j_2)$.
Apply the universal property of $G_1 *_H G_2$ with $K = P$ and $\phi_k = j'_k$: we obtain a unique homomorphism
\begin{align*}
\alpha: G_1 *_H G_2 &\to P, & \alpha \circ j_k &= j'_k, \quad k = 1, 2.
\end{align*}
Apply the universal property of $P$ with $K = G_1 *_H G_2$ and $\phi_k = j_k$: we obtain a unique homomorphism
\begin{align*}
\beta: P &\to G_1 *_H G_2, & \beta \circ j'_k &= j_k, \quad k = 1, 2.
\end{align*}
Then $\beta \circ \alpha: G_1 *_H G_2 \to G_1 *_H G_2$ satisfies $(\beta \circ \alpha) \circ j_k = \beta \circ j'_k = j_k$. But the identity map $\operatorname{id}_{G_1 *_H G_2}$ also satisfies $\operatorname{id} \circ j_k = j_k$. By the uniqueness clause in the universal property of $G_1 *_H G_2$ (applied with $K = G_1 *_H G_2$, $\phi_k = j_k$), we conclude $\beta \circ \alpha = \operatorname{id}_{G_1 *_H G_2}$. The symmetric argument gives $\alpha \circ \beta = \operatorname{id}_P$. Hence $\alpha$ is an isomorphism with inverse $\beta$.
[guided]
This is the standard abstract-nonsense uniqueness argument for objects defined by a universal property: any two solutions are canonically isomorphic.
**The setup.** Suppose both $(G_1 *_H G_2, j_1, j_2)$ and $(P, j'_1, j'_2)$ solve the same universal problem: each is a group equipped with two compatible homomorphisms from $G_1, G_2$ that universally factor any other such pair.
**Producing maps in both directions.** The universal property of $G_1 *_H G_2$ takes any compatible pair of maps into some target $K$ and produces a unique factorisation through $G_1 *_H G_2$. Feeding it $(j'_1, j'_2)$ (with $K = P$) produces $\alpha: G_1 *_H G_2 \to P$ satisfying $\alpha \circ j_k = j'_k$. Feeding the universal property of $P$ the data $(j_1, j_2)$ (with $K = G_1 *_H G_2$) produces $\beta: P \to G_1 *_H G_2$ satisfying $\beta \circ j'_k = j_k$.
**Why the compositions are identities.** Consider $\beta \circ \alpha: G_1 *_H G_2 \to G_1 *_H G_2$. It satisfies $(\beta \circ \alpha) \circ j_k = \beta \circ (\alpha \circ j_k) = \beta \circ j'_k = j_k$. So $\beta \circ \alpha$ is a factorisation of the pair $(j_1, j_2)$ through $G_1 *_H G_2$. But $\operatorname{id}_{G_1 *_H G_2}$ is also such a factorisation. The universal property asserts there is a **unique** such factorisation, so $\beta \circ \alpha = \operatorname{id}$. By symmetry $\alpha \circ \beta = \operatorname{id}_P$.
The uniqueness clause is the entire content of the argument — without it, we could produce two different factorisations and the comparison would fail. This is why universal properties always package existence *and* uniqueness together.
[/guided]
[/step]