A Short Introduction to Metric Spaces
Section 4: Compactness
In the final three sections of this introduction to metric spaces,
we will look at three important properties that metric spaces and their subsets can have: compactness,
completeness, and connectedness.
All of these are generalizations of familiar properties of sets in
Any closed, bounded subset of is compact. itself is the principal example of a
complete metric space. And any interval in is connected. This section introduces compactness.
But before we can even define compactness, we need the concept of an open cover.
Definition 4.1:
Let be a metric space, and let be a subset of An open cover
of (in ) is a collection of open subsets
of such that every point of
is contained in at least one of the open sets in the collection.
In other words, an open cover is a set of open subsets
of such that (where is some index set).
Definition 4.2:
Let be a subset of a metric space and suppose that
is an open cover of A subcover of from
is a subset of that is still an open cover of A subcover that is finite is said to be a
finite subcover.
Definition 4.3:
Let be a metric space, and let be a subset of is said to be a
compact subset of if every open cover of in has a finite
subcover. If every open cover of itself has a finite subcover, then is said to be
a compact metric space.
If is a subset of a metric space we seem to have two different meanings
for compactness of because can be considered to be a
subspace of
That is, we can consider the metric space where is the subspace metric
on and ask whether is a compact metric space. So if I simply say
" is compact," do I mean that is a compact subset in or do I mean
that is a compact metric space? Fortunately, there is no ambiguity in
saying simply that is compact, because
the two conditions are equivalent:
Theorem 4.1:
Let be a metric space, and let be a subset of Then is a compact subset
of if and only if the subspace is a compact metric space.
Proof:
Suppose that is a compact subset of To show that is a compact metric
space, let be a collection of open subsets in the metric
space that covers We need to find a finite subcover of from
By Theorem 2.1,
for each there is an open subset of such that
The collection is then an open cover of in Since
is a compact subset of there is finite subcover
of from But then
is a finite subcover of from To see this, let
Then there is some such that Since and
then That is, So, every element of is
contained in some
Conversely, suppose that is a compact metric space, and let
be an open cover of in so that each is an open subset of
Then, again using Theorem 2.1,
is an open cover of consisting of open sets in
This open cover has a finite subcover
And it is then clear that is a finite subcover of
from ∎
As our first example, we show that every bounded, closed interval in is compact. This is a
special case of the well-known Heine-Borel Theorem, which says that every bounded, closed
subset of is compact. We will not prove the general result here.
Theorem 4.2:
Every bounded, closed interval in is compact.
Proof:
Let with and consider the
bounded, closed interval Suppose that
is an open cover of in Consider the set
the interval has a finite subcover from
Now, for some and therefore is a finite cover of
from So, and is non-empty. Furthermore
is bounded above by By the least upper bound axiom,
every non-empty subset of that is bounded above has a least upper bound.
Let be the least upper bound of Note that
because and is an upper bound for That is,
We show that and that This will finish the
proof of the theorem, since by definition of it will mean that
has a finite subcover from
Since and is an open cover of
there is a such that
Since is open, there is an such that
Since is the least upper bound for there must be some such
that for otherwise, would be an
upper bound for that is smaller than Since there is a finite subcover
of from say
But then since we get a finite
subcover of by adding to
So, by definition of
Finally, we show that Suppose for the sake of contradiction that
Let Then and therefore
is a finite subcover of
from And because This
means and But that contradicts the fact that
is an upper bound for This contradiction shows that
which finishes the proof. ∎
On the other hand, an open interval in is not compact. For example, consider the
open interval The collection
is an open cover of that has no finite subcover. You are asked to verify
this in Exercise 4.1. Similarly, the half-open interval is not compact.
You might think about what goes wrong if you try to apply the proof of Theorem 4.2
to the set In fact, as our next theorem shows, any compact subset of
a metric space must be closed.
Take careful note of how the finite subcover property is used in the proof; the
technique is common in proofs about compactness.
Theorem 4.3:
Let be a metric space, and supposed that is a compact subset of
Then is a closed subset of
Proof:
We show is closed by showing that its complement, is open.
Let We must find an such that
For each let Since
so that is an open set.
Note that and
The collection is an open cover
of since any is covered by the open set
Since is compact, there is a finite subcover Let

We show that which will finish the proof.
To show this, let We want to show that is,
Consider where
By the triangle inequality,
So, subtracting from both sides of the inequality,
(The last inequality follows
because )
Then, since is not in the open ball of radius about
Since this is true for every and
the open balls cover we have that ∎
It is also true that every compact set is bounded, but we need a definition of bounded
that applies to all metric spaces, not just to
"Bounded" should mean that the subset "does not extend to infinity," that is, that
it is contained in some open ball around some point. But we will use an equivalent
definition, which says that a set is bounded if there is a limit on how far
apart two points in the set can be. We can define the "diameter" of such
a subset:
Definition 4.4:
Let be a metric space. A subset of is said to be bounded
if and only if the set of real numbers is bounded above.
For a non-empty bounded set we define the diameter of
to be the least upper bound of the set (which
exists by the least upper bound property of since the set is bounded above).
Note that by this definition, the empty set is bounded, but we
will not attempt to define the diameter of the empty set.
Theorem 4.4:
Let be a metric space, and supposed that is a compact subset of
Then is bounded.
Proof:
If is empty, then it is bounded. Suppose that is not empty.
Let be any element of and consider the
collection of open balls of integral radius, Since every element of
has some finite distance from this collection is an open cover of
Since is compact, it has a finite subcover
where we can assume But since this means that by itself
already covers Then, for and are in and
It follows that is an upper bound
for So, is bounded. ∎
We have shown that every compact subset of a metric space is closed and
bounded. However, the converse does not hold in general. That is, it is not
the case that every closed, bounded set is compact. However,
that is true for subsets of with the usual metric, and this fact gives a complete
characterization of compact subsets of We will not prove this,
but Exercise 4.8 proves it for the case
We turn to another property of compact sets.
The Bolzano-Weirstrass Theorem for closed, bounded intervals in says that
any infinite subset of such an interval has an
accumulation point in the interval.
A similar result holds for a compact subset of a metric space.
The proof is again an application of the finite subcover property.
Theorem 4.5:
Let be a metric space and let be a compact subset of
Then any infinite subset of has an accumulation point that is an element of
Proof:
We prove the contrapositive. Let Assume that has no accumulation
point in We must show that is finite. Let Since is
not an accumulation point of there is an such that
Thus,
either is empty or is the single point The set of
open balls is an open cover of
Since is compact, there is a finite subcover. That is, there are finitely
many points such that the corresponding open balls
already cover But each of the open balls in that subcover contains at most one
point of and it follows that has or fewer points. So
we have proved that is finite. ∎
Another version of the Bolzano-Weirstrass says that every bounded infinite
sequence in has a convergent subsequence.
We prove an analogous theorem for compact sets.
Theorem 4.6:
Let be a metric space, and suppose that is a compact subset
of Let be any sequence of points in
Then has a subsequence that converges to a point
in
Proof:
If the terms of the sequence include only finitely many different
points of then at least one of those points, say occurs infinitely
often in the sequence. Then has a constant
subsequence consisting of all the occurrences of and that
subsequence converges to which is in since every is in
So, suppose that the terms of the sequence include infinitely many different
points in Since is compact, the infinite subset containing all of
the terms of the sequence has an accumulation point in by the previous theorem.
Let be that accumulation point. We show that
has a subsequence that converges to We use the result
from Exercise 1.8, which implies that for any
the open ball contains infinitely many of the
terms of the sequence. Since is an accumulation
point of the set consisting of all the there is an index
such that Then, since contains
infinitely many terms of the sequence, there is an index
such that Then, since contains
infinitely many terms of the sequence, there is an index
such that Proceeding in this way,
we obtain indices such that
for all It follows easily that the
subsequence converges to ∎
We finish with an important theorem about the relationship between
continuity and compactness:
The image of a compact set under a continuous function is a compact set.
Theorem 4.7:
Let and be metric spaces, and let
be a continuous function. Then for any
compact subset of the image is a compact
subset of
Proof:
Let be a compact subset of To show that is compact, we must show that any open
cover of has a finite subcover.
Suppose that
is an open cover of in By
Theorem 3.3,
each set is open in Furthermore,
the collection
covers , since for for
some and then
Since is compact, it has a finite subcover,
I claim that
is a finite subcover of from In fact, let
That is, for some Now,
for some So,
That is, every element of is covered by some ∎
Exercises
Exercise 4.1
Show that the open interval is not a compact subset of by verifying
that
is an open cover of that has no finite subcover.
Exercise 4.2
Show that the closed interval is not a compact subset of by finding
an open cover of that has no finite subcover.
Exercise 4.3
Consider a metric space where is the discrete metric as defined
in Exercise 1.5.
Let be any infinite subset of Show that is closed and bounded but
not compact.
Exercise 4.4
Consider the subspace of That is, consider
the metric space where is the restriction of the usual metric
on to Let
Show that is a closed, bounded subset of that is not compact.
Hint: Use Theorem 2.1
for part of the proof.
Exercise 4.5
Let be a metric space, and let be a non-empty subset of Show that the following
are equivalent:
- is bounded (in the sense that it has a finite diameter)
- For every there is a number such that
- There is a and a number such that
Hint: The proof of Theorem 4.3 already did part of the work.
Exercise 4.6
A subset of a metric space is said to be totally bounded
if for every can be covered by a finite collection of
open balls of radius Show that every compact set is totally bounded.
Hint: Start with one open ball of radius for every element of
Exercise 4.7
Let be a metric space. Let be a compact subset of and let
be a closed subset of Then is compact. Hint:
The set is an open set; try adding this set to an
open cover of
Exercise 4.8
Show that any bounded, closed subset of is compact. Hint: Use the previous
exercise and Theorem 4.2.
Exercise 4.9
Let be a non-empty compact metric space and let be a continuous
function (where has its usual metric). Show that achieves a
minimum value and a maximum value. That is, there is an such that
for all and there is a such that
for all
This is a generalization of the Extreme Value Theorem.
Hint: Use the fact that is compact, and apply and
Exercise 1.10 along
with some theorems from this section.
Exercise 4.10
This exercise considers the idea of the distance between sets.
Let be a metric space, let and be non-empty subsets of
Define and Note that if
then Find an example where but
Now suppose that and are non-empty compact subsets of Show that if and
only if Hint: Suppose and Then,
because is open, there is an such that
(Note that the result remains true if we just
assume that is closed and is compact.)