# 3.8. Compactness#

The material in this section is primarily based on [2, 41].

Recall from Definition 1.21 that for a subset $$A \subseteq X$$, a cover is a family $$\{ A_i \}_{i \in I}$$ of subsets of $$X$$ such that

$A \subseteq \bigcup_{i \in I} A_i.$

## 3.8.1. Open Covers#

Definition 3.54 (Open cover)

A family of open subsets $$\{ A_i \}_{i \in I}$$ of subsets of $$(X,d)$$ is an open cover of $$A$$ if it covers $$A$$.

Theorem 3.74 (Lindelöf)

Every open cover of a subset of $$\RR^m$$ can be reduced to an at-most countable subcover.

Proof. We call a point $$a = (a_1, \dots, a_m) \in \RR^m$$ a rational point if every component of $$a$$ is a rational number.

1. Let $$A$$ be a subset of $$\RR^m$$.

2. Let $$\{ \OOO_i \}_{i \in I}$$ be an open cover of $$A$$ (possibly uncountable).

3. Thus, $$A \subseteq \bigcup_{i \in I} \OOO_i$$.

4. For each $$x \in A$$,

1. Choose an index $$i_x \in I$$ such that $$x \in \OOO_{i_x}$$.

2. Pick a rational point $$a_x \in \RR^m$$ and a rational positive number $$r_x$$ such that $$x \in B(a_x, r_x) \subseteq \OOO_{i_x}$$.

5. Consider the collection $$C = \{ B(a_x, r_x) \ST x \in A \}$$.

6. Since the set of rational points is countable and the set of rational numbers is countable, hence the set of all open balls centered at rational points with rational radii is countable.

7. Hence, $$C$$ which is a subset of open balls with rational points as centers and rational radii, is at most countable.

8. Thus, $$C$$ is an at most countable open cover of $$A$$.

9. Since each $$B(a_x, r_x)$$ is a subset of an $$\OOO_{i_x}$$, hence there exists an at most countable subcover of $$\{ \OOO_i\}_{i \in I}$$ for $$A$$.

## 3.8.2. Compact Sets#

Definition 3.55 (Compact set)

Let $$(X, d)$$ be a metric space. A subset $$A$$ of $$X$$ is called compact if every open cover of $$A$$ can be reduced to a finite subcover.

Definition 3.56 (Compact metric space)

Let $$(X,d)$$ be a metric space. If $$X$$ is itself a compact set, then $$(X,d)$$ is called a compact metric space.

Example 3.24 ($$(0,1)$$ is not compact)

The set $$(0,1)$$ is not compact in $$\RR$$. We first show this the hard way by picking an open cover for $$(0,1)$$ which cannot be reduced to a finite subcover. Later, we discuss how to verify compactness through easy checks.

1. Consider the family of open intervals:

$C = \left \{ \left(\frac{1}{n}, 1 \right ) \ST n \geq 2 \right \}.$
2. For every $$x \in (0,1)$$, there is a natural number $$n$$ such that $$x > \frac{1}{n}$$.

3. Thus, $$x \in \left(\frac{1}{n}, 1 \right )$$.

4. Thus,

$(0, 1) \subseteq \bigcup_{n=2}^{\infty} \left(\frac{1}{n}, 1 \right )$

implying that $$C$$ is an open cover of $$(0,1)$$.

5. At the same time for every $$n \geq 2$$, we have:

$\left(\frac{1}{n}, 1 \right ) \subseteq (0, 1)$

since $$\frac{1}{n} > 0$$.

6. Thus,

$(0, 1) = \bigcup_{n=2}^{\infty} \left(\frac{1}{n}, 1 \right ).$
7. But there is no finite subcover of $$(0,1)$$ in $$C$$.

8. If there was a finite subcover, we could pick a maximum $$n$$ among those intervals.

9. But then $$x = \frac{1}{n}$$ won’t belong to any of those intervals in the finite subcover.

10. Hence $$(0,1)$$ is not compact.

We later show in Theorem 3.76 that every compact set is closed and bounded. Hence, an easy way to say that $$(0,1)$$ is not compact is by noticing that it is not closed.

## 3.8.3. Characterization of Compactness#

We have defined compactness as a property where every open cover can be reduced to a finite subcover. The characterization of a property involves identifying other properties which are equivalent in the sense that property A $$\iff$$ property B. If one is true then the other must be true and vice versa.

We will see later that compactness of a set $$A$$ is equivalent to the property that every sequence of $$A$$ has a subsequence that converges to a point in $$A$$. However, before we go there, let us examine some implications of this property that every sequence of a set $$A$$ has a subsequence that converges within the set $$A$$. These results will be useful later in the characterization of compact sets.

Lemma 3.1 (Lebesgue number)

Let $$A \subseteq \bigcup_{i \in I} \OOO_i$$ be an open cover of $$A$$.

If every sequence in $$A$$ has a subsequence which converges to a point of $$A$$, then, there exists a number $$\delta > 0$$ such that for each $$x \in A$$, we have $$B(x, \delta) \subseteq \OOO_i$$ for at least one $$i \in I$$.

Any such number $$\delta > 0$$ is called a Lebesgue number of $$A$$ for the open cover $$\{\OOO_i \}_{i \in I}$$.

