Note that this article assumes that the reader is familiar with metric spaces. At least at the level where open sets, closed sets, and subspaces are used. I am in the process of writing an article to describe the basics of metric spaces as well.
Today, we will cover some of the basics of a concept known as compactness. I recall that when I first learned about compactness, I was reading Jay Cummings’ book, Real Analysis: A Long-Form Textbook (you can find it in the list of Resources Worthy of Study on this site; this book is one of the best). In this book, Cummings calls the definition of a compact set “the greatest definition in all of mathematics”. Of course, this caught my attention and set the stage for my engagement with the concept. Looking back, I was very fortunate for this. If it weren’t for this characterization of compactness as being the greatest definition in math(s), I would have likely thought that this was one silly little thing that we would use once and then disregard in the future. Similar to how we define real numbers as equivalence classes of Cauchy sequences of rational numbers, and then disregard that entirely! This is why I mention this to you, in the hope that you, too, will benefit from knowing how important compactness is in the whole of mathematics. Moreover, we will cover more on compact sets here than in that particular book, so I hope this will be useful to all who read it. We will also cover some material about compact sets that is not covered in the classic text Baby Rudin. Hopefully, this will give you more intuition for the concept!
We will cover a few different characterizations of compactness, starting with the honest topological definition, as one of my professors put it. We give some examples of compact and non-compact subsets of real numbers. We then prove using the honest topological definition that the closed unit interval is compact. We then develop another characterization of compactness that deals with sequences of points. Along the way, we `accidentally’ find a third way to characterize compactness. This culminates with Theorem 4, which states that all three characterizations of compactness are equivalent. We end with a few consequences of compactness to really drive home why we care about it.
- The Honest Topological Definition
- Another Characterization of Compactness
- Compactness Three Ways
- Consequences of Compactness
- Extreme-Value Theorem
- See You Next Time!
The Honest Topological Definition
To begin, let’s first describe what an open cover is.
Open Covers
Definition (Open Covers): Let be a metric space. We call a collection of open subsets (in ) an open cover of if
If there is a finite subset such that covers then we call a finite subcover.
***Note that the index set can be finite, countably infinite, or uncountably infinite. It’s an arbitrary index set.***
At first glance, we might wonder why this is useful at all! It seems, at least to me, like something out of left field. But it turns out that this is precisely what we want to focus on. Let’s consider some examples with familiar metric spaces.
Example 1 : (Click in the Discovery)
Let’s consider the metric space Note, this is the subspace of the real line with the Euclidean metric. We claim that the following is an open cover of
Indeed, each set is open in Furthermore, every is contained in one of the intervals. Note that this open cover contains infinitely many open sets.
Next, we can see that this particular cover has a finite subcover,
So, as it turns out, we could cover with only four of the open sets.
Example 2 : (Click in the Discovery)
Let’s consider again the metric space We claim that the following is another open cover of
Indeed, each set is open in Furthermore, every is contained in one of the intervals. Note that this open cover contains infinitely many open sets.
Next, we can see that this particular cover has a finite subcover,
So, as it turns out, we could cover with only two of the open sets.
Example 3 : (Click in the Discovery)
Let’s mix it up and consider the metric space
We claim that the following is an open cover of
Indeed, each set is open in Furthermore, we can see that every is contained in one of the intervals.
Note that this open cover contains infinitely many open sets. Furthermore, there is no finite subcover that covers all of Indeed, first note that
Thus, if there were a finite subcover, then we would be able to cover with only one interval Where is the largest index that was contained in the finite subcover.
Thus, we see that some open covers have no finite subcovers.
Example 4 : (Click in the Discovery)
Let’s continue with the metric space
We claim that the following is an open cover of
Indeed, each set is open in Furthermore, we can see that every is contained in one of the intervals.
Note that this open cover contains infinitely many open sets. Furthermore, there is a finite subcover this time. In particular,
covers the open unit interval.
As the previous examples show, there are open covers with finite subcovers and others without. Furthermore, there are metric spaces, such as that have both infinite open covers and finite open covers. This leads to the Honest Topological Definition
Topological Compactness
Definition (Compact Sets): Let be a metric space. We say that is a compact metric space if every open cover of contains a finite subcover.
That’s it! The greatest definition in all of mathematics. How wonderfully strange and seemingly insignificant!
First observation: we can see that is definitely not compact since we found an open cover of that did not have a finite subcover in Example 3.
Second observation: We do not have enough information to deduce that is compact. To be compact, we must show that every possible open cover of has a finite subcover. We’ve only shown that the two covers in Examples 1 and 2 have a finite subcover. However, it’s true that is compact.
Theorem 1: The metric space is compact.
Proof: (Click in the Discovery)
Key Idea: We proceed by contradiction. So, suppose that we have an open cover of that does not have a finite subcover. Then `cut’ in half into and At least one of those halves requires an infinite number of open sets in the cover to cover it. Focusing on that half-sized interval, we cut it in half and deduce that one of those quarter-sized intervals requires an infinite number of the open sets in the cover to cover it. We continue this process indefinitely. From there, we choose a point in each of those intervals and produce a Cauchy sequence that converges. From there, we deduce a contradiction.
Notation: Let be the length of the interval Similarly, for open intervals
Begining of Proof: To begin, let be an arbitrary open cover of Without loss of generality, we can suppose that every open set in the open cover is an open interval in

We aim to show that there is a finite subcover. To this end, assume for the hope of a contradiction that there is no finite number of open sets in that cover Denote and cut it in half to get the intervals and It follows that either or requires an infinite number of open sets from to cover it. Indeed, if not, then both halves and need only a finite number of open sets to cover, and hence the entire interval needs only a finite number of open sets to cover it.

Let’s assume, without loss of generality, that the interval requires an infinite number of open sets from to cover it. Remark: Note that and
Next, we cut in half and run the same argument again on and Thus, we deduce that at least one of them requires an infinite number of open sets to cover it. Label this interval Remark: Note that and
We continue in the manner, cut in half, and choose the subinterval that requires an infinite number of open sets from our cover to cover it and label it By induction, we see that

Thus, we have a sequence of nested closed intervals each of which requires an infinite number of open sets to cover and is shrinking in length:
We now show that there is for some Indeed, for each of the intervals, choose the left endpoint of the interval in order to construct a sequence Furthermore, we can see that is Cauchy. Indeed, let There is some such that Consequently, for all such that we have (since and ) and thus Therefore, we know that converges to some In particular, for all Therefore,
To see that suppose that there was some such that Then, let However, there is some such that and therefore both and we cannot be in Thus, a contradiction and therefore

Since, it follows that there is some open set in the cover such that

Let There is some such that and consequently, However, the intervals were constructed so that each of them required an infinite number of open sets to cover them. However, only requires one open set, namely to cover it. This is our contradiction.
We conclude that has a finite subcover of Hence is compact.
Some authors and professors motivate compactness as being the next best thing to being finite. We will see why more clearly later, however let’s see that finite spaces are compact.
Theorem 2: Let be a finite metric space. That is, Then is compact.
Proof: (Click in the Discovery)
Let be a finite metric space and let be an open cover of It follows that each Thus, forms a finite subcover, since is a finite set.
Another Characterization of Compactness
The open cover definition can be tricky to apply in many situations. Consequently, we are motivated to find other equivalent properties.
Sequential Compactness
In the first section, we learned about what we’ll briefly call topological compactness. In this section, we will learn about sequential compactness.
Definition (Sequentially Compact) : Let be a metric space. We say that is sequentially compact if every sequence contains a convergent subsequence.
For those of you who have taken real analysis, you might recall the Bolzano-Weierstrass theorem, which states, using our new vocabulary, that closed and bounded sets of real numbers are sequentially compact. That is, any bounded sequence of real numbers has a convergent subsequence. The standard proof, and the proof given here, rely on limsups and liminfs. However, there is another proof which I find particularly beautiful. So, I will subject those willing to read the following to a proof of this property. It relies on my favorite theorem from elementary real analysis, the monotone convergence theorem.
Theorem 3: Let be such that Then, is sequentially compact.
I.e. every sequence contains a convergent subsequence.
I.e. (part two) Every bounded sequence of real numbers contains a convergent subsequence.
Proof: (Click in the Discovery)
Let be a sequence of real numbers that is bounded below by and bounded above by I.e. We claim that contains a monotone subsequence. Note, this proves the theorem since, by the monotone convergence theorem, a bounded monotone sequence converges.
Terminology: Before we begin, we call an element from our sequence a tiptop element or point if for all That is, every point further into the sequence is less than or equal to
There are two cases we need to consider (i) there are an infinite number of tiptop points, or (ii) there are only a finite number of tiptop points.
In case (i), the sequence of tiptop points forms a monotone decreasing subsequence. Thus, we are done.
In case (ii), let be the last tiptop point. It follows that for all with there is some such that I.e., there is a monotone increasing subsequence! Thus, we are done again!
Corollary: The metric space is sequentially compact.
Topological Compactness and Sequential Compactness – The Connection
As you might have guessed based on the fact that topological compactness and sequential compactness both use the word compact(ness) they are connected. In fact, they are equivalent! This is the content of the next theorem.
Theorem 4: Let be a metric space. Then,
is compact is sequentially compact.
Note: No one uses the phrase `topologically compact’. They only say compact, and from now on, we will do the same.
I find this result extremely beautiful.
Proof of Theorem 4 Forward Direction : (Click in the Discovery)
Let be a metric space.
Forward: is compact is sequentially compact.
Let be compact and let be a sequence of elements from We aim to show that there is a subsequence that converges to some To this end, consider the following claim:
Claim 1: There is some point such that for all the open ball contains an infinite number of elements from the sequence That is, there is an infinite number of such that
We continue by contradiction. Suppose that for all there is some such that each open ball contains only a finite number of elements from Next, note that the collection forms an open cover of It follows by compactness, there is a finite collection of open balls, those open balls that cover
Now, we have reached our contradiction. Indeed, since each open ball in the finite cover contains only a finite number of elements from we conclude that there are only a finite number of elements (or natural numbers) in Hence, claim 1 is true.
Now, using claim 1, we construct a convergent subsequence of
Let Then, let Which exists by claim 1. Next, since there is an infinite number of elements from in there is some such that We continue inductively. Suppose that we have determined then we let such that
We claim that the subsequence converges to Indeed, let It follows that there is some such that Consequently, for all we have and thus
To avoid useless complications in proving the backward direction of Theorem 4, we first bring into play a definition and two lemmas.
Lemma 1: Let be a sequentially compact metric space and be an open cover of Then, there is some such that for all -balls, (i.e. open balls with radius ), there is some open set that contains
Proof of Lemma 1: (Click in the Discovery)
We prove this by contradiction. That is, suppose that for all there is some open ball with radius that is not contained in any single open set In particular, for all there is some open ball with radius that is not contained in any open set
We focus on the centers of the balls and deduce a contradiction, so let be the ball’s center.
Consider the sequence of centers By sequential compactness, there is some convergent subsequence denoted Let as Since covers there is some that contains Since is open, there is some such that
Next, since as there is some such that for all we have Furthermore, there is some such that for all we have Let We claim that for all we have Indeed, let It follows
Thus, we see that This contradicts the assumption that was not contained in any open set in the cover. Thus, proving Lemma 1.
We now introduce a type of boundedness with a flavor similar to that of compactness. In that, it has to do with covering the space.
Definition (Totally Bounded) : Let be a metric space. We say that is totally bounded if for all we can cover with a finite number of -balls (that is, open balls whose radius is equal to ).
Remark: Note that this simply says, there exists a finite covering of with -balls. Not that every cover has a finite subcover.
Lemma 2: Let be a sequentially compact metric space. Then, is totally bounded.
Proof of Lemma 2: (Click in the Discovery)
Key Idea: We will show that if is not totally bounded, then there would be a sequence that has no convergent subsequence. Thus contradicting that is sequentially compact.
We proceed by contradiction. Suppose that there were some so that there is no finite subcover of Then, we claim:
Claim: There is a sequence of points such that for all
To see this, we construct inductively.
Choose any Suppose that we have chosen It follows that there is some such that for all If not, then for all there is some such that However, this implies and hence This contradicts the assumption that there was no finite subcover of Hence, we can find some such that for all Thus our claim holds.
By our claim, the sequence is such that for all Thus, has no convergent subsequence since no subsequence can be Cauchy. Indeed, since for all the sequence never gets arbitrarily close to itself. This contradicts the fact that is sequentially compact. Thus, we must have a finite subcover of -balls: that covers
We are now ready to finish the proof of Theorem 4.
Proof of Theorem 4 Backward Direction : (Click in the Discovery)
Backward: is sequentially compact is compact.
Let be sequentially compact and let be an open cover of We aim to show that there is a finite subcover. Next, let be such that Lemma 1 holds. That is, every -ball is contained in some open set in the open cover. I.e., for all there is some such that
By Lemma 2, there is a finite subcover of the cover of -balls, that covers However, this implies that there is finite subcover covers Indeed, since every Thus concluding the proof.
Compactness Three Ways
What a wonderful result Theorem 4 is. It gives us a topological and a sequential way to prove compactness. And, as we can see in the proof for Theorem 1 and Theorem 3, one method might be way easier to prove than the other.
In the proof of Theorem 4, more precisely, the backward direction, we introduced the notion of total boundedness. Furthermore, we proved in Lemma 2 that sequential compactness implies total boundedness. This might make us wonder whether or not total boundedness is equivalent to compactness (equivalently, sequential compactness) as well. Unfortunately, this is not the case. Although it is almost the case! We must make one more assumption on for total boundedness to imply compactness. This leads us to our main theorem:
Theorem 5: Let be a metric space. Then the following are equivalent.
- is compact;
- is sequentially compact;
- is totally bounded and complete.
Remark: Recall that a metric space is complete if every Cauchy sequence converges to some
Remark: We’ve already seen that (1) iff (2). Furthermore, we’ve seen that sequential compactness implies total boundedness. Thus, to prove Theorem 5, we need only show that sequential compactness implies completeness and that (3) implies (2). Indeed, then we will have shown: (1)(2)(3).
Proof : (Click in the Discovery)
The rest of (2) (3)
Let be a sequentially compact metric space. We aim to prove that is totally bounded and complete. By Lemma 2 is totally bounded. To prove completeness, consider some Cauchy sequence we need to show that for some
To begin, by sequential compactness, there is some convergent subsequence with limit We claim that too.
Let is Cauchy, there is some such that for all we have Furthermore, there is some such that for all we have Consequently, for all we have
Now we aim to show (3) (2)
To this end, let be totally bounded and complete, and let We will show that there is a convergent subsequence of Here’s the key idea. Let We cover with finitely many -balls. We can do this since is totally bounded. It follows that there is an open ball that contains an infinite number of elements from Now ignore all other elements from the original sequence. Cover with finitely many -balls. Note, from the elements remaining from the original sequence, there is one open -ball that contains an infinite number of those! We continue this process and produce a subsequence that is Cauchy. By completeness, it converges. We will make this precise, and in turn change some of the details for convenience.
This type of proof is called a diagonal proof and is always accompanied with a picture that looks like the following.

We will construct the subsequence as follows. First, let be our original sequence For we let have the following properties:
- is a subsequence of and
- is contained in a ball with radius
We use induction. We alrady have Let and suppose that we have defined for Cover with finitely many -balls. It follows that there are an infinite number of elements from in at least one of the -balls. Denote this particular ball We then let be the first element from that is in Then we let the be the second element from that is in Etc.
We now construct a diagonal sequence from the This is where the picture comes in. Let be the sequence such that We can see that is indeed a subsequence of Furthermore, we see that is Cauchy. Indeed, let There is some such that Thus, for all we have being a subsequence of Thus, This concludes the proof.
Consequences of Compactness
Heini-Borel and Bolzano-Wierstrass Theorems
An easy corollary of Theorem 5 is the following deep result we tend to learn in real analysis.
Theorem 6 (Heini-Borel and Bolzano-Wierstrass Theorems): Let be a subset of Then the following are equivalent.
- is compact;
- is sequentially compact;
- is closed and bounded.
Uniformly Continuity
Another great theorem is the generalization of the following: If is continuous, then is uniformly continuous. But first, recall what it means for a function to be uniformly continuous in general metric spaces.
Definition (Uniformly Continuous) : Let and be metric spaces. We say that is uniformly continuous on if for all there exists a such that whenever where 1
Let’s show that continuous functions on compact sets are uniformly continuous.
Theorem 6: Let and be metric spaces. If is compact and is continuous, then is uniformly continuous.
Proof : (Click in the Discovery)
Let be a compact metric space and let be continuous.
Let We aim to find some such that for all where we have
To begin, since is continuous on for all there is some so that implies Note that depends on the point chosen. Next, we cover with -balls. I.e., we’re using the open cover, where is an open ball in Since is compact, there is a finite subcover denoted
Let We claim this does the job. Indeed, for all where we have for some Indeed, note that for some since the open balls cover Furthermore, we have Hence as claimed.
Finally, by definition of implies
Thus concluding the proof.
The reason why compactness was crucial was so that we could set and have it be positive. This is because the minimum of a finite collection of positive numbers is still positive. If we didn’t have compactness and still tried to run the same argument, we’d have to have There is no reason why this has to be non-zero. That’s the key.
Extreme-Value Theorem
Recall the Extreme Value Theorem from real analysis. We now give a more general form of it using compact metric spaces.
Theorem 7 (Extreme-Value Theorem): Let and be metric spaces. If is compact and is continuous, then attains its maximum and minimum. That is, there are such that
However, to prove this theorem, we will actually prove another, more general theorem.
Theorem 8 (The continuous image of a comact set is compact): Let and be metric spaces. If is compact and is continuous, then is compact.
In this proof, we will need to use an equivalent definition of continuity to the standard definition that relies on open sets. It goes as follows:
Definition/Theorem (Continuous) : Let and be metric spaces. We say that is continuous on if for all open sets the preimage
is open.
I apologize for skipping a proof that shows that the above characterization continuity is the same as the standard characterization. This article is long, and so some stuff must get cut that’s not about compactness. To get started, use the fact that we can express the definition in terms of open -balls. This might be a fun problem for you to try and work out on your own!
Proof of Theorem 8 : (Click in the Discovery)
Let be a compact metric space and let be continuous. Since we aim to show that is compact, we let be an open cover of Note, We need to find a finite subcover.
First, since is continuous, the preimages of the open sets in the cover are open. Thus, is an open collection of open sets in We claim that is an open cover of Indeed, let and observe that Thus, for some hence, Consequently,
Next, by the compactness of there is a finite subcover that covers We claim that the corresponding cover Indeed, let It follows that and thus
Thus concluding the proof.
Note that the extreme value theorem follows directly since compact sets of real numbers are closed and bounded.
See You Next Time!
We have covered a lot of material today. Hopefully, you have found it interesting, helpful, or useful. Or all three!
As stated earlier, some people motivate compactness as being the next best thing to being finite. The reason is that finite metric spaces always have finite subcovers, they always have convergent subsequences, etc. This follows from our main theorem, Theorem 5.
There is more to be said about compact sets; for instance, we didn’t mention anything about metric spaces of continuous functions. This leads to a discussion that culminated in the Arzelà–Ascoli theorem. However, that is a story for another day! In the mean
Since math(s) is not a spectator sport, I will leave a few exercises for you to struggle with and practice! You’re welcome! As always, I’m not great at ending these articles, so we will just end it now with the exercises. Leave your answers below! Oh, if you find any errors or typos, please leave a comment so that they can be fixed!
- Show that closed subsets of compact sets are compact.
- Show that finite metric spaces are sequentially compact using only the definition of sequential compactness. That is, without using any of the theorems here!
- Prove that the definition of continuity is equivalent to the open sets definition of continuity.
- Here’s a classic: Let be a metric space. A collection of closed sets in has the finite intersection property if for all finite subsets the intersection is non-empty. Here’s the question: prove that the following are equivalent
- is compact,
- has the following property: If the collection of closed subsets in that has the finite intersection property, then
***Note this intersection is over all of ***
Be Kind. Be Curious. Be Compassionate. Be Creative.
And Have Fun!
Footnote:
- Note the difference between being continuous and uniformly continuous. It’s easier to see when written in symbols:
Continuous on : If
Uniformly Continuous on : If
The key difference is the fact that is dependent on when the function is only continuous. However, is independent of when the function is uniformly continuous.
↩︎

Leave a comment