---
title: Connectedness
module: Metric Spaces and Topology
moduleNumber: 3
lessonNumber: 5
order: 305
summary: >
  A space is connected when it cannot be split into two nonempty open pieces.
  The connected subsets of $\mathbb{R}$ are precisely the intervals, path-
  connectedness gives a constructive sufficient condition, and connectedness is
  a topological invariant preserved by continuous maps, the fact behind the
  intermediate value theorem.
topics: [Metric Spaces and Topology]
draft: false
sources:
  - book: Lebl
    ref: "Ch. 7 — Metric Spaces; §7.2 Open and closed sets (connectedness)"
  - book: Rosenlicht
    ref: "Ch. 3 — Metric spaces"
---

An interval on the real line has a feature no union of separated pieces has:
one can move continuously from any point to any other without leaving it or
jumping a gap. **Connectedness** abstracts exactly that. Like
[compactness](/real-analysis/metric-spaces/compactness), it is a topological
invariant preserved by continuous maps; compactness underlies the extreme value
theorem, and connectedness underlies the intermediate value theorem: a
continuous function cannot skip a value on a connected domain because its image
is again connected.

## Separations

The definition rules out the way a space could split into two pieces.

> **Definition (Connected).** A nonempty metric space $(X, d)$ is **connected**
> if the only subsets that are both open and closed (**clopen**) are $\emptyset$
> and $X$. Otherwise $X$ is **disconnected**. A nonempty subset $A \subseteq X$
> is connected if it is connected in its subspace topology.

Equivalently, $X$ is disconnected when it splits as $X = X_1 \cup X_2$ with
$X_1, X_2$ nonempty, open, and disjoint; such a pair is a **separation**. Each
piece is then also closed (it is the complement of the other), so a separation
is precisely a nontrivial clopen decomposition. Connectedness is the absence of
any separation: the space is all one piece.

For a subset $S$ of a larger space, the separating sets are taken in the
ambient space and cut down to $S$.

> **Proposition (Separation of a subset).** A nonempty $S \subseteq X$ is
> disconnected iff there exist open sets $U_1, U_2 \subseteq X$ with
> $$
> U_1 \cap S \ne \emptyset, \quad U_2 \cap S \ne \emptyset, \quad
> U_1 \cap U_2 \cap S = \emptyset, \quad
> S = (U_1 \cap S) \cup (U_2 \cap S).
> $$

The sets $U_1, U_2$ need not be disjoint in $X$; they only have to separate the
points of $S$, meeting no common point of $S$. This subtlety is why the
condition is phrased through $U_1 \cap U_2 \cap S = \emptyset$ rather than
$U_1 \cap U_2 = \emptyset$.

$$
% caption: A connected set (left) has no separation; a disconnected set
% (right) splits into two nonempty open pieces with a gap between them.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
% connected
\begin{scope}
\draw[acc, thick, fill=acc!10] plot[smooth cycle, tension=0.8]
  coordinates {(0,0) (1.6,-0.4) (2.6,0.6) (2.0,1.8) (0.4,1.6)};
\node[acc] at (1.3,0.7) {connected};
\end{scope}
% disconnected
\begin{scope}[xshift=5.2cm]
\draw[black, thick] plot[smooth cycle, tension=0.8]
  coordinates {(0,0) (1.0,-0.3) (1.3,0.9) (0.6,1.6) (-0.2,1.0)};
\draw[black, thick] plot[smooth cycle, tension=0.8]
  coordinates {(2.3,0.2) (3.3,-0.1) (3.6,1.1) (2.9,1.7) (2.1,1.1)};
\node[black] at (0.5,0.7) {$S_1$};
\node[black] at (2.8,0.8) {$S_2$};
\draw[black, <->] (1.35,0.6) -- (2.05,0.6);
\node[black, font=\scriptsize] at (1.7,0.9) {gap};
\end{scope}
\end{tikzpicture}
$$