Proof. Assume the claim is false.

1. Then, for each $$\delta > 0$$, there exists some $$x \in A$$ such that $$B (x, \delta)$$ is not a subset of any $$\OOO_i$$.

2. In particular, for each $$n$$, there exists some $$x_n \in A$$ such that $$B (x_n, \frac{1}{n}) \cap (X \setminus \OOO_i) \neq \EmptySet$$ holds for each $$i \in I$$.

3. Consider the sequence $$\{ x_n \}$$.

4. By the hypothesis, every sequence has a subsequence that converges to a point of $$A$$.

5. Let $$x \in A$$ be the limit of such a subsequence of $$\{ x_n \}$$.

6. Since $$x \in A$$, $$x \in \OOO_i$$ for at least one $$i \in I$$.

7. Pick some $$i \in I$$ such that $$x \in \OOO_i$$.

8. Choose some $$r > 0$$ such that $$x \in B(x, r) \subseteq \OOO_i$$.

1. Recall that $$\OOO_i$$ is open and $$x$$ is its interior point. So such an $$r > 0$$ can be chosen.

9. Now, select some $$n$$ such that $$\frac{1}{n} < \frac{r}{2}$$ and $$d(x, x_n) < \frac{r}{2}$$.

10. It follows that $$B(x_n, \frac{1}{n}) \subseteq B(x, r) \subseteq \OOO_i$$.

11. But this contradicts with the selection of $$x_n$$ such that $$B (x_n, \frac{1}{n})$$ is not contained in any $$\OOO_i$$.

12. Thus, a $$\delta > 0$$ must exist satisfying the condition that for each $$x \in A$$, $$B(x, \delta) \subseteq \OOO_i$$ for at least one $$i \in I$$.

Lemma 3.2 (Existence of finite cover of open balls)

Let $$A \subseteq X$$ of a metric space $$(X,d)$$. If every sequence in $$A$$ has a subsequence which converges to a point of $$A$$, then, for every $$r > 0$$ there exist $$x_1, \dots, x_n \in A$$ such that

$A \subseteq \bigcup_{j=1}^n B(x_j, r).$

This lemma simply claims that we can construct a finite open cover of open balls for $$A$$ for every $$r > 0$$.

Proof. Assume the claim to be false. Choose $$r > 0$$ such that it is not possible to select a finite number of points from $$A$$ such that

$A \subseteq \bigcup_{j=1}^n B(x_j, r).$
1. Pick some $$x_1 \in A$$.

2. Choose some $$x_2 \in A \setminus B(x_1, r)$$. We can choose $$x_2$$ since $$A$$ doesn’t have a finite open ball cover.

3. Assuming that $$x_1, x_2, \dots, x_n$$ have been chosen inductively, choose $$x_{n+1}$$ from the set $$A \setminus \bigcup_{i=1}^n B(x_i, r)$$.

4. By design, $$d(x_n, x_m) \geq r$$ holds for every $$n \neq m$$.

5. Then, no subsequence of $$\{ x_n \}$$ can converge.

6. This contradicts with the hypothesis that every sequence has a subsequence that converges in $$A$$.

7. Hence, the claim must be true.

Theorem 3.75 (Characterization of compactness)

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

1. $$A$$ is compact.

2. Every infinite subset of $$A$$ has an accumulation point in $$A$$.

3. Every sequence in $$A$$ has a subsequence which converges to a point of $$A$$.

Proof. (1) $$\implies$$ (2)

1. Let $$S$$ be an infinite subset of $$A$$.

2. Assume, by way of contradiction, that $$S$$ has no accumulation point in $$A$$.

3. Then for every $$x \in A$$, there exists a deleted neighborhood of $$x$$ that is disjoint with $$S$$.

4. That is, $$\forall x \in A, \exists r_x > 0 \ST B (x, r_x) \cap ( S \setminus \{ x \}) = \EmptySet$$.

5. Then, $$B(x, r_x) \cap S$$ can either be empty or it can at most contain $$x$$.

6. Thus, $$B(x, r_x) \cap S \subseteq \{ x\}$$.

7. Consider the open cover $$C = \bigcup_{x \in A} B(x, r_x)$$.

8. It is easy to see that $$A \subseteq C$$.

9. Since $$A$$ is compact (by hypothesis), there exists a finite set $$\{ x_1, \dots, x_n \} \subseteq A$$ such that $$A \subseteq \bigcup_{i=1}^n B(x_i, r_{x_i})$$.

10. But then

$S = A \cap S = \bigcup_{i=1}^n [B(x_i, r_{x_i}) \cap S] \subseteq \{ x_1, \dots, x_n \}.$
11. Thus, $$S$$ must be a finite set containing at most $$n$$ elements.

12. We arrive at a contradiction as $$S$$ is infinite.

13. Hence, $$S$$ has an accumulation point in $$A$$.

(2) $$\implies$$ (3)

1. We assume that every infinite subset of $$A$$ has an accumulation point in $$A$$.

2. Let $$\{x_n \}$$ be an arbitrary sequence of $$A$$.

3. If $$\{x_n \}$$ is constant, then every subsequence is constant and convergent.

4. If $$\{x_n \}$$ takes a finite number of distinct values, then there is at least one value which must occur infinite times. Thus, at least one subsequence is a constant sequence and hence convergent.

