A set is compact when every sequence in it has a subsequence converging inside it, or equivalently when every cover by open sets can be trimmed to finitely many. In R^n that means closed and bounded (Heine–Borel), in function spaces it does not, and compactness is exactly what makes continuous functions attain extremes and have one delta for the whole set.
Beyond the courseRudin, Principles of Mathematical Analysis, ch. 2 (Thm 2.35 to 2.41) and ch. 4 (Thm 4.14 to 4.19)Abbott, Understanding Analysis, Sec. 3.3 and 4.4Munkres, Topology, Sec. 26 to 28Apostol Vol. 2, Sec. 8.2 and 9.9
In 1.3 two theorems were proved on the interval [a,b]: a continuous function attains a maximum, and it is uniformly continuous. Both proofs went through the same step, Bolzano–Weierstrass: take a sequence of points of [a,b], extract a convergent subsequence, and observe that its limit is still in [a,b]. The interval (0,1] fails this (n1 has no limit in the set) and so do both theorems. So the interval was not the point. The property that a set must have so that sequences have a limit inside it is called compactness. This chapter defines it for any metric space, in two ways that look different (subsequences, and covers by open sets), proves they agree, proves that in Rn it means closed and bounded, shows that this fails in spaces of functions, and then proves the two theorems of 1.3 again for every compact set.
Quick checkThe sequence 1,−1,1,−1,… is bounded. Which is true?
The terms in odd positions form the constant sequence 1,1,1,… which converges to 1, and the even positions give −1. Every bounded sequence of reals has a convergent subsequence (Bolzano–Weierstrass, 1.2). The sequence itself oscillates and does not converge.Review: Bolzano–Weierstrass
Quick checkIs (0,1] a closed subset of R?
A closed set contains the limit of every convergent sequence of its points (4.2). The sequence n1 lies in (0,1] and converges to 0, outside. The right endpoint being present does not help because the left end is open.Review: closed sets and limits
Quick checkDoes f(x)=x attain a maximum on the interval (0,1)?
The extreme value theorem of 1.3 needs a closed bounded interval [a,b]. On (0,1) the supremum 1 is not attained. The sequence xn=1−n1 has the right values but its limit 1 is outside the set.Review: the extreme value theorem
The picture: covers and finite subcovers
A cover of a set K is a family of open sets whose union contains K. In the picture the sets are open intervals drawn as blue bars, and K is the black line. Slide k to use only the first k intervals and watch the uncovered points (red). Three things to do:
Start with (0,1] and the intervals (n1,2). Every point of K is covered if you use all of them (given x>0 pick n with n1<x). But for every k there is a red gap (0,k1]. No finite part of the cover works.
Switch to [0,1] with the same intervals plus one around 0. Now the point 0 is covered by the new interval, and the red gap disappears when k reaches 12 (the new set and U1,…,U11). Of those twelve, two already suffice: the new one and (111,2).
Try the hand-made family. It is finite, so a finite subcover is automatic. The interesting case is an infinite family, and the claim of compactness is that for [0,1] some finite part of it always works.
Where this came from· Heine, Borel and a disputed name
Dirichlet was the first to prove that a continuous function on a closed interval is uniformly continuous. His proof, given in lectures in 1852 and published only in 1904, quietly used a finite subcover of an open cover. Heine, Weierstrass and Pincherle later used similar techniques, which is why Heine’s name is attached to the theorem even though his own result was about uniform continuity. Émile Borel stated and proved, in 1895, that any cover of a closed interval by countably many open intervals has a finite subcover. Pierre Cousin (1895), Henri Lebesgue (1898) and Arthur Schoenflies (1900) extended this to arbitrary covers, and the result is sometimes called the Borel–Lebesgue lemma. The problem they were solving was how to pass from “every point has a good neighbourhood” to “the whole set has a uniform bound”. A finite cover does that, because you can take a minimum of finitely many numbers. (The history here follows Raman-Sundström, “A Pedagogical History of Compactness”, American Mathematical Monthly, 2015.)
Where this came from· Fréchet and the two definitions
Maurice Fréchet’s 1906 thesis (the same one that began metric spaces, see 4.1) studied sets in which every sequence has a convergent subsequence, generalizing Bolzano–Weierstrass from the line to spaces of functions. The open-cover definition, which is the one topology uses, was formulated in the 1920s by Pavel Alexandroff and Pavel Urysohn (who called it “bicompact”). For metric spaces the two are equivalent, which is Theorem “Compact equals sequentially compact” below. In general topological spaces they differ, and the cover definition is the one that works.
The idea, in words
Why· Compact means: it behaves like a finite set
Finite sets are friendly. Every function on a finite set has a largest value. If every point has its own tolerance δp>0, then there is one tolerance for the whole set, the smallest δp, and it is positive because a minimum of finitely many positive numbers is positive. Infinite sets lose both properties.
Compactness is the way an infinite set earns them back. It says the set can be handled by finitely many pieces at the scale you care about, whichever scale that is. Two statements express it:
Sequences. An infinite supply of points must pile up somewhere in the set: some subsequence converges to a point of the set. (A finite set has this, since some point repeats infinitely often.)
Covers. If every point of the set is given an open neighbourhood, finitely many of those neighbourhoods already cover the set. This is “take the minimum of finitely many tolerances” in disguise.
The set must be closed (no escape through an edge) and “not too spread out” (the interval [0,1] yes, the line R no). In Rn that is closed and bounded. In infinite dimensions “not too spread out” needs a sharper meaning, called total boundedness.
Definitions and theorems
Sequential compactness
Definition B
Sequentially compact
Let K be a subset of a metric space X. K is sequentially compact if for every sequence (xn) with all xn∈K there are indices n1<n2<⋯ and a point x∈K with xnk→x. (The limit must be in K.)
In one lineA set K is sequentially compact if every sequence of points of K has a subsequence that converges to a point of K.
Why it existsIt is the property that Bolzano–Weierstrass gives for [a,b] and that the proofs of the extreme value theorem and of uniform continuity in 1.3 used.
We use the following fact all the time: if xn→x then every subsequence xnk→x too, because nk≥k, so the terms after index N of the subsequence are terms of the original after index N.
Worked example
Which of these subsets of R are sequentially compact: [0,1], (0,1], R, {1,2,3}, Q∩[0,1], Z?
Solution.
[0,1] is. A sequence in [0,1] is bounded, so Bolzano–Weierstrass gives a convergent subsequence, and 0≤xnk≤1 passes to the limit, so the limit is in [0,1]. Boundedness gives the subsequence, closedness keeps the limit inside.
(0,1] is not. The sequence n1 has every subsequence converging to 0, which is outside. One sequence all of whose subsequences fail is enough to disprove the property.
R is not. The sequence xn=n has no convergent subsequence, since a convergent sequence is bounded and every subsequence of n is unbounded. Bounded fails.
{1,2,3} is. Any sequence takes some value infinitely often; the subsequence at those positions is constant, hence convergent. Finite sets are always sequentially compact.
Q∩[0,1] is not. Take rationals xn→22 (decimal truncations). Every subsequence converges to 22, which is irrational, so outside the set. The set is bounded but not closed in R: it has holes.
Z is not. The sequence n again. Unbounded.
Answer. Sequentially compact: [0,1] and {1,2,3}. Not: the other four. ■ The pattern, closed and bounded, is the next theorem.
Definition B
Bounded set in a metric space
A subset K of a metric space X is bounded if there exist p∈X and R>0 with d(x,p)<R for all x∈K. (For R with ∣x−y∣ this is the notion of bounded from 1.1.)
In one lineA set K is bounded if it fits inside some ball: there are a point p and a radius R with K⊆B(p,R).
Why it existsIt is the replacement for 'between two numbers' in a space with no order, and it is the condition that fails for R and for Z.
Theorem BRudin Thm 2.34 and Thm 3.6; Abbott Sec. 3.3
Sequentially compact sets are closed and bounded
If K is a sequentially compact subset of a metric space X, then K is closed and bounded.
In one lineIn any metric space, a sequentially compact set is closed and bounded.
Why it is trueA sequence escaping through a missing limit point, or running off to infinity, has no subsequence that converges inside the set.
ProofRudin 2.34
The idea: Closed: a sequence in K converging to a point outside K would force all its subsequences to converge outside K. Bounded: an unbounded set yields a sequence moving ever farther from a base point, which cannot have a convergent subsequence.
Closed. Let xn∈K and xn→x∈X. We show x∈K.
By the theorem in 4.2, a set is closed iff the limit of every convergent sequence of its points lies in the set. So take such a sequence.
Some subsequence xnk converges to a point y∈K.
K is sequentially compact.
But xnk→x as well, so y=x and x∈K. So K is closed.
A subsequence of a sequence converging to x also converges to x, and limits in a metric space are unique (4.2).
For each n choose xn∈K with d(xn,p)≥n.
Bounded: suppose not. Fix any p∈X. Not bounded means no ball B(p,n) contains K, for every n.
Suppose a subsequence converges to y∈K. Then d(xnk,p) is bounded.
A sequence xnk→y is bounded: d(xnk,p)≤d(xnk,y)+d(y,p), and d(xnk,y)<1 for large k, so the distances stay below 1+d(y,p) after some point.
That contradicts the choice of xn. So no subsequence converges, which contradicts sequential compactness. Hence K is bounded. ■
d(xnk,p)≥nk≥k is unbounded.
For the converse we need a statement about boxes. A box in Rn is Q=[a1,b1]×⋯×[an,bn]. Every bounded set lies in some box.
Theorem BRudin Thm 2.41 and Thm 3.6; Abbott Sec. 3.3
Bolzano–Weierstrass in R^n
Let K⊆Rn be closed and bounded (for any of the 1-, 2- or max-distances). Then K is sequentially compact.
In one lineEvery closed bounded subset of Rn is sequentially compact: each sequence in it has a subsequence converging to a point of it.
Why it is truePass to a subsequence for the first coordinate, then a further subsequence for the second, and so on; after n rounds every coordinate converges.
ProofRudin 2.41
The idea: Bounded in R^n means each coordinate is a bounded real sequence. Apply Bolzano–Weierstrass of 1.2 one coordinate at a time, always to the subsequence already found. Then the vector converges, because convergence is coordinatewise (4.2). The limit is in K since K is closed.
Let x(m) be a sequence in K. Each coordinate sequence (xi(m))m lies in [−R,R].
K is bounded, so ∥x∥2≤R for some R and all x∈K. Each coordinate is at most the 2-norm in absolute value (the comparison theorem of 4.1).
There is a subsequence along which the first coordinate converges.
Bolzano–Weierstrass in 1.2, for the first coordinate.
Take a further subsequence along which the second coordinate also converges. Continue through coordinate n.
A subsequence of a bounded sequence is bounded, so Bolzano–Weierstrass applies again, now to the second coordinate along the subsequence from the previous step. The first coordinate still converges along it, since subsequences of convergent sequences converge.
So some subsequence converges to a point x∈Rn.
After n steps we have one subsequence x(mk) along which every coordinate converges. By the coordinatewise theorem of 4.2, x(mk)→x in Rn.
x∈K. ■
K is closed, so by 4.2 the limit of a convergent sequence of its points lies in K.
Quick checkWhich of these subsets of R2 is sequentially compact?
The closed disc is closed and bounded. The open disc is bounded but not closed (the sequence (1−n1,0) approaches the missing boundary point (1,0)). The x-axis is closed but not bounded (the points (n,0) have no convergent subsequence).
Open covers and compactness
Definition B
Open cover
Let K be a subset of a metric space X. An open cover of K is a collection {Uα} of open sets of X with K⊆⋃αUα. A subcover is a sub-collection that still covers K; it is a finite subcover if it has finitely many sets.
In one lineAn open cover of a set K is a collection of open sets of the space whose union contains K. A finite subcover is a finite part of the collection that still covers K.
Why it existsA cover is the data 'give every point an open neighbourhood'. Compactness asks that finitely many of those neighbourhoods are enough.
Definition B
Compact set
A subset K of a metric space X is compact if every open cover of K has a finite subcover.
In one lineA set K is compact if every open cover of K has a finite subcover.
Why it existsIt is the cover version of 'behaves like a finite set': finitely many of any given neighbourhoods already reach every point.
One remark about the definition. If we asked for covers by sets open in K itself (as in 4.4), we would get the same notion: a set open in K has the form K∩W with W open in X (the lemma “Open sets inside a subset” in 4.4), and covers by the K∩Wα correspond to covers by the Wα. So being compact is a property of K as a metric space on its own. That lets us treat K as the whole space in proofs.
Worked example
Show that (0,1] is not compact by giving an open cover with no finite subcover. Then show [0,1] is not defeated by the same family.
Solution.
The cover. Let Un=(n1,2) for n=1,2,3,…. Each is open. Open intervals are balls in R.
It covers (0,1]. Given x∈(0,1], pick n with n1<x (Archimedean property). Then x∈Un, as x≤1<2. Every point needs a set containing it.
No finite subcover. Any finitely many Un1,…,Unj have union UN with N=maxni (the sets increase with n), which is (N1,2). It misses the point N1∈(0,1]. The sets are nested, so the union of finitely many is the biggest of them, and that one has a left end.
So (0,1] is not compact.Compactness requires a finite subcover for EVERY open cover. One bad cover is enough.
The same family on [0,1]. It does not cover [0,1] (the point 0 is in no Un), so add U0=(−ε,ε) with ε=0.05. The sets U0 and UN cover [0,1] once N1<ε, that is N≥21. Points below ε are in U0; points from ε up are above N1 and below 2. For N=20, 201=0.05 exactly, and the point 0.05 is in neither set.
Answer.(0,1] has the open cover {(n1,2)} with no finite subcover, so it is not compact. Adding the one set U0 around the missing point makes two sets suffice for [0,1], and compactness says that something like this always happens for [0,1]. ■
Your answerCover [0,1] by U0=(−0.05,0.05) together with Un=(n1,2). What is the smallest n such that {U0,Un} already covers [0,1]?
The point x=0.05 is the hardest to cover. What must n satisfy for 0.05∈(n1,2)?
Points x≥0.05 must lie in Un, so we need n1<0.05, which means n>20. For n=20 the point 0.05 is in neither set (U0 stops before 0.05 and U20 starts after 201=0.05), so n=21 is the least.
Worked example
Prove directly from the definition that K={0}∪{n1:n≥1} is compact.
Solution.
Start with an arbitrary open cover. Let {Uα} be a family of open sets of R whose union contains K. The definition says every open cover has a finite subcover, so we may not choose the cover. We are handed it.
Handle the troublemaker 0. Some member, call it U0, contains the point 0. It is open, so it contains an interval (−r,r) for some r>0. Open means a ball around each of its points fits inside.
See what U0 covers. Choose N with N1<r (Archimedean property). Then n1∈(−r,r)⊆U0 for every n≥N. The tail of the sequence n1 is squeezed toward 0, so all of it is swallowed by the one set around 0. Infinitely many points are handled by a single set.
Handle the finitely many points left over. The points 1,21,…,N−11 number finitely many. For each, pick one member of the cover containing it. One set per point, and there are only N−1 points, so this uses at most N−1 more sets.
Collect.U0 together with those at most N−1 sets is a finite subfamily, and it covers K. It contains 0, the tail, and each leftover point.
Answer. Every open cover of K has a finite subcover, so K is compact. This is the standard shape of a direct proof: one set handles the accumulation point and an infinite tail, finitely many sets handle the rest. Compare {n1} without 0, where nothing handles the tail. ■
Two general facts, true in every metric space.
Theorem BRudin Thm 2.34; Abbott Sec. 3.3
Compact sets are closed and bounded
If K is a compact subset of a metric space X, then K is closed and bounded.
In one lineIn any metric space, every compact set is closed and bounded.
Why it is trueCover the set by balls that grow, or by the sets of points farther than 1/n from a point outside the set; a finite subcover forces a gap around that outside point.
ProofRudin 2.34
The idea: Bounded: the balls B(p, n) cover everything; finitely many suffice, so the biggest contains K. Closed: for a point q outside K, the open sets {x : d(x, q) > 1/n} cover K; a finite subcover gives a ball around q that misses K.
Bounded. By compactness finitely many of these balls cover K.
For any fixed p∈X the open balls B(p,n), n=1,2,…, cover all of X, so cover K.
So K⊆B(p,N) for some N: K is bounded.
The balls increase with n, so the union of finitely many is the largest of them.
Closed. Let q∈X∖K and Un={x∈X:d(x,q)>n1}.
To show K is closed we show its complement is open: take a point q∈/K and find a ball around q that misses K.
Each Un is open.
If d(x,q)>n1 put s=d(x,q)−n1. For y∈B(x,s) the triangle inequality gives d(y,q)≥d(x,q)−d(x,y)>n1.
The sets Un cover K.
If x∈K then x=q, so d(x,q)>0 by (M1), and d(x,q)>n1 for n large.
So K⊆UN: every point of K is farther than N1 from q.
Compactness gives a finite subcover. The sets increase with n, so one set UN already contains K.
Hence B(q,N1)⊆X∖K, so X∖K is open and K is closed. ■
That says no point of K is in B(q,N1).
Lemma BRudin Thm 2.35
Closed subsets of compact sets are compact
Let Q be a compact subset of a metric space X, and let F⊆Q be closed in X. Then F is compact.
In one lineIf Q is compact and F⊆Q is closed, then F is compact.
Why it is trueCover F and also the complement of F, which is open; the finite subcover of Q restricts to a finite subcover of F.
ProofRudin 2.35
The idea: Given an open cover of F, add the open set X minus F. The result covers Q, so finitely many of its sets cover Q; drop X minus F.
Let {Uα} be an open cover of F.
Start with an arbitrary open cover of F.
Then {Uα}∪{X∖F} is an open cover of Q.
F is closed, so X∖F is open. Every point of Q is in F (so in some Uα) or not in F (so in X∖F).
A finite part of it covers Q, hence covers F.
Q is compact.
Remove X∖F if it is among the sets. What remains is finitely many Uα covering F. ■
X∖F contains no point of F, so it is not needed to cover F.
The Heine–Borel theorem
Theorem BRudin Thm 2.40 and 2.41; Abbott Sec. 3.3
Heine–Borel theorem
A subset K⊆Rn (with the 1-, 2- or max-distance) is compact if and only if it is closed and bounded.
In one lineA subset of Rn is compact if and only if it is closed and bounded.
Why it is true'Compact implies closed and bounded' holds in every metric space. For the converse, keep halving a box that has no finite subcover; the nested boxes shrink to a point, and the open set covering that point also covers a small box, a contradiction.
Why· The picture behind the proof
Imagine the box Q and an open cover of it with no finite subcover. Cut Q into 2n equal sub-boxes (in the plane, four quarters). If each quarter had a finite subcover, so would Q. So some quarter has none. Cut that quarter into four, and again some quarter has none. The nested squares shrink to a single point x. That point is in one set U of the cover. Because U is open, a small disc around x fits in U, and when the squares are small enough one of them fits inside this disc. That square is covered by the single set U. It was supposed to have no finite subcover. In the cover visualizer above this is the situation near 0 for (0,1]: the nested intervals shrink toward a point which is not in the set, so the argument has nothing to land on. Closedness is what lets the point exist.
ProofRudin 2.40 and 2.41
The idea: (⇒) is the general theorem. (⇐) First prove that every box is compact by the halving argument; then a closed bounded set is a closed subset of a box, hence compact.
(⇒) A compact K is closed and bounded.
The general theorem that compact sets are closed and bounded, in the metric space Rn.
Halve every side of Q0. This cuts Q0 into 2n sub-boxes whose union is Q0.
(⇐), part 1: boxes are compact. By contradiction: suppose a box Q0 has an open cover U with no finite subcover.
So at least one sub-box has no finite subcover. Call it Q1.
If all 2n sub-boxes had a finite subcover from U, the union of those finitely many finite subcovers would be a finite subcover of Q0.
We get nested boxes Q0⊇Q1⊇Q2⊇⋯, none having a finite subcover from U, with diamQk=2−kdiamQ0.
The same argument applied to Q1, then Q2, and so on (we choose one each time, an infinite repeated choice).
Pick xk∈Qk for each k. The sequence (xk) is Cauchy.
For m≥k both xk and xm lie in Qk (the boxes are nested), so d(xk,xm)≤diamQk→0.
So xk→x for some x∈Rn.
Rn is complete (4.2).
Hence x∈Qk for every k, in particular x∈Q0.
For a fixed k, the points xm with m≥k lie in Qk and converge to x. A box is closed (its defining inequalities pass to limits coordinatewise), so x∈Qk.
Some U∈U contains x.
U covers Q0.
There is r>0 with B(x,r)⊆U.
U is open.
Then Qk⊆B(x,r)⊆U: the single set U is a finite subcover of Qk. This contradicts the choice of Qk. So every box is compact.
Choose k with diamQk<r. Every point y∈Qk has d(y,x)≤diamQk<r since x∈Qk too.
Let K be closed and bounded. Then K⊆[−R,R]n, a box.
(⇐), part 2: a closed bounded set sits inside a box. If ∥x∥2≤R on K then every coordinate is in [−R,R].
K is a closed subset of a compact box, so K is compact. ■
The lemma on closed subsets of compact sets.
Proof workshopRebuild the halving argument: every box is compact
Tap the lines in the order a proof would write them. Each line can only use what is already above it.
A proof by contradiction: assume the box is not compact.
If every piece had a finite subcover, so would the whole box. Each halving halves the diameter.
The hypothesis, a cover with no finite subcover, must come first.
Late points all lie in one small box, and completeness of Rn (4.2) turns Cauchy into convergent.
You need the nested boxes before you can pick a point in each.
A closed set contains the limit of a convergent sequence of its points.
The limit x has to exist first.
U covers Q0 and U is open.
You need x∈Q0, which is part of the previous line.
A box containing x with diameter below r fits in the ball around x.
The ball and its radius r must be chosen before comparing with the diameters.
Worked example
Which of these subsets of R2 or R3 are compact: the closed triangle {x,y≥0,x+y≤1}, the sphere {x2+y2+z2=1}, the hyperbola {xy=1}, the open disc {x2+y2<1}, the set {(x,y):y=sinx1,0<x≤1}?
Solution.
Closed triangle. Defined by non-strict inequalities of continuous functions, so closed. It lies in [0,1]2, so bounded. By Heine–Borel it is compact. A set defined by ≥, ≤ and = on continuous functions is closed: limits of points satisfying them still satisfy them.
Sphere. Closed because xk→x with ∥xk∥2=1 forces ∥x∥2=1 (the norm is continuous: ∣∥xk∥−∥x∥∣≤∥xk−x∥, the reverse triangle inequality). Bounded since every coordinate has absolute value at most 1. Compact. This sphere is the set where continuous-function arguments will find maxima and minima; it is used again in 4.5.
Hyperbola xy=1. Closed (an equation in continuous functions) but unbounded, since (n,n1) lies on it. Not compact. Heine–Borel needs both properties.
Open disc. Bounded, not closed (the boundary circle is missing). Not compact. The sequence (1−n1,0) approaches a point outside the set.
The graph of sinx1 on (0,1]. Bounded, but not closed: (nπ1,0) lies on it and tends to (0,0), which is not on it. Not compact. This is the set G of the topologist’s sine curve in 4.4; adding the missing segment makes it closed, bounded and compact.
Answer. Compact: the triangle and the sphere. Not compact: the other three. ■
Compact and sequentially compact are the same in a metric space
In Rn we proved that closed and bounded gives sequential compactness and also gives compactness. In a general metric space the two properties still agree, which we now prove. The proof needs a measure of “how finely do I need to look”. It is called total boundedness.
Definition B
Totally bounded
A metric space K (or a subset with the inherited distance) is totally bounded if for every ε>0 there are finitely many points p1,…,pm∈K with K=B(p1,ε)∪⋯∪B(pm,ε).
In one lineA metric space is totally bounded if for every ε>0 it can be covered by finitely many balls of radius ε.
Why it existsBounded says one big ball is enough. Totally bounded says finitely many small balls are enough at every scale, which is the property 'not too spread out' that compactness needs.
A totally bounded set is bounded: take ε=1, then one big ball around p1 of radius 1+maxid(p1,pi) contains all the small ones. The converse fails: the closed unit ball of an infinite-dimensional space is bounded but, as we show, not totally bounded. Boundedness in Rn does imply total boundedness (cut a box into small cubes).
Lemma Bstandard; Munkres Thm 45.1
Sequentially compact implies totally bounded
If a metric space K is sequentially compact, then it is totally bounded.
In one lineA sequentially compact metric space can be covered by finitely many balls of any given radius.
Why it is trueIf it could not, you could pick points one after another, each at distance at least ε from all earlier ones, and that sequence has no Cauchy subsequence.
Proofstandard
The idea: Suppose some radius ε is not enough. Pick points greedily, each outside the balls of the earlier ones. All pairs are at least ε apart, so no subsequence is Cauchy, hence none converges.
Pick any x1∈K.
Contrapositive. Suppose, for some ε>0, no finite set of balls of radius ε covers K.
Pick x2∈K∖B(x1,ε).
B(x1,ε) alone does not cover K by the assumption.
Having chosen x1,…,xj, pick xj+1∈K∖(B(x1,ε)∪⋯∪B(xj,ε)).
Finitely many balls never cover K, so there is always a point outside B(x1,ε)∪⋯∪B(xj,ε).
Then d(xi,xj)≥ε for all i=j.
Each point is outside the earlier balls, so its distance to each earlier point is at least ε.
So no subsequence of (xj) converges, contradicting sequential compactness. ■
A convergent sequence is Cauchy (4.2). A subsequence with all pairwise distances at least ε is not Cauchy for the tolerance ε.
The next lemma gives the one tolerance that works for a whole cover.
Lemma BMunkres Lemma 27.5
Lebesgue number lemma
Let K be a sequentially compact metric space and {Uα} a cover of K by open sets of K. Then there is λ>0 (a Lebesgue number of the cover) such that for every x∈K the ball B(x,λ) is contained in some Uα.
In one lineIf K is sequentially compact and {Uα} is an open cover of K, there is a number λ>0 such that every ball B(x,λ) with x∈K lies inside a single Uα.
Why it is trueIf no such λ existed, there would be points whose n1-balls escape every set; a subsequence of them converges to a point of some Uα, and the balls around it eventually fit inside that set.
ProofMunkres 27.5
The idea: Contradiction: for λ = 1/n pick a bad centre x_n. A convergent subsequence tends to a point x lying in some U; a ball around x fits inside U, and for large k the bad ball around x_{n_k} fits inside it too.
For each n choose xn∈K such that B(xn,n1) is contained in no Uα.
Assume the opposite: for every λ>0 there is a centre whose λ-ball fits in no Uα. Use λ=n1.
A subsequence xnk→x for some x∈K.
K is sequentially compact.
Some Uβ contains x, and B(x,r)⊆Uβ for some r>0.
{Uα} covers K and each Uα is open.
Choose k with d(xnk,x)<2r and nk1<2r.
Convergence xnk→x and nk1→0: both are below 2r for large k.
That is exactly what we assumed was impossible for the centre xnk.
Theorem BRudin Thm 2.37 and 3.6; Munkres Thm 28.2
Compact equals sequentially compact
A subset K of a metric space is compact if and only if it is sequentially compact.
In one lineIn a metric space, a set is compact if and only if it is sequentially compact.
Why it is trueCompact to sequential: a sequence with no convergent subsequence gives each point a ball containing only finitely many terms, and finitely many such balls cannot hold infinitely many terms. Sequential to compact: totally bounded gives finitely many balls of radius equal to a Lebesgue number, and each of those balls sits inside one set of the cover.
ProofMunkres 28.2
The idea: (⇒) Contrapositive with balls that catch only finitely many terms. (⇐) Take a Lebesgue number λ, cover K by finitely many λ-balls using total boundedness, and put each ball inside one set of the cover.
Let p∈K. If every ball B(p,j1) contained xn for infinitely many n, we could pick n1<n2<⋯ with xnj∈B(p,j1).
(⇒) Suppose K is compact and (xn) is a sequence in K with no subsequence converging to a point of K.
Then xnj→p, contrary to the assumption. So some ball B(p,rp) contains xn for only finitely many indices n.
That subsequence has d(xnj,p)<j1→0.
Say B(p1,rp1),…,B(pm,rpm) cover K.
The balls B(p,rp) for p∈K are open and cover K. By compactness finitely many of them cover K.
But there are infinitely many indices n, a contradiction. So every sequence in K has a subsequence converging in K. K is sequentially compact.
Every xn lies in K, so in one of these m balls, and each ball holds xn for only finitely many n. Finitely many balls, each with finitely many indices, give finitely many indices in total.
By the Lebesgue number lemma there is λ>0 such that every ball B(x,λ), x∈K, lies in some Uα.
(⇐) Suppose K is sequentially compact, and let {Uα} be an open cover of K (by open sets of K, equivalent to the definition, by the remark above).
There are p1,…,pm∈K with K=B(p1,λ)∪⋯∪B(pm,λ).
Sequentially compact implies totally bounded. Take ε=λ.
For each i choose αi with B(pi,λ)⊆Uαi.
Each centre pi is a point of K, so the Lebesgue property applies to the ball around it.
Then K⊆Uα1∪⋯∪Uαm: a finite subcover. So K is compact. ■
The balls cover K and each lies in its set.
Proof workshopPick the reason for each line of 'sequentially compact implies compact'
Each line of the proof is shown in order. Choose the reason that justifies it, then press Check.
Let {Uα} be an open cover of the sequentially compact set K.
There is λ>0 such that every ball B(x,λ) lies in a single Uα.
There are p1,…,pm∈K whose λ-balls cover K.
For each i, B(pi,λ)⊆Uαi for some αi.
So K⊆Uα1∪⋯∪Uαm.
In the picture: the Lebesgue number is the width of the narrowest “room” a point has inside the sets of the cover. For [0,1] with the family {U0,Un} of the first visualizer (where U0=(−0.1,0.1)) the room is at least 0.05 everywhere: a point x with 0≤x≤0.1 has room 0.1−x inside U0 and nearly x inside some Un, and the worse of the two bests, at x=0.05, is 0.05. For (0,1] with (n1,2) the room of the point x is about x, which tends to 0 as x→0: there is no Lebesgue number, and no finite subcover.
Quick checkWhich of these metric spaces (with the distance ∣x−y∣) is totally bounded?
(0,1) is covered by ⌈1/ε⌉ intervals of length about ε (radius ε around points of (0,1)), for every ε. It is not compact because it is not complete (it is missing its endpoints), which shows the next theorem needs completeness as well as total boundedness. Z and R are unbounded.
Worked example
How many open intervals of length 0.1 are needed to cover [0,1]?
Solution.
Eleven are enough. Take the intervals of radius 0.05 around the centres cj=0.04+0.095j for j=0,1,…,10. The first reaches down to c0−0.05=−0.01<0, the last up to c10+0.05=1.04>1, and neighbouring centres are 0.095<0.1 apart, so neighbouring intervals overlap. Two open intervals of length 0.1 overlap exactly when their centres are less than 0.1 apart, and overlapping intervals leave no point between them uncovered.
Ten are not enough. Suppose ten open intervals of length 0.1 cover [0,1]. Their union U is open and contains 0 and 1, so it contains small intervals around both, and so contains an interval (−η,1+η) of length 1+2η>1. But the total length of ten intervals of length 0.1 is 1, and a union of intervals cannot contain an interval longer than the sum of their lengths. Open intervals cannot touch end to end: the touching point would be missing. Overlap costs length, and there is no spare length. This is the same reason that [0,1] cannot be split into open pieces (4.4).
Conclude. The least number is 11. This is a count of the balls in a finite cover at scale ε=0.05, which is what total boundedness asks for at each scale.
Answer.11. ■
Your answerWhat is the least number of open intervals of length 0.1 that cover [0,1]?
Try ten intervals and ask what happens at the points where consecutive intervals meet.
Ten open intervals of length 0.1 have total length 1, but a union that contains [0,1] and is open must reach beyond both ends, so it needs more than total length 1. Eleven with small overlaps work (centres 0.04+0.095j for j=0,…,10).
Theorem BMunkres Thm 45.1
Compact equals complete and totally bounded
A metric space K is compact if and only if it is complete and totally bounded.
In one lineA metric space is compact if and only if it is complete and totally bounded.
Why it is trueCompact means every sequence has a convergent subsequence. A Cauchy sequence with a convergent subsequence converges, so compact spaces are complete. Conversely, total boundedness lets you pick a nested sequence of small balls, which yields a Cauchy subsequence that completeness converts into a limit.
ProofMunkres 45.1
The idea: (⇒) Sequentially compact implies totally bounded, and a Cauchy sequence with a convergent subsequence converges. (⇐) From any sequence, use total boundedness repeatedly to pick nested infinite subsequences, each inside a ball of radius 1/k; the diagonal subsequence is Cauchy.
(⇒) K is totally bounded.
By the equivalence theorem, compact means sequentially compact. The lemma above gives totally bounded.
A Cauchy sequence in K has a convergent subsequence, hence converges to the same limit. So K is complete.
Let (xn) be Cauchy with a subsequence xnk→x. Given ε, choose N with d(xm,xn)<2ε for m,n>N and k with nk>N and d(xnk,x)<2ε. For n>N: d(xn,x)≤d(xn,xnk)+d(xnk,x)<ε.
One of those balls contains xn for infinitely many n. Let S1 be the subsequence of those terms.
(⇐) Let K be complete and totally bounded, and (xn) any sequence. Finitely many balls of radius 1 cover K.
Let S2⊆S1 be the terms lying in one ball of radius 21. Continue: Sk⊆Sk−1 lies in a ball of radius k1.
Finitely many balls of radius 21 cover K, hence cover the terms of S1; by the same pigeonhole one of them contains infinitely many terms of S1.
The sequence (yk) is a subsequence of (xn) and is Cauchy.
The diagonal: let yk be the k-th term of Sk, chosen with strictly increasing original indices. For m≥k both yk and ym lie in Sk, inside one ball of radius k1, so d(yk,ym)<k2 by the triangle inequality.
So yk converges in K. Every sequence has a convergent subsequence: K is sequentially compact, hence compact. ■
K is complete.
Worked example
Decide whether each metric space is complete, totally bounded and compact: (a) [0,1], (b) (0,1), (c) Z, all with the distance ∣x−y∣, and (d) an infinite set with the discrete metric.
Solution.
(a) [0,1]. It is closed in the complete space R, so it is complete. Intervals of radius ε around 0,ε,2ε,… (about ε1 of them) cover it, so it is totally bounded. Hence compact. The theorem: compact means complete and totally bounded.
(b) (0,1). Totally bounded, by the same count of intervals. Not complete: n1 is Cauchy and has no limit in (0,1). So not compact. One of the two properties is missing. Totally bounded alone is not enough.
(c) Z. Complete: a Cauchy sequence of integers is eventually constant, because after some point the terms are less than 21 apart, hence equal. Not totally bounded: balls of radius 21 are single points, and Z is infinite. So not compact. Here the missing property is total boundedness.
(d) A discrete infinite set. Complete for the same reason as Z (a Cauchy sequence is eventually constant), and not totally bounded for the same reason (balls of radius 21 are single points). So not compact. The sets {x} are open and cover the space, and no finite part does, which is the cover form of the same failure.
Answer. Only [0,1] is compact. (b) fails completeness; (c) and (d) fail total boundedness. ■
This is why Rn obeys Heine–Borel. A closed subset of Rn is complete (4.2), and a bounded subset of Rn is totally bounded, so a closed bounded set is complete and totally bounded. It also explains the failure below: the closed unit ball of a function space is complete and bounded, and not totally bounded.
Closed and bounded is not enough in function spaces
Proposition Bstandard
The unit ball of C[0,1] is closed and bounded but not compact
Let B={f∈C[0,1]:d∞(f,0)≤1} be the closed unit ball of C[0,1] with the sup metric. Then B is closed and bounded, but not compact.
In one lineIn C[0,1] with the sup metric, the closed unit ball {f:max∣f∣≤1} is closed and bounded and has a sequence with no convergent subsequence, so it is not compact.
Why it is trueTent functions with disjoint supports are all at distance exactly 1 from each other, so no subsequence is Cauchy, let alone convergent.
Proofstandard
The idea: Build functions f_n that are zero except on disjoint little intervals, with a peak of height 1 on each. Any two are at sup distance exactly 1, so no subsequence is Cauchy.
B is bounded and closed.
The ball B(0,2) contains it. Closed: it is a closed ball, and closed balls are closed (the problem at the end of 4.1; the complement is open by the triangle inequality argument).
Let cn=21(n1+n+11), hn=21(n1−n+11) and fn(x)=max(0,1−∣x−cn∣/hn).
Tent of height 1 and half-width hn, centred at the midpoint cn of the interval [n+11,n1]. For n=1 the interval is [21,1] and the centre is 43.
For n=m the functions fn and fm are never non-zero at the same point.
Each fn is continuous with values in [0,1], so fn∈B. It is non-zero only on the open interval (n+11,n1), and these open intervals are pairwise disjoint.
Hence d∞(fn,fm)=1 for all n=m.
At x=cn: fn(cn)=1 and fm(cn)=0. Everywhere else at most one of them is non-zero, and values lie in [0,1], so ∣fn−fm∣≤1.
No subsequence of (fn) converges. So B is not sequentially compact, hence not compact. ■
A convergent sequence is Cauchy (4.2). A subsequence of (fn) has all pairwise distances equal to 1, so for ε=21 it is not Cauchy.
The unit ball here is closed, bounded and even complete (4.2 shows C[0,1] is complete and the ball is a closed subset). What fails is total boundedness: no finite set of functions is within 21 of all the tents. The space has infinitely many independent directions, the way Rn has n, and a ball in each direction is needed.
Quick checkThe closed unit ball of C[0,1] with the sup metric is closed, bounded and complete. Why is it not compact?
Compact means complete and totally bounded. Closed bounded subsets of Rn are totally bounded, but infinite-dimensional balls are not.
A computation in this space, to get used to the sup metric:
Your answerIn C[0,1] with the sup metric, what is d∞(xn,x2n) for any n≥1? (Hint: the gap is xn−x2n; put u=xn.)
Substitute u=xn and maximize u−u2.
With u=xn∈[0,1], the gap is u−u2, whose largest value on [0,1] is 41 at u=21. As x runs over [0,1], u=xn takes every value in [0,1], so the sup is 41. The distance does not depend on n.
Compactness at work
A few statements about continuous maps before the three theorems. A map f:X→Y between metric spaces is continuous at a if for every ε>0 there is δ>0 with dY(f(x),f(a))<ε whenever dX(x,a)<δ (the definition of 1.3 with two distances; 4.5 names and studies it).
Lemma BAbbott Thm 4.3.2; Rudin Thm 4.2
Continuous maps send convergent sequences to convergent sequences
Let f:X→Y be continuous at a and xn→a in X. Then f(xn)→f(a) in Y.
In one lineIf f is continuous at a and xn→a, then f(xn)→f(a).
Why it is trueContinuity turns the target tolerance into an input tolerance, and convergence of xn makes the inputs fall inside it eventually.
ProofAbbott 4.3.2
The idea: The same two-step proof as the sequential criterion in 1.3, with distances.
Let ε>0.
Arbitrary output tolerance.
Choose δ>0 with dY(f(x),f(a))<ε whenever dX(x,a)<δ.
Continuity of f at a.
Choose N with dX(xn,a)<δ for n>N.
xn→a with tolerance δ.
For n>N, dY(f(xn),f(a))<ε. ■
Combine the two choices.
Theorem BRudin Thm 4.14; Abbott Thm 4.4.1
Continuous image of a compact set is compact
If K is a compact metric space and f:K→Y is continuous, then f(K) is a compact subset of Y.
In one lineIf K is compact and f:K→Y is continuous, then f(K) is compact.
Why it is trueA sequence in the image comes from a sequence in K; a convergent subsequence there is carried by continuity to a convergent subsequence of the image.
ProofRudin 4.14
The idea: Use sequential compactness on both ends: lift a sequence of the image to K, extract a convergent subsequence there, and push it forward.
Let (yn) be a sequence in f(K). Each yn=f(xn) for some xn∈K.
By the equivalence theorem, compact means sequentially compact, so we may check that.
Some subsequence xnk→x∈K.
K is sequentially compact.
ynk=f(xnk)→f(x), and f(x)∈f(K).
The lemma on convergent sequences.
So f(K) is sequentially compact, hence compact. ■
Every sequence in f(K) has a subsequence converging in f(K).
Theorem BRudin Thm 4.16; Abbott Thm 4.4.2; Apostol Sec. 9.9
Extreme value theorem on a compact set
Let K be a non-empty compact metric space and f:K→R continuous. Then there are c,d∈K with f(c)≤f(x)≤f(d) for all x∈K.
In one lineA continuous real function on a non-empty compact set attains a maximum and a minimum.
Why it is trueThe image is a compact subset of the line, so closed and bounded; a non-empty closed bounded set of reals contains its supremum and infimum.
ProofRudin 4.16
The idea: f(K) is compact in R, so bounded; its supremum M exists; M is a limit of values of f, and a closed set contains its limits, so M is a value.
f(K) is a compact subset of R.
The theorem on continuous images.
So f(K) is closed and bounded, and non-empty.
Compact sets are closed and bounded.
Let M=supf(K).
Bounded above and non-empty, so the supremum exists (completeness axiom, 1.1).
There are yn∈f(K) with M−n1<yn≤M, so yn→M.
Approximation property of the supremum: for each n there is a value within n1 of M.
So M∈f(K): M=f(d) for some d∈K.
A closed set contains the limit of every convergent sequence of its points (4.2).
Hence f(d) is the maximum and a minimum f(c) exists. ■
The same argument for −f gives the minimum.
This is the extreme value theorem of 1.3, with the interval [a,b] replaced by any compact metric space. Its three ingredients are the three facts proved above: the image is compact, compact sets of R are closed and bounded, and closed sets contain their supremum.
Worked example
Show that f(x,y)=x+2y attains a maximum on the circle x2+y2=1, and find it.
Solution.
The circle is compact. It is closed (the sphere argument above) and bounded, so compact by Heine–Borel. Heine–Borel in R2.
f is continuous. It is a sum of coordinate functions with constant factors; ∣f(p)−f(q)∣≤∣p1−q1∣+2∣p2−q2∣≤3∥p−q∥2. The inequality gives δ=ε/3.
So a maximum exists. By the extreme value theorem on a compact set. It does not tell where; it promises that a search for the maximum has a target.
Find it. By Cauchy–Schwarz (2.9), x+2y=(x,y)⋅(1,2)≤∥(x,y)∥∥(1,2)∥=5, with equality when (x,y) is parallel to (1,2): (x,y)=51(1,2). Equality in Cauchy–Schwarz holds for parallel vectors, and this point is on the circle.
Answer. The maximum is 5≈2.236, attained at (51,52). ■
Your answerWhat is the maximum value of x+2y on the circle x2+y2=1?
Write x+2y as a dot product with (1,2) and use Cauchy–Schwarz.
Cauchy–Schwarz gives x+2y≤x2+y21+4=5, and the point (1,2)/5 on the circle attains it. The theorem guaranteed a maximum existed before we found it.
Theorem BRudin Thm 4.19; Abbott Thm 4.4.7
Continuous on a compact set implies uniformly continuous
Let K be a compact metric space and f:K→Y continuous. Then for every ε>0 there is δ>0 with dY(f(x),f(y))<ε whenever dK(x,y)<δ. (This is uniform continuity as defined in 1.3, with the two distances.)
In one lineA continuous map from a compact metric space to any metric space is uniformly continuous: one δ works for the whole set.
Why it is trueEvery point has its own tolerance; the Lebesgue number of the cover by those tolerance-balls is a single tolerance that serves everywhere.
ProofRudin 4.19
The idea: Give each point p the δ_p that works for ε/2 at p. The balls B(p, δ_p) cover K. A Lebesgue number λ of this cover is the δ: two points within λ of each other lie in one ball B(p, δ_p), so their images are both within ε/2 of f(p).
Let ε>0. For each p∈K choose δp>0 with dY(f(x),f(p))<2ε whenever dK(x,p)<δp.
Arbitrary tolerance. For each point we use continuity with half of it, to get two images close through a common centre.
The balls B(p,δp), p∈K, form an open cover of K.
Each point p lies in its own ball.
Let λ>0 be a Lebesgue number: every ball B(x,λ) lies in some B(p,δp).
K is compact, hence sequentially compact; the Lebesgue number lemma applies.
So dY(f(x),f(p))<2ε and dY(f(y),f(p))<2ε.
Take δ=λ. Let dK(x,y)<λ, so y∈B(x,λ). Choose p with B(x,λ)⊆B(p,δp). Then both x and y are within δp of p.
dY(f(x),f(y))≤dY(f(x),f(p))+dY(f(p),f(y))<ε. ■
Triangle inequality in Y, through f(p).
The proof in 1.3 used sequences instead, and found a convergent subsequence of “bad pairs”. The Lebesgue number is the same device: in the picture it is the minimum of the infinitely many local tolerances, and compactness keeps that minimum positive.
Worked example
For f(x)=x2 on [0,3] and ε=0.03, find a δ that works at every point at once.
Solution.
The set is compact.[0,3] is closed and bounded. Heine–Borel, so the theorem promises a uniform δ exists.
Find the size of the slope. For x,y∈[0,3], ∣x2−y2∣=∣x−y∣∣x+y∣≤6∣x−y∣. ∣x+y∣≤6 on [0,3], the bound on how steep the graph can get.
Choose δ. We want 6δ≤ε=0.03, so δ=0.005=2001. Then ∣x−y∣<δ implies ∣x2−y2∣<6δ=0.03 for every pair of points in the interval.
Answer.δ=2001 works everywhere on [0,3]. On R no such δ exists (1.3). ■
Your answerFor f(x)=x2 on [0,3] the bound ∣x2−y2∣≤6∣x−y∣ holds. For ε=0.03, what is δ=ε/6?
Divide 0.03 by the slope bound 6.
δ=60.03=0.005=2001. With ∣x−y∣<2001 the values differ by less than 6⋅2001=0.03.
Quick checkWhich of these functions is uniformly continuous on its domain?
[0,10] is compact, so the continuous x2 is uniformly continuous there. The other two have domains that are not compact, and both fail: they oscillate or blow up near 0, so closer and closer pairs have outputs far apart.
Where it is used
Used inside maths· Inside maths: why the earlier chapters worked, and what comes next
Every proof in 1.3 that said “take a convergent subsequence” was using compactness of [a,b]. Chapter 1.5 needs uniform continuity to show that a continuous function is integrable; that is the compact-set theorem above. In 4.5 the compactness of the unit sphere of Rn proves that all norms on Rn are equivalent, the fact that 4.1 stated without proof. In Unit 5, a function of several variables on a closed bounded region has a maximum and a minimum by the theorem above; critical-point methods then find them. Later courses use the stronger statements named here without proof: the Arzelà–Ascoli theorem says which subsets of C[0,1] are compact (the extra condition is that the functions do not oscillate faster and faster), and Tychonoff’s theorem says a product of compact spaces is compact (B, named only). A continuous bijection from a compact space onto another metric space is automatically a homeomorphism, shown in 4.5.
Used in the real world· Machine learning: when does a minimizer of the loss exist?
Training a model means minimizing a continuous loss L(w) over weights w. The extreme value theorem says a minimizer exists on a compact set. Take logistic regression on two points: x=1 with label +1, and x=−1 with label −1, one weight w. The loss is L(w)=2log(1+e−w). It is continuous and decreasing, with infimum 0 approached as w→∞ but never reached: on the unbounded set R the minimum does not exist. Gradient descent on separable data of this kind makes the weights grow without bound, like logt after t steps (Soudry and co-authors, 2018). Constrain ∣w∣≤B, a compact interval, and the minimum exists, at w=B: with B=5 it is 2log(1+e−5)≈0.0134. Weight decay, norm clipping and constraint balls all restore compactness in finite dimensions. In infinite-dimensional function spaces the closed ball is not compact (the tent functions above), so minimizers over all functions need extra structure, such as equicontinuity in Arzelà–Ascoli.
Your answerLogistic loss on the two points above is L(w)=2log(1+e−w). What is its minimum over the compact set ∣w∣≤5, as a decimal?
The loss decreases as w grows. Evaluate it at the right end of the interval.
L is decreasing, so the minimum over [−5,5] is at w=5: 2ln(1+e−5)≈2×0.006715=0.01343. Over all of R there is no minimum, only the infimum 0.
Python labFind a finite subcover, and see the Lebesgue number
import randomrandom.seed(3)def make_cover(): sets, x = [], -0.05 while x < 1.05: w = random.uniform(0.05, 0.3) sets.append((x - random.uniform(0, 0.05), x + w)) x += w * random.uniform(0.3, 0.9) # change 0.9 to 2.0 to open gaps random.shuffle(sets) return setsdef room(x, S): # how far a ball around x can grow and stay inside one set return max(min(x - l, r - x) for l, r in S if l < x < r)sets = make_cover()grid = [i / 2000 for i in range(2001)]assert all(any(l < x < r for l, r in sets) for x in grid), "not a cover"lam = min(room(x, sets) for x in grid)print("sets in the cover:", len(sets), " Lebesgue number about", round(lam, 4))chosen, x = [], 0.0 # greedy finite subcoverwhile x <= 1: options = [s for s in sets if s[0] < x < s[1]] best = max(options, key=lambda s: s[1]) chosen.append(best) x = best[1]print("a finite subcover uses", len(chosen), "sets")inf_cover = [(1 / n, 2) for n in range(1, 10001)]for x in [0.5, 0.1, 0.01, 0.001]: print("(0,1] cover: x =", x, " room =", round(room(x, inf_cover), 5))
Try this.Run it as is. The Lebesgue number is the smallest 'room' any point of [0, 1] has inside the sets of the cover, and it is positive. The last four lines show the same quantity for the cover (1/n, 2) of (0, 1]: the room at the point x is about x, which shrinks to 0, so there is no Lebesgue number and no finite subcover. Now change the 0.9 in the step to 2.0, so that neighbouring intervals can stop overlapping. The assertion fails (some grid point is uncovered): a family with gaps is not a cover.
Traps
Watch out· Closed and bounded is compact only in R^n
Heine–Borel is a theorem about Rn. In C[0,1], in the space of bounded sequences and in every infinite-dimensional normed space, the closed unit ball is closed and bounded and not compact. The right general statement is “complete and totally bounded”. If a problem is set in a function space, do not quote Heine–Borel.
Watch out· Sequentially compact means the limit is INSIDE the set
(0,1] has plenty of convergent subsequences. n1 converges, in R. What fails is that the limit is in (0,1]. The definition says “a subsequence that converges to a point of K”. Dropping “of K” turns it into boundedness.
Watch out· To show NOT compact, exhibit one cover, not 'many covers'
Compact means EVERY open cover has a finite subcover. To prove a set is not compact you give one cover with no finite subcover (like {(n1,2)} for (0,1]). To prove a set is compact you cannot check covers one at a time. You use Heine–Borel, or sequences, or a continuous image of a compact set.
Watch out· A cover that is already finite proves nothing
The one-set family {R} covers every subset of the line, and it is finite. That shows nothing about compactness. The definition quantifies over ALL open covers: you are handed a family, possibly infinite and chosen to be awkward, and must find finitely many of its members that still cover. A cover that thins out near an edge, like the sets (n1,2) for (0,1], is the dangerous kind.
Watch out· Compactness is not preserved by taking preimages
The continuous image of a compact set is compact. The preimage of a compact set need not be. Take f(x)=0 for all x∈R and the compact set {0}: its preimage is all of R, which is not compact. Only images behave.
Problems
check
Decide whether each is compact: (a) [0,1]×[2,5]⊂R2. (b) {(x,y):x2+y2≤1}∖{(0,0)}. (c) {1/n:n≥1}∪{0}. (d) {1/n:n≥1}.
Solution
(a) Closed bounded box: compact. (b) The closed disc with the centre removed is not closed ((n1,0)→(0,0), which is outside). Not compact. (c) Closed (it contains the limit 0 of n1) and bounded: compact. (d) Not closed (0 is a limit point outside): not compact.
check
Write an open cover of (0,∞) with no finite subcover. Is the set (0,∞) compact?
Solution
Un=(n1,n). Each x>0 is in Un for n large. A finite subfamily has union UN, which misses small and large numbers. So (0,∞) is not compact.
check
True or false: every finite subset of a metric space is compact.
Solution
True. Given an open cover, choose for each of the finitely many points one set containing it. Those finitely many sets cover the set.
check
A continuous function f on (0,1) is bounded. Does f attain a maximum? Give an example either way.
Solution
Not necessarily. f(x)=x is bounded by 1 and takes all values below 1 but never reaches it. On the other hand f(x)=sin(πx) attains 1 at x=21. The extreme value theorem needs a compact domain; bounded values are not enough.
use
Show that the closed ball {x∈Rn:∥x−c∥2≤r} is compact, and that the sphere {∥x−c∥2=r} is compact.
Solution
Bounded: every point is within r of c. Closed: if xk→x and ∥xk−c∥≤r then ∥x−c∥≤r, since ∣∥xk−c∥−∥x−c∥∣≤∥xk−x∥→0. The same argument with equality gives the sphere. Heine–Borel applies to both.
use
Let K⊂R2 be the compact set {x2+y2≤4} and f(x,y)=x2−y. Explain why f has a maximum and a minimum on K, and find them.
Solution
K is a closed disc, compact, f is continuous, so extremes exist. Interior critical point: ∇f=(2x,−1)=0, so none. On the boundary x=2cost, y=2sint: f=4cos2t−2sint=4−4sin2t−2sint. Put s=sint∈[−1,1]: 4−4s2−2s, with vertex at s=−41 giving 4−41+21=4.25. At s=1: −2; at s=−1: 2. Maximum 4.25, minimum −2 (at (0,2)).
use
Is f(x)=x uniformly continuous on [0,1]? What is a δ for ε=0.1 that works everywhere?
Solution
Yes: continuous on the compact [0,1]. For explicit δ use ∣x−y∣≤∣x−y∣. So δ=ε2=0.01 works: ∣x−y∣<0.01 gives ∣x−y∣<0.1. (The derivative is unbounded near 0, so δ cannot be proportional to ε.)
use
For the discrete metric on a set X, which subsets of X are compact?
Solution
Exactly the finite ones. A finite set is compact (an earlier check problem). If K⊆X is infinite, the sets {x} for x∈K are open (the ball of radius 21 around x is {x}) and cover K, and removing any one of them leaves its point uncovered, so no finite subfamily covers K. Equivalently, K is complete but not totally bounded, as in part (d) of the example above.
prove
Prove that a finite union of compact sets is compact.
Solution
Plan. Cover the union, then take a finite subcover for each piece.
Let K1,…,Km be compact and {Uα} an open cover of K1∪⋯∪Km. It also covers each Ki, so finitely many Uα cover Ki. Collect these finite subfamilies: finitely many sets in total cover the union. ■
proveRudin Thm 2.35 style; new
Prove that if K is compact and F is closed then K∩F is compact.
Solution
Plan. It is a closed subset of the compact set K.
K∩F⊆K, and it is closed because an intersection of closed sets is closed (4.1). By the lemma on closed subsets of compact sets, it is compact. ■
prove
Prove: if K is a compact subset of a metric space and p is a point outside K, there is a point q∈K with d(p,q)≤d(p,x) for all x∈K (a nearest point).
Solution
Plan. The distance to p is a continuous function on a compact set.
h(x)=d(p,x) is continuous on K because ∣h(x)−h(y)∣≤d(x,y) (reverse triangle inequality), so δ=ε works. K is compact, and non-empty (it must be, for a nearest point to exist), so by the extreme value theorem h attains its minimum at some q∈K. ■
prove
Prove: if K1⊇K2⊇⋯ is a nested sequence of non-empty compact sets, then ⋂nKn=∅.
Solution
Plan. Pick a point in each set, take a convergent subsequence, and show the limit is in every Kn.
Choose xn∈Kn. All xn∈K1, which is sequentially compact, so a subsequence xnk→x∈K1. For a fixed m, the terms xnk with nk≥m lie in Km (nested), and Km is closed (compact sets are closed), so the limit x∈Km. This holds for every m, so x∈⋂Km. ■ (This is the compact version of the nested interval theorem. The halving argument in Heine–Borel used the same idea, with completeness of Rn finding the common point.)
prove
Prove that a continuous bijection f:K→Y from a compact metric space onto a metric space has a continuous inverse. (Hint: argue with sequences and a convergent subsequence.)
Solution
Plan. Argue by contradiction with sequences: if the inverse is not continuous, a bad sequence in K has a convergent subsequence, and pushing it forward with f gives a contradiction. (4.5 proves the same fact with closed sets.)
Let g=f−1 and suppose yn→y in Y but g(yn)→g(y). Here we use the sequence form of continuity, 4.5. Then for some ε>0 there is a subsequence with d(g(ynk),g(y))≥ε. The points xk=g(ynk) lie in the compact K, so a further subsequence converges to some x∈K, with d(x,g(y))≥ε. By continuity, f(xk)→f(x), but f(xk)=ynk→y, so f(x)=y by uniqueness of limits, so x=g(y) by injectivity, a contradiction with d(x,g(y))≥ε. ■
stretch
Prove that the set K={f∈C[0,1]:∣f(x)−f(y)∣≤∣x−y∣ and f(0)=0} is totally bounded in the sup metric. (This is the Arzelà–Ascoli idea. K is also closed, so it is compact.)
Solution
Plan. Round the function values on a grid; the Lipschitz condition forces each function to be close to a rounded step version of itself.
Fix ε>0 and choose N with N1<4ε. Grid points xj=Nj. For f∈K, ∣f(xj)∣≤xj≤1. Round each f(xj) to the nearest multiple of 4ε: finitely many possible rounded vectors (r1,…,rN). Two functions f,g∈K with the same rounded vector satisfy ∣f(xj)−g(xj)∣≤4ε at every grid point. For any x, pick the nearest grid point xj with ∣x−xj∣≤N1<4ε: ∣f(x)−g(x)∣≤∣f(x)−f(xj)∣+∣f(xj)−g(xj)∣+∣g(xj)−g(x)∣<4ε+4ε+4ε<ε. So the functions of K fall into finitely many classes, each of diameter below ε in d∞; picking one function from each class gives finitely many balls of radius ε covering K. ■
stretch
Prove that a compact metric space K has a countable dense subset: a countable set D⊆K such that every ball B(x,r) with x∈K contains a point of D.
Solution
Plan. Total boundedness at the scales n1 gives finitely many centres at each scale. Collect all the centres.
For each n, total boundedness gives a finite set Dn⊆K with K=⋃p∈DnB(p,n1). Let D=⋃nDn, a countable union of finite sets, so countable. Given x∈K and r>0, choose n with n1<r. Then x∈B(p,n1) for some p∈Dn, so d(x,p)<n1<r, that is p∈B(x,r)∩D. ■
Summary
A set is sequentially compact if every sequence in it has a subsequence converging to a point of the set. It is compact if every open cover has a finite subcover. In a metric space these two are the same.
Compact sets are closed and bounded in every metric space. In Rn the converse holds as well: this is Heine–Borel, proved by halving a box that has no finite subcover until the boxes shrink to a point covered by one open set.
In a function space the closed unit ball is closed and bounded and not compact (tent functions at distance 1 from each other). The general statement is: compact means complete and totally bounded.
The proof that sequentially compact implies compact uses a Lebesgue number: one radius such that every ball of that radius sits inside a single set of the cover.
A continuous map sends compact sets to compact sets. Hence a continuous real function on a compact set attains its maximum and minimum, and a continuous map on a compact set is uniformly continuous.
Compactness is how an infinite set earns the good properties of a finite one: finite sets have a largest value and a smallest tolerance.
In machine learning, a minimizer of a continuous loss exists on a compact weight set. Logistic loss on separable data has infimum 0 on the whole line and no minimizer.
MATH 375: Apostol 8.2 to 8.3 define open sets and balls but never use the word compact. The extreme value theorem for a continuous function on a closed bounded region of $\mathbb R^n$ (Apostol 9.9 to 9.12, maxima and minima) is quoted without proof. This chapter proves it.
MATH 521: 521 spends several weeks here: Heine–Borel, sequential compactness, the equivalence in metric spaces, the extreme value theorem and uniform continuity on compact sets. Chapter 4.3 contains all of them with full proofs.
MATH 551: Topology defines compact by open covers alone and proves that compact spaces are well behaved: closed subsets are compact, continuous images are compact. The sequential definition used here is only equivalent for metric spaces.
CS 532 / optimization: A minimizer of a continuous loss exists when the search region is compact. Constraining weights to a norm ball is what makes that hold in finite dimensions.