> **Worked example ($\mathbb{Q}$ is totally disconnected).** Take distinct
> rationals $x < y$. Between them lies an irrational $z$ (for instance $z = x +
> (y - x)/\sqrt{2}$, irrational because $\sqrt{2}$ is and $x, y$ are rational,
> with $0 < (y-x)/\sqrt{2} < y - x$). The open sets $U_1 = (-\infty, z)$ and
> $U_2 = (z, \infty)$ then satisfy every clause of the separation criterion for
> $S = \mathbb{Q}$:
> $$
> x \in U_1 \cap \mathbb{Q}, \quad y \in U_2 \cap \mathbb{Q}, \quad
> U_1 \cap U_2 = \emptyset, \quad
> \mathbb{Q} = (U_1 \cap \mathbb{Q}) \cup (U_2 \cap \mathbb{Q}),
> $$
> the last equality because $z \notin \mathbb{Q}$: every rational is on one side
> of $z$. So any subset of $\mathbb{Q}$ with two distinct points is
> disconnected, and the only connected subsets of $\mathbb{Q}$ are single
> points: $\mathbb{Q}$ is **totally disconnected**.

A ball need not be connected either. In the two-point discrete space
$\{a, b\}$, the ball $B(a, 2) = \{a, b\}$ splits into the open singletons
$\{a\}$ and $\{b\}$.

## Connected subsets of the line

On $\mathbb{R}$ connectedness has a complete, concrete description.

> **Theorem (Connected subsets of $\mathbb{R}$).** A nonempty $S \subseteq
> \mathbb{R}$ is connected if and only if $S$ is an interval or a single point.

> **Proof.** Suppose $S$ is connected and not a single point, and take $x, y
> \in S$ with $x < y$. If some $z$ with $x < z < y$ were missing from $S$, the
> open rays $(-\infty, z)$ and $(z, \infty)$ would meet $S$ (at $x$ and $y$),
> be disjoint, and jointly cover $S$ — a separation. Connectedness forbids
> this, so $z \in S$: the set contains every point between any two of its
> points, which is just the [definition of an
> interval](/real-analysis/foundations/intervals-uncountability).
>
> Conversely, let $S$ be an interval and suppose open sets $U_1, U_2$ satisfy
> $U_1 \cap S \ne \emptyset$, $U_2 \cap S \ne \emptyset$, and $S = (U_1 \cap S)
> \cup (U_2 \cap S)$. We find a common point, so the pieces are not disjoint on
> $S$ and no separation exists. Take $x \in U_1 \cap S$, $y \in U_2 \cap S$,
> without loss of generality $x < y$; as $S$ is an interval, $[x, y] \subseteq
> S$. The set $U_2 \cap [x, y]$ is nonempty, so the
> [least-upper-bound property](/real-analysis/foundations/ordered-fields-completeness)
> supplies
> $$
> z = \inf \bigl( U_2 \cap [x, y] \bigr).
> $$
> If $z = x$, then $z \in U_1$. If $z > x$, then every ball $(z - \varepsilon,
> z + \varepsilon)$ contains points of $[x, y]$ below $z$, hence outside $U_2$;
> an open set containing $z$ would trap such points, so $z \notin U_2$, and
> since every point of $[x, y]$ lies in $U_1$ or $U_2$, $z \in U_1$. Now $U_1$
> is open, so $B(z, \delta) \subseteq U_1$ for some $\delta > 0$; and $z$ being
> the infimum of $U_2 \cap [x, y]$, some $w \in U_2 \cap [x, y]$ lies in $[z,
> z + \delta) \subseteq U_1$. Then $w \in U_1 \cap U_2 \cap S$. $\blacksquare$