5. We are left with the case where $$\{ x_n \}$$ contains infinite distinct values.

6. Then, we can choose a subsequence $$\{ y_n \}$$ of $$\{ x_n \}$$ which consists of all distinct values; i.e., $$y_n \neq y_m$$ whenever $$n \neq m$$.

1. Let $$k_1 = 1$$.

2. Assuming $$k_1, \dots, k_n$$ have been selected, choose $$k_{n+1} > k_n$$ such that $$x_{k_{n+1}} \neq x_{k_i}$$ for $$1 \leq i \leq n$$.

3. This is possible since $$\{x_n \}$$ has infinite distinct values and so far only $$n$$ distinct values have been chosen.

4. Now, let $$y_n = x_{k_n}$$.

5. It is clear that $$\{y_n\}$$ is a subsequence of $$\{x_n\}$$ consisting of all distinct values.

7. Consider the set $$Y = \{ y_1, y_2, \dots \}$$ (not the sequence but the set).

8. By our hypothesis (2), since $$Y$$ is an infinite subset of $$A$$, hence it must have an accumulation point in $$A$$.

9. Let $$x$$ be an accumulation point of $$Y$$.

10. Assume that $$x \neq y_n$$ for each $$n$$. If $$x = y_k$$ for some $$k$$, then drop the first $$k$$ elements of $$\{ y_n \}$$.

11. This ensures that $$d(x, y_n) > 0$$ for every $$n$$.

12. We will now select a subsequence of $$\{ y_n \}$$ that converges to $$x$$.

13. Towards this, choose $$m_1$$ such that $$d(y_{m_1}, x) < 1$$.

14. Now, inductively, assuming that $$m_1 < m_2, \dots < m_n$$ have been chosen, choose $$m_{n+1}$$ such that

$d(y_{m_{n+1}}, x) < r_{n+1} = \min \{\frac{1}{n+1}, d(y_1, x), d(y_2, x), \dots, d(y_{m_n}, x) \}.$
15. Since $$d(x, y_n) > 0$$, hence $$r_{n+1} > 0$$.

16. Since $$x$$ is an accumulation point of $$Y$$, hence for every $$r > 0$$, there exists a point $$y \in Y$$ such that $$d(x, y) < r$$.

17. Thus, it is possible to pick a suitable $$m_{n+1}$$ such that $$d(y_{m_{n+1}}, x) < r_{n+1}$$.

18. Also, by design, $$m_{n+1}$$ must be greater than $$m_n$$ as $$r_{n+1} < d(y_i, x) \Forall 1 \leq i \leq m_n$$.

19. Thus, $$\{ y_{m_n} \}$$ is a subsequence of $$\{ y_n \}$$.

20. Hence, $$\{y_{m_n}\}$$ is a subsequence of $$\{ x_n \}$$ too.

21. Since $$d(x, y_{m_n}) < \frac{1}{n}$$, it follows that $$\lim y_{m_n} = x$$.

22. Thus, $$\{ x_n \}$$ has a convergent subsequence which converges to a point of $$A$$.

(3) $$\implies$$ (1)

1. Let $$A \subseteq \bigcup_{i \in I} \OOO_i$$ be an arbitrary open cover of $$A$$.

2. We can pick a Lebesgue number $$\delta > 0$$ such that for each $$x \in A$$, we have $$B(x, \delta) \subseteq \OOO_i$$ for at least one $$i \in I$$ thanks to Lemma 3.1.

3. Now, thanks to Lemma 3.2, we can pick $$x_1, \dots, x_n \in A$$ such that:

$A \subseteq \bigcup_{j=1}^n B(x_j, \delta).$
4. Now, for each $$j$$ pick some $$i_j \in I$$ such that $$B(x_j, \delta) \subseteq \OOO_{i_j}$$.

5. Then,

$A \subseteq \bigcup_{j=1}^n B(x_j, \delta) \subseteq \bigcup_{j=1}^n \OOO_{i_j}.$
6. Thus, the open cover of $$A$$ has a finite subcover.

7. Thus, $$A$$ is compact.

Definition 3.57 (Bolzano-Weierstrass property)

A set $$A$$ in a metric space has the Bolzano-Weierstrass property if every sequence in $$A$$ has a convergent subsequence that converges to a point in $$A$$.

Observation 3.1

A compact set has the Bolzano-Weierstrass property.

## 3.8.4. Closedness and Boundedness#

Theorem 3.76 (Compact sets are closed and bounded)

A compact set is closed and bounded.

Proof. Assume $$A$$ to be compact. We shall show that $$A$$ must be bounded.

1. Choose an open cover for $$A$$ as $$A \subseteq \bigcup_{x \in A}B(x, 1)$$.

2. Since $$A$$ is compact, hence there exist finite set of points $$\{ x_1, \dots x_n \} \subseteq A$$ such that $$A \subseteq \bigcup_{i=1}^n B(x_i, 1)$$.

3. Let $$M = \max \{ d(x_i, x_j) \ST 1 \leq i, j \leq n\}$$.

4. For any $$x, y \in A$$, choose $$i, j$$ such that $$x \in B(x_i, 1)$$ and $$y \in B(x_j, 1)$$.

