MATH-447 · Lesson 6 of 12 · 24 min

Connectedness and path-connectedness

Lesson 1 used the idea of a space being in one piece to show that a circle is not homeomorphic to an interval and that the line is not homeomorphic to the plane. This lesson makes the idea precise in two ways. A space is connected if it cannot be split into two disjoint nonempty open sets; it is path-connected if any two points can be joined by a continuous path. The two notions agree for the open subsets of Euclidean space but not in general, and the gap between them is illustrated by one of the most famous examples in topology, the topologist's sine curve.

Connected spaces

Definition. A separation of a space \(X\) is a pair of disjoint nonempty open sets \(U, V\) with \(U \cup V = X\). The space is connected if it has no separation.

Theorem. The following are equivalent for a space \(X\). (1) \(X\) is connected. (2) The only subsets of \(X\) that are both open and closed are \(\varnothing\) and \(X\). (3) Every continuous map from \(X\) to the discrete two-point space \(\{0, 1\}\) is constant.

Proof. A separation \(U, V\) gives a set \(U\) that is open, and closed because its complement \(V\) is open, and conversely a proper nonempty clopen set \(U\) gives the separation \(U, X \setminus U\). So (1) and (2) are equivalent. A continuous map \(f : X \to \{0, 1\}\) that is not constant gives the separation \(f^{-1}(0), f^{-1}(1)\), and a separation \(U, V\) gives the non-constant continuous map equal to 0 on \(U\) and 1 on \(V\). So (1) and (3) are equivalent.

For a subspace \(Y \subseteq X\), a separation of \(Y\) consists of sets open in \(Y\), not necessarily in \(X\). The subspace \(Y = [0, 1) \cup (1, 2]\) of the real line is disconnected, separated by \([0, 1)\) and \((1, 2]\), which are open in \(Y\). The rationals are disconnected, separated by \(\{q < \sqrt{2}\}\) and \(\{q > \sqrt{2}\}\). In fact the only connected subsets of \(\mathbb{Q}\) are single points: a space with this property is called totally disconnected. The Cantor set is totally disconnected too, and so is any discrete space with at least two points.

The real line is connected

Theorem. Every interval of the real line is connected. Conversely, every connected subset of the real line is an interval.

Proof. Let \(I\) be an interval and suppose \(U, V\) is a separation of \(I\). Pick \(a \in U\) and \(b \in V\), and suppose \(a < b\); the other case is symmetric. Then \([a, b] \subseteq I\). Let \(s = \sup\{x \in [a, b] : x \in U\}\), which exists by the completeness of the reals, the least upper bound property. Since \(U \cap [a, b]\) is closed in \([a, b]\), being the complement of the open set \(V \cap [a, b]\), the supremum belongs to it: \(s \in U\), and in particular \(s < b\). But \(U \cap [a, b]\) is also open in \([a, b]\), so it contains \([s, s + \varepsilon)\) for some \(\varepsilon > 0\), contradicting the choice of \(s\) as an upper bound. So no separation exists. Conversely, if \(Y \subseteq \mathbb{R}\) is not an interval, there are \(a < c < b\) with \(a, b \in Y\) and \(c \notin Y\), and then \(Y \cap (-\infty, c)\) and \(Y \cap (c, \infty)\) separate \(Y\).

The proof uses the least upper bound property essentially, and that is no accident: connectedness of the line is a topological form of completeness. The rationals, which lack least upper bounds, are totally disconnected.

Preserving connectedness

Theorem. (a) The continuous image of a connected space is connected. (b) If a family of connected subspaces all contain a common point, their union is connected. (c) If \(A\) is connected and \(A \subseteq B \subseteq \overline{A}\), then \(B\) is connected. (d) A product of connected spaces is connected.

