LightMySky
En anglais

Compactness in Metric Spaces

Compare the open-cover and sequential definitions, prove they agree in a metric space, and see what compactness implies for continuous functions.

No account needed. Progress saves in this browser.

What a learner can do afterwards

  • Prove that continuous maps preserve compactness and that continuous real-valued functions on nonempty compact domains attain both bounds
  • Use completeness, total boundedness and separated sequences to distinguish compactness from closedness and boundedness
  • Prove the equivalence of open-cover and sequential compactness in metric spaces and identify the completeness step in Heine-Borel

1 · Read

You have used completeness to obtain limits of Cauchy sequences. Compactness adds another requirement. In a metric space X, write B(x,r)={y:d(x,y)<r}. An open cover is a family of open sets covering X. X is compact if every open cover has a finite subcover. It is sequentially compact if every sequence has a subsequence converging in X. A subsequence uses strictly increasing indices. For metric spaces, these two compactness definitions agree.

Suppose X is compact. If every ball about some x contains infinitely many indexed terms, choose increasing indices with distances to x below 1/j. This gives a convergent subsequence. Otherwise every x has a ball containing only finitely many indexed terms. These balls cover X. A finite subcover would contain only finitely many indices, a contradiction. Thus X is sequentially compact.

Infinite terms near xIncreasing indicesDistances below 1/jSubsequence tends to x

X is totally bounded if, for every ε>0, finitely many open ε-balls centred in X cover X. Sequential compactness implies total boundedness. Otherwise, for some ε, choose each new point outside the ε-balls about all earlier points. Distinct chosen points remain at least ε apart. No subsequence is Cauchy, so none converges. This contradicts sequential compactness.

Now suppose X is sequentially compact and fix an open cover. We claim some δ>0 makes every B(x,δ) lie in a cover member. If not, choose x_n such that B(x_n,1/n) lies in none. Select a subsequence x_(n_j) converging to x. A cover member U containing x contains B(x,r) for some r>0. Eventually d(x_(n_j),x)<r/2 and 1/n_j<r/2. The triangle inequality puts B(x_(n_j),1/n_j) inside U, a contradiction.

Total boundedness now gives a finite cover by δ/2-balls, centred at c_1,...,c_N. For each centre choose an original cover member containing B(c_i,δ). It also contains B(c_i,δ/2). Thus at most N original members cover X, proving compactness. This completes the metric equivalence of open-cover and sequential compactness. The empty space satisfies both definitions directly.

N small-ball centresChoose N cover membersEach contains its ballFinite subcover

A metric space is compact exactly when it is complete and totally bounded. We already proved total boundedness for compact spaces. To prove completeness, take a Cauchy sequence and a subsequence converging to x. For ε>0, choose a late subsequence term within ε/2 of x. All sufficiently late sequence terms are within ε/2 of that term. The triangle inequality gives distance below ε from x. The whole sequence converges to x.

Conversely, assume completeness and total boundedness. Cover X by finitely many balls of radius 2^(-j), for j=1,2,... . At each stage retain infinitely many previous indices in one ball, then select an index larger than the last selected index. The retained index groups are nested. Any two selected terms from stage j onward are less than 2^(1-j) apart. This is a Cauchy subsequence. Completeness gives its limit in X, proving compactness.

Finite small-ball coverRetain infinite indicesSelect increasing indicesCauchy subsequenceCompleteness gives limit

Heine-Borel: a subset of Euclidean R^m is compact exactly when it is closed and bounded. A bounded set lies in a box. Finite grids of small cells, with a centre chosen in each nonempty cell of the set, prove total boundedness. R^m is complete because each coordinate of a Cauchy sequence converges. A closed subset contains those limits and is complete. Conversely, compact subsets of metric spaces are closed and bounded.

In R, enclose a bounded sequence in a closed interval. Bisect it and retain a closed half with infinitely many indexed terms. Repeat within that half. The nested lengths tend to zero. Completeness supplies L=sup a_j for the left endpoints, with a_j≤L≤b_j for every j. Increasing indices chosen from the intervals give a subsequence converging to L in R. If the sequence lies in a closed subset K of R, then L belongs to K.

Nested closed intervalsLengths tend to zeroCompleteness supplies LIf K closed, L lies in K