5. Then, by triangle inequality, we have:

$d(x, y) \leq d(x, x_i) + d(x_i, x_j) + d(x_j, y) < M + 2 < \infty.$
6. Thus, $$\diam A = \sup d(x,y)$$ is finite and $$A$$ is bounded.

We now show that if $$A$$ is compact then $$A$$ must be closed too. Towards this, we show that $$A$$ contains all its closure points.

1. Let $$x \in \closure A$$.

2. Due to Theorem 3.31, there exists a sequence $$\{ x_n \}$$ of $$A$$ with $$\lim x_n = x$$.

3. Due to Theorem 3.75, $$\{x_n\}$$ has a subsequence that converges to a point of $$A$$ (since $$A$$ is compact by hypothesis).

4. As per Theorem 3.35, subsequences of a convergent sequence converge to the same limit.

5. Thus, $$x$$ must be in $$A$$.

6. Thus, $$\closure A \subseteq A$$. Thus, $$\closure A = A$$. Thus, $$A$$ is closed.

Although every compact set is closed and bounded, the converse need not be true. See Example 3.29 for an example of closed and bounded set (in discrete space) which is not compact. In fact, discrete space is a complete metric space. Yet, it has closed and bounded sets which are not compact.

In the specific case of Euclidean spaces, all closed and bounded sets are compact too. See Heine-Borel theorem below.

## 3.8.5. Nested Sequence of Compact Sets#

Theorem 3.77 (Nonempty nested intersection property)

Let $$\{ A_n \}$$ be a nested sequence of nonempty compact subsets of $$(X, d)$$ such that

$S_1 \supseteq S_2 \supseteq S_3 \supseteq \dots$

Then their intersection is nonempty; i.e.,

$\bigcap_{n=1}^{\infty} S_n \neq \EmptySet.$

Proof. We prove this result by way of contradiction.

1. Assume for contradiction that $$\bigcap_{n=1}^{\infty} S_n = \EmptySet$$.

2. Let $$V_n = X \setminus S_n$$ for every $$n \in \Nat$$.

3. Since $$S_{n +1 } \subseteq S_n$$ for every $$n$$ hence $$V_n \subseteq V_{n+1}$$ for every $$n$$.

4. Then $$V = \{ V_n \ST n \in \Nat \}$$ is a collection of open sets.

5. Since $$\bigcap_{n=1}^{\infty} S_n = \EmptySet$$, hence

$\begin{split} X &= X \setminus \EmptySet \\ &= X \setminus \left ( \bigcap_{n=1}^{\infty} S_n \right ) \\ &= \bigcup_{n=1}^{\infty}(X \setminus S_n) \\ &= \bigcup_{n=1}^{\infty} V_n. \end{split}$
6. Hence $$V$$ is an open cover for every $$S_n$$ as $$S_n \subseteq X = \bigcup_{n=1}^{\infty} V_n$$.

7. In particular, $$V$$ is an open cover for $$S_1$$.

8. Since $$S_1$$ is compact, hence there exists a finite subcover of $$S_1$$ indexed by a finite set of natural numbers $$I$$.

9. Let $$I = \{ i_1, i_2, \dots, i_k \}$$ and the finite subcover be $$F_k = \{ V_i \in V \ST i \in I \}$$.

10. Since $$I$$ is a finite set, it has a maximum element.

11. Let $$m = \max I = \max \{ i_1, i_2, \dots, i_k \}$$.

12. Then $$F_m = \{ V_1, \dots, V_m \}$$ is also a finite subcover of $$S_1$$ since $$F_k \subseteq F_m$$.

13. But then $$\bigcup_{k=1}^m V_k = V_m$$ since $$V_n \subseteq V_{n+1}$$ for every $$n$$.

14. Hence $$S_1 \subseteq V_m$$.

15. Then $$S_m \subseteq S_1 \subseteq V_m$$.

16. But $$V_m = X \setminus S_m$$, hence $$V_m \cap S_m = \EmptySet$$ a contradiction.

17. Hence, the intersection of the nested compact sets must be nonempty.

## 3.8.6. Continuity#

Theorem 3.78 (Continuous images of compact sets are compact)

Let $$f: (X, d) \to (Y, \rho)$$ be a continuous function. Let $$A$$ be a compact subset of $$X$$ with $$A \subseteq \dom f$$. Then $$f(A)$$ is a compact subset of $$Y$$.

Proof. We prove this by showing that any open cover of $$f(A)$$ can be reduced to a finite subcover.

1. Let $$f(A) \subseteq \bigcup_{i \in I} \OOO_i$$ be an open cover for $$f(A)$$.

2. Then $$A \subset \bigcup_{i \in I} f^{-1} (\OOO_i)$$.

3. Since $$f$$ is continuous, hence $$f^{-1} (\OOO_i)$$ is an open subset of $$X$$ for every $$i \in I$$.

4. Since $$A$$ is compact, there exist indices $$i_1, \dots, i_n$$ such that $$A \subseteq \bigcup_{j=1}^n f^{-1}(\OOO_{i_j})$$.

5. Then

$f(A) \subseteq f\left ( \bigcup_{j=1}^n f^{-1}(\OOO_{i_j}) \right ) = \bigcup_{j=1}^n f(f^{-1}(\OOO_{i_j})) \subseteq \bigcup_{j=1}^n \OOO_{i_j}.$
6. Thus, $$A$$ is compact.