Proof. (a) If \(f : X \to Y\) is continuous and surjective and \(g : Y \to \{0, 1\}\) is continuous, then \(g \circ f\) is constant because \(X\) is connected, so \(g\) is constant because \(f\) is onto. (b) Let \(g\) map the union continuously to \(\{0, 1\}\). Its restriction to each piece is constant, and every piece contains the common point \(p\), so every piece takes the value \(g(p)\). (c) Let \(g : B \to \{0, 1\}\) be continuous. It is constant on \(A\), say equal to 0. The set \(g^{-1}(0)\) is closed in \(B\) and contains \(A\), so it contains \(\overline{A} \cap B = B\). (d) First take two spaces. Fix \((a, b) \in X \times Y\). For each \(x \in X\), the set \(T_x = (\{x\} \times Y) \cup (X \times \{b\})\) is a union of two connected sets, homeomorphic to \(Y\) and \(X\), meeting at \((x, b)\), so it is connected by (b). All the \(T_x\) contain \((a, b)\), and their union is \(X \times Y\), so the product is connected by (b) again. Induction handles finite products. For an arbitrary product, fix a point \(p\); the points that differ from \(p\) in only finitely many coordinates form a connected set by the finite case and (b), and this set is dense in the product topology, since every basic open set restricts only finitely many coordinates. By (c) the whole product is connected.

Part (a) with the theorem on intervals gives the intermediate value theorem: if \(f : [a, b] \to \mathbb{R}\) is continuous, its image is connected, hence an interval, so it contains every value between \(f(a)\) and \(f(b)\). In this form the theorem holds for any connected domain: a continuous real function on a connected space that takes a positive and a negative value also takes the value zero.

Example: a fixed point theorem in one dimension. Every continuous \(f : [0, 1] \to [0, 1]\) has a fixed point. Let \(g(x) = f(x) - x\). Then \(g(0) = f(0) \ge 0\) and \(g(1) = f(1) - 1 \le 0\), so by the intermediate value theorem \(g\) vanishes somewhere. Lesson 10 proves the two-dimensional version, Brouwer's fixed point theorem, which needs the fundamental group.

Example: antipodal points in one dimension. For every continuous \(f : S^1 \to \mathbb{R}\) there is a point \(x\) with \(f(x) = f(-x)\). Let \(g(x) = f(x) - f(-x)\). Then \(g(-x) = -g(x)\), so either \(g\) vanishes at some point or it takes both signs, and in the latter case it vanishes by the intermediate value theorem on the connected circle. At any moment there are two opposite points on the equator with the same temperature. Lesson 10 proves the two-dimensional version, the Borsuk–Ulam theorem.

Components

Define \(x \sim y\) if some connected subspace contains both. This is an equivalence relation: reflexivity uses the connected set \(\{x\}\), and transitivity uses part (b), since two connected sets sharing the point \(y\) have connected union. The equivalence classes are the connected components of \(X\). Each component is connected, by (b), and is a maximal connected subset. Each component is closed, by (c), since its closure is connected and contains it. Components need not be open: the components of \(\mathbb{Q}\) are its single points, which are not open.

Path-connectedness

Definition. A path in \(X\) from \(x\) to \(y\) is a continuous map \(\gamma : [0, 1] \to X\) with \(\gamma(0) = x\) and \(\gamma(1) = y\). The space \(X\) is path-connected if any two points can be joined by a path.

Theorem. A path-connected space is connected.

Proof. Fix \(x \in X\). For each \(y\) choose a path \(\gamma_y\) from \(x\) to \(y\). Its image is connected, as the continuous image of the interval, and contains \(x\). The union of these images is \(X\), which is therefore connected by part (b).

Convex subsets of \(\mathbb{R}^n\), such as balls and cubes, are path-connected by straight-line paths \(t \mapsto (1 - t)x + ty\). The sphere \(S^n\) for \(n \ge 1\) is path-connected, being the continuous image of \(\mathbb{R}^{n+1} \setminus \{0\}\) under \(v \mapsto v/\|v\|\), and \(\mathbb{R}^{n+1} \setminus \{0\}\) is path-connected for \(n \ge 1\) because any two points can be joined by a path avoiding the origin, going around it by a third point if the segment passes through it. The relation of being joined by a path is an equivalence relation, using reversed paths and concatenation of paths with the pasting lemma, and its classes are the path components.