$$
% caption: A subset of $\mathbb{R}$ with a hole: $x$ and $y$ are in $S$ but the
% point $z$ between them is not, so the two rays separate $S$.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.5,0) -- (7,0) node[right]{$\mathbf{R}$};
% S as two segments with hole at z
\draw[black, very thick] (0.6,0) -- (3.0,0);
\draw[black, very thick] (3.8,0) -- (6.2,0);
\fill[black] (1.4,0) circle (2pt);
\node[below] at (1.4,-0.05) {$x$};
\fill[black] (5.2,0) circle (2pt);
\node[below] at (5.2,-0.05) {$y$};
\draw[acc, thick, fill=white] (3.4,0) circle (2.4pt);
\node[below] at (3.4,-0.1) {$z$};
\node[acc, font=\scriptsize] at (3.4,0.5) {hole: $z \notin S$};
\node[black, font=\scriptsize] at (1.8,0.35) {$S$};
\node[black, font=\scriptsize] at (5.6,0.35) {$S$};
\end{tikzpicture}
$$

This underlies the intermediate value theorem: intervals are connected,
continuous maps preserve connectedness, so the image of an interval is again an
interval and omits no value between two it attains.

## Path-connectedness

Verifying that no separation exists is awkward; exhibiting an actual path is
constructive and usually easier.

> **Definition (Path-connected).** A set $A \subseteq X$ is **path-connected**
> if for every $p, q \in A$ there is a continuous map $\gamma : [0, 1] \to A$
> with $\gamma(0) = p$ and $\gamma(1) = q$.

> **Proposition.** Every path-connected set is connected.

If a path-connected $A$ had a separation $A = (U_1 \cap A) \cup (U_2 \cap A)$,
take $p \in U_1$, $q \in U_2$, and a path $\gamma$ between them; then
$\gamma^{-1}(U_1)$ and $\gamma^{-1}(U_2)$ would separate $[0, 1]$, contradicting
its connectedness. So no separation exists.

$$
% caption: Path-connectedness: any two points $p$ and $q$ of the region are
% joined by a continuous path $\gamma$ that stays inside it.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, thick] plot[smooth cycle, tension=0.75]
  coordinates {(0,0) (3.0,-0.5) (4.6,0.8) (3.8,2.6) (1.2,2.4) (-0.6,1.2)};
\node[black] at (0.3,2.0) {$A$};
\fill[acc] (0.8,0.7) circle (1.8pt);
\node[below left] at (0.8,0.7) {$p$};
\fill[acc] (3.8,1.6) circle (1.8pt);
\node[right] at (3.85,1.6) {$q$};
\draw[acc, very thick] (0.8,0.7) .. controls (1.6,1.9) and (2.8,0.5) .. (3.8,1.6);
\node[acc, font=\scriptsize] at (2.3,1.55) {path};
\end{tikzpicture}
$$

The implication does not reverse in general. The **topologist's sine curve**,
the closure of $\{(x, \sin(1/x)) : 0 < x \le 1\}$ together with the segment
$\{0\} \times [-1, 1]$, is connected: the oscillating graph accumulates on the
whole vertical segment, so no separation can split the segment from the graph.
Yet no continuous path reaches the segment from the graph, because a path would
have to traverse infinitely many oscillations of unit height in finite time. So
the curve is connected but not path-connected.