## 3.8.7. Lipschitz Continuity#

Theorem 3.79

Let $$f : (X,d) \to (Y, \rho)$$ be a (partial) function with $$S = \dom f$$. Assume that $$f$$ is locally Lipschitz continuous at every $$x \in S$$. Let $$A \subseteq S$$ be a compact subset of $$S$$. Then, $$f$$ is Lipschitz function on $$A$$. In other words, there exists a constant $$L > 0$$ such that

$\rho(f(x),f(y)) \leq L d(x, y)$

for every $$x, y \in A$$.

Proof. We proceed as follows.

1. Since $$f$$ is locally Lipschitz continuous on $$S$$ hence $$f$$ is continuous by Theorem 3.57.

2. Thus, by Theorem 3.78, $$f(A)$$ is compact.

3. Hence, $$f(A)$$ is closed and bounded.

4. Thus, there exists $$M > 0$$ such that for any $$x, y \in A$$, $$\rho(f(x), f(y)) \leq M$$.

5. For contradiction, assume that $$f$$ is not Lipschitz on $$A$$.

6. Then, there is no $$L > 0$$ such that

$\rho(f(x), f(y)) \leq L d(x,y) \Forall x, y \in A.$
7. Then, there exist two sequences $$\{ x_n \}$$ and $$\{ y_n \}$$ of $$A$$ such that

$\lim_{n \to \infty} \frac{\rho(f(x_n), f(y_n)) }{d(x_n,y_n)} = \infty.$
8. But $$\rho(f(x_n), f(y_n)) \leq M$$.

9. Thus,

$\lim d(x_n,y_n) = 0.$
10. Since $$A$$ is compact, hence $$\{ x_n \}$$ has a convergent subsequence.

11. Let $$\{x_{n_k} \}$$ be a convergent subsequence with $$x = \lim_{k \to \infty} x_{n_k}$$.

12. By compactness of $$A$$, $$x \in A$$.

13. Then, $$f$$ cannot be not locally Lipschitz continuous at $$x$$.

15. Thus, $$f$$ must be Lipschitz continuous on $$A$$.

## 3.8.8. Homeomorphism#

Theorem 3.80 (Homeomorphism preserves compactness)

Let $$f: (X, d) \to (Y, \rho)$$ be a homeomorphism. Then, $$A$$ is a compact subset of $$(X,d)$$ is and only if $$f(A)$$ is a compact subset of $$(Y, \rho)$$.

Proof. Let $$A \subseteq X$$ be compact. Then, $$f(A)$$ is compact since $$f$$ is continuous due to Theorem 3.78.

Let $$f(A)$$ be compact. Since $$f$$ is a homeomorphism, hence $$f^{-1}$$ is continuous and bijective. Hence, $$f^{-1}(f(A)) = A$$ is compact due to Theorem 3.78.

## 3.8.9. Compact Spaces#

Theorem 3.81

Every closed subset of a compact space is compact.

Proof. Let $$(X, d)$$ be a compact metric space and let $$A$$ be a closed subset of $$X$$.

1. Let $$\{\OOO_i\}_{i \in I}$$ be an open cover of $$A$$. We have, $$A \subseteq \bigcup_{i \in I}\OOO_i$$.

2. $$X = A \cup (X \setminus A)$$.

3. Then, $$X \subseteq (X \setminus A) \cup \bigcup_{i \in I} \OOO_i$$.

4. Since all $$\OOO_i$$ are subsets of $$X$$, hence we can write it as: $$X = (X \setminus A) \cup \bigcup_{i \in I} \OOO_i$$.

5. Since $$A$$ is closed, hence $$X \setminus A$$ is open.

6. Thus, $$(X \setminus A) \cup \bigcup_{i \in I} \OOO_i$$ is an open cover of $$X$$.

7. But $$X$$ is compact. Hence, there exist finite indices $$i_1, \dots, i_n$$ such that $$X = (X \setminus A) \cup \OOO_{i_1} \cup \dots \cup \OOO_{i_n}$$.

8. But then $$A \subseteq X$$ and $$A \cap (X \setminus A) = \EmptySet$$ imply that: $$A \subseteq \OOO_{i_1} \cup \dots \cup \OOO_{i_n}$$.

9. Thus, $$A$$ is compact.

Theorem 3.82 (Continuous maps are closed)

Let $$(X, d)$$ be a compact metric space and suppose that $$f : (X, d) \to (Y, \rho)$$ is a (total) continuous function. Then $$f$$ is a closed mapping. If $$f$$ is bijective, then $$f$$ is a homeomorphism.

Proof. Let $$C$$ be a closed subset of $$X$$.

1. Due to Theorem 3.81, $$C$$ is compact.

2. Since $$f$$ is continuous, hence, due to Theorem 3.78, $$f(A)$$ is compact.

3. As per Theorem 3.76, since $$f(A)$$ is compact, hence $$f(A)$$ is closed.

4. Thus, $$f$$ maps every closed set to a closed set.

5. Thus, $$f$$ is a closed mapping.

Now, assume that $$f$$ is bijective too.

