Topology
Connectedness
"All one piece" — but the topologist's sine curve is one piece without a path between its ends
A topological space is connected if you can't slice it into two disjoint open chunks. It is path-connected if any two points can be joined by a continuous path. Path-connected implies connected — but in 1898 William Henry Young's "broom" and the topologist's sine curve showed the reverse fails dramatically. The latter is the union of sin(1/x) on (0, 1] with the segment {0} × [−1, 1]: a single closed connected piece in R² in which no path can travel from the y-axis to the wiggly part, because the path would need infinite oscillations in finite time.
- ConnectedNo partition into two non-empty disjoint open sets
- Path-connectedFor every a, b there is continuous γ: [0,1] → X with γ(0)=a, γ(1)=b
- ImplicationPath-connected ⇒ connected; converse fails (topologist's sine curve)
- Connected ⊂ RExactly the intervals (single points, open, closed, half-open, R)
- ComponentMaximal connected subset containing a given point
- Formal originJordan 1893; Hausdorff axioms 1914; Polish school refined definitions
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
Three equivalent definitions of "connected"
A topological space X is connected if any one of the following holds (the three are equivalent):
- X cannot be written as a disjoint union of two non-empty open subsets — there is no decomposition X = U ∪ V with U, V open, non-empty, and U ∩ V = ∅.
- The only subsets of X that are both open and closed (clopen) are ∅ and X.
- Every continuous map f: X → {0, 1} (with the discrete topology on the codomain) is constant.
Equivalence (1) ↔ (2): a non-trivial clopen subset U gives the decomposition X = U ∪ (X \ U). Equivalence (2) ↔ (3): a continuous map to {0, 1} has clopen pre-images, so it must be constant if the only clopen sets are trivial.
Path-connectedness
X is path-connected if for every pair of points a, b ∈ X there is a continuous map γ: [0, 1] → X with γ(0) = a and γ(1) = b. The image of γ is called a path from a to b.
Path-connectedness defines an equivalence relation on X: a ~ b if there is a path between them. Equivalence classes are path components. π₀(X) is the set of path components; for a path-connected space, |π₀(X)| = 1.
Path-connected ⇒ connected
Suppose X is path-connected. To show X is connected, assume X = U ∪ V is a disconnection. Pick a ∈ U, b ∈ V. There's a path γ from a to b. Then γ⁻¹(U) and γ⁻¹(V) are disjoint, open, and non-empty subsets of [0, 1] whose union is [0, 1] — contradicting the connectedness of [0, 1]. So X is connected. ∎
The topologist's sine curve — connected but not path-connected
Let G = {(x, sin(1/x)) : 0 < x ≤ 1} (the "wiggly graph") and S = {0} × [−1, 1] (the limit segment on the y-axis). The topologist's sine curve is T = G ∪ S.
T is connected: G is the continuous image of (0, 1] under a continuous map, so G is connected. S is the closure of G in R² minus G, so adjoining S still produces a connected set (the closure of a connected set is connected, and T equals the closure of G in R²).
T is not path-connected: suppose γ: [0, 1] → T is a path with γ(0) = (0, 0) ∈ S and γ(1) = (1, sin(1)) ∈ G. Let t* be the supremum of t with γ(t) ∈ S. By continuity γ(t*) ∈ S. For any t > t*, γ(t) ∈ G. But then γ(t).x → 0⁺ as t → t*, so γ(t).y = sin(1/γ(t).x) takes every value in [−1, 1] infinitely often — γ cannot have a limit at t*, contradicting continuity.
So T is connected but not path-connected. The phenomenon is purely local: at the segment S, T fails to be locally path-connected, and that local failure breaks the equivalence with global connectedness.
Connected and path components
The connected component C(x) of a point x ∈ X is the largest connected subset of X containing x. The path component P(x) of x is the largest path-connected subset of X containing x.
Always: P(x) ⊆ C(x). For the topologist's sine curve, the two components of (0, 0) differ — P(0, 0) = S, but C(0, 0) = T.
Connected components are always closed in X. Path components are not always closed (the wiggly part of T is the path component of (1, sin 1) but its closure includes the y-axis segment, which is in a different path component).
A reference table
| Space | Connected? | Path-connected? | Notes |
|---|---|---|---|
| Single point | Yes | Yes | Trivially both |
| Open interval (0, 1) | Yes | Yes | Any interval works |
| Two disjoint disks in R² | No | No | Two connected components |
| Q (rationals) ⊂ R | No | No | Totally disconnected — components are singletons |
| Closed disk D² | Yes | Yes | Convex sets in R^n are always path-connected |
| Topologist's sine curve T | Yes | No | The classical counter-example |
| GL(n, R) for n ≥ 1 | No (n=1) / 2 comps (n≥1) | 2 path components | det > 0 and det < 0 pieces |
| S^n for n ≥ 1 | Yes | Yes | Connected manifolds are path-connected (locally PC) |
Historical context
The intuitive idea of "one piece" appears throughout 19th-century analysis, but Camille Jordan gave the first formal definition in his 1893 Cours d'analyse: a set is connected if it cannot be partitioned into two parts each containing none of the limit points of the other. Felix Hausdorff's 1914 Grundzüge der Mengenlehre introduced general topological spaces and refined the definition to the open-set version used today.
The Polish school — Sierpiński, Kuratowski, Mazurkiewicz — explored pathological examples in the 1910s and 1920s. Knaster and Kuratowski's "broom-like" connected-not-path-connected spaces appeared in 1921. The topologist's sine curve became the iconic example by the mid-20th century, appearing in every general-topology textbook from Kelley (1955) onwards.
Hahn–Mazurkiewicz (1914) proved that a Hausdorff space is the continuous image of [0, 1] if and only if it is compact, connected, locally connected, and second-countable — characterising "Peano continua." This was a 30-year-old open problem.
Why connectedness is everywhere
- Intermediate value theorem. The continuous image of a connected space is connected. Connected subsets of R are intervals. So a continuous f: [a, b] → R changing sign must hit zero — IVT in one line.
- Identity theorem. Two holomorphic functions agreeing on a set with a limit point in a connected domain agree everywhere. Without connectedness this fails — different formulas on different components.
- Numerical solvers — bisection. The bisection method for f(x) = 0 relies on IVT, hence connectedness of [a, b]. Each step halves a connected sub-interval.
- Computer graphics — flood fill. Filling a pixel region with a colour traverses the connected component of the starting pixel. Algorithms (BFS, scanline fill) compute path components in the grid graph.
- Riemann surfaces. Two holomorphic structures on a connected Riemann surface agree on the entire surface if they agree on any open subset — analytic continuation hinges on connectedness.
- Manifold classification. The classification of closed connected surfaces (Möbius–Kerékjártó, 1923) requires "connected" as a hypothesis — otherwise the classification is just "do it on each component."
- Galois theory. The Galois group of a connected scheme acts as the étale fundamental group π₁^ét — a number-theoretic analogue of topological connectedness.
JavaScript — flood fill computes a connected component
// Connected components on a pixel grid (4-connectivity)
function connectedComponent(grid, startR, startC) {
const rows = grid.length, cols = grid[0].length;
const target = grid[startR][startC];
const visited = Array.from({ length: rows }, () => Array(cols).fill(false));
const stack = [[startR, startC]];
const component = [];
while (stack.length) {
const [r, c] = stack.pop();
if (r < 0 || c < 0 || r >= rows || c >= cols) continue;
if (visited[r][c] || grid[r][c] !== target) continue;
visited[r][c] = true;
component.push([r, c]);
stack.push([r+1, c], [r-1, c], [r, c+1], [r, c-1]);
}
return component;
}
// Two disjoint blobs of 1s — two connected components
const grid = [
[1, 1, 0, 0, 0],
[1, 0, 0, 1, 1],
[0, 0, 0, 1, 1],
[0, 0, 0, 0, 0],
];
console.log(connectedComponent(grid, 0, 0).length); // 3 cells — top-left blob
console.log(connectedComponent(grid, 1, 3).length); // 4 cells — bottom-right blob
// Check connectedness of a subset of R via interval-property
function isInterval(sortedPoints) {
// For a finite set of points to be 'connected' in R, they must be a single interval
for (let i = 1; i < sortedPoints.length; i++) {
if (sortedPoints[i] - sortedPoints[i-1] > 1e-9 * Math.max(1, sortedPoints[i])) return false;
}
return true;
}
// The rationals in [0,1] sampled at 100 points are densely connected — but rationals
// themselves are totally disconnected: every rational is its own connected component.
Variants and stronger conditions
- Locally connected. Every point has arbitrarily small connected neighbourhoods. Implies connected components are open. R^n and manifolds are locally connected; rationals are not.
- Locally path-connected. Every point has arbitrarily small path-connected neighbourhoods. Combined with connectedness, implies path-connectedness. Manifolds satisfy this.
- Simply connected. Path-connected plus trivial fundamental group: every loop contracts to a point. Disk is simply connected; annulus is not.
- Totally disconnected. Every connected component is a single point. Examples: rationals, Cantor set, p-adic numbers Q_p.
- n-connected. π_k(X) trivial for k ≤ n. 0-connected = path-connected; 1-connected = simply connected. The full hierarchy of "higher-dimensional connectedness."
- Hyperconnected. Any two non-empty open sets intersect. The Zariski topology on irreducible varieties is hyperconnected.
Common misconceptions
- "Connected and path-connected are the same." They agree on open subsets of R^n and on manifolds (locally path-connected spaces). They disagree on the topologist's sine curve, Warsaw circle, comb space, and many other classical examples.
- "Disconnected means physically separated." Not necessarily. The rationals Q sit densely inside R but are totally disconnected — every rational is its own component. The disconnection is topological, not visual.
- "Connectedness is preserved under set intersection." Two connected sets can intersect in a disconnected set — e.g. two overlapping annuli in R². The union of two connected sets is connected only if they intersect.
- "A finite space can't be connected unless it's a single point." Wrong — the Sierpiński space {0, 1} with open sets {∅, {1}, {0, 1}} is connected and has two points. Finite spaces with non-trivial topologies can be highly non-trivial.
- "Discrete spaces are disconnected." True for spaces with ≥ 2 points (every singleton is clopen). The empty space and a single point are connected by convention or by vacuous reasoning.
- "Connectedness implies compactness." No — R is connected and not compact. Compactness and connectedness are independent properties. A space can have any combination of (connected? compact?).
Frequently asked questions
What is the formal definition of connectedness?
A topological space X is connected if it cannot be written as X = U ∪ V with U, V non-empty open and U ∩ V = ∅. Equivalently, the only subsets that are both open and closed ('clopen') are ∅ and X itself. Equivalently, every continuous function f: X → {0, 1} (with the discrete topology on {0, 1}) is constant. The three formulations are interchangeable and all standard in textbooks.
What is path-connectedness?
X is path-connected if for any two points a, b ∈ X there exists a continuous map γ: [0, 1] → X with γ(0) = a and γ(1) = b. The map γ is the 'path' from a to b. Path-connectedness implies connectedness because the unit interval is connected and continuous images preserve connectedness. The converse fails for the topologist's sine curve and certain comb spaces.
What is the topologist's sine curve?
T = {(x, sin(1/x)) : 0 < x ≤ 1} ∪ ({0} × [−1, 1]) ⊂ R². It is the union of the graph of sin(1/x) for x > 0 and the vertical segment {0} × [−1, 1]. The graph wiggles infinitely as x → 0⁺ between heights −1 and 1; the segment is its limit set. T is the closure of the wiggly graph in R², so it is closed; it is connected because the segment is in the closure of the graph. But no continuous path can travel from the segment to the graph — any such path would have to oscillate infinitely in finite time. So T is connected but not path-connected.
Why does the intermediate value theorem rely on connectedness?
IVT says a continuous f: [a, b] → R with f(a) and f(b) of opposite sign has a zero in (a, b). Proof: the image f([a, b]) is a continuous image of a connected space, hence connected. Connected subsets of R are precisely intervals. Since the image is an interval containing both a negative and positive value, it contains 0. IVT is the canonical application of 'continuous functions preserve connectedness.'
What is a connected component?
The connected component of a point x ∈ X is the largest connected subset of X containing x. Equivalently, it is the union of all connected subsets containing x. The connected components partition X into maximal connected pieces. Components are always closed; in locally connected spaces they are also open. The set of components of a manifold M is a topological invariant — often denoted π₀(M).
Which subsets of R are connected?
Exactly the intervals — including degenerate cases ∅, single points, the entire real line, half-lines, open/closed/half-open intervals. Proof sketch: an interval cannot be split by removing a single point's neighbourhood without breaking either non-emptiness or openness of the parts. Conversely, a non-interval contains points a < c < b with c ∉ S; the sets S ∩ (−∞, c) and S ∩ (c, ∞) form a disconnection.
When does connected imply path-connected?
If X is also locally path-connected, then connected and path-connected coincide. Open subsets of R^n are locally path-connected, so for them the two notions agree. Manifolds are locally path-connected (each point has a Euclidean neighbourhood), so connected manifolds are path-connected — a useful shortcut. The topologist's sine curve fails local path-connectedness at points on the y-axis, which is exactly where the counter-example lives.