$$
% caption: The topologist's sine curve: the graph of $\sin(1/x)$ oscillates
% ever faster near $0$ and accumulates on the vertical segment, giving a
% connected set that no path can cross from graph to segment.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.7,0) -- (5.6,0) node[right]{$x$};
\draw[->, black] (0,-1.6) -- (0,1.7) node[above]{$y$};
% vertical limit segment
\draw[black, very thick] (0,-1.2) -- (0,1.2);
\node[black, left, align=right, font=\scriptsize] at (-0.12,0.6) {limit\\segment};
% sin(1/x) style curve, hand-drawn oscillations accelerating toward 0
\draw[acc, thick]
  (5.0,1.02) .. controls (4.2,0.9) and (3.6,-0.2) .. (3.1,-1.2)
  .. controls (2.85,-1.2) and (2.7,0.6) .. (2.45,1.2)
  .. controls (2.28,1.2) and (2.2,-0.8) .. (2.0,-1.2)
  .. controls (1.86,-1.2) and (1.82,0.9) .. (1.68,1.2)
  .. controls (1.58,1.2) and (1.55,-1.0) .. (1.44,-1.2)
  .. controls (1.36,-1.2) and (1.34,1.0) .. (1.25,1.2)
  .. controls (1.19,1.2) and (1.17,-1.05) .. (1.10,-1.2)
  .. controls (1.05,-1.2) and (1.04,1.05) .. (0.98,1.2)
  .. controls (0.94,1.2) and (0.93,-1.1) .. (0.88,-1.2)
  .. controls (0.85,-1.2) and (0.84,1.1) .. (0.80,1.2)
  .. controls (0.77,1.2) and (0.76,-1.1) .. (0.73,-1.2)
  .. controls (0.71,-1.2) and (0.70,1.1) .. (0.67,1.2)
  .. controls (0.65,1.2) and (0.645,-1.1) .. (0.62,-1.2)
  .. controls (0.60,-1.2) and (0.595,1.1) .. (0.58,1.2);
\node[acc, font=\scriptsize] at (4.5,0.35) {graph};
\node[black, font=\scriptsize] at (3.4,1.45) {oscillations pile up near the axis};
\end{tikzpicture}
$$

For **open** subsets of
$\mathbb{R}^n$, however, the two notions coincide, so on regions in Euclidean
space one may use whichever is convenient. Convex sets and star-shaped sets are
path-connected outright: the straight segment $\gamma(t) = (1 - t)p + t q$ stays
inside them, so balls, boxes, and all of $\mathbb{R}^n$ are connected.

A product of connected sets is connected: $[0,1] \times [0,1]$ is connected
because any two of its points are joined by an "L"-shaped path (horizontal then
vertical) lying inside the square. The same argument makes any box in
$\mathbb{R}^n$ connected, and hence, by the theorem below, the target of an
intermediate value statement in several variables.

$$
% caption: The unit square is path-connected: an L-shaped path (horizontal,
% then vertical) joins any two points without leaving the square.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, thick] (0,0) rectangle (3.2,3.2);
\node[black] at (0.55,2.85) {unit square};
\fill[acc] (0.7,0.8) circle (1.8pt);
\node[below left] at (0.7,0.8) {$p$};
\fill[acc] (2.6,2.5) circle (1.8pt);
\node[above right] at (2.6,2.5) {$q$};
\draw[acc, very thick] (0.7,0.8) -- (2.6,0.8);
\draw[acc, very thick] (2.6,0.8) -- (2.6,2.5);
\fill[black] (2.6,0.8) circle (1.4pt);
\node[acc, font=\scriptsize, below] at (1.65,0.72) {horizontal leg};
\node[acc, font=\scriptsize, left] at (2.52,1.7) {vertical leg};
\end{tikzpicture}
$$

## Components and invariance

Every space partitions into maximal connected pieces.

> **Definition (Connected component).** The **connected component** of a point
> $x \in X$ is the union of all connected subsets containing $x$. Components are
> connected, and distinct components are disjoint, so they partition $X$.

Components are always closed; in $\mathbb{Q}$ they are single points, and in an
interval there is one component, the whole interval.

> **Worked example (Components of $[0,1] \cup [2,3]$).** Let $S = [0,1] \cup
> [2,3] \subseteq \mathbb{R}$. The open sets $U_1 = (-\tfrac12, \tfrac32)$ and
> $U_2 = (\tfrac32, \tfrac72)$ are disjoint, meet $S$ in $[0,1]$ and $[2,3]$
> respectively, and jointly cover $S$, so $S$ is disconnected. Each piece
> $[0,1]$ and $[2,3]$ is an interval, hence connected. No connected subset of
> $S$ can contain points of both pieces: it would contain $1$ and $2$ but miss
> $\tfrac32$, so the missing-point criterion disconnects it. The maximal
> connected subsets containing a given point are therefore $[0,1]$ and
> $[2,3]$ — the two components of $S$.