1. Thus, $$f^{-1}$$ exists. Let $$g = f^{-1}$$.

2. Then, due to bijection property $$g^{-1}(A) = f(A)$$ holds for every subset $$A$$ of $$X$$.

3. Thus, $$g^{-1}(A) = f(A)$$ is a closed subset of $$Y$$ whenever $$A$$ is a closed subset of $$X$$.

4. Thus, as per Theorem 3.42 $$[(5) \implies (1)]$$, $$g$$ is continuous.

5. Thus, both $$f$$ and $$f^{-1} = g$$ are continuous.

6. Thus, $$f$$ is a homeomorphism.

Theorem 3.83 (Compact domain + Continuity = Uniform continuity)

Let $$f: (X, d) \to (Y, \rho)$$ be continuous on $$X$$. If $$X$$ is compact, then $$f$$ is uniformly continuous.

Proof. We proceed as follows.

1. Let $$\epsilon > 0$$.

2. Since $$f$$ is continuous on $$X$$, hence for every $$x \in X$$, there exists $$r_x > 0$$ such that $$\rho(f(y), f(x)) < \epsilon$$ holds whenever $$d(x, y) < 2 r_x$$.

3. The collection of open balls $$B(x, r_x)$$ covers $$X$$; i.e., $$X = \bigcup_{x \in X}B(x, r_x)$$.

4. Since $$X$$ is compact, there exists a set of finite number of points $$x_1, \dots, x_n$$ such that $$X = \bigcup_{i=1}^n B(x_i, r_{x_i})$$.

5. Now, let $$\delta = \min \{r_{x_1}, \dots, r_{x_n} \}$$.

6. Since $$\delta$$ is the minimum of a finite number of positive numbers, hence $$\delta > 0$$.

7. Now, pick any $$x, y \in X$$ that satisfy $$d(x, y) < \delta$$.

8. There exists an integer $$i$$ such that $$d(x, x_i) < r_{x_i}$$ (due to the finite open cover).

9. Therefore, $$\rho(f(x), f(x_i)) < \epsilon$$.

10. Now, by triangle inequality:

$d(y, x_i) \leq d(y, x) + d(x, x_i) < \delta + r_{x_i} \leq 2 r_{x_i}$

holds true.

11. Thus, $$\rho(f(x_i), f(y)) < \epsilon$$, since $$d(y, x_i) < 2 r_{x_i}$$.

12. Thus,

$\rho(f(x), f(y)) \leq \rho(f(x), f(x_i)) + \rho(f(x_i), f(y)) < \epsilon + \epsilon = 2\epsilon.$
13. Thus, $$f$$ is uniformly continuous.

## 3.8.10. Euclidean Spaces#

Recall that $$\RR^m$$ are called Euclidean spaces with the standard metric:

$d (x, y) \triangleq \left ( \sum_{i=1}^m |x_i - y_i|^2 \right )^{\frac{1}{2}}.$

By $$0 \in \RR^m$$ we shall mean the vector $$(0, \dots, 0)$$.

The compact subsets of a Euclidean space are precisely those sets which are closed and bounded.

Theorem 3.84 (Heine-Borel theorem)

A subset of a Euclidean space is compact if and only if it is closed and bounded.

Compare this to Heine-Borel theorem for the real line. We established there that for a closed and bounded subset of $$\RR$$, any open cover can be reduced to a finite subcover. There, we defined closed and bounded sets as compact sets. Our treatment of compactness in this section is more general.

We start here with the definition that a compact set is one for which any open cover can be reduced to a finite subcover. We then show in this theorem that in the special case of Euclidean spaces $$\RR^m$$, the compact subsets are identical to the closed and bounded subsets of $$\RR^m$$.

Proof. We have shown in Theorem 3.76 that every compact set is closed and bounded.

For the converse, we assume $$A$$ is a closed and bounded subset of $$\RR^m$$. We will show that every sequence of $$A$$ has a subsequence converging in $$A$$.

1. Since $$A$$ is bounded, we can pick $$M > 0$$ such that $$d(x, y) \leq M$$ for all $$x, y \in A$$.

2. Fix an element $$y \in A$$.

3. Let $$a = (a_1, \dots, a_m) \in A$$ be some arbitrary point of $$A$$. Then

$|a_i | \leq d(a, 0) \leq d(a, y) + d(y, 0) \leq M + d(y, 0)$

holds for every $$1 \leq i \leq m$$.

4. Thus, the set of real numbers consisting of the $$i$$-th coordinates of the elements of $$A$$ is a bounded set.

5. Choose an arbitrary sequence $$\{ x_n \}$$ of $$A$$.

6. Recall from Bolzano Weierstrass theorem for real numbers that every bounded sequence of real numbers has a convergent subsequence.

7. Note that if we form the sequence of real numbers from any particular coordinate of $$\{x_n\}$$, (say first coordinates or second coordinates) then the sequence is bounded by $$M + d(y, 0)$$.

8. Every such sequence of real numbers (from a fixed coordinate of $$\{x_n\}$$) will have a convergent subsequence.

9. Thus, there is a subsequence $$\{x^1_n\}$$ of $$\{x_n\}$$ whose first coordinates form a sequence in $$\RR$$ that converges in $$\RR$$.

