STEMviz
Mathematics · Real Analysis and Topology

Open, Closed and Compact Sets (the Heine-Borel Theorem)

Defines compactness via open covers, proves its equivalence with sequential compactness, and establishes Bolzano-Weierstrass and the Heine-Borel characterisation of compact subsets of R.

Open, Closed and Compact Sets (the Heine-Borel Theorem)

Compactness is the single most useful finiteness property in analysis: it lets an argument that only works for finitely many objects extend to infinitely many. Continuous functions attain their maximum on compact sets, uniform continuity holds there automatically, and whole classes of existence theorems (the Extreme Value Theorem, among others) reduce to this one idea. This chapter defines compactness via open covers — the definition that generalises beyond Rn\mathbb{R}^n — proves its equivalence with sequential compactness in metric spaces, and proves the Heine-Borel theorem characterising compact subsets of R\mathbb{R} (and, by the same coordinatewise pattern, Rn\mathbb{R}^n) concretely as the closed and bounded ones.

Have to hand: open and closed sets, limit points and sequences in a metric space (Chapter 2), and the Archimedean property and nested interval property (Chapter 1) — the bisection argument of Section 3 reuses the latter directly.

Why open covers, and not just "closed and bounded"? "Closed and bounded" is a consequence of compactness in Rn\mathbb{R}^n, true by the Heine-Borel theorem — but it is specific to Rn\mathbb{R}^n. In general metric (and later topological) spaces, closed and bounded sets can fail to be compact. The open-cover definition is what actually generalises, which is why it is taken as primary.

1. Open Covers and Compactness

Definition. An open cover of K⊆XK\subseteq X is a collection {Uα}α∈A\{U_\alpha\}_{\alpha\in A} of open sets with K⊆⋃α∈AUαK\subseteq\bigcup_{\alpha\in A}U_\alpha. A subcover is a subcollection that still covers KK.

KK is compact if every open cover of KK has a finite subcover.

Worked example — a non-compact set via a bad cover. Let K=(0,1)K=(0,1) and consider the open cover Un=(1/n,1)U_n = (1/n, 1), n∈Nn\in\mathbb{N}. Every x∈(0,1)x\in(0,1) lies in some UnU_n (take nn with 1/n<x1/n<x, by the Archimedean property), so this is indeed a cover. But any finite subcollection Un1,…,UnkU_{n_1},\ldots,U_{n_k} equals UNU_N where N=max⁡(n1,…,nk)N=\max(n_1,\ldots,n_k) (the largest index gives the largest interval, since UnU_n grows as nn grows), and UN=(1/N,1)U_N=(1/N,1) misses (0,1/N](0,1/N]. No finite subcover exists, so this particular cover already shows (0,1)(0,1) is not compact.

Key distinction. To prove a set is not compact, exhibiting one open cover with no finite subcover suffices (as above). To prove a set is compact, you must handle every possible open cover — which is why direct open-cover arguments are hard, and why the sequential and Heine-Borel characterisations below are so valuable.

2. Sequential Compactness

Definition. K⊆XK\subseteq X is sequentially compact if every sequence in KK has a subsequence converging to a point of KK.

A subsequence of (xn)(x_n) is a sequence (xnk)k=1∞(x_{n_k})_{k=1}^{\infty} where n1<n2<n3<⋯n_1<n_2<n_3<\cdots is a strictly increasing sequence of indices; it keeps infinitely many of the original terms, in order, discarding the rest.

Theorem. In a metric space, KK is compact if and only if KK is sequentially compact.

Proof sketch (compact ⇒\Rightarrow sequentially compact). Suppose KK is compact and (xn)(x_n) is a sequence in KK with no subsequence converging in KK. Then for every y∈Ky\in K, some ball B(y,ry)B(y,r_y) contains xnx_n for only finitely many nn (otherwise a subsequence could be extracted converging to yy). The collection {B(y,ry)}y∈K\{B(y,r_y)\}_{y\in K} is an open cover of KK; by compactness finitely many balls B(y1,ry1),…,B(ym,rym)B(y_1,r_{y_1}),\ldots,B(y_m,r_{y_m}) cover KK. But each contains only finitely many terms of (xn)(x_n), so their union contains only finitely many terms in total — contradicting that all xn∈Kx_n\in K lie in this union.

Proof (sequentially compact ⇒\Rightarrow compact). This direction needs two lemmas; neither is the bisection argument of Section 3 (that argument only produces Bolzano–Weierstrass in R\mathbb{R} and does not by itself yield a finite subcover in a general metric space).

Lemma A (totally bounded). If KK is sequentially compact, then for every ε>0\varepsilon>0, KK is covered by finitely many balls of radius ε\varepsilon. Proof. If not, some ε>0\varepsilon>0 admits no finite cover by ε\varepsilon-balls. Pick x1∈Kx_1\in K arbitrarily; having chosen x1,…,xnx_1,\ldots,x_n, the balls B(x1,ε),…,B(xn,ε)B(x_1,\varepsilon),\ldots,B(x_n,\varepsilon) do not cover KK (else they would be a finite subcover), so pick xn+1∈Kx_{n+1}\in K outside all of them. The resulting sequence satisfies d(xi,xj)≥εd(x_i,x_j)\ge\varepsilon for all i≠ji\ne j, so no subsequence is Cauchy, hence none converges — contradicting sequential compactness.