$$
% caption: The two components of $[0,1] \cup [2,3]$: disjoint open sets
% separate the pieces, and each piece is a maximal connected subset.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-1.0,0) -- (7.6,0) node[right]{$\mathbf{R}$};
% component 1
\draw[acc, very thick] (0,0) -- (1.8,0);
\fill[acc] (0,0) circle (2pt);
\fill[acc] (1.8,0) circle (2pt);
\node[below] at (0,-0.1) {$0$};
\node[below] at (1.8,-0.1) {$1$};
\node[acc, above, font=\scriptsize] at (0.9,0.15) {component 1};
% component 2
\draw[acc, very thick] (3.6,0) -- (5.4,0);
\fill[acc] (3.6,0) circle (2pt);
\fill[acc] (5.4,0) circle (2pt);
\node[below] at (3.6,-0.1) {$2$};
\node[below] at (5.4,-0.1) {$3$};
\node[acc, above, font=\scriptsize] at (4.5,0.15) {component 2};
% separating open sets drawn as brackets above
\draw[black, dashed] (-0.9,0.65) -- (2.7,0.65);
\draw[black, dashed] (-0.9,0.65) -- (-0.9,0.45);
\draw[black, dashed] (2.7,0.65) -- (2.7,0.45);
\node[black, font=\scriptsize] at (0.9,0.9) {$U_1$};
\draw[black, dashed] (2.8,0.65) -- (6.4,0.65);
\draw[black, dashed] (2.8,0.65) -- (2.8,0.45);
\draw[black, dashed] (6.4,0.65) -- (6.4,0.45);
\node[black, font=\scriptsize] at (4.5,0.9) {$U_2$};
\end{tikzpicture}
$$

The number and structure of components is preserved under any map
that preserves connectedness, and continuous maps do.

> **Theorem (Continuous invariance).** If $f : X \to Y$ is continuous and
> $X$ is connected, then the image $f(X)$ is connected.

A separation of $f(X)$ by open $V_1, V_2 \subseteq Y$ would pull back, via the
[preimage characterization of continuity](/real-analysis/continuity/continuity-metric-spaces),
to a separation of $X$ by the open sets $f^{-1}(V_1)$ and $f^{-1}(V_2)$,
contradicting connectedness of $X$. So connectedness is a **topological
invariant**: it is preserved by continuous maps and, in particular, by
homeomorphisms.

The intermediate value theorem is the immediate corollary in one variable.

> **Corollary (Intermediate value theorem).** If $f : [a, b] \to \mathbb{R}$ is
> continuous and $y$ lies between $f(a)$ and $f(b)$, then $f(c) = y$ for some
> $c \in [a, b]$.

The interval $[a, b]$ is connected, so its image $f([a,b])$ is a connected
subset of $\mathbb{R}$, hence an interval; an interval containing $f(a)$ and
$f(b)$ contains every value between them, so $y$ is attained. No estimate on
$f$ is used, only that a continuous image of a connected set is connected.
Connectedness supplies the "no gaps in the domain" half of the theorem the way
[compactness](/real-analysis/metric-spaces/compactness) supplies the "attains
its bounds" half of the extreme value theorem.

| Property | Definition via | Preserved by continuous maps | Controls |
| --- | --- | --- | --- |
| Compactness | finite subcovers | image is compact | extreme value theorem |
| Connectedness | no separation | image is connected | intermediate value theorem |

Both invariance statements reappear for
[continuous functions on metric spaces](/real-analysis/continuity/evt-ivt):
"the image of a compact set is compact" gives the extreme value theorem, and
"the image of a connected set is connected" gives the intermediate value
theorem.[^lebl-conn]

[^lebl-conn]: **Lebl**, _Basic Analysis I_, §7.2.2 — Connected sets: clopen decompositions and separations, the characterization of connected subsets of $\mathbb{R}$ as intervals, and connectedness under the subspace topology.