Let f:K→Y be continuous and K compact. Pull an open cover of f(K) back through f: preimages of open sets are open in K and cover K. Compactness selects finitely many preimages. Their corresponding original sets cover f(K), so the image is compact. If Y=R, the image is also bounded: the cover (-n,n), n≥1, has a finite subcover.

Open cover of f(K)Preimages cover KFinite selection on KFinite cover of f(K)

For nonempty compact A in R, boundedness gives M=sup A. Choose y_n in A with M-1/n<y_n≤M. A subsequence converges in A, and these inequalities force its limit to be M. Applying the argument to -A gives a minimum. Thus a continuous real-valued function on a nonempty compact domain attains both bounds. The empty set is compact, since every cover has an empty finite subcover, but a function on it attains no values.

Use the usual distance when comparing these sets. The interval [0,1] in R is nonempty, closed and bounded, hence compact. Every continuous real-valued function on it attains both bounds. On (0,1), the continuous function 1/x is unbounded. On Q intersect [0,1], choose irrational a in (0,1). The continuous function 1/|x-a| is defined but unbounded as rational inputs approach a. Neither set has the same guarantee.

[0,1] in RClosed and boundedNonempty compact domainReal extrema attained

For a quadratic, -x²+2ax=a²-(x-a)²≤a². On a closed interval containing a, equality at x=a gives maximum a². For example, -x²+4x on [0,5] has maximum 4 at x=2. Also, for 0≤u≤v, v²-u²=(v-u)(v+u)≥0. Squaring preserves order on nonnegative inputs, so the maximum of x² on [u,v] is v².

-x²+4x4-(x-2)²(x-2)²≥0f(x)≤4

On (0,1], f(x)=-x has supremum 0 but no maximum: -1/n approaches 0, while -x=0 requires the excluded input 0. The sequence 1/n has no subsequence converging inside (0,1], so the domain is not compact. A missing endpoint does not prevent every extremum. On (0,b], where b>0, 1/x is unbounded above but has minimum 1/b at x=b. Positive x≤b gives 1/x≥1/b. Polynomials and reciprocals are continuous on their domains.

-1-1/2-1/3...Approach 0

K=Q intersect [0,1], with distance |x-y|, is closed relative to Q: its complement in Q consists of the points below 0 or above 1 and is open. K is bounded and totally bounded, using finite short-interval covers. Rational approximations to sqrt(2)/2 form a Cauchy sequence with no limit in K. Every subsequence has that same irrational real limit. Thus K is incomplete and not compact. K is not closed in R.

The space ell^2 consists of real sequences x with sum x_j² finite and norm ||x||=sqrt(sum x_j²). Its closed unit ball is {x:||x||≤1}. Let e_n have coordinate 1 at position n and 0 elsewhere. Each has norm 1. For n≠m, ||e_n-e_m||=sqrt(2). No subsequence is Cauchy, so none converges. This closed bounded ball is not compact: it lacks total boundedness.

||e_n||=1Distance sqrt(2)No Cauchy subsequenceBall is not compact

To count small balls, use separation. If distinct points p and q lie in one open ε-ball, the triangle inequality gives d(p,q)<2ε. Hence a ball of radius ε contains at most one point from a set whose pairwise distances are at least 2ε. Covering N such points needs at least N balls. N balls centred at the points suffice, giving an exact minimum.

Two points in one ballDistance less than 2εSeparation forbids thisOne ball per point

A closed subset F of compact X is compact. Write each member of an open cover of F as F intersect U, where U is open in X. Add X\F to the U sets to cover X. A finite subcover exists. Discard X\F and take the corresponding original cover members; they cover F. Finite metric spaces are compact too: select one cover member for each point.

Relative open cover of FAdd X\F to cover XFinite selection on XFinite cover of F

The sets U_n=(1/n,2), n≥1, form an open cover of (0,1]. For each x>0, choose an integer n>1/x. Then x belongs to U_n. In a finite selection let N be the largest index. Every selected set lies in U_N. The domain point 1/(N+1) is below 1/N, so no selected set contains it. This cover has no finite subcover.

Largest selected index NAll selected sets in U_N1/(N+1)<1/NDomain point uncovered

