Tutorials › Real Analysis › Prove a Metric-Space Compactness Theorem

Comprehensive Proof Practicum · Tutorial 983 of 1000

Prove a Metric-Space Compactness Theorem

Learn how completeness and total boundedness combine to characterize compactness in metric spaces, and how to use the theorem to test examples.

Advanced 9 min read

What You'll Learn

  • Define completeness and total boundedness for metric spaces
  • Extract a Cauchy subsequence from any sequence in a totally bounded space
  • Prove that compact metric spaces are complete
  • Prove the complete-and-totally-bounded characterization of compactness
  • Test the theorem on a closed interval, an open interval, and an infinite discrete space

Compactness Through Two Metric Conditions

Compactness in a metric space can be described using open covers, but many arguments about metric spaces are easier to conduct with sequences and distances. The Compactness and Sequential Compactness in Metric Spaces theorem, established earlier in the course, lets us move between these viewpoints. Here we use it to prove a further characterization: a metric space is compact exactly when it is complete and totally bounded.

The two conditions play different roles. Total boundedness ensures that points in any sequence can repeatedly be confined to smaller and smaller regions, producing a Cauchy subsequence. Completeness then guarantees that this subsequence converges to a point of the space. In the other direction, compactness supplies convergent subsequences, which can be used to prove completeness; compactness also implies total boundedness by the result established earlier in the course.

Definition: A sequence \((x_n)\) in a metric space \((X,d)\) is Cauchy if, for every \(\varepsilon>0\), there is a positive integer \(N\) such that \(d(x_m,x_n)<\varepsilon\) whenever \(m,n\geq N\). The space is complete if every Cauchy sequence in it converges to a point of the space. A subset \(F\subseteq X\) is totally bounded if, for every \(\varepsilon>0\), there are finitely many points \(p_1,\ldots,p_k\in F\) such that every \(x\in F\) satisfies \(d(x,p_i)<\varepsilon\) for at least one \(i\). Such a finite collection is called an \(\varepsilon\)-net for \(F\).

The centers of a net are required to lie in the set being covered. This convention is convenient for constructing subsequences: if a sequence lies in \(F\), a ball centered at a net point still gives a direct bound on the distances between sequence terms in that ball. The empty set is complete and totally bounded, with the latter condition holding vacuously; it is also compact.

Total Boundedness Produces a Cauchy Subsequence

The first step is a sequence-selection argument. At each stage, a finite net covers the space by finitely many small balls. Among those balls, at least one must contain terms with infinitely many indices from the part of the sequence retained so far. Choosing such a ball repeatedly gives nested infinite sets of indices.

Lemma (Cauchy Subsequence in a Totally Bounded Space): Let \((X,d)\) be a totally bounded metric space. Every sequence in \(X\) has a Cauchy subsequence.

Proof. Let \((x_n)\) be a sequence in \(X\). For each positive integer \(j\), total boundedness gives a finite \(2^{-j}\)-net for \(X\), so finitely many open balls of radius \(2^{-j}\), centered in \(X\), cover \(X\).

Set \(A_0=\mathbb{N}\), the set of positive integers. Suppose an infinite set of indices \(A_{j-1}\) has been chosen. The finitely many balls in the \(2^{-j}\)-cover cover every \(x_n\) with \(n\in A_{j-1}\). At least one of these balls contains \(x_n\) for infinitely many indices \(n\in A_{j-1}\); otherwise the union of the finitely many finite sets of such indices would be finite, contrary to the infinitude of \(A_{j-1}\). Let \(A_j\) be an infinite set of those indices. Thus \(A_j\subseteq A_{j-1}\), and all terms \(x_n\) with \(n\in A_j\) lie in one ball of radius \(2^{-j}\).

Choose indices \(n_j\in A_j\) recursively so that \(n_1<n_2<\cdots\). This is possible because each \(A_j\) is infinite, hence contains indices larger than any fixed integer. If \(p,q\geq j\), then \(n_p,n_q\in A_j\), since the sets of indices are nested. Both \(x_{n_p}\) and \(x_{n_q}\) lie in the same ball of radius \(2^{-j}\), so the triangle inequality gives

$$ d(x_{n_p},x_{n_q})<2^{-j}+2^{-j}=2^{1-j}. $$

Given \(\varepsilon>0\), choose \(j\) large enough that \(2^{1-j}<\varepsilon\). For all \(p,q\geq j\), the displayed estimate then gives \(d(x_{n_p},x_{n_q})<\varepsilon\). Thus \((x_{n_j})\) is Cauchy. \(\square\)

The proof does not claim that the original sequence is Cauchy, nor that all its terms lie in one small ball. Instead, it selects a subsequence whose sufficiently late terms lie together in a ball at each chosen scale. The radii tend to zero, which is what makes the subsequence Cauchy.

Worked Example: Finding a Cauchy Subsequence by Finite Covers

Consider the sequence \(x_n=(-1)^n+1/n\) in \(\mathbb{R}\). It is not Cauchy: the even-indexed terms approach \(1\), while the odd-indexed terms approach \(-1\). The subsequence with even indices is \(x_{2k}=1+1/(2k)\). For \(p,q\geq1\),

$$ |x_{2p}-x_{2q}| =\left|\frac{1}{2p}-\frac{1}{2q}\right| \leq \frac{1}{2p}+\frac{1}{2q}. $$

If \(p,q\geq N\), this is at most \(1/N\), which is less than any prescribed \(\varepsilon>0\) once \(N>1/\varepsilon\). Thus the even-indexed subsequence is Cauchy. This explicit selection illustrates the type of subsequence the lemma guarantees in a totally bounded space; the lemma itself does not require an algebraic formula for the sequence.

The Metric-Space Compactness Theorem

We can now prove the characterization. For the forward implication, compactness gives total boundedness by the theorem Every compact metric space is totally bounded, established earlier in the course. It also gives sequential compactness by the Compactness and Sequential Compactness in Metric Spaces theorem. A convergent subsequence of a Cauchy sequence will force the whole sequence to converge. For the reverse implication, the lemma and completeness give a convergent subsequence for every sequence, after which the same compactness-sequential compactness theorem applies.

Theorem (Metric-Space Compactness Theorem): A metric space is compact if and only if it is complete and totally bounded.

Proof. First suppose \(X\) is compact. By the Compactness and Sequential Compactness in Metric Spaces theorem, every sequence in \(X\) has a subsequence converging to a point of \(X\). We show that \(X\) is complete. Let \((x_n)\) be Cauchy in \(X\), and choose a subsequence \((x_{n_k})\) converging to some \(x\in X\). Let \(\varepsilon>0\). Since \((x_n)\) is Cauchy, there is an \(N_1\) such that

$$ d(x_m,x_n)<\frac{\varepsilon}{2} \qquad(m,n\geq N_1). $$

Since \(x_{n_k}\to x\), there is a \(k\) large enough that \(n_k\geq N_1\) and \(d(x_{n_k},x)<\varepsilon/2\). For every \(n\geq N_1\), the triangle inequality yields

$$ d(x_n,x)\leq d(x_n,x_{n_k})+d(x_{n_k},x) <\frac{\varepsilon}{2}+\frac{\varepsilon}{2} =\varepsilon. $$

Therefore \(x_n\to x\), proving completeness. Total boundedness follows from the theorem Every compact metric space is totally bounded. Hence every compact metric space is complete and totally bounded.

Conversely, suppose \(X\) is complete and totally bounded. If \(X\) is empty, it is compact. Otherwise, take any sequence in \(X\). By the Cauchy Subsequence in a Totally Bounded Space lemma, it has a Cauchy subsequence. Completeness implies that this subsequence converges to a point of \(X\). Thus every sequence in \(X\) has a subsequence converging to a point in \(X\), so \(X\) is sequentially compact. By the Compactness and Sequential Compactness in Metric Spaces theorem, \(X\) is compact. This proves both implications. \(\square\)

The argument separates the work cleanly: total boundedness supplies a Cauchy subsequence, and completeness supplies its limit inside the space. Neither condition alone can replace the other in this theorem.

Testing the Two Conditions

Worked Example: A Closed Interval Is Compact

Consider \(X=[-2,3]\) with the usual distance \(d(x,y)=|x-y|\). To see that \(X\) is complete, let \((x_n)\) be Cauchy in \(X\). It is also Cauchy as a real sequence, so completeness of \(\mathbb{R}\) gives a real limit \(x\). Since \(-2\leq x_n\leq3\) for every \(n\), preservation of order under limits gives \(-2\leq x\leq3\). Thus \(x\in X\), and \(X\) is complete.

To check total boundedness, let \(\varepsilon>0\). Choose a positive integer \(m\) with \(5/m<\varepsilon\). Use the finite set of centers

$$ -2+\frac{5j}{m},\qquad j=0,1,\ldots,m. $$

These centers lie in \([-2,3]\). Every \(x\in[-2,3]\) lies in one of the \(m\) subintervals of length \(5/m\) between consecutive centers, so its distance from at least one endpoint of that subinterval is at most \(5/m<\varepsilon\). The centers form a finite \(\varepsilon\)-net. The Metric-Space Compactness Theorem now implies that \([-2,3]\) is compact.

Worked Example: The Open Interval Is Not Complete

The interval \((0,1)\), with the usual distance, is totally bounded. Given \(\varepsilon>0\), choose an integer \(m\geq2\) with \(1/m<\varepsilon\). The finitely many points \(k/m\), for \(k=1,\ldots,m-1\), lie in \((0,1)\). Every \(x\in(0,1)\) lies within distance at most \(1/m\) of one of these points: between consecutive grid points this follows from the spacing \(1/m\), and near either endpoint the nearest listed point is still less than \(1/m\) away.

However, the sequence \(x_n=1/n\), for \(n\geq2\), is Cauchy because it converges to \(0\) in \(\mathbb{R}\). It has no limit in \((0,1)\): any limit in this subspace would also be a real limit, and uniqueness of limits would force it to equal \(0\), which is not in the interval. Thus \((0,1)\) is not complete, so the theorem shows that it is not compact.

Worked Example: An Infinite Discrete Space Is Not Totally Bounded

Let \(X=\mathbb{N}\) with the discrete metric \(d(m,n)=0\) when \(m=n\) and \(d(m,n)=1\) when \(m\neq n\). This space is complete. Indeed, if \((x_n)\) is Cauchy, apply the Cauchy condition with \(\varepsilon=1/2\). There is an \(N\) such that \(d(x_m,x_n)<1/2\) for \(m,n\geq N\). Distances in this metric are either \(0\) or \(1\), so the inequality forces \(x_m=x_n\) for all \(m,n\geq N\). The sequence is eventually constant and therefore converges in \(X\).

But \(X\) is not totally bounded. An open ball of radius \(1/2\) around any point \(p\in X\) contains only \(p\), because every other point has distance \(1\) from \(p\). A finite collection of such balls covers only finitely many natural numbers, so no finite \(1/2\)-net covers \(X\). The theorem therefore rules out compactness, despite completeness.

Why Both Hypotheses Matter

The examples show the distinct roles of the conditions. The open interval has finite nets at every scale, but a Cauchy sequence can approach a missing boundary point. The infinite discrete space has no missing limits for Cauchy sequences, but its points remain separated at a fixed positive distance, preventing any finite net at small scales. Compactness rules out both obstructions: it prevents Cauchy sequences from losing their limits and prevents a space from requiring infinitely many small balls to cover it.

A useful proof check is to keep the directions of the theorem separate. When starting from compactness, cite the earlier total-boundedness result and use sequential compactness to establish completeness. When starting from completeness and total boundedness, do not try to construct a finite subcover directly unless the particular problem calls for it. Instead, extract a Cauchy subsequence, invoke completeness, and conclude compactness through the established equivalence of compactness and sequential compactness in metric spaces.

1
For compactness to completeness.
Start with an arbitrary Cauchy sequence and use sequential compactness to obtain a convergent subsequence.
2
Pass convergence to the whole sequence.
Combine the Cauchy estimate with the subsequence's closeness to its limit using the triangle inequality.
3
For completeness and total boundedness to compactness.
Use finite covers at successively smaller radii to select a Cauchy subsequence, then apply completeness.
4
Finish with sequential compactness.
Once every sequence has a convergent subsequence with limit in the space, invoke the metric-space equivalence to obtain compactness.

Check Your Understanding

Use the definitions and proof strategy above to answer these questions.

  1. In the Cauchy Subsequence in a Totally Bounded Space lemma, why must one ball in each finite cover contain terms with infinitely many retained indices?
  2. How does completeness enter the proof that a complete, totally bounded space is compact?
  3. Why does compactness imply that a Cauchy sequence converges, even though sequential compactness initially gives only a convergent subsequence?
  4. Which condition fails for \((0,1)\), and which condition fails for \(\mathbb{N}\) with the discrete metric?
  5. Why must the centers of the finite nets in the definition of total boundedness belong to the space being covered?