10. Now, we choose $$\{x^2_n\}$$ as a subsequence of $$\{x^1_n\}$$ so that the corresponding sequence of second coordinates of $$\{x^2_n\}$$ converge in $$\RR$$.

11. Proceeding in this manner, after $$m$$ steps, we have a subsequence $$\{x^m_n\}$$ of $$\{x_n\}$$ with the property that for each $$1 \leq i \leq m$$, the sequence of its $$i$$-th coordinates forms a convergent subsequence in $$\RR$$.

12. Since each of the coordinates of $$\{x^m_n\}$$ converges in $$\RR$$, hence, $$\{x^m_n\}$$ converges in $$\RR^m$$.

13. But since $$A$$ is closed, hence $$\{x^m_n\}$$ converges to a point of $$A$$.

14. Thus, every sequence of $$A$$ has a convergent subsequence in $$A$$.

15. Thus, by Theorem 3.75, $$A$$ is compact.

Note that the property convergence in individual coordinates implies convergence in $$\RR^m$$ is due to the specific choice of Euclidean metric.

Theorem 3.85 (Attainment of minimum and maximum values)

Let $$f : (X, d) \to \RR$$ be a real valued function. If $$f$$ is continuous then $$f$$ attains a maximum and minimum value on every compact subset of $$\dom f$$.

Proof. Let $$A$$ be a compact subset of $$\dom f$$.

1. Then, $$f(A)$$ is compact in $$\RR$$ due to Theorem 3.78.

2. Then, $$f(A)$$ is closed and bounded due to Heine-Borel theorem.

3. Since $$f(A)$$ is bounded, hence it has an infimum and supremum.

4. Since $$f(A)$$ is closed, hence its infimum and supremum lie inside $$f(A)$$ itself.

5. Thus, $$f$$ attains a maximum and minimum value in $$A$$.

Theorem 3.86 (Bolzano Weierstrass theorem for bounded subsets of $$\RR^m$$)

Every sequence in a closed and bounded set in $$\RR^m$$ has a convergent subsequence.

Proof. Let $$A$$ be a closed and bounded subset of $$\RR^n$$.

1. By Theorem 3.84, $$A$$ is compact.

2. By Theorem 3.75, every sequence in $$A$$ has a subsequence which converges to a point of $$A$$.

Theorem 3.87 (Bolzano Weierstrass theorem for bounded sequences of $$\RR^m$$)

Every bounded sequence in $$\RR^m$$ has a convergent subsequence.

Proof. Let $$\{ x_m \}$$ be a bounded sequence of $$\RR^m$$. Then there exists a closed ball $$B[0, M]$$ such that $$\{ x_m \} \subset B[0, M]$$.

$$B[0, M]$$ is closed and bounded. From Theorem 3.86, every sequence in a closed and bounded subset of $$\RR^n$$ has a convergent subsequence.

## 3.8.11. Totally Bounded Metric Spaces#

Definition 3.58 (Totally bounded space)

A metric space $$(X,d)$$ is called totally bounded if for each $$r > 0$$, there exists a finite number of points $$x_1, \dots, x_n \in X$$ such that

$X = \bigcup_{i=1}^n B(x_i, r).$

Theorem 3.88 (Compactness implies total boundedness)

A compact metric space is totally bounded.

Proof. Let $$(X,d)$$ be a compact metric space.

1. Let $$r > 0$$.

2. Consider the family of open balls $$\{ B(x, r) \}_{x \in X}$$.

3. Then $$X = \bigcup_{x \in X} B(x, r)$$.

4. Since $$X$$ is compact, there is a finite subcover of open balls.

5. Thus, for every $$r > 0$$, there $$X$$ is a union of finite open balls.

6. Thus, $$X$$ is totally bounded.

Example 3.25

We showed earlier in Example 3.24 that $$(0,1)$$ is not compact.

However $$(0,1)$$ is totally bounded.

1. Let $$r > 0$$.

2. Pick any $$n> \frac{1}{r}$$. Thus, $$r > \frac{1}{n}$$.

3. Consider the points $$\frac{1}{n}, \frac{2}{n}, \dots, \frac{n-1}{n}$$.

4. $$\frac{k}{n} + r > \frac{k}{n} + \frac{1}{n} = \frac{k+1}{n}$$.

5. $$\frac{k}{n} - r < \frac{k}{n} - \frac{1}{n} = \frac{k-1}{n}$$.

6. Thus,

$\left (\frac{k-1}{n}, \frac{k+1}{n}\right ) \subseteq B\left (\frac{k}{n}, r \right )$
7. Thus,

$(0, 1) = \bigcup_{k=1}^{n-1}B\left (\frac{k}{n}, r \right ).$

with the caveat that the first and last balls are restricted within the set $$(0,1)$$.

8. Thus, we have a finite union of open balls.

9. Thus, $$(0,1)$$ is totally bounded.

Theorem 3.89 (Completeness and Compactness)

A metric space is compact if and only if it is complete and totally bounded.

Proof. Let $$(X,d)$$ be a metric space. Assume that $$(X,d)$$ is compact.

1. $$(X,d)$$ is totally bounded (Theorem 3.88).

2. Since $$(X,d)$$ is compact, hence every sequence has a convergent subsequence that converges to a point in $$X$$ (Theorem 3.75 (3)).

