Compactness in R^n
Suppose you are told a function is continuous on a set . You are asked to prove it attains a maximum value somewhere on . If is an open ball, this can fail spectacularly. The function might climb forever as you approach the missing boundary. If is unbounded, the function might climb forever as you walk off to infinity. Something about being closed and bounded simultaneously rescues the argument. Compactness is the precise name for that combination of virtues. Compactness is the property that makes finite reasoning apply to infinite settings. A compact set is one where every sequence of points has a subsequence. That subsequence converges to a point still inside the set. It is also one where every open cover — however wild and infinite — admits a finite subcover. These two descriptions sound unrelated. Yet in they coincide exactly. Both also coincide exactly with "closed and bounded." This triple equivalence is the Heine–Borel theorem, one of the load-bearing walls of analysis. It underlies the Extreme Value Theorem and uniform continuity. It also underlies the existence of Riemann/Lebesgue integrals on rectangles. Countless compactness arguments in optimization and PDE theory depend on it too. The word "compact" evokes something small and tightly packed. That intuition is correct. A compact set cannot "run away" to infinity. It also cannot have any "holes" at its edge. Sequences cannot escape there without a limit. The Bolzano–Weierstrass theorem powers everything here: every bounded sequence in has a convergent subsequence. It is where we begin. This article builds the full logical chain. It covers Bolzano–Weierstrass in , sequential compactness, and the open-cover definition. It also proves that in , all three characterizations of compactness are equivalent. These are sequential compactness, closed+bounded, and open-cover compactness. We assume familiarity with Open and Closed Sets in R^n. We prepare the ground for Limits and Continuity in Several Variables and Multiple Integrals over Rectangles.
- A set is sequentially compact if every sequence in has a subsequence converging to a point of .
- Bolzano–Weierstrass in : every bounded sequence in has a convergent subsequence.
- Heine–Borel theorem: is compact (in any of the equivalent senses below) iff is closed and bounded.
- Compactness also has a topological (open-cover) formulation: every open cover of has a finite subcover.
- In , sequential compactness, the closed-and-bounded property, and the open-cover property are all logically equivalent.
- Compactness is exactly the hypothesis needed for continuous functions to attain maxima/minima and to be uniformly continuous.
- Key idea: in , compactness is a purely metric fact — "closed and bounded" — but it is best understood through the equivalent lens of sequences having nowhere to escape.
Where this lives today
Compactness is the hidden hypothesis behind the Extreme Value Theorem: a continuous on a compact attains a maximum and minimum, because the image is itself compact (a continuous image of a compact set is compact, proved via the sequential characterization), hence closed and bounded, hence contains its supremum and infimum. This single fact underwrites the Limits and Continuity in Several Variables toolkit, guarantees uniform continuity of continuous functions on compact domains (essential for building the Multiple Integrals over Rectangles via Riemann sums), and justifies why Lagrange multiplier problems on closed bounded constraint sets always have solutions to search for. Beyond calculus, compactness drives existence proofs throughout mathematics: in optimization, feasible regions are frequently compact so that minimizers provably exist (linear programming, convex optimization); in differential equations, compactness of trajectory sets underlies Peano's existence theorem and Arzelà–Ascoli-type arguments for PDEs; in numerical analysis, discretizing a compact domain into finitely many patches (exactly the open-cover intuition) underlies mesh-based methods and finite element analysis; in statistics and machine learning, compactness of parameter spaces is a standard regularity condition ensuring maximum-likelihood estimators exist; in cryptography and coding theory, compactness arguments on finite-dimensional lattices and compact groups (like circle groups used in Fourier-based constructions) support existence and approximation results; and in physics, compact phase-space regions (bounded energy surfaces) are what make statistical mechanics' partition-function sums well-behaved.
:::quiz[What goes wrong with sequential compactness for ?]
- is unbounded, so sequences escape to infinity
- is bounded but not closed; the sequence has all subsequential limits equal to ✓
- has no sequences at all
- Sequential compactness is undefined for non-closed sets
Ask the tutor: Can you show me why the closed unit ball in an infinite-dimensional space fails to be compact, using the same sequence-escaping idea?
Let .
(Sequential compactness.) is sequentially compact if every sequence with for all has a subsequence that converges to a point .
(Open-cover compactness.) A collection of open subsets of is an open cover of if . is compact if every open cover of admits a finite subcover: there exist finitely many indices with
(Metric characterization.) is bounded if there exists such that for all , and is closed if is open (equivalently, contains all its limit points). The Heine–Borel theorem (proved below) shows that for subsets of , all three notions — sequential compactness, open-cover compactness, and "closed and bounded" — pick out exactly the same sets. We may therefore speak unambiguously of being compact.
Intuition
Picture a sequence of points wandering inside a set . If is bounded, the points cannot escape to infinity, so intuitively they must "pile up" somewhere — this piling-up is exactly what Bolzano–Weierstrass guarantees, one coordinate at a time. But piling up is not enough: the pile-up point might sit just outside , at a missing boundary point, the way but . Closedness patches this last hole by insisting that wherever a sequence accumulates, that point belongs to . Compactness is the conjunction: no escape to infinity, and no escape through a missing edge. The open-cover definition looks different in flavor — more like a statement about maps or blankets than about sequences — but it is capturing the same finiteness. Think of covering with countably many small open patches. If is compact, no matter how the patches are chosen, finitely many of them already do the job; there is no need for infinitely many patches to "chase" an escaping point toward a hole or off to infinity. When is not compact — say — the cover by intervals for covers , yet no finite subcollection does, because any finite subcollection has a largest and misses points below it.
Bolzano–Weierstrass, the metric characterization, and open covers
Every bounded sequence in has a subsequence that converges to some point of .
We use the nested-interval bisection method, first for and then by iterating across coordinates for general . Case . Suppose is a bounded sequence of real numbers, so for all , for some . Bisect into two closed halves of equal length. At least one half contains for infinitely many indices (since the set of all indices is infinite and it splits into the union of the index sets of the two halves — if both were finite their union would be finite, a contradiction). Call that half , and note . Repeat: bisect , and choose a half containing for infinitely many , again possible by the same finite-union argument. Inductively construct closed intervals
each containing for infinitely many indices . Since the are nested closed intervals with lengths tending to , the Nested Interval Property of (a consequence of completeness) gives a unique point . Now build the subsequence: choose with . Having chosen with , use the fact that contains for infinitely many to choose with . This is possible at every stage because "infinitely many " always leaves room to pick an index larger than the finitely many already used. Then for every , both and lie in , so
Hence , proving the case . Case general . Write . Since is bounded in , each coordinate sequence is a bounded sequence of real numbers (bounded by the same , since ). Apply the case to the first coordinate: extract a subsequence (indices restricted to an infinite subset ) converging to some . Now restrict attention to indices in and apply the case to the second coordinate sequence , which is still bounded: extract a further infinite subset along which . Crucially, along the first coordinate still converges to , because and every subsequence of a convergent sequence converges to the same limit. Iterate this for coordinates , producing nested infinite index sets
such that along , every coordinate converges: for , . List the elements of in increasing order as ; this defines the desired subsequence . By definition of convergence in (coordinatewise convergence, equivalent to convergence in the Euclidean norm since
for each ), we conclude as .
∎Let . The following are equivalent:
(a) is closed and bounded.
(b) is sequentially compact.
(c) is compact in the open-cover sense: every open cover of has a finite subcover.
We prove (a) (b) (c) (a), closing the logical circle. The technique for (a)(b) is direct use of Bolzano–Weierstrass plus closedness; for (b)(c) we use a two-step argument (total boundedness plus a Lebesgue-number-style covering argument); for (c)(a) we exhibit explicit covers that fail to have finite subcovers when closedness or boundedness is dropped.
(a) (b). Assume is closed and bounded. Let be any sequence with for all . Since is bounded, is a bounded sequence in , so by Bolzano–Weierstrass theorem in there is a subsequence for some . We must show . Since is closed, is open; if were in , there would be an open ball . But means eventually , and for all — a contradiction, since is disjoint from . Hence , proving sequential compactness.
(b) (c). Assume is sequentially compact. We argue in two steps. Step 1 (total boundedness). We claim: for every , can be covered by finitely many open balls of radius centered at points of . Suppose not, for some . Then we may construct a sequence in inductively as follows: pick arbitrarily. Having chosen , since (by assumption) the balls do not cover , pick . By construction for all . Such a sequence has no convergent subsequence, since any subsequence would have all pairwise distances , so no subsequence is Cauchy, hence none converges. This contradicts sequential compactness of . Hence for every , has a finite -net. Step 2 (finite subcover from any open cover). Let be an open cover of . Suppose toward contradiction that no finite subcollection of covers . By Step 1, for each , cover by finitely many balls of radius centered at points of . If every one of these finitely many balls could be covered by finitely many 's, then (taking the union of these finite subcollections over all the balls, still a finite union since there are finitely many balls) itself would be covered by finitely many 's, contradicting our assumption. Hence for each , at least one ball (with ) has the property that is not covered by any finite subcollection of . This gives a sequence in . By sequential compactness, some subsequence . Since covers , for some ; since is open, there is with . Choose large enough that and simultaneously (possible since and along the subsequence). Then for any ,
so . Thus is covered by the single set — a finite subcollection of — contradicting the defining property of chosen above. This contradiction shows some finite subcollection of must cover after all.
(c) (a). Assume has the open-cover finite-subcover property. Boundedness. The balls for form an open cover of (every point has finite norm, hence lies in some ), hence of . By hypothesis, finitely many of them cover : . Hence is bounded. Closedness. Suppose is not closed; then there is a limit point of . For each , let
an open set (complement of a closed ball). Since , every satisfies , so , so for large enough; hence is an open cover of . If finitely many covered , then with we'd have , meaning . But is a limit point of , so every ball around meets at a point other than — contradiction. So no finite subcover exists, contradicting hypothesis (c). Hence must be closed.
∎If is compact and is closed (in ), then is compact.
By the Heine–Borel theorem, is closed and bounded. Since , is bounded. Since is closed by hypothesis, is closed and bounded, hence compact by Heine–Borel.
∎Worked examples
Example 1: A genuinely two-dimensional set, checked all three ways. Let
This is the closed elliptical region intersected with the closed half-plane . We verify compactness directly from the definitions, not by quoting Heine–Borel as a black box, to see the machinery work. Closed. The ellipse condition describes the sublevel set of the continuous function ; sublevel sets of continuous functions at closed thresholds are closed (preimage of the closed set under a continuous map is closed — a fact from Open and Closed Sets in R^n applied via continuity, or directly: if with , then by continuity of , ). Similarly is closed. An intersection of closed sets is closed (complement is a union of open sets, which is open). Hence is closed. Bounded. If then and , so , giving . So is bounded, e.g. by . By Heine–Borel, is compact. Let's also verify sequential compactness directly for a specific sequence to build confidence: take where ranges over points on the boundary satisfying the linear constraint, say for (choosing angles that keep us on the boundary of the ellipse, and one checks numerically for these that holds, e.g. at : , point , check ? No — so we must be careful and restrict to actually inside the feasible arc). Take instead , so . As , , so . Check : ellipse condition ✓; half-plane condition ✓. So the limit is in , consistent with compactness. This subsequence (already convergent, so it is its own convergent subsequence) illustrates (b): every sequence drawn from has a subsequence converging into .
Example 2: A set that fails compactness in two different ways, diagnosed precisely. Let
This is a piece of the hyperbola for . Is bounded? As , , so is unbounded — e.g. the points for lie in (since for ) and . Is closed? Consider the sequence ... that's constant and unhelpful; instead probe the open end at : take again — this sequence has no finite limit (it diverges to infinity), so it doesn't witness non-closedness by itself. To test closedness properly, note . The set is not closed (it excludes , a limit point of the constraint region), so we must check directly: is there a sequence in converging to a point outside but still in ? Take ... but , so those points aren't in . Instead approach from inside: , giving points for (since ). As , this converges to — no violation there. The real failure is at : although the sequence diverges (doesn't converge in at all, so it doesn't directly violate the closed-set limit point definition), boundedness fails outright, which alone already prevents compactness by Heine–Borel. To see sequential compactness fail concretely: the sequence has no convergent subsequence at all (any subsequence still has second coordinate , hence unbounded, hence no subsequence can converge in ). This directly falsifies condition (b) of the Heine–Borel theorem, consistent with the failure of boundedness (a). Contrast: if we instead take , then is closed (continuous image constraint intersected with a closed interval condition) and bounded (), hence compact — the same curve, truncated correctly at both ends, restores compactness. This pair of examples pins down exactly which end of the interval was doing the damage.
The Heine–Borel theorem requires both closedness and boundedness. Here we drop boundedness alone and keep closedness, to show sequential compactness genuinely fails — not just that Heine–Borel's proof stops working, but that the conclusion is false. Let itself (closed, since its complement is open, but manifestly unbounded), or more simply in let . is closed: if and , then (a strict inequality would put within of a negative number for large , forcing , contradiction), so . is not bounded. Consider the sequence for , entirely contained in . Any subsequence satisfies as (since , being a strictly increasing sequence of positive integers). No subsequence converges to any real number: convergence would require the subsequence to be bounded, but . Hence has a sequence with no convergent subsequence at all, so is not sequentially compact, even though is closed. This shows closedness alone is insufficient; boundedness is doing indispensable work, precisely by ruling out sequences that escape to infinity. Symmetrically, one can drop closedness and keep boundedness — e.g. , where has every subsequence converging only to — showing boundedness alone is also insufficient. Both hypotheses are load-bearing.
Scope, edge cases & common traps
| Situation | Compact? | Reason |
|---|---|---|
| Closed ball , any | Yes | Closed and bounded |
| Open ball | No | Bounded but not closed |
| A single point | Yes | Trivially closed and bounded |
| Finite union of compact sets | Yes | Bounded by max of the bounds; closed as finite union of closed sets |
| No | Closed but unbounded | |
| No | Bounded but not closed (limit points like escape) | |
| Empty set | Yes (vacuously) | Vacuously closed, bounded, and every cover has the empty finite subcover |
| Graph of continuous | Yes | Continuous image of a compact set is compact |
The mathematician behind it
Origins · 1 minBernard Bolzano and how this was discovered
Bolzano, a priest and philosopher-mathematician working in Prague, anticipated much of the rigor that later analysts (Cauchy, Weierstrass) are credited with. He gave an early proof of what we now call the intermediate value theorem and articulated versions of the accumulation-point principle behind Bolzano–Weierstrass decades before Weierstrass's own lectures popularized it, though his work circulated slowly and was not widely recognized in his lifetime.
Why does "closed and bounded" only characterize compactness in , and not in general metric spaces?
Heine–Borel is a special feature of finite-dimensional Euclidean space. The proof crucially uses Bolzano–Weierstrass, which itself rests on the completeness of via nested intervals, iterated finitely many times across the coordinates. In infinite-dimensional normed spaces (like spaces of functions), closed and bounded sets can fail to be compact — the closed unit ball in an infinite-dimensional Hilbert or Banach space is never compact, because you can always construct a sequence of unit vectors with no convergent subsequence (e.g. an orthonormal sequence, all pairwise distances ). So "closed and bounded implies compact" genuinely depends on finite dimension; in general metric spaces, one must instead work directly with sequential compactness or total boundedness plus completeness.
Is sequential compactness the same as the open-cover definition in every metric space, or only in ?
They coincide in every metric space, not just — that equivalence (sequential compactness open-cover compactness) is a general metric space theorem, proved by the same total-boundedness argument used in this article. What is special to is the further equivalence with "closed and bounded," which fails in infinite-dimensional metric spaces, as the previous FAQ explains. So the article's three-way equivalence has two universal legs (sequential open-cover) and one Euclidean-specific leg (either closed and bounded).
Does compactness require the set to be connected, like an interval or disk?
No. Compactness has nothing to do with connectedness. A finite set of isolated points, such as , is compact (it's closed, since finite sets have no limit points to miss, and bounded), yet wildly disconnected. Conversely, connected sets can fail to be compact, like the open interval , which is connected but not compact. Compactness and connectedness are independent topological properties that happen to both be preserved under continuous images, which is why they're often discussed together, but neither implies the other.
Why is the finite subcover property useful if every compact set already has the simpler closed-and-bounded description in ?
Because many important theorems are most naturally proved using the open-cover formulation, even in , and this formulation generalizes to settings (topological spaces) where "bounded" doesn't even make sense. For instance, the proof that continuous images of compact sets are compact, or that continuous functions on compact sets are uniformly continuous, is often cleanest via covers: build an open cover from the continuity hypothesis at each point, then extract a finite subcover to get a single uniform bound or modulus of continuity. The closed-and-bounded description is a wonderful computational test, but the open-cover description is often the better proof engine.
How do I actually check compactness for a set defined by inequalities, in practice?
For a set given by inequalities involving continuous functions, like with each continuous, closedness is usually free: each is closed as a preimage of the closed set under a continuous function, and a finite intersection of closed sets is closed. The real work is checking boundedness, typically by finding an explicit bound (as in the worked ellipse example) or by showing the defining inequalities force each coordinate into a bounded range. If you can show for some , boundedness is done, and Heine–Borel finishes the job.
What is a "Lebesgue number" and why did it appear implicitly in the proof?
A Lebesgue number for an open cover of a sequentially compact set is a number such that every subset of with diameter less than is entirely contained in some single . The proof of (b)(c) in this article essentially constructs such a implicitly, via the contradiction argument with balls : it shows that if no finite subcover existed, we could find arbitrarily small balls escaping every single member of the cover, which is precisely the failure of a Lebesgue number to exist. The Lebesgue number lemma is often stated as a standalone tool because it is useful well beyond Heine–Borel, for instance in proving uniform continuity directly.
Does compactness in depend on which norm we use — Euclidean, max-norm, or sum-norm?
No, and this is a special and useful fact about finite dimensions: all norms on are equivalent, meaning for any two norms there are constants with for all . Equivalent norms generate exactly the same open sets, the same convergent sequences, and hence the same bounded sets and the same compact sets. So whether you check boundedness using , , or , you get the identical verdict on compactness — a convenience that fails in infinite dimensions, where inequivalent norms can disagree about which sets are compact.