The topologist's sine curve

Let \(S = \{(x, \sin(1/x)) : 0 < x \le 1\}\) and \(\overline{S} = S \cup (\{0\} \times [-1, 1])\). The set \(S\) is the graph of a continuous function on a connected interval, so it is path-connected and connected. As \(x \to 0\) the graph oscillates infinitely often between \(-1\) and \(1\), so every point of the segment \(\{0\} \times [-1, 1]\) is a limit of points of \(S\), and \(\overline{S}\) is indeed the closure. By part (c), \(\overline{S}\) is connected.

The graph of y equals sine of 1 over x for x between 0 and 1, oscillating ever faster as x approaches 0, with the vertical segment from (0, -1) to (0, 1) drawn in a different shade on the left. A point on the segment is marked p and a point on the curve is marked q. A note says no path joins p to q.
The topologist’s sine curve: connected, because the segment lies in the closure of the graph, but not path-connected

Theorem. \(\overline{S}\) is not path-connected.

Proof. Suppose \(\gamma : [0, 1] \to \overline{S}\) is a path with \(\gamma(0) = (0, 0)\) and \(\gamma(1) \in S\). The set of times \(t\) with \(\gamma(t)\) on the segment is closed, being the preimage of a closed set, and contains 0; let \(b\) be its largest element. Then \(b < 1\), \(\gamma(b) = (0, y_0)\) for some \(y_0\), and \(\gamma(t) \in S\) for \(t > b\). Write \(\gamma(t) = (x(t), y(t))\); the coordinates are continuous, \(x(b) = 0\), \(x(t) > 0\) and \(y(t) = \sin(1/x(t))\) for \(t > b\). Choose \(\delta > 0\) so that \(|y(t) - y_0| < 1/2\) for \(t \in [b, b + \delta]\), by continuity of \(y\) at \(b\). The value \(x(b + \delta)\) is positive, and \(x\) takes every value between 0 and \(x(b + \delta)\) on \([b, b + \delta]\) by the intermediate value theorem. Among those values are points \(1/(\pi/2 + 2k\pi)\), where \(\sin(1/x) = 1\), and points \(1/(3\pi/2 + 2k\pi)\), where \(\sin(1/x) = -1\), for all large \(k\). So \(y\) takes both values 1 and \(-1\) on \([b, b + \delta]\), and these cannot both be within \(1/2\) of \(y_0\). This contradiction shows no such path exists.

So \(\overline{S}\) has one component but two path components, \(S\) and the segment. Observe that the path components can fail to be closed: \(S\) is not closed in \(\overline{S}\). The example also shows that the closure of a path-connected set need not be path-connected. Variants include the Warsaw circle, which closes up the sine curve with an arc and appears in shape theory, and the comb space, which shows that a contractible space need not have nice local behaviour.

Local connectedness and open sets of Euclidean space

A space is locally path-connected if every neighbourhood of every point contains a path-connected open neighbourhood of that point. Open subsets of \(\mathbb{R}^n\) are locally path-connected, since balls are convex. The topologist's sine curve is not locally connected at points of the segment.

Theorem. In a locally path-connected space, path components are open, and they coincide with components. In particular, a connected open subset of \(\mathbb{R}^n\) is path-connected.

Proof. Let \(P\) be a path component and \(x \in P\). A path-connected neighbourhood \(W\) of \(x\) lies inside \(P\), since every point of \(W\) can be joined to \(x\) within \(W\). So \(P\) is open. The complement of \(P\) is the union of the other path components, also open, so \(P\) is clopen. A component \(C\) containing \(P\) is connected, so \(P = C\).

