[example: Two Intervals Are Separated]
Let $X = [0,1] \cup [2,3]$ with the [subspace topology](/page/Subspace%20Topology) inherited from $\mathbb{R}$. Set $A=[0,1]$ and $B=[2,3]$. Both sets are nonempty because $0 \in A$ and $2 \in B$. They are disjoint: if $x \in A \cap B$, then $0 \le x \le 1$ and $2 \le x \le 3$, which would imply $2 \le x \le 1$, impossible. Also,
\begin{align*}
A \cup B
&= [0,1] \cup [2,3] \\
&= X.
\end{align*}
To check openness in the subspace topology, compute the two intersections:
\begin{align*}
X \cap (-1,3/2)
&= \bigl([0,1] \cup [2,3]\bigr) \cap (-1,3/2) \\
&= \bigl([0,1]\cap (-1,3/2)\bigr) \cup \bigl([2,3]\cap (-1,3/2)\bigr) \\
&= [0,1] \cup \varnothing \\
&= A,
\end{align*}
and
\begin{align*}
X \cap (3/2,4)
&= \bigl([0,1] \cup [2,3]\bigr) \cap (3/2,4) \\
&= \bigl([0,1]\cap (3/2,4)\bigr) \cup \bigl([2,3]\cap (3/2,4)\bigr) \\
&= \varnothing \cup [2,3] \\
&= B.
\end{align*}
Since $(-1,3/2)$ and $(3/2,4)$ are open in $\mathbb{R}$, these equalities show that $A$ and $B$ are open in $X$. Thus $X$ is split into two nonempty disjoint open pieces, so the two intervals are separated even though each interval has no internal gap.
[/example]