Skip to content

Compactness and Heine-Borel

In this lesson you’ll learn the open-cover definition of compactness, the Heine-Borel theorem identifying compact subsets of R\mathbb{R}, and sequential compactness. This is the concept that explains why “continuous on a closed bounded interval” is the hypothesis of half the theorems in calculus.

An open cover of SS is a collection of open sets whose union contains SS. A subcover is a subcollection that still covers SS.

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

Note the quantifier: every cover must admit a finite subcover. Exhibiting one cover with a finite subcover proves nothing, because every set has such covers (R\mathbb{R} alone covers anything). To prove non-compactness you produce a single cover with no finite subcover.

Take the cover {(1n,1):n2}\left\{\left(\frac1n, 1\right) : n \ge 2\right\}. Every x(0,1)x \in (0,1) is in some member, since 1n<x\frac1n < x for large enough nn by the Archimedean property. So it is a genuine open cover.

But any finite subfamily has a largest 1n\frac1n, say 1N\frac{1}{N}, and then the union misses everything in (0,1N]\left(0, \frac1N\right] - which is non-empty. No finite subcover.

The failure is at the missing endpoint. Points sneak arbitrarily close to 0 and 0 is not there to be covered along with them.

Similarly [0,)[0,\infty) fails via the cover {(1,n):nN}\{(-1, n) : n \in \mathbb{N}\}: finitely many have a largest nn and miss everything beyond it. Here the failure is unboundedness.

KRK \subseteq \mathbb{R} is compact     \iff KK is closed and bounded.

Two failure modes, two hypotheses. Bounded rules out escaping to infinity; closed rules out leaking through a missing boundary point. That’s exactly what the two counterexamples above illustrate.

This is why “closed bounded interval” appears everywhere. The extreme value theorem, uniform continuity of continuous functions, Riemann integrability of continuous functions - each really requires compactness, and on R\mathbb{R} that means closed and bounded.

The theorem is specific to Rn\mathbb{R}^n. In general metric spaces compactness is strictly stronger than closed and bounded, and closed bounded sets can fail to be compact. Do not carry the equivalence into infinite-dimensional settings.

KK is sequentially compact if every sequence in KK has a subsequence converging to a point of KK.

In R\mathbb{R} (indeed in any metric space) this is equivalent to compactness.

For R\mathbb{R} the proof is short and reuses what we have. If KK is closed and bounded, take any sequence in KK. It is bounded, so Bolzano-Weierstrass gives a convergent subsequence, and closedness puts the limit in KK. ∎

Two lessons pulling their weight at once: Bolzano-Weierstrass supplies the subsequence, closedness keeps the limit inside. That pairing is the practical content of compactness, and it is the version most proofs actually use.

Conversely, if KK is unbounded you can pick xnx_n with xn>n|x_n| > n, and no subsequence converges. If KK is not closed there is a sequence in KK converging to a point outside KK, and every subsequence has that same outside limit.

Compactness converts “local” information into “global” information. That’s the slogan, and it’s worth unpacking.

Suppose each point of KK has some neighbourhood where a property holds. On a compact set, finitely many of those neighbourhoods cover everything, and a finite collection has a worst case: a smallest δ\delta, a largest bound. Infinitely many neighbourhoods have no worst case, since an infimum of infinitely many positive numbers can be 0.

Finiteness is what lets you take a minimum. That single observation is the engine behind the extreme value theorem and behind continuous-implies-uniformly-continuous, both coming shortly.

Example 1: Is [0,1][2,3][0,1] \cup [2,3] compact?

Solution. Bounded: contained in [0,3][0,3]. ✓

Closed: it’s a union of two closed sets, and a finite union of closed sets is closed. ✓

Compact, by Heine-Borel.

Compact sets need not be intervals or connected. Compactness says nothing about being in one piece.

Example 2: Is {1n:nN}\{ \frac1n : n \in \mathbb{N}\} compact?

Solution. Bounded: contained in (0,1](0,1]. ✓

Closed: no. The sequence 1n\frac1n lies in the set and converges to 0, which is not a member.

Not compact. An explicit bad cover: put a tiny interval around each 1n\frac1n, narrow enough to catch only that point. Any finite subfamily covers only finitely many points and misses the rest.

Adding the limit point repairs it: {1n}{0}\{ \frac1n \} \cup \{0\} is closed and bounded, hence compact.

Example 3: Is Z\mathbb{Z} compact?