This theorem is used throughout complex analysis, where a domain is defined as a connected open set and arguments by paths are then always available. It also gives the clean invariant behind lesson 1: removing a point from \(\mathbb{R}^2\) leaves a path-connected set, removing one from \(\mathbb{R}\) leaves a disconnected set, so the two spaces are not homeomorphic. Similarly, removing a point from \(S^1\) leaves a connected set, but removing two points disconnects it, while removing two points from \(S^2\) leaves it connected; hence \(S^1\) and \(S^2\) are not homeomorphic.

Experiments

The program computes the components of a pixel image, treating pixels as connected when they share an edge, finds a pair of antipodal points on a circle where a given function agrees by bisection, as the intermediate value theorem guarantees, and samples the topologist's sine curve to show how wildly the second coordinate behaves on short intervals near zero.

Components of a pixel image, an antipodal pair found by bisection, and the oscillation of the sine curve
import math

image = ["##..#....",
         "#...#.###",
         "#.###.#.#",
         "......###",
         "##.#.....",
         ".#.#..##."]
rows, cols = len(image), len(image[0])
label = {}
count = 0
for r in range(rows):
    for c in range(cols):
        if image[r][c] == '#' and (r, c) not in label:
            count += 1
            stack = [(r, c)]
            label[(r, c)] = count
            while stack:
                a, b = stack.pop()
                for da, db in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
                    p = (a + da, b + db)
                    if 0 <= p[0] < rows and 0 <= p[1] < cols and image[p[0]][p[1]] == '#' and p not in label:
                        label[p] = count
                        stack.append(p)
print("pieces in the image:", count)
for r in range(rows):
    print("  " + "".join(str(label[(r, c)]) if (r, c) in label else "." for c in range(cols)))

def f(t):                       # a temperature profile around the circle, angle t
    return 3 * math.cos(t) + math.sin(2 * t) + 0.5 * math.cos(3 * t + 1)
def g(t):
    return f(t) - f(t + math.pi)
a, b = 0.0, math.pi            # g(pi) = -g(0), so g changes sign on [0, pi]
assert g(a) * g(b) <= 0
for step in range(60):
    m = (a + b) / 2
    if g(a) * g(m) <= 0:
        b = m
    else:
        a = m
print(f"antipodal pair at angle {a:.6f}: f = {f(a):.6f} and {f(a + math.pi):.6f}")

for lo in [0.1, 0.01, 0.001]:
    xs = [lo / 2 + k * (lo / 2) / 20000 for k in range(20001)]
    ys = [math.sin(1 / x) for x in xs]
    print(f"on [{lo/2:g}, {lo:g}] sin(1/x) ranges over [{min(ys):+.4f}, {max(ys):+.4f}]")
Output
pieces in the image: 6
  11..2....
  1...2.333
  1.222.3.3
  ......333
  44.5.....
  .4.5..66.
antipodal pair at angle 1.737834: f = -0.327896 and -0.327896
on [0.05, 0.1] sin(1/x) ranges over [-1.0000, +1.0000]
on [0.005, 0.01] sin(1/x) ranges over [-1.0000, +1.0000]
on [0.0005, 0.001] sin(1/x) ranges over [-1.0000, +1.0000]

The image splits into six pieces, numbered in the order the scan meets them; the ring of pixels labelled 3 is one piece even though it surrounds an empty pixel. The bisection finds an angle at which the function takes equal values at opposite points, exactly as the intermediate value theorem promised. And on every short interval near 0 the values of \(\sin(1/x)\) reach both 1 and \(-1\): this is the oscillation that defeats every attempted path from the segment to the curve in the proof above.

Worked problem

Proving a space is not homeomorphic to an interval

Show that the letter T, the union of \([-1, 1] \times \{1\}\) and \(\{0\} \times [0, 1]\) in the plane, is not homeomorphic to \([0, 1]\).

