[proofplan]
The canonical homomorphism $\Phi$ is defined on elementary factors — loops contained in $A$ or in $B$ — and the claim is that it induces an isomorphism from the amalgamated free product. We prove surjectivity by a path-subdivision argument: any loop in $X$ is cut by the [Lebesgue Number Lemma](/theorems/952) into finitely many subpaths, each of which lies in $A$ or in $B$; rerouting the endpoints through $x_0$ using the path-connectedness of $A \cap B$ expresses $[\gamma]$ as a product of classes in $\pi_1(A)$ and $\pi_1(B)$. For injectivity, we take a word mapping to $1$ in $\pi_1(X)$, use the null-homotopy to subdivide the square $[0,1]^2$ into rectangles each mapping into $A$ or $B$, and run a combinatorial cancellation argument on the boundaries of these rectangles. The cancellations exactly match the relations defining $\pi_1(A) *_{\pi_1(A \cap B)} \pi_1(B)$, so any word killed in $\pi_1(X)$ is already trivial in the amalgamated product.
[/proofplan]
[step:Assemble the canonical homomorphism $\Phi$ from the inclusions]
Let $i_A: A \cap B \hookrightarrow A$, $i_B: A \cap B \hookrightarrow B$, $j_A: A \hookrightarrow X$, $j_B: B \hookrightarrow X$ denote the inclusions. Applying $\pi_1(-, x_0)$ functorially yields [induced homomorphisms](/theorems/1879) $i_{A*}, i_{B*}, j_{A*}, j_{B*}$. Since $j_{A*} \circ i_{A*} = j_{B*} \circ i_{B*}$ (both equal $(j_A \circ i_A)_* = (j_B \circ i_B)_*$, the inclusion $A \cap B \hookrightarrow X$), the pair $(j_{A*}, j_{B*})$ satisfies the compatibility hypothesis of the [Universal Property of the Free Product with Amalgamation](/theorems/1904). Hence there is a unique homomorphism
\begin{align*}
\Phi: \pi_1(A, x_0) *_{\pi_1(A \cap B, x_0)} \pi_1(B, x_0) &\to \pi_1(X, x_0)
\end{align*}
with $\Phi \circ k_A = j_{A*}$ and $\Phi \circ k_B = j_{B*}$, where $k_A, k_B$ are the canonical inclusions into the amalgamated product. We prove $\Phi$ is an isomorphism by showing it is surjective (Step 2) and injective (Step 3).
[/step]
[step:Prove surjectivity by subdividing a loop and rerouting through $x_0$]
Let $[\gamma] \in \pi_1(X, x_0)$ be represented by a loop $\gamma: [0,1] \to X$ with $\gamma(0) = \gamma(1) = x_0$. The preimages $\gamma^{-1}(A)$ and $\gamma^{-1}(B)$ are open (by continuity of $\gamma$) and cover $[0,1]$. By the [Lebesgue Number Lemma](/theorems/952), there exists $\delta > 0$ such that every subinterval of $[0,1]$ of length at most $\delta$ is contained in one of $\gamma^{-1}(A), \gamma^{-1}(B)$.
Choose a partition $0 = t_0 < t_1 < \cdots < t_n = 1$ with $t_i - t_{i-1} < \delta$ for all $i$. Define the subpaths
\begin{align*}
\gamma_i: [0,1] &\to X, & \gamma_i(s) &:= \gamma\big((1-s) t_{i-1} + s\, t_i\big), \quad i = 1, \ldots, n.
\end{align*}
By choice of $\delta$, each $\gamma_i$ has image in $A$ or in $B$.
At each partition point, we route through $x_0$. Each $\gamma(t_i) \in X = A \cup B$ lies in $A$ or in $B$. If $\gamma(t_i) \in A$ but not $A \cap B$, then the two subpaths $\gamma_i, \gamma_{i+1}$ meeting at $\gamma(t_i)$ both lie in $A$ (since they lie in $A$ or $B$ and pass through a point not in $B$). Symmetrically if $\gamma(t_i) \in B \setminus A$. So we may assume, by merging adjacent subpaths of the same "colour", that
\begin{align*}
\gamma(t_i) \in A \cap B \quad \text{for every internal partition point } i = 1, \ldots, n-1.
\end{align*}
Since $A \cap B$ is path-connected and $x_0 \in A \cap B$, choose paths
\begin{align*}
\alpha_i: [0,1] &\to A \cap B, & \alpha_i(0) &= x_0, \quad \alpha_i(1) = \gamma(t_i), \quad i = 1, \ldots, n-1,
\end{align*}
and set $\alpha_0 = \alpha_n \equiv x_0$ (constant paths). Define the reparametrised loops
\begin{align*}
\tilde\gamma_i &:= \alpha_{i-1} \cdot \gamma_i \cdot \bar\alpha_i,
\end{align*}
where $\bar\alpha_i$ is the reverse of $\alpha_i$ and $\cdot$ denotes path concatenation. Each $\tilde\gamma_i$ is a loop at $x_0$, and its image lies in $A$ or in $B$ (the same containment as $\gamma_i$, since $\alpha_{i-1}, \alpha_i \subseteq A \cap B \subseteq A, B$).
By the [Group Laws for Paths up to Homotopy](/theorems/1877), insertion of cancelling path–reverse-path pairs is a homotopy-rel-endpoints move. Thus
\begin{align*}
[\gamma] = [\gamma_1 \cdot \gamma_2 \cdots \gamma_n] = [\tilde\gamma_1 \cdot \tilde\gamma_2 \cdots \tilde\gamma_n] = [\tilde\gamma_1][\tilde\gamma_2] \cdots [\tilde\gamma_n]
\end{align*}
in $\pi_1(X, x_0)$. Each $[\tilde\gamma_i]$ lies in $j_{A*}(\pi_1(A, x_0))$ or $j_{B*}(\pi_1(B, x_0))$, and is therefore in the image of $\Phi$. Since $\Phi$ is a homomorphism and its image contains a product equal to $[\gamma]$, we conclude $[\gamma] \in \operatorname{image}(\Phi)$.
[guided]
**Why does this work?** A loop $\gamma$ in $X$ visits both $A$ and $B$ in a potentially tangled way. The goal is to chop it into pieces each of which lies *entirely* in $A$ or *entirely* in $B$, since only then can we interpret a piece as a fundamental-group element of $A$ or $B$ and multiply them together.
**Finding the chopping points.** The preimages $\gamma^{-1}(A), \gamma^{-1}(B)$ are open and cover $[0,1]$. We want a partition of $[0,1]$ so fine that every subinterval falls into one of these preimages. This is exactly what the [Lebesgue Number Lemma](/theorems/952) provides: a uniform length scale $\delta > 0$ below which every subinterval is contained in some element of the cover. Verifying its hypotheses: $[0,1]$ is a compact metric space, and $\{\gamma^{-1}(A), \gamma^{-1}(B)\}$ is an open cover. Both hypotheses hold, so $\delta$ exists.
**The rerouting move.** Each piece $\gamma_i$ starts and ends at points $\gamma(t_{i-1}), \gamma(t_i)$ that may be anywhere in $X$. To interpret $\gamma_i$ as an element of $\pi_1(A)$ or $\pi_1(B)$, we need it to be a *loop at $x_0$*. We first arrange for the intermediate endpoints to lie in $A \cap B$ (by merging same-colour subpaths), then use path-connectedness of $A \cap B$ to choose paths $\alpha_i$ from $x_0$ to each intermediate endpoint $\gamma(t_i)$. Prepending $\alpha_{i-1}$ and appending $\bar\alpha_i$ to $\gamma_i$ produces a loop $\tilde\gamma_i$ based at $x_0$.
**Why does the concatenation still represent $[\gamma]$?** Between two adjacent subpaths $\tilde\gamma_i, \tilde\gamma_{i+1}$, we have inserted the cancelling pair $\bar\alpha_i \cdot \alpha_i$ (a path followed by its reverse). By the [Group Laws for Paths up to Homotopy](/theorems/1877), this cancels up to homotopy-rel-endpoints; hence $[\tilde\gamma_1 \cdots \tilde\gamma_n] = [\gamma_1 \cdots \gamma_n] = [\gamma]$.
**Conclusion.** Each $\tilde\gamma_i$ represents an element of $\pi_1(A, x_0)$ or $\pi_1(B, x_0)$, so $[\gamma]$ is a product of elements in the image of $j_{A*} \cup j_{B*}$, both of which factor through $\Phi$. Hence $[\gamma] \in \operatorname{image}(\Phi)$.
**Where is path-connectedness of $A \cap B$ used?** Exactly in the choice of rerouting paths $\alpha_i$. Without it, the intermediate endpoints $\gamma(t_i) \in A \cap B$ could not be connected to $x_0$ within $A \cap B$, and we could not manufacture loops based at $x_0$.
[/guided]
[/step]
[step:Prove injectivity via a rectangular subdivision of a null-homotopy]
Let $w \in \pi_1(A, x_0) * \pi_1(B, x_0)$ be a word whose image in $\pi_1(X, x_0)$ is trivial; write $w = [\sigma_1][\sigma_2] \cdots [\sigma_m]$, where each $\sigma_k$ is a loop at $x_0$ contained in $A$ or in $B$. Concatenating gives a loop $\sigma = \sigma_1 \cdot \sigma_2 \cdots \sigma_m: [0,1] \to X$ homotopic to the constant loop at $x_0$, via some null-homotopy
\begin{align*}
H: [0,1] \times [0,1] &\to X, & H(s, 0) &= \sigma(s),\quad H(s, 1) = x_0,\quad H(0, t) = H(1, t) = x_0.
\end{align*}
The preimages $H^{-1}(A)$ and $H^{-1}(B)$ are open and cover $[0,1]^2$. By the Lebesgue Number Lemma (hypotheses verified as in Step 2: $[0,1]^2$ is compact, the cover is open), there is $\delta > 0$ such that every subset of diameter $< \delta$ lies in one preimage. Subdivide $[0,1]^2$ into an $N \times N$ grid of closed rectangles $R_{ij} = [s_{i-1}, s_i] \times [t_{j-1}, t_j]$ with mesh $< \delta$. Refine the partition of $[0,1] \times \{0\}$ so that it includes the division points of $\sigma$ into the factors $\sigma_1, \ldots, \sigma_m$. Each $R_{ij}$ then satisfies $H(R_{ij}) \subseteq A$ or $H(R_{ij}) \subseteq B$.
Label each vertex $p = (s_i, t_j)$ of the grid by its image $H(p) \in X$. For each internal vertex not lying on the top or bottom edge, the four adjacent rectangles need not all lie in $A$ or all in $B$; however, if all four sit in $A$ and all four sit in $B$, then $H(p) \in A \cap B$. More precisely:
[claim:Every grid vertex $p$ with $H(p) \notin A \cap B$ has a consistent colour at its neighbouring rectangles]
If $H(p) \in A$ but $H(p) \notin B$, then every rectangle $R_{ij}$ containing $p$ satisfies $H(R_{ij}) \subseteq A$. Symmetrically if $H(p) \in B \setminus A$.
[proof]
Suppose $H(p) \in A \setminus B$ and some adjacent rectangle $R$ has $H(R) \subseteq B$. Then $H(p) \in H(R) \subseteq B$, contradicting $H(p) \notin B$.
[/proof]
[/claim]
Choose, for each grid vertex $p$, a path $\alpha_p$ in $X$ from $x_0$ to $H(p)$, with the following constraints:
- If $H(p) \in A \cap B$, choose $\alpha_p$ to lie in $A \cap B$ (possible by path-connectedness of $A \cap B$).
- If $H(p) \in A \setminus B$, choose $\alpha_p$ to lie in $A$ (possible by path-connectedness of $A$).
- If $H(p) \in B \setminus A$, choose $\alpha_p$ to lie in $B$.
- For vertices on the boundary of $[0,1]^2$ where $H(p) = x_0$, take $\alpha_p$ constant at $x_0$.
For each rectangle $R_{ij}$, let $\partial R_{ij}$ denote its boundary loop (traversed counterclockwise starting from the lower-left corner). The map $H|_{\partial R_{ij}}$ is a loop in either $A$ or $B$ at the image of the lower-left corner. Conjugating by the chosen path $\alpha_{p_{ij}}$ (where $p_{ij}$ is the lower-left corner) yields a loop $\ell_{ij}$ at $x_0$ contained in $A$ or in $B$, whose class in $\pi_1(A, x_0)$ or $\pi_1(B, x_0)$ we denote $[\ell_{ij}]$.
Since $R_{ij}$ is simply connected (it is a rectangle, homeomorphic to a disk) and $H$ maps it into $A$ or into $B$, the boundary loop $H|_{\partial R_{ij}}$ is null-homotopic in that subspace. Hence
\begin{align*}
[\ell_{ij}] = 1 \quad \text{in } \pi_1(A, x_0) \text{ or } \pi_1(B, x_0), \text{ whichever contains } H(R_{ij}).
\end{align*}
The boundary of $[0,1]^2$ equals the union of the $\partial R_{ij}$ with all internal edges traversed twice, once in each direction. Translating to words in $\pi_1(A, x_0) * \pi_1(B, x_0)$, and tracking the conjugations by the $\alpha_p$, we obtain an equality of words
\begin{align*}
w = \prod_{i,j} (\text{conjugate of } [\ell_{ij}])
\end{align*}
modulo the following relations: whenever an internal edge lies in $A \cap B$, the loop it contributes can be expressed in $\pi_1(A)$ or equivalently in $\pi_1(B)$, giving a relation of the form $k_A(i_{A*}[h]) = k_B(i_{B*}[h])$ for some $[h] \in \pi_1(A \cap B, x_0)$. This is precisely the amalgamation relation in $\pi_1(A) *_{\pi_1(A \cap B)} \pi_1(B)$.
Every vertex with $H(p) \in A \cap B$ has the flexibility to reinterpret the edges through it as lying in $A$ or in $B$: the amalgamation relation permits this reinterpretation in the amalgamated product. Every edge contained in $A \cap B$ similarly permits both interpretations. Every $[\ell_{ij}]$ is trivial in $\pi_1(A)$ or $\pi_1(B)$, contributing a trivial factor. Assembling the boundary equation and applying these permitted moves, the word $w$ reduces to $1$ in $\pi_1(A, x_0) *_{\pi_1(A \cap B, x_0)} \pi_1(B, x_0)$. Hence $\ker \Phi$ is trivial, i.e., $\Phi$ is injective.
<!-- illustration-needed: the null-homotopy square $[0,1]^2$ subdivided into a grid of rectangles, each rectangle shaded with colour indicating whether $H$ maps it into $A$ or into $B$, with vertices on the bottom edge labelled by the decomposition points of $\sigma = \sigma_1 \cdots \sigma_m$, and a path $\alpha_p$ from $x_0$ sketched to an internal vertex $p$ -->
[guided]
**The strategy.** We have a word $w$ that dies in $\pi_1(X, x_0)$, and we must show it was already dead in the amalgamated product. The key insight: a null-homotopy of the loop represented by $w$ is a map from a square into $X$; subdividing the square produces a combinatorial gadget whose boundary equation is exactly the expression for $w$, and whose interior relations are exactly the relations of the amalgamated product.
**Subdividing the square.** As in Step 2, we apply the [Lebesgue Number Lemma](/theorems/952) — this time to the open cover $\{H^{-1}(A), H^{-1}(B)\}$ of the compact metric space $[0,1]^2$ — to get a mesh size below which every piece lies in a single preimage. We subdivide into an $N \times N$ grid of rectangles, refining so that the grid is compatible with the decomposition of $\sigma$ into $\sigma_1 \cdots \sigma_m$ along the bottom edge.
**Paths to base everything at $x_0$.** Every vertex $p$ of the grid gets its own path $\alpha_p$ from $x_0$ to $H(p)$, chosen to respect the colouring: if $H(p) \in A \cap B$, choose $\alpha_p$ in $A \cap B$; otherwise in $A$ or $B$ according to where $H(p)$ lives. These path choices let us conjugate each small boundary loop $H|_{\partial R_{ij}}$ to a loop based at $x_0$.
**Why each rectangle contributes trivially.** A rectangle is simply connected. If $H(R_{ij}) \subseteq A$, then $H|_{\partial R_{ij}}$ bounds in $A$, so the corresponding class $[\ell_{ij}] = 1$ in $\pi_1(A, x_0)$. The interior of the rectangle provides the null-homotopy.
**The boundary equation.** When we sum up the boundary loops $\partial R_{ij}$ over all rectangles, every internal edge appears twice with opposite orientations, so internal edges cancel — *as long as we are free to interpret them the same way each time they appear*. For an edge whose image lies entirely in $A \cap B$, this freedom is exactly the amalgamation relation: the edge can be read in $\pi_1(A)$ or in $\pi_1(B)$, and these two readings are identified in the amalgamated product via $i_{A*}, i_{B*}$. This is where the amalgamation is **consumed**.
**What remains after cancellation.** Only the boundary of the outer square survives: the loop $\sigma$ along the bottom (which equals the word $w$ after the base-point adjustments) and the constant loop $x_0$ along the other three edges. The total rectangle contribution is $1$ (each $[\ell_{ij}] = 1$). So the boundary equation reads $w = 1$ in the amalgamated product. This is what we needed.
**Why the amalgamation is necessary, not just the free product.** Without the amalgamation, the relation that an element of $\pi_1(A \cap B)$ can be viewed equally in $\pi_1(A)$ or in $\pi_1(B)$ would not hold, and we would be unable to cancel internal edges lying in $A \cap B$. The injectivity argument would collapse: we would only prove injectivity onto a quotient by the amalgamation relations, which is exactly why $\pi_1(X)$ equals $\pi_1(A) *_{\pi_1(A \cap B)} \pi_1(B)$, not $\pi_1(A) * \pi_1(B)$.
[/guided]
[/step]
[step:Conclude that $\Phi$ is an isomorphism]
Combining Step 2 and Step 3, $\Phi$ is a surjective and injective group homomorphism, hence an isomorphism. This completes the proof of the Seifert–van Kampen theorem.
[/step]