Many existence theorems in analysis depend on some set being compact. Therefore, it is important to be able to identify compact sets. The purpose of this section is to describe compact sets in a metric space.
Definition 6.2.1 Let A be a subset of X. A is compact if whenever A is contained in the union of a set of open sets, there exists finitely many of these open sets whose union contains A. (Every open cover admits a finite subcover.) A is “sequentially compact” means every sequence has a convergent subsequence converging to an element of A.
In a metric space compact is not the same as closed and bounded!
Example 6.2.2 Let X be any infinite set and define d
You should verify the details that this is a metric space because it satisfies the axioms of a metric. The set X is closed and bounded because its complement is ∅ which is clearly open because every point of ∅ is an interior point. (There are none.) Also X is bounded because X = B
From this example it is clear something more than closed and bounded is needed. If you are not familiar with the issues just discussed, ignore them and continue.
Definition 6.2.3 In any metric space, a set E is totally bounded if for every ε > 0 there exists a finite set of points {x_{1},

The following proposition tells which sets in a metric space are compact. First here is an interesting lemma.
Lemma 6.2.4 Let X be a metric space and suppose D is a countable dense subset of X. In other words, it is being assumed X is a separable metric space. Consider the open sets of the form B
Proof: Let U be an open set and let x ∈ U. Let B

Now let C be any collection of open sets. Each set in this collection is the union of countably many sets of ℬ. Let ℬ^{′} denote the sets of ℬ which are contained in some set of C. Thus ∪ℬ^{′} = ∪C. Then for each B ∈ℬ^{′}, pick U_{B} ∈C such that B ⊆ U_{B}. Then
Proof: Suppose 6.2.3 and let

is a closed set because it has no limit points and if

then

but there is no finite subcovering, because no value of the sequence is repeated more than finitely many times. This contradicts compactness of
Now suppose 6.2.4 and let {x_{n}} be a Cauchy sequence. Is
Now suppose 6.2.5. What about 6.2.4? Let {p_{n}} be a sequence and let {x_{i}^{n}}_{i=1}^{mn }be a2^{−n} net for n = 1,2,

be such that B_{n} contains p_{k} for infinitely many values of k and B_{n} ∩B_{n+1}≠∅. To do this, suppose B_{n} contains p_{k} for infinitely many values of k. Then one of the sets which intersect B_{n},B

Then if k ≥ l,
Now suppose 6.2.4 and 6.2.5 which have now been shown to be equivalent. Let D_{n} be a n^{−1} net for n = 1,2,

Thus D is a countable dense subset of
Now let C be any set of open sets such that ∪C⊇ X. By Lemma 6.2.4, there exists a countable subset of C,

such that ∪

All but finitely many points of {p_{nk}}are inX ∖∪_{k=1}^{n}U_{k}. Therefore p ∈ X ∖∪_{k=1}^{n}U_{k} for each n. Hence

contradicting the construction of {U_{n}}_{n=1}^{∞} which required that ∪_{n=1}^{∞}U_{n} ⊇ X. Hence X is compact. This proves the proposition.
Consider ℝ^{n}. In this setting totally bounded and bounded are the same. This will yield a proof of the Heine Borel theorem from advanced calculus.
Proof: Let A be totally bounded. Is it bounded? Let x_{1},

Thus A ⊆ B
Now suppose A is bounded and suppose A is not totally bounded. Then there exists ε > 0 such that there is no ε net for A. Therefore, there exists a sequence of points {a_{i}} with

(x ∈[−r,r)^{n} means x_{i} ∈ [−r,r) for each i.) Now define S to be all cubes of the form

where

for i ∈{0,1,
The next theorem is called the Heine Borel theorem and it characterizes the compact sets in ℝ^{n}.
Proof: Since a set in ℝ^{n} is totally bounded if and only if it is bounded, this theorem follows from Proposition 6.2.5 and the observation that a subset of ℝ^{n}is closed if and only if it is complete. This proves the theorem.