An infinite set can still be compact. Let K={0} union {1/n:n≥1}. Given an open cover, choose a member U containing 0. It contains (-r,r) intersect K for some r>0. Therefore all sufficiently late terms 1/n lie in U. Only finitely many earlier terms remain. Choose one cover member for each remaining point. Together with U, these form a finite subcover.

U contains 0U contains the tailFinite earlier termsFinite subcover

Metric compactness means complete and totally bounded. In Euclidean R^m it means closed and bounded. Continuous real functions attain extrema on nonempty compact domains.

This compactness lesson, its worked questions and flashcards were written for this dataset.

These compactness readings, additional questions and flashcards were written for this dataset.

More to read

From a compact domain to attained bounds

Let K be nonempty and compact, and let f:K→R be continuous. Begin with any open cover of f(K). Taking preimages gives open sets covering K. Finitely many preimages cover K, so their corresponding original sets cover f(K). This proves compactness of the image.

Write A=f(K). The intervals (-n,n), for positive integers n, cover A. A finite selection covers A, placing it inside one bounded interval. Thus A has a supremum M. Choose y_n in A with M-1/n<y_n≤M. Compactness gives a subsequence converging to a point of A. The inequalities force that limit to equal M. Therefore M belongs to A: some input gives the maximum value. Applying the argument to -A gives the minimum.

Nonemptiness matters. The empty set is compact, but no value can be attained on an empty domain. Compactness also gives a guarantee rather than a necessary condition for a particular function to have an extremum. On (0,4], the continuous function 1/x has minimum 1/4, although it is unbounded above and its domain is not compact. On (0,1], the continuous function -x has supremum 0 without a maximum.

Missing limits and separated points

A bounded metric space fits in one ball of some finite radius. A totally bounded space can be covered by finitely many open ε-balls for every ε>0. The second condition is stronger. Metric compactness is equivalent to completeness together with total boundedness.

Start with any sequence. At stage j≥1, cover the space by finitely many balls of radius 2^(-j). Retain infinitely many indices from the preceding group whose terms lie in one chosen ball. Select an index from this group larger than the previously selected index. The index groups are nested, so all selected terms from stage j onward lie in the stage-j ball. Their pairwise distances are less than 2^(1-j), which tends to zero. Given ε>0, choose j with 2^(1-j)<ε. This proves the subsequence is Cauchy. Completeness supplies its limit in the space.

The rational points of [0,1] are bounded and closed relative to Q. They are also totally bounded. Their failure is a missing limit: rational approximations to sqrt(2)/2 have no limit within the rational set.

The closed unit ball of ell^2 fails differently. A unit vector e_n has a single coordinate equal to 1. Distinct unit vectors have distance sqrt(2), so no subsequence is Cauchy. Any open ball of radius below sqrt(2)/2 contains at most one unit vector. A finite collection of those balls cannot cover all unit vectors. The unit ball is closed and bounded but not totally bounded, and therefore not compact.

Where completeness enters Heine-Borel

Heine-Borel applies to subsets of R^m with Euclidean distance. Such a subset is compact exactly when it is closed and bounded. Boundedness gives total boundedness: place the set inside a finite box, subdivide the box into cells of small diameter, and select a point of the set from each nonempty cell. These points provide a finite small-ball cover. Coordinatewise completeness of R makes R^m complete, and closed subsets retain the resulting limits.

In R, put a bounded sequence inside a closed interval. Retain a closed half containing infinitely many indexed terms and continue inside that half. The retained intervals are nested and their lengths tend to zero. Let a_j and b_j be their endpoints. The least-upper-bound property gives L=sup a_j. Each a_j≤L≤b_j, so L belongs to every retained interval. Choosing increasing indices from these intervals yields a subsequence converging to L in R. If the sequence lies in a closed subset K of R, then L belongs to K. Without this extra assumption, the limit need not lie in the sequence's range.

For the reverse direction, compactness gives closedness and boundedness. A sequence in the set approaching an ambient limit has a subsequence converging inside the set. Uniqueness of limits puts the ambient limit there too. To prove boundedness, cover the set by balls of positive integer radii about a fixed ambient point. A finite subcover places the whole set in one bounded ball.

2 · Watch

En anglais

Take it off screen

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Learn first

This opens up

Nothing builds on it yet.

Then practise

17 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.

Spotted a problem on this page? Tell us
Compactness in Metric Spaces · Mathematics, ages 21 to 22 · LightMySky