[proofplan]
Choose a point $p \in A \cap B$. Given arbitrary points $x,y \in A \cup B$, join $x$ to $p$ inside whichever of $A$ or $B$ contains $x$, and join $p$ to $y$ inside whichever of $A$ or $B$ contains $y$. The subspace inclusions turn these paths into paths in $A \cup B$, and concatenating them gives a path from $x$ to $y$ in $A \cup B$.
[/proofplan]
custom_env
admin
[step:Choose a common point and reduce to arbitrary endpoints in the union]
Since $A \cap B \neq \varnothing$, choose a point $p \in A \cap B$. Let $U := A \cup B$, equipped with the [subspace topology](/page/Subspace%20Topology) inherited from $X$.
To prove that $U$ is path-connected, let $x,y \in U$ be arbitrary. It suffices to construct a continuous map $\gamma : [0,1] \to U$ such that $\gamma(0)=x$ and $\gamma(1)=y$.
[/step]
custom_env
admin
[step:Join each endpoint to the common point inside an appropriate subspace]Choose $C_x \in \{A,B\}$ such that $x \in C_x$, and choose $C_y \in \{A,B\}$ such that $y \in C_y$. This is possible because $x,y \in A \cup B$. Since $p \in A \cap B$, we have $p \in C_x \cap C_y$.
Because $C_x$ is path-connected, there exists a continuous map $\alpha : [0,1] \to C_x$ such that $\alpha(0)=x$ and $\alpha(1)=p$. Because $C_y$ is path-connected, there exists a continuous map $\beta : [0,1] \to C_y$ such that $\beta(0)=p$ and $\beta(1)=y$.[/step]
custom_env
admin
[guided]The point $p$ is the bridge between the two subspaces. Since $p \in A \cap B$, it lies in both $A$ and $B$, so it can serve as an intermediate endpoint no matter which subspace contains $x$ or $y$.
Because $x \in A \cup B$, at least one of the statements $x \in A$ or $x \in B$ holds. Choose $C_x \in \{A,B\}$ with $x \in C_x$. Because $y \in A \cup B$, choose $C_y \in \{A,B\}$ with $y \in C_y$. The choices are not required to be unique; if $x$ lies in both $A$ and $B$, either choice works. Since $p \in A \cap B$, the point $p$ belongs to both possible choices, so $p \in C_x$ and $p \in C_y$.
Now use path-connectedness in the selected subspaces. The subspace $C_x$ is path-connected, so there is a path from $x$ to $p$ inside $C_x$: that is, a continuous map $\alpha : [0,1] \to C_x$ satisfying $\alpha(0)=x$ and $\alpha(1)=p$. Similarly, $C_y$ is path-connected, so there is a continuous map $\beta : [0,1] \to C_y$ satisfying $\beta(0)=p$ and $\beta(1)=y$.[/guided]
custom_env
admin
[step:View the two paths as paths in the union]
Let $i_x : C_x \to U$ and $i_y : C_y \to U$ be the inclusion maps. These maps are continuous because $C_x$ and $C_y$ carry the subspace topologies inherited from $X$, and $U \subset X$ also carries the subspace topology inherited from $X$.
Define $\alpha_U : [0,1] \to U$ by $\alpha_U := i_x \circ \alpha$, and define $\beta_U : [0,1] \to U$ by $\beta_U := i_y \circ \beta$. The maps $\alpha_U$ and $\beta_U$ are continuous as compositions of continuous maps, and they satisfy
\begin{align*}
\alpha_U(0)=x,\quad \alpha_U(1)=p,\quad \beta_U(0)=p,\quad \beta_U(1)=y.
\end{align*}
Thus $\alpha_U$ is a path in $U$ from $x$ to $p$, and $\beta_U$ is a path in $U$ from $p$ to $y$.
[/step]
custom_env
admin
[step:Concatenate the two paths to obtain a path between the original endpoints]
The endpoint of $\alpha_U$ equals the starting point of $\beta_U$, namely $p$. Hence, by [citetheorem:9159] applied in the [topological space](/page/Topological%20Space) $U$ to the path $\alpha_U$ from $x$ to $p$ and the path $\beta_U$ from $p$ to $y$, the concatenation $\gamma := \alpha_U * \beta_U$ is a path in $U$ from $x$ to $y$.
Since $x,y \in U$ were arbitrary, every two points of $U=A \cup B$ can be joined by a path in $U$. Therefore $A \cup B$ is path-connected with the subspace topology.
[/step]