Solution. Closed ✓ (shown in the previous lesson), but unbounded.

Not compact. The cover {(n12,n+12):nZ}\{(n - \frac12, n+\frac12) : n \in \mathbb{Z}\} has no finite subcover, since each member contains exactly one integer and there are infinitely many.

Or sequentially: xn=nx_n = n has no convergent subsequence.

Example 4: Show [0,)[0,\infty) is not compact directly.

Solution. Consider U={(1,n):nN}\mathcal{U} = \{(-1, n) : n \in \mathbb{N}\}, all open, and covering [0,)[0,\infty) since every x0x \ge 0 satisfies x<nx < n for some nn by the Archimedean property.

Any finite subfamily {(1,n1),,(1,nk)}\{(-1,n_1), \dots, (-1,n_k)\} has union (1,N)(-1, N) where N=maxniN = \max n_i, which misses NN itself.

No finite subcover.

Example 5: Compactness gives a smallest delta.

Suppose for each x[0,1]x \in [0,1] you are given some δx>0\delta_x > 0. Must infxδx>0\inf_x \delta_x > 0?

Solution. Not directly - an infimum over infinitely many positive numbers can be 0. Take δx=x\delta_x = x on (0,1](0,1]; the infimum is 0.

But compactness gives a workaround. Cover [0,1][0,1] by the intervals (xδx2,x+δx2)\left(x - \frac{\delta_x}{2}, x + \frac{\delta_x}{2}\right). Finitely many suffice, say indexed by x1,,xkx_1,\dots,x_k. Now

δ=min(δx12,,δxk2)>0\delta = \min\left(\frac{\delta_{x_1}}{2}, \dots, \frac{\delta_{x_k}}{2}\right) > 0

because it is a minimum of finitely many positive numbers.

That is exactly the argument used to prove uniform continuity from continuity, five lessons ahead. The whole trick is replacing an infimum with a minimum.

Example 6: A compact set with empty interior.

Solution. The Cantor set is closed and bounded, hence compact, yet contains no interval. It is also uncountable.

So compact does not mean “chunky.” Compactness controls escape to infinity and leakage at the boundary, and says nothing about size or thickness.

Example 7: Continuous image of a compact set.

Show that if ff is continuous on a compact KK then f(K)f(K) is compact.

Solution. Take an open cover {Vi}\{V_i\} of f(K)f(K). Continuity makes each preimage f1(Vi)f^{-1}(V_i) open (relative to KK), and these cover KK.

Compactness of KK gives finitely many, f1(Vi1),,f1(Vik)f^{-1}(V_{i_1}),\dots,f^{-1}(V_{i_k}), covering KK. Then Vi1,,VikV_{i_1},\dots,V_{i_k} cover f(K)f(K). ∎

Continuous functions preserve compactness, and this one fact will immediately give the extreme value theorem: a compact subset of R\mathbb{R} is closed and bounded, so it has a maximum and minimum, and those are attained.

Existence of optima. Every proof that an optimization problem has a solution rather than merely an infimum runs through compactness. In economics this is how equilibrium existence is established, and in engineering it is why a bounded closed design space guarantees a best design exists.

Global error bounds in numerical methods. Error estimates like “the error is at most Ch2C h^2 on this interval” need a single constant CC valid everywhere. That constant comes from taking a maximum over a compact set, and it does not exist on an open or unbounded domain. This is why numerical analysis works on closed intervals.

Machine learning generalization. Uniform convergence bounds require compactness of the parameter space or a substitute for it, such as a covering-number condition. Covering numbers are literally counting how many small balls it takes to cover the space - the open-cover definition, quantified.

Robotics and motion planning. A robot’s configuration space is compact when joint angles are bounded and the constraint set is closed, which guarantees that if a path exists, an optimal one exists too.

Image compression. Finite covers of a compact space underlie quantization: you approximate a continuum of possible values by finitely many representatives, with a uniform error bound. Compactness is why finitely many suffice.

Numerical integration. Guarantees for quadrature rules need a bound on a derivative across the whole interval, and that bound is a maximum on a compact set. On an unbounded interval the analysis changes completely, which is why improper integrals get separate treatment.

What does the Heine-Borel theorem say about subsets of ℝ?
Why is (0, 1) not compact?
What is sequential compactness?
Is {1/n : n ∈ ℕ} compact?
What does compactness let you do that an infinite collection does not?
If f is continuous and K is compact, what can be said about f(K)?