Show solution
  1. Suppose \(h : T \to [0, 1]\) is a homeomorphism, and let \(p = (0, 1)\) be the junction point.
  2. Removing \(p\) leaves three pieces: the left arm, the right arm and the stem, each connected and each clopen in \(T \setminus \{p\}\).
  3. Then \(h\) restricts to a homeomorphism from \(T \setminus \{p\}\) onto \([0, 1] \setminus \{h(p)\}\).
  4. But removing any point from \([0, 1]\) leaves at most two components: one if the point is an endpoint, two otherwise.
  5. The number of components is preserved by homeomorphisms, so no such \(h\) exists.

Answer: T is not homeomorphic to an interval: it has a point whose removal leaves three components.

Common mistakes

  • MistakeUsing sets open in the ambient space to test connectedness of a subspace.

    InsteadA separation of \(Y\) uses sets open in \(Y\); \([0, 1)\) is open in \([0, 1) \cup (1, 2]\) although not in \(\mathbb{R}\).

  • MistakeAssuming connected implies path-connected.

    InsteadThe topologist’s sine curve is connected but not path-connected.

  • MistakeAssuming components are open.

    InsteadThe components of \(\mathbb{Q}\) are single points, which are not open; components are always closed.

  • MistakeForgetting completeness in the proof that intervals are connected.

    InsteadThe supremum argument needs the least upper bound property; the rationals are totally disconnected.

  • MistakeThinking the closure of a path-connected set is path-connected.

    InsteadThe closure of the sine graph is not.

Summary and key terms

  • A space is connected if it has no separation into two disjoint nonempty open sets; equivalently, every continuous map to a two-point discrete space is constant.
  • The connected subsets of the real line are exactly the intervals; the proof uses completeness.
  • Continuous images, closures, unions with a common point and products of connected spaces are connected; this gives the intermediate value theorem.
  • Path-connected spaces are connected; the topologist’s sine curve shows the converse fails.
  • In locally path-connected spaces, such as open subsets of Euclidean space, components and path components coincide.
  • Counting components after removing points distinguishes spaces such as the line, the plane, the circle and the letter T.
separation
A pair of disjoint nonempty open sets whose union is the space.
connected
Having no separation.
component
A maximal connected subset.
path
A continuous map from \([0, 1]\) into a space.
path-connected
Any two points can be joined by a path.
totally disconnected
The only connected subsets are single points.
locally path-connected
Every point has arbitrarily small path-connected open neighbourhoods.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Is \(\{(x, y) : xy = 0\}\) connected? Path-connected?

    Show answer

    Both: it is the union of the two axes, each path-connected, meeting at the origin.

  2. Show that \(\mathbb{R}^2 \setminus \mathbb{Q}^2\) is path-connected.

    Show answer

    Points with at least one irrational coordinate. Join \((a, b)\) to \((c, d)\) by moving along lines \(x = r\) and \(y = s\) with \(r, s\) irrational: vertical and horizontal lines with an irrational fixed coordinate lie entirely in the set.

  3. Prove there is no continuous injection from \(S^1\) into \(\mathbb{R}\).

    Show answer

    By the antipodal theorem, any continuous \(f : S^1 \to \mathbb{R}\) has \(f(x) = f(-x)\) for some \(x\), and \(x \ne -x\).

  4. Show that a connected space \(X\) with a nonconstant continuous \(f : X \to \mathbb{R}\) is uncountable.

    Show answer

    The image is connected, hence an interval, and it has at least two points, so it is uncountable; \(X\) maps onto it.

  5. Find the components of \(\{0\} \cup \{1/n : n \ge 1\}\).

    Show answer

    Every point is its own component; the space is totally disconnected, though 0 is not an open point.

  6. Show that the circle and the figure eight are not homeomorphic.

    Show answer

    Removing the crossing point of the figure eight leaves two disjoint open arcs, so two components, while removing any point of the circle leaves a single open arc.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz