In real analysis, there is a theorem that a bounded sequence has a convergent subsequence. Also, the limit lies in the same set as the elements of the sequence, if the set is closed.

Then when metric spaces are introduced, there is a similar theorem about convergent subsequences, but for compact sets. At this point things get a bit abstract.

So, can somebody explain the difference between compact, bounded and closed sets with examples?

  • 1
    $\begingroup$ Do you know their definitions? $\endgroup$ – Shahab Feb 13 '14 at 11:24
  • $\begingroup$ The theorem you are looking for is due to Heine and Borel. What you are really asking about is the difference between "bounded" and "totally bounded" in a metric space, and the difference between "complete" and "closed in the associated topology" in a metric space. $\endgroup$ – Willie Wong Feb 13 '14 at 11:26
  • $\begingroup$ The essay (answer) from kahen appears to cover it all. Many students learn that a subset of $\mathbb R^n$ with the usual (Euclidean) metric is compact iff it is closed and bounded, and then mistakenly suppose that it is true in any metric space. $\endgroup$ – DanielWainfleet Dec 9 '16 at 16:25

Take $X=(0,\infty)$ with the usual metric.

  • $[1,2]$ is a closed, bounded and compact set in $X$.
  • $(0,1]$ is a closed and bounded set in $X$, which is not compact (e.g. $(0,1]\subseteq\bigcup_n(1/n,2)$).
  • $[1,\infty)$ is a closed, but unbounded and not compact set in $X$.
  • $(1,\infty)$ is an unbounded set which is neither closed nor compact in $X$.
  • $(1,2)$ is neither closed nor unbounded in $X$, and it's not compact.
  • No unbounded set or not closed set can be compact in any metric space.
| cite | improve this answer | |
  • 4
    $\begingroup$ Is really $(0,1)$ closed? 1 is an accumulation point for $(0,1)$... In $\Bbb R$ there can't be any closed and bounded set which is not compact $\endgroup$ – User Feb 13 '14 at 11:52
  • 2
    $\begingroup$ A simple fix for the second bullet point is to use $(0,1]$, which was probably intended anyway. $\endgroup$ – user714630 Feb 13 '14 at 11:55
  • 3
    $\begingroup$ @Matteo No, $(\frac 1{n+1},\frac1{n-1})_{n>1},(1/2,1]$--or some variant if I messed something up--is an open cover without a finite subcover. Note that compactness of a topological space is independent of the ambient space; so heuristically it is easy to justify the fact that $(0,1]$ is not compact. $\endgroup$ – user714630 Feb 13 '14 at 11:59
  • 4
    $\begingroup$ (0,1] is neither closed nor open. $\endgroup$ – Albert Chen Feb 10 '17 at 23:55
  • 3
    $\begingroup$ @AlbertChen: it is closed in $X$. $\endgroup$ – tomasz Feb 11 '17 at 15:59


Part of the problem is that boundedness is a nearly useless property by itself in the context of metric spaces.

Consider a metric space $(X,d)$ and define a new metric $b$ on $X$ by

$\qquad\displaystyle b(x,y) := \min \{d(x,y),1\}$.

Then $b$ and $d$ will produce exactly the same open sets in $X$, but every subset of $X$ is bounded w.r.t. $b$.

Now think back to the Bolzano–Weierstraß theorem: "Every bounded sequence (of real numbers) has a Cauchy subsequence" (*). Whether a sequence in a metric space is convergent or not depends only on the open sets of the space. Therefore $(X,d)$ and $(X,b)$ will have the same convergent sequences. Moreover, every sequence in $X$ is bounded w.r.t. $b$.

But is it necessarily the case that every sequence in an arbitrary metric space must have a Cauchy subsequence? Obviously not. We can take $x_n = n$ in the reals. Nice and bounded w.r.t. a metric like the $b$ above, but it has no Cauchy subsequence w.r.t. any metric that produces the same open sets as the usual metric (because if it had, then that subsequence would converge).

All of this is to say that boundedness is not the correct way to specify that "$(X,d)$ is a small metric space". Instead we have come up with the notion of total boundedness:

A metric space $(X,d)$ is said to be totally bounded when for every $\varepsilon > 0$ there exists finitely many $x_1,\dotsc,x_n \in X$ such that $X$ is the union of the balls of radius $\varepsilon$ around the $x_i$.

For the real numbers (and $\mathbb R^n$) we just so happen to be so fortunate that boundedness w.r.t. the usual metric and total boundedness are the same.

And how does total boundedness tie into the Bolzano–Weierstraß theorem? It does so due to the following proposition:

A metric space $(X,d)$ is totally bounded if and only if every sequence contains a Cauchy subsequence.

In other words, the Bolzano–Weierstraß theorem is really just stating that boundedness w.r.t. the usual metric in $\mathbb R^n$ is the same as total boundedness.

Since total boundedness implies boundedness, it becomes very reasonable to ask questions about the converse, e.g.:

In some particular metric space $(X,d)$ where I know something about $d$, under what conditions is a bounded set $E \subseteq X$ totally bounded? Or more schematically:

W.r.t. $d$, boundedness + ??? $\implies$ total boundedness.

This is for example the question that lies at the root of the Arzelà–Ascoli theorem and the Kolmogorov–Riesz theorem.

[*]: That's not how it's normally expressed, but the real numbers are nice in the sense that a sequence of real numbers converges if and only if it's Cauchy, so the two formulations are equivalent.


It's easy to show that in an arbitrary metric space $(X,d)$ that a sequence is convergent implies that it's Cauchy (w.r.t. $d$). And again we wonder about the converse. Does Cauchy imply convergent? If it did, we would be very happy. Because then whenever we have a totally bounded space and a sequence in it, we would know that it has a Cauchy and therefore convergent subsequence.

We know from our study of the real numbers that Cauchy sequences in $\mathbb R$ are convergent. But we are not so fortunate that this holds in arbitrary metric spaces. The obvious and easy example is a (totally) bounded open interval like $(0,2)$ where $(\tfrac1n)_{n\geq1}$ is a Cauchy sequence that doesn't converge.

But—the clever student protests—does that sequence not converge to $0$?

Which it sort of does, but it's not in the space under consideration. However, the objection does illustrate that it's not an ideal example which is why I'd like to consider instead the following:

We start with the space $X = C[0,1]$, i.e. the continuous real-valued functions on the unit interval. And on this we put the $1$-norm, i.e. $\|f\|_1 := \int_0^1 |f(x)|\,dx$. And this induces a metric $d(f,g) = \|f-g\|_1 = \int_0^1 |f(x)-g(x)|\,dx$.

Next we consider a sequence of functions in $X$ given by

$\qquad\displaystyle f_n(x) = \begin{cases} \frac1{\sqrt x} & \tfrac 1n \leq x \leq 1 \cr f(\tfrac1n) & 0 \leq x < \tfrac1n \end{cases}$

It may not be immediately obvious that this sequence is Cauchy w.r.t. $d$, so one could take it as an exercise to verify that it is.

But it's far more interesting to ask what it converges to. In some sense it converges pointwise to

$\qquad\displaystyle f(x) = \begin{cases} \infty & x = 0 \cr \tfrac1{\sqrt x} & 0 < x \leq 1\end{cases}$

This is obviously rubbish because "$\infty$" isn't a number. But if we ignore whatever value $f$ has at $0$, we also have that $f-f_n \to 0$ w.r.t. $d$ which is to say that it looks like $f_n \to f$ in $(X,d)$.

Except $f$ cannot be in $X$. E.g. since all continuous functions on a closed and bounded interval have bounded range.

So what went wrong? It looks like $(f_n)_{n\geq 1}$ should converge. We even have a candidate for the limit, but it doesn't fit into our space.

The sad news is that there isn't a whole lot we can do. Some metric spaces have the property that Cauchy sequences converge and those are nice and we call them complete. The word seems to suggest that "all the limits of Cauchy sequences that should be there, are there" which is not an entirely wrong picture.

This can further be illustrated by the following standard result:

Let $(X,d)$ be a metric space. The following are equivalent

  • $(X,d)$ is complete.
  • (Nested Set Property) Any decreasing sequence of closed sets $F_1 \supseteq F_2 \supseteq \dotsb$ in $X$ with $\operatorname{diam}(F_i) \to 0$ has $\bigcap_{i=1}^\infty F_i \neq \emptyset$ (in fact the intersection contains exactly one point).
  • (Bolzano–Weierstraß metric space formulation) Every infinite, totally bounded subset of $X$ has a limit point in $X$.

As it happens $\mathbb R^n$ with its usual metric is complete. And a further theorem tells is that a subset of a complete space is itself complete if and only if it's closed in the larger space. This is the reason that being closed in $\mathbb R^n$ is such a special property.


Tying it all together, we have total boundedness and completeness. As you might imagine a totally bounded complete space is a wonderful place to do analysis. Whenever you're given a sequence you know that it has a Cauchy subsequence and by completeness you know that said subsequence must be convergent. Absolutely fantastic!

But how does that tie in to the Heine–Borel "every open cover has a finite subcover" definition?

The first thing we note is that a metric space which has the Heine–Borel property must be totally bounded. For $\varepsilon > 0$ take the set of all balls of radius $\varepsilon$ in the space. It is an open cover and therefore has a finite subcover. Done.

Next we apply De Morgan's law to the Heine–Borel definition and get the following

Every collection of closed sets $\mathcal F$ which has the finite intersection property (the FIP: any finite subcollection of $\mathcal F$ has non-empty intersection), has itself non-empty intersection, i.e. $\cap \mathcal F = \cap \{F : F \in \mathcal F\} \neq \emptyset$.

Which is equivalent to the Heine–Borel property. But this tells us something about completeness because it easily implies the Nested Set Property from the previous section.

What is slightly harder is to show that totally bounded + complete implies the Heine–Borel property.

This is all very standard material in courses on metric spaces. I can wholeheartedly recommend N. L. Carothers - Real Analysis which (IMO) does an excellent job at presenting these ideas.

| cite | improve this answer | |

Let $X$ be a topological space. A closed set $A\subseteq X$ is a set containing all its limit points, this might be formulated as $X\setminus A$ being open, or as $\partial A\subseteq A$, so every point in the boundary of $A$ is actually a point of $A$. This doesn't mean $A$ is bounded or even compact, for example $A=X$ is always closed. If $X$ is a metric space we can say whenever $d(x,A)=\inf_{a\in A} d(x,a)=0$ then $x\in A$, since the first statement is equivalent to $x\in\partial A$ in the metric case.

A bounded set in a metric space $X$ is a set $A\subseteq X$ with finite diameter $\operatorname{diam}(A) =\sup_{a,b\in A} d(a,b)$, or equivalently $A$ is contained in some open ball with finite radius. This does not imply that $A$ is closed, for example $(0,1)$ is bounded in $\mathbb R$ but not closed.

When it comes to compact sets, it gets a little involved in the topological case, here we define a set $A\subseteq X$ to be compact if any open cover $\bigcup_{i\in I} U_i\supseteq A$ allows a finite subcover $U_{i_1}\cup \dots \cup U_{i_n} \supseteq A$. Some schools (like Bourbaki) call this quasi-compact and define compact to be Hausdorff and quasi-compact.

For subsets of $\mathbb R^n$ we have the theorem of Heine and Borel, that tells us that $A\subseteq \mathbb R^n$ is compact if and only if it is closed and bounded.

| cite | improve this answer | |
  • $\begingroup$ The OP is at the level where he/she does not understand the difference between closed, bounded, and compact sets. For this reason, I think (though this is pure speculation) that your answer is probably a little too technical for the OP to follow. $\endgroup$ – Jesse Madnick Feb 13 '14 at 11:40
  • $\begingroup$ You might be right, but if OP or someone else comes back to this question after knowing a little more of these things, he or she might be happy with a concise formulation of the different concepts. After all, OP is not the only one reading answers on questions in most cases. $\endgroup$ – Christoph Feb 13 '14 at 11:45
  • $\begingroup$ I completely agree $\endgroup$ – Jesse Madnick Feb 13 '14 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.