3. Thus, if $$\{x_n\}$$ is a Cauchy subsequence of $$X$$, then it has a subsequence with limit $$x \in X$$ leading to $$\lim x_n = x$$.

4. Thus, every Cauchy sequence of $$X$$ converges in $$X$$.

5. Thus, $$(X,d)$$ is complete.

For the converse, assume that $$(X,d)$$ is complete and totally bounded. To show that $$(X,d)$$ is compact, we will show that every infinite subset of $$X$$ has an accumulation point in $$X$$ (Theorem 3.75 (2)).

1. Let $$A$$ be an infinite subset of $$X$$.

2. Since $$X$$ is totally bounded, there exists a finite subset $$F_1 \subset X$$ such that

$X = \bigcup_{x \in F_1} B(x, 1).$
3. We can extend the open balls with closed balls without problem:

$X = \bigcup_{x \in F_1} B[x, 1].$
4. Thus:

$A = A \cap X = \bigcup_{x \in F_1}( A \cap B[x, 1]).$
5. Since $$A$$ is infinite, there is some $$x_1 \in F_1$$ such that $$A_1 = A \cap B[x_1, 1]$$ is an infinite set.

1. If $$A \cap B[x, 1]$$ were finite for each $$x \in F$$, then $$A$$ would be finite as a finite union of finite sets.

6. Since $$X$$ is totally bounded, we can again find a finite subset $$F_2 \subset X$$ such that

$X = \bigcup_{x \in F_2} B\left [x, \frac{1}{2}\right].$
7. Since $$A_1$$ is infinite, there is some $$x_2 \in F_2$$ such that $$A_2 = A_1 \cap B\left[x_2, \frac{1}{2} \right]$$ is an infinite set.

8. Proceeding inductively, if $$x_1, x_2, \dots, x_n$$ have been chosen, we can choose $$x_{n+1}$$ such that the set

$A \cap B[x_1, 1] \cap B\left [x_2, \frac{1}{2} \right] \cap \dots \cap B\left [x_n, \frac{1}{n}\right] \cap B\left [x_{n+1}, \frac{1}{n+1} \right]$

is infinite.

9. Define

$E_n = B[x_1, 1] \cap B\left [x_2, \frac{1}{2} \right] \cap \dots \cap B\left [x_n, \frac{1}{n}\right]$

for each $$n$$.

10. Then for each $$n$$:

1. $$E_n$$ is nonempty and closed.

2. $$A \cap E_n$$ is infinite.

3. $$E_{n+1} \subseteq E_{n}$$.

4. $$\diam E_n \leq \frac{2}{n}$$. $$\lim \diam E_n = 0$$.

11. Due to Theorem 3.59, there exists $$a \in X$$, such that $$a \in E_n$$ for each $$n$$.

12. Now, if $$y \in A \cap E_n$$, then

$d(a, y) \leq d(a, x_n) + d(x_n, y) < \frac{1}{n} + \frac{1}{n} = \frac{2}{n}.$
13. Thus, for every $$r > 0$$, we can pick $$n > \frac{2}{r}$$ such that for every $$y \in A \cap E_n$$, $$y \in B(a, r)$$.

14. Thus, $$a$$ is an accumulation point of $$A$$.

15. Thus, every infinite subset of $$X$$ has an accumulation point in $$X$$.

16. Thus, $$X$$ is compact.

## 3.8.12. Equivalent Metrics#

Theorem 3.90 (Metric equivalence and compactness)

Let $$d_a$$ and $$d_b$$ be two different metrics on the same set $$X$$ that are equivalent.

Then, a set $$A \subseteq X$$ is compact in $$(X, d_a)$$ if and only if $$A$$ is compact in $$(X, d_b)$$.

In other words, the compact sets in the two metric spaces are identical.

Proof. Assume $$A$$ to be compact in $$(X, d_a)$$.

1. Let $$A \subseteq \bigcup_{i \in I} \OOO_i$$ be an open cover of $$A$$ in $$(X, d_b)$$; i.e. $$\OOO_i$$ are open in $$(X, d_b)$$.

2. Since $$d_a$$ and $$d_b$$ are equivalent, hence $$\OOO_i$$ are open in $$(X, d_a)$$ too.

3. Thus, $$\bigcup_{i \in I} \OOO_i$$ is an open cover for $$A$$ in $$(X, d_a)$$ too.

4. Since $$A$$ is compact in $$(X, d_a)$$, hence, there exist finite indices $$i_1, \dots, i_n$$ such that $$A \subseteq \OOO_{i_1} \cup \dots \cup \OOO_{i_n}$$.

5. But then, $$\OOO_{i_1}, \dots, \OOO_{i_n}$$ are open in $$(X, d_b)$$ too.

6. Thus, $$A \subseteq \OOO_{i_1} \cup \dots \cup \OOO_{i_n}$$ is a finite open subcover of $$A$$ in $$(X, d_b)$$.

7. Thus, every open cover of $$A$$ in $$(X, d_b)$$ can be reduced to a finite subcover.

8. Thus, $$A$$ is compact in $$(X, d_b)$$.

A similar reasoning establishes that if $$A$$ is compact in $$(X, d_b)$$ then $$A$$ is compact in $$(X, d_a)$$ too.