[proofplan]
We write $X \cup_f D^n$ as a union of two open sets engineered so that [Seifert–van Kampen](/theorems/1905) applies cleanly: $A$ consists of $X$ together with the punctured cell (which deformation retracts to $X$), and $B$ is the open cell (contractible). Because $n \geq 3$, the intersection $A \cap B$ is homotopy equivalent to $S^{n-1}$, which is simply connected, so the amalgamation is over a trivial group and the van Kampen formula collapses to $\pi_1(A) \cong \pi_1(X)$. A [change of basepoint](/theorems/1880) transports this isomorphism back to the specified base point $x_0$.
[/proofplan]
[step:Construct the open cover $\{A, B\}$ of the attachment]
Write $Y := X \cup_f D^n$ and let $q: X \sqcup D^n \to Y$ denote the quotient map defining the attachment, so that $q(a) = q(f(a))$ for $a \in S^{n-1} = \partial D^n$. We identify $X$ and $\mathring{D}^n$ with their images in $Y$ under $q$ (both are injective on these subsets).
Fix the origin $0 \in \mathring{D}^n$. Define
\begin{align*}
A &:= Y \setminus \{q(0)\} = X \cup_f (D^n \setminus \{0\}), \\
B &:= q(\mathring{D}^n) \cong \mathring{D}^n.
\end{align*}
We verify $A, B$ are open in $Y$ and cover $Y$:
- $\{q(0)\}$ is closed in $Y$ (its preimage $\{0\}$ under $q$ is closed in $X \sqcup D^n$), so $A = Y \setminus \{q(0)\}$ is open.
- $B$ is open because $q^{-1}(B) = \mathring{D}^n$, which is open in $X \sqcup D^n$ (it is the preimage of the open ball under the projection to $D^n$, and $q$ is the quotient map).
- $A \cup B = Y$, since every point of $Y$ either equals $q(0)$ (in which case it lies in $B$) or is distinct from $q(0)$ (in which case it lies in $A$).
The intersection is
\begin{align*}
A \cap B = B \setminus \{q(0)\} = q(\mathring{D}^n \setminus \{0\}) \cong \mathring{D}^n \setminus \{0\}.
\end{align*}
[/step]
[step:Establish the homotopy equivalences $A \simeq X$, $B \simeq \{*\}$, $A \cap B \simeq S^{n-1}$]
**$B$ is contractible.** The open ball $\mathring{D}^n \subseteq \mathbb{R}^n$ is convex, hence contractible via the straight-line homotopy $(x, t) \mapsto (1-t) x$ to the origin.
**$A$ is homotopy equivalent to $X$.** The punctured closed disk $D^n \setminus \{0\}$ deformation retracts onto $S^{n-1}$ via the radial homotopy
\begin{align*}
r: (D^n \setminus \{0\}) \times [0,1] &\to D^n \setminus \{0\}, & r(x, t) &:= (1-t) x + t \frac{x}{|x|}.
\end{align*}
This homotopy fixes $S^{n-1}$ pointwise (when $|x| = 1$, $(1-t) x + t x = x$), so it is a deformation retraction in the sense that the $t=1$ map retracts onto $S^{n-1}$ rel $S^{n-1}$. Quotienting, since the relation $q(a) = q(f(a))$ only affects points of $S^{n-1}$ and the homotopy $r$ extends continuously by the identity on $X$, we obtain a deformation retraction of $A$ onto $X$. In particular, $A \simeq X$.
**$A \cap B$ is homotopy equivalent to $S^{n-1}$.** The punctured open ball $\mathring{D}^n \setminus \{0\}$ deformation retracts onto any sphere $\{x : |x| = r\}$ for $0 < r < 1$ via the radial homotopy
\begin{align*}
s: (\mathring{D}^n \setminus \{0\}) \times [0,1] &\to \mathring{D}^n \setminus \{0\}, & s(x, t) &:= (1-t) x + t\, r \frac{x}{|x|}.
\end{align*}
The sphere $\{|x| = r\}$ is homeomorphic to $S^{n-1}$ via scaling, so $A \cap B \simeq S^{n-1}$.
**Path-connectedness.** For $n \geq 2$ (in particular $n \geq 3$), $S^{n-1}$ is path-connected, hence so is $A \cap B$ (which is homotopy equivalent to it). The space $B \simeq \{*\}$ is trivially path-connected. Finally, $A$ is path-connected because $X$ (assumed connected — if $X$ is disconnected, replace $X$ by the component containing $f(S^{n-1})$; the inclusion-induced map on $\pi_1$ is unaffected) is, and the deformation retraction identifies $A$ with $X$ up to homotopy.
[guided]
**Why this cover?** The strategy of van Kampen is to decompose a space into open path-connected pieces with path-connected intersection and compute $\pi_1$ as an amalgamated product. Here we want $\pi_1(Y) = \pi_1(X)$, so we need one open set ($A$) that is homotopy equivalent to $X$, one that is simply connected ($B$), and an intersection whose $\pi_1$ doesn't contribute new relations — i.e., simply connected.
**The punctured cell trick.** A single point is not open, but removing a point from a cell leaves an open set. So we choose $0 \in \mathring{D}^n$ (the centre) and take $A = Y \setminus \{0\}$ (complement of a point, which is open) and $B = \mathring{D}^n$ (the open cell).
**Why $A \simeq X$?** The attaching map $f: S^{n-1} \to X$ glues the boundary of the cell to $X$. Inside $A$, the cell is punctured, so $D^n \setminus \{0\}$ deformation retracts radially to $S^{n-1}$, and then the attaching map identifies this $S^{n-1}$ with its image in $X$. The net effect: $A$ deformation retracts to $X$.
**Why $A \cap B \simeq S^{n-1}$?** The intersection is the punctured open ball $\mathring{D}^n \setminus \{0\}$, which deformation retracts onto any concentric sphere by straight-line homotopy in the radial direction.
**The critical hypothesis $n \geq 3$.** For $n \geq 2$, $S^{n-1}$ is path-connected (required to apply van Kampen). For $n \geq 3$, $S^{n-1}$ is additionally **simply connected** — this is the fact that kills the amalgamation relation in the next step and reduces van Kampen to a plain equality $\pi_1(Y) = \pi_1(A)$. For $n = 2$, $S^1$ has $\pi_1 \cong \mathbb{Z}$, and this generator becomes a new relation in $\pi_1(Y)$ — that is the content of the $n = 2$ case treated separately as the attaching-a-2-cell theorem.
[/guided]
[/step]
[step:Apply Seifert–van Kampen at an auxiliary basepoint $y_1 \in A \cap B$]
Choose $y_1 \in A \cap B$ (for example, $y_1 = q(x)$ for any $x \in \mathring{D}^n$ with $0 < |x| < 1$). The spaces $A, B, A \cap B$ are all open in $Y$ and path-connected (Step 2). The hypotheses of [Seifert–van Kampen](/theorems/1905) are satisfied at basepoint $y_1$, yielding the isomorphism
\begin{align*}
\pi_1(A, y_1) *_{\pi_1(A \cap B, y_1)} \pi_1(B, y_1) &\xrightarrow{\;\cong\;} \pi_1(Y, y_1).
\end{align*}
We evaluate each factor:
- $\pi_1(B, y_1) \cong \pi_1(\mathring{D}^n, y_1) = \{e\}$ because $B$ is contractible (Step 2) and $\pi_1$ of a contractible space is trivial. This is the [homotopy invariance of the fundamental group](/theorems/1882) applied to $B \simeq \{*\}$.
- $\pi_1(A \cap B, y_1) \cong \pi_1(S^{n-1}, *) = \{e\}$ because $n \geq 3$ implies $S^{n-1}$ is simply connected (again via homotopy invariance; the fundamental group of $S^{k}$ for $k \geq 2$ is trivial).
Substituting, the amalgamated product simplifies:
\begin{align*}
\pi_1(A, y_1) *_{\{e\}} \{e\} \cong \pi_1(A, y_1).
\end{align*}
Indeed, the amalgamation over the trivial group is just the free product, and the free product with the trivial group is the first factor:
\begin{align*}
G *_{\{e\}} \{e\} \cong G * \{e\} \cong G.
\end{align*}
Combining,
\begin{align*}
\pi_1(Y, y_1) \cong \pi_1(A, y_1).
\end{align*}
[guided]
With the three homotopy types from Step 2 in hand, we plug them into [Seifert–van Kampen](/theorems/1905) and observe the amalgamation collapses.
**Verifying van Kampen's hypotheses.** van Kampen (Theorem 1905) requires: $Y = A \cup B$ (verified), $A, B$ open (verified), $A, B, A \cap B$ path-connected (verified for $n \geq 3$ in Step 2). A basepoint $y_1 \in A \cap B$ is chosen.
**Trivialising the amalgamation.** The theorem concludes that $\pi_1(Y, y_1)$ is the pushout of $\pi_1(A, y_1) \leftarrow \pi_1(A \cap B, y_1) \rightarrow \pi_1(B, y_1)$ in the category of groups. Both $\pi_1(A \cap B, y_1) = \pi_1(S^{n-1})$ (for $n \geq 3$) and $\pi_1(B, y_1) = \pi_1(\{*\})$ are trivial. The universal property of the pushout with a trivial vertex is immediate: there are no amalgamation relations to impose, and the second factor contributes nothing. So the pushout collapses to $\pi_1(A, y_1)$.
**Why $n \geq 3$?** Exactly the fact $\pi_1(S^{n-1}) = \{e\}$, which fails for $n = 2$ (where $\pi_1(S^1) = \mathbb{Z}$) and degenerates for $n = 1$ (where $S^0$ has two components). The case $n = 2$ is genuinely different and is the content of Theorem 1908.
[/guided]
[/step]
[step:Transport the isomorphism to the basepoint $x_0$ via change of basepoint]
So far we have $\pi_1(Y, y_1) \cong \pi_1(A, y_1)$. We now recover $\pi_1(Y, x_0) \cong \pi_1(X, x_0)$ at the specified basepoint $x_0$ in the image of $f$, i.e., $x_0 \in q(S^{n-1}) \subseteq X$.
Since $Y$ is path-connected (as a union of path-connected sets sharing $y_1 \in A \cap B$), choose a path $\gamma: [0,1] \to Y$ from $y_1$ to $x_0$. By the [Change of Basepoint](/theorems/1880) theorem, $\gamma$ induces an isomorphism
\begin{align*}
\gamma_\#: \pi_1(Y, y_1) &\xrightarrow{\;\cong\;} \pi_1(Y, x_0), & [\alpha] &\mapsto [\bar\gamma \cdot \alpha \cdot \gamma].
\end{align*}
Similarly, since $x_0 \in X \subseteq A$ and $A \simeq X$ is path-connected, there is a path $\gamma'$ in $A$ from $y_1$ to $x_0$, inducing
\begin{align*}
\gamma'_\#: \pi_1(A, y_1) \xrightarrow{\;\cong\;} \pi_1(A, x_0).
\end{align*}
Finally, the deformation retraction $A \to X$ from Step 2 is a homotopy equivalence, so by the [homotopy invariance of the fundamental group](/theorems/1882), the inclusion $X \hookrightarrow A$ induces an isomorphism $\pi_1(X, x_0) \xrightarrow{\cong} \pi_1(A, x_0)$ (using $x_0 \in X$ as basepoint on both sides).
Composing the isomorphisms:
\begin{align*}
\pi_1(X, x_0) \xrightarrow{\;\cong\;} \pi_1(A, x_0) \xrightarrow{(\gamma'_\#)^{-1}} \pi_1(A, y_1) \xrightarrow{\;\cong\;} \pi_1(Y, y_1) \xrightarrow{\gamma_\#} \pi_1(Y, x_0),
\end{align*}
where the middle isomorphism is the Seifert–van Kampen isomorphism of Step 3. The total composition is the homomorphism induced by the inclusion $X \hookrightarrow Y$: at each step we pass through the natural inclusion or deformation-retraction, and the basepoint-change paths are chosen compatibly inside $A$. Hence the inclusion $X \hookrightarrow Y$ induces an isomorphism $\pi_1(X, x_0) \xrightarrow{\cong} \pi_1(Y, x_0)$, completing the proof.
[/step]