Lemma B (Lebesgue number). If KK is sequentially compact and {Uα}\{U_\alpha\} is an open cover of KK, there exists δ>0\delta>0 such that every subset of KK of diameter less than δ\delta lies entirely inside some single UαU_\alpha. Proof. If not, for each n∈Nn\in\mathbb{N} there is Sn⊆KS_n\subseteq K with diam(Sn)<1/n\mathrm{diam}(S_n)<1/n contained in no single UαU_\alpha; pick xn∈Snx_n\in S_n. By sequential compactness, some subsequence xnk→x∈Kx_{n_k}\to x\in K. Since {Uα}\{U_\alpha\} covers KK, x∈Uαx\in U_\alpha for some α\alpha, and openness gives B(x,r)⊆UαB(x,r)\subseteq U_\alpha for some r>0r>0. For kk large enough that d(xnk,x)<r/2d(x_{n_k},x)<r/2 and 1/nk<r/21/n_k<r/2: any y∈Snky\in S_{n_k} satisfies d(y,x)≤d(y,xnk)+d(xnk,x)<1/nk+r/2<rd(y,x)\le d(y,x_{n_k})+d(x_{n_k},x)<1/n_k+r/2<r, so Snk⊆B(x,r)⊆UαS_{n_k}\subseteq B(x,r)\subseteq U_\alpha — contradicting that SnkS_{n_k} lies in no single UαU_\alpha.

Main argument. Let {Uα}\{U_\alpha\} be any open cover of KK, and let δ>0\delta>0 be a Lebesgue number for it (Lemma B). By Lemma A with ε=δ/3\varepsilon=\delta/3, KK is covered by finitely many balls B(x1,δ/3),…,B(xm,δ/3)B(x_1,\delta/3),\ldots,B(x_m,\delta/3). Each set B(xi,δ/3)∩KB(x_i,\delta/3)\cap K has diameter at most 2δ/3<δ2\delta/3<\delta, so by the defining property of δ\delta it lies inside some single UαiU_{\alpha_i}. Then Uα1,…,UαmU_{\alpha_1},\ldots,U_{\alpha_m} is a finite subcover of KK. ■\blacksquare

This equivalence is why, in practice, compactness in Rn\mathbb{R}^n is almost always checked via sequences rather than open covers directly.

3. The Bolzano–Weierstrass Theorem

Theorem (Bolzano–Weierstrass). Every bounded sequence in R\mathbb{R} has a convergent subsequence.

Proof. Let (xn)(x_n) be bounded, so xn∈[a,b]x_n\in[a,b] for all nn, some a<ba<b. Bisect [a,b][a,b] into two closed halves; at least one half contains xnx_n for infinitely many nn (if both contained only finitely many, the whole interval would too, contradicting that every nn appears). Call this half I1=[a1,b1]I_1=[a_1,b_1], and pick an index n1n_1 with xn1∈I1x_{n_1}\in I_1. Bisect I1I_1 again; again one half contains infinitely many of the remaining terms. Call it I2⊆I1I_2\subseteq I_1, and pick n2>n1n_2>n_1 with xn2∈I2x_{n_2}\in I_2 (possible since I2I_2 contains infinitely many terms, so some index beyond n1n_1 works). Repeating indefinitely gives nested closed intervals I1⊇I2⊇⋯I_1\supseteq I_2\supseteq\cdots with bk−ak=(b−a)/2k→0b_k-a_k = (b-a)/2^k \to 0, and indices n1<n2<⋯n_1<n_2<\cdots with xnk∈Ikx_{n_k}\in I_k.

By the Nested Interval Property (Chapter 1), ⋂kIk={L}\bigcap_k I_k = \{L\} for a single point LL. Since xnk,L∈Ikx_{n_k},L\in I_k and IkI_k has length (b−a)/2k(b-a)/2^k, ∣xnk−L∣≤(b−a)/2k→0|x_{n_k}-L|\le (b-a)/2^k \to 0 by the Archimedean property, so xnk→Lx_{n_k}\to L. ■\blacksquare

This is the engine behind the Heine-Borel theorem and reappears constantly: whenever a sequence is merely known to be bounded, Bolzano–Weierstrass upgrades that to "has a convergent subsequence," which is often exactly what an existence proof needs.

4. The Heine-Borel Theorem

Theorem (Heine-Borel, in R\mathbb{R}). K⊆RK\subseteq\mathbb{R} is compact if and only if KK is closed and bounded.

Proof. (⇒\Rightarrow) Suppose KK is compact. Bounded: the cover {(−n,n)}n∈N\{(-n,n)\}_{n\in\mathbb{N}} of R\mathbb{R} (hence of KK) has a finite subcover, which (being a finite collection of these nested intervals) equals some single (−N,N)(-N,N); so K⊆(−N,N)K\subseteq(-N,N) is bounded. Closed: suppose x∉Kx\notin K. For each y∈Ky\in K, let ry=∣y−x∣/2>0r_y = |y-x|/2>0; the balls B(y,ry)B(y,r_y) cover KK (each yy lies in its own ball), so finitely many B(y1,ry1),…,B(ym,rym)B(y_1,r_{y_1}),\ldots,B(y_m,r_{y_m}) cover KK. Let r=min⁡(ry1,…,rym)>0r=\min(r_{y_1},\ldots,r_{y_m})>0; one checks B(x,r)B(x,r) is disjoint from each B(yi,ryi)B(y_i,r_{y_i}) (since d(x,yi)=2ryi≥ryi+rd(x,y_i) = 2r_{y_i}\ge r_{y_i}+r, so points within rr of xx cannot be within ryir_{y_i} of yiy_i), hence disjoint from KK. So X∖KX\setminus K is open, i.e. KK is closed.

(⇐\Leftarrow) Suppose KK is closed and bounded. By Section 2, it suffices to show KK is sequentially compact. Let (xn)(x_n) be a sequence in KK. Since KK is bounded, Bolzano–Weierstrass gives a subsequence xnk→Lx_{n_k}\to L for some L∈RL\in\mathbb{R}. Since KK is closed and (xnk)(x_{n_k}) is a sequence in KK converging to LL, the sequential characterisation of closed sets (Chapter 2) gives L∈KL\in K. So every sequence in KK has a subsequence converging to a point of KK: KK is sequentially compact, hence compact. ■\blacksquare

Scope warning. Heine-Borel as stated is specific to R\mathbb{R} (and, with the same proof pattern applied coordinatewise, to Rn\mathbb{R}^n). In a general metric space, closed and bounded does not imply compact — this is explored in the exercises, and is the reason the open-cover definition, not "closed and bounded," is taken as the primary meaning of compactness.

Worked example. K=[0,1]∪{3}K=[0,1]\cup\{3\} is compact: it is closed (finite union of the closed set [0,1][0,1] and the closed singleton {3}\{3\}) and bounded (contained in [0,3][0,3]), so Heine-Borel applies. By contrast (0,1)(0,1) is bounded but not closed (missing limit points 0,10,1), consistent with the explicit failure of compactness shown in Section 1.

5. Compactness, Closedness and Subsets

Theorem. (i) A compact subset of a metric space is closed. (ii) A closed subset of a compact set is compact.

Proof sketch. (i) is the "closed" half of the Heine-Borel proof above, which did not in fact use boundedness of XX itself — it only used compactness of KK, so it holds in any metric space. (ii) Let F⊆KF\subseteq K be closed with KK compact, and let {Uα}\{U_\alpha\} be an open cover of FF. Adding the open set X∖FX\setminus F to this collection covers all of KK (every point of KK is either in FF, covered by some UαU_\alpha, or outside FF, covered by X∖FX\setminus F). Compactness of KK gives a finite subcover of KK, hence of FF; discard X∖FX\setminus F from it if present (it contributes nothing to covering FF), leaving a finite subcover of FF drawn from the UαU_\alpha. ■\blacksquare

Common Exam Pitfalls

  • Treating "closed and bounded ⇒\Rightarrow compact" as universal. It is a theorem specific to Rn\mathbb{R}^n (Heine-Borel); do not quote it in a general metric space without justification.
  • Proving compactness by checking only one open cover. Compactness requires every open cover to have a finite subcover; checking one well-chosen cover only ever disproves compactness, never proves it.
  • Confusing "finite subcover" with "finitely many points." A finite subcover is a finite subcollection of the given open sets that still covers KK — not a statement that KK itself is a finite set.
  • Forgetting the indices in a subsequence must be strictly increasing. (xnk)(x_{n_k}) requires n1<n2<n3<⋯n_1<n_2<n_3<\cdots; reusing or reordering indices does not define a valid subsequence.
  • Omitting boundedness or closedness when citing Heine-Borel. Both hypotheses are necessary: (0,1)(0,1) is bounded but not closed (not compact); Z\mathbb{Z} is closed but not bounded (not compact).
  • Believing every bounded sequence converges. Bolzano–Weierstrass only guarantees a convergent subsequence; e.g. xn=(−1)nx_n=(-1)^n is bounded, does not converge, but has convergent subsequences x2k→1x_{2k}\to1 and x2k+1→−1x_{2k+1}\to-1.

Summary

  • Open cover: a collection of open sets whose union contains KK; compact means every open cover has a finite subcover.
  • Exhibiting one open cover with no finite subcover suffices to prove non-compactness; proving compactness directly requires handling all covers.
  • Sequentially compact: every sequence has a subsequence converging within KK; equivalent to compactness in any metric space.
  • Bolzano–Weierstrass: every bounded sequence in R\mathbb{R} has a convergent subsequence, proved by repeated bisection and the Nested Interval Property.
  • Heine-Borel (in R\mathbb{R} / Rn\mathbb{R}^n): KK is compact   ⟺  \iff KK is closed and bounded — specific to Rn\mathbb{R}^n, not a general metric-space fact.
  • A compact subset of any metric space is closed; a closed subset of a compact set is itself compact.