1. Completeness and Compactness

Here we continue the exploration of the relationship between compactness and completeness. The first observation is a very important topological observation: subsets of complete metric spaces inherit completeness if and only if they are closed.
Lemma
A subset of a complete metric space is complete if and only if it is closed.
Proof
If \((X,d)\) is a complete metric space, \(E\) is a subset of \(X\), and \(\{x_n\}_{n=1}^\infty\) is a Cauchy sequence in \(E\), then we may trivially regard \(\{x_n\}_{n=1}^\infty\) as a Cauchy sequence in \(X\) as well. By completeness of X, there is some limit \(x \in X\). If the sequence \(\{x_n\}_{n=1}^\infty\), when regarded as a sequence in \(E\), has some limit \(e \in E\), then \(d(x_n,e) \rightarrow 0\) as \(n \rightarrow \infty\) by definition of convergence. But likewise \(d(x_n,x) \rightarrow 0\) as \(n \rightarrow \infty\), and by the triangle inequality, \(d(x,e) \leq d(x,x_n) + d(x_n,e)\), and taking the limit gives that \(d(x,e) = 0\) as points in \(X\); consequently the sequence converges in \(E\) if and only if its limit \(x\) belongs to \(E\). It is left as an exercise to show that in complete metric spaces, closed sets are the only sets which contain all limits of all sequences within them.

The next lemma is not of the same fundamental importance as the one above, but it will be very useful in establishing that all compact metric spaces are complete.
Lemma
Suppose that \((X,d)\) is a metric space and \(\{x_n\}_{n=1}^\infty\) is a Cauchy sequence in \(X\). Then \(\{x_n\}_{n=1}^\infty\) is convergent if and only if there is some \(x \in X\) such that every neighborhood \(N_\epsilon(x)\) contains \(x_n\) for infinitely many values of \(n\).
Proof
If there is some \(x\) such that every neighborhood \(N_\epsilon(x)\) contains \(x_n\) for infinitely many \(n\), we can show that \(x_n \rightarrow x\), simply because there will always be some threshold \(N\) such that \(d(x_n,x_m) < \epsilon/2\) for all \(n,m > N\) and there will always be some \(n > N\) such that \(d(x,x_n) < \epsilon/2\), so by the triangle inequality, \(d(x,x_m) < \epsilon\) for all \(m > N\).

On the flip side, if \(\{x_n\}_{n=1}^\infty\) is known to converge, the limit point \(x\) has \(x_n \in N_\epsilon(x)\) for all \(n\) sufficiently large.
Theorem
Every compact metric space is complete.
Proof
Suppose \(\{x_n\}_{n=1}^\infty\) is a Cauchy sequence which doesn't converge. Since it doesn't converge, every point \(y \in X\) must have some \(\epsilon > 0\) such that \(N_\epsilon(y)\) contains \(x_n\) for only finitely many values of \(n\). Because \(X\) is compact, we can cover \(X\) by finitely many such balls \(N_{\epsilon_1}(y_1),\ldots,N_{\epsilon_M}(y_M)\). But this would imply that \(x_n \in X\) for only finitely many values of \(n\), which is certainly a contradiction.
Corollary
If \((X,d)\) is a compact metric space, then every sequence \(\{x_n\}_{n=1}^\infty\) in \(X\) has a convergent subsequence.
Proof
By completeness, it suffices to show that there is a subsequence which is Cauchy. Here we can approximate the proof of the Bolzano-Weierstrass Theorem: we can cover \(X\) by finitely many neighborhoods \(N_1(y)\) of radius \(1\); at least one such neighborhood \(N_1(y_1)\) must contain \(x_n\) for infinitely many values of \(n\). Now cover the closure of \(N_1(y_1)\) by finitely many balls of radius \(1/2\); there must be at least one, \(N_{1/2}(y_2)\) containing \(x_n\) for infinitely many of the indices \(n\) satisfying \(x_n \in N_1(y_1)\). Continuing in this way, we must have balls \(N_{2^{-j}}(y_j)\) for each \(j \geq 0\) such that \(x_n \in N_{2^{-j}}(y_j) \cap \cdots \cap N_{1}(y_1)\) for infinitely many values of \(n\). We can define \(n_1\) to be the smallest \(n\) such that \(x_n \in N_1(y_1)\) and can take \(n_j\) to be the smallest \(n > n_{j-1}\) such that \(x_n \in N_{2^{-j}}(y_j) \cap \cdots \cap N_{1}(y_1)\). If \(j_1,j_2 > j\), it follows that \(x_{n_{j_1}}\) and \(x_{n_{j_2}}\) both belong to \(N_{2^{-j-1}}(y_{j+1})\) and the triangle inequality gives that \(d(x_{n_{j_1}},x_{n_{j_2}}) < 2^{-j}\). Thus our subsequence is Cauchy. By completeness, it converges.
Exercises
  1. Suppose that \((X,d)\) is a complete metric space. Show that a set \(E \subset X\) has the property that all convergent sequences \(\{x_n\}_{n=1}^\infty \subset E\) have their limit in \(E\) if and only if \(E\) is closed.

2. Baire Category Theorem

The Baire Category Theorem is another extremely important result concerning complete metric spaces. It is the foundation of a number of very important theorems in functional analysis, for example. Roughly speaking, it asserts that complete metric spaces cannot be written as countable unions of ``negligible sets.‘’ The statement and its proof are given below.
Definition
A closed set \(E\) in a metric space \((X,d)\) is called nowhere dense if it contains no neighborhood \(N_\epsilon(x)\), i.e., if \(N_\epsilon(x) \not \subset E\) for each \(\epsilon > 0\) and \(x \in X\).
Theorem (Baire Category Thm)
Suppose \((X,d)\) is a complete metric space. If \(E\) is a countable union of nowhere dense sets, then \(E \neq X\), i.e., there must be a point \(x \in X \setminus E\).
Proof of BCT: Part 1 The proof is not unlike the proof above concerning convergent subsequences. Let \(E_1,E_2,\ldots,\) be the closed, nowhere dense sets whose union is \(E\). Since \(E_1^c\) is open, it must contain a neighborhood \(N_{r_1}(y_1)\). Since \(E_2\) is nowhere dense, it does not contain \(N_{r_1/4}(y_1)\), and consequently, the open set \(N_{r_1/4}(y_1) \setminus E_2\) is nonempty and therefore contains a ball \(N_{r_2}(y_2)\). Without loss of generality, it may be assumed that \(r_2 < r_1/4\). Thus, for this \(y_2\) and \(r_2\), \(N_{r_2}(y_2) \subset N_{r_1/4}(y_1) \setminus E_2\). Repeating this construction for each \(k\), there is always some \(r_k < r_{k-1}/4\) and ball \(N_{r_k}(y_k) \subset N_{r_{k-1}/4}(y_{k-1}) \setminus E_{k}\) for each \(k > 1\).

The image below illustrates the construction: the gray shaded disk represents the neighborhood \(N_{r_k}(y_k)\). It is chosen so that it does not to intersect the set \(E_k\), represented by the curve on the right. The neighborhood's radius is reduced by a factor of four, indicated by the smaller dotted circle centered at \(y_k\). Within this reduced neighborhood, a new neighborhood \(N_{r_{k+1}}(y_{k+1})\) is selected (shaded in blue) in such a way that it does not meet \(E_{k+1}\). The process then continues indefinitely.
Figure. Illustration of the Baire Category Theorem Construction

Part 2: Convergence of the \(y_k\) Consider the sequence \(\{y_k\}_{k=1}^\infty\). We will show this is a Cauchy sequence. This is because we have by induction that \(r_k < 4^{-k+1} r_1\) for each \(k > 1\) and that \(y_{k'} \in N_{r_k/4}(y_k)\) whenever \(k' > k\). Therefore if \(k',k'' > K\) for some indices \(k',k'',K\), it follows by the triangle inequality that \(d(y_{k'},y_{k''}) \leq 2 (r_K/4) < 2 r_1 4^{-K}\). Choosing \(K\) large enough that \(2 r_1 4^{-K} < \epsilon\) when \(\epsilon > 0\) is given establishes that the sequence is Cauchy. Because \(X\) is complete, the sequence of \(y_k\)'s converges to some \(y\). We will show that this \(y\) cannot belong to \(E_j\) for any \(j\).

Part 3: Distance Estimates and Conclusion Notice that for each \(k > 1\), \(d(y_{k+1},y_{k}) < r_{k}/4\). By the triangle inequality,
\[{}d(y_{k+\ell},y_k) < \frac{r_{k}}{4} + \cdots + \frac{r_{k+\ell-1}}{4}{}\]
\[{}< \frac{r_{k}}{4} + \frac{r_k}{16} + \frac{r_k}{64} + \cdots{}\]
\[{}\leq \frac{r_k}{3}.{}\]
Since \(d(y_{k+\ell},y) < r_k/6\) for all \(\ell\) sufficiently large, it follows by a further application of the triangle inequality that \(d(y,y_k) < r_k\). Thus \(y\) must belong to \(N_{r_k}(y_k)\) for each \(k\). But \(N_{r_k}(y_k)\) is disjoint from \(E_k\), so \(y \not \in E_k\) for each \(k\).