The following exercises are meant to reinforce the notion of compact sets in \(\mathbb R\). We will rely mainly on the Heine–Borel theorem, which states that a subset of \(\mathbb R\) is compact if and only if it is closed and bounded.
Exercise 1 — level ★☆☆☆☆
Determine whether the set
\[ A=[2,5] \]
is compact in \(\mathbb R\).
Answer
The set \(A=[2,5]\) is compact.
Solution
In \(\mathbb R\), by the Heine–Borel theorem, a set is compact if and only if it is closed and bounded.
The interval \([2,5]\) is closed, since it contains both of its endpoints \(2\) and \(5\).
It is also bounded, since all of its elements satisfy
\[ 2\le x\le 5. \]
Thus \(A\) is closed and bounded. Therefore, by the Heine–Borel theorem, \(A\) is compact.
Exercise 2 — level ★☆☆☆☆
Determine whether the set
\[ A=(2,5) \]
is compact in \(\mathbb R\).
Answer
The set \(A=(2,5)\) is not compact.
Solution
The interval \((2,5)\) is bounded, since all of its elements lie between \(2\) and \(5\).
However, it is not closed, because it fails to contain its accumulation points \(2\) and \(5\). Indeed, there are sequences of points of \(A\) that converge to \(2\) or to \(5\); for instance,
\[ x_n=2+\frac1n. \]
For every sufficiently large \(n\) we have \(x_n\in(2,5)\), yet
\[ x_n\to 2, \]
and \(2\notin A\).
Hence \(A\) is not closed. Since a compact set in \(\mathbb R\) must be closed and bounded, \(A\) is not compact.
Exercise 3 — level ★☆☆☆☆
Determine whether the set
\[ A=[0,+\infty) \]
is compact in \(\mathbb R\).
Answer
The set \(A=[0,+\infty)\) is not compact.
Solution
The set \(A=[0,+\infty)\) is closed in \(\mathbb R\), since it contains its boundary point \(0\) and its complement
\[ \mathbb R\setminus A=(-\infty,0) \]
is open.
However, \(A\) is not bounded above. Indeed, for every \(M>0\), the number
\[ M+1 \]
belongs to \(A\) and is greater than \(M\).
Hence \(A\) is not bounded. By the Heine–Borel theorem, being unbounded, it cannot be compact.
Exercise 4 — level ★☆☆☆☆
Determine whether the set
\[ A=\{1,2,3,4\} \]
is compact in \(\mathbb R\).
Answer
The set \(A=\{1,2,3,4\}\) is compact.
Solution
Every finite set of real numbers is closed and bounded.
The set \(A\) is bounded, since all of its elements lie between \(1\) and \(4\):
\[ 1\le x\le 4 \quad \text{for every } x\in A. \]
Moreover, \(A\) is closed, since it is a finite set and all of its points are isolated.
Thus \(A\) is closed and bounded. By the Heine–Borel theorem, \(A\) is compact.
Exercise 5 — level ★★☆☆☆
Determine whether the set
\[ A=\left\{\frac1n:n\in\mathbb N,\ n\ge 1\right\} \]
is compact in \(\mathbb R\).
Answer
The set \(A\) is not compact.
Solution
The set \(A\) is bounded, since
\[ 0<\frac1n\le 1 \]
for every \(n\ge 1\). Hence
\[ A\subseteq (0,1]. \]
However, \(A\) is not closed. Indeed, the sequence
\[ x_n=\frac1n \]
consists of points of \(A\), but converges to \(0\):
\[ \frac1n\to 0. \]
The point \(0\) is therefore an accumulation point of \(A\), yet
\[ 0\notin A. \]
Hence \(A\) is not closed. Being bounded but not closed, it is not compact.
Exercise 6 — level ★★☆☆☆
Determine whether the set
\[ A=\left\{0\right\}\cup\left\{\frac1n:n\in\mathbb N,\ n\ge 1\right\} \]
is compact in \(\mathbb R\).
Answer
The set \(A\) is compact.
Solution
The set \(A\) is bounded, since
\[ 0\le x\le 1 \]
for every \(x\in A\). Hence \(A\subseteq[0,1]\).
Let us now check that \(A\) is closed. The points of the form \(\displaystyle \frac1n\) are isolated, while the only accumulation point of the set is \(0\).
Indeed,
\[ \frac1n\to 0. \]
Unlike in the previous exercise, this time \(0\) belongs to the set \(A\).
Hence \(A\) contains all of its accumulation points and is closed.
Since \(A\) is closed and bounded, by the Heine–Borel theorem it is compact.
Exercise 7 — level ★★☆☆☆
Determine whether the set
\[ A=[-1,1]\setminus\{0\} \]
is compact in \(\mathbb R\).
Answer
The set \(A\) is not compact.
Solution
The set \(A\) is bounded, since it is contained in \([-1,1]\).
However, \(A\) is not closed. Indeed, \(0\) is an accumulation point of \(A\): every neighbourhood of \(0\) contains points of \(A\) different from \(0\), for instance numbers of the form
\[ \pm\frac1n \]
for sufficiently large \(n\).
Moreover,
\[ \frac1n\in A \quad \text{and} \quad \frac1n\to 0. \]
But \(0\notin A\), since it was removed from the interval \([-1,1]\).
Hence \(A\) does not contain all of its accumulation points, and so it is not closed.
Being bounded but not closed, \(A\) is not compact.
Exercise 8 — level ★★☆☆☆
Determine whether the set
\[ A=\left[-2,3\right]\cup\{7\} \]
is compact in \(\mathbb R\).
Answer
The set \(A\) is compact.
Solution
The interval \([-2,3]\) is closed and bounded, hence compact.
The singleton \(\{7\}\) is also closed and bounded, hence compact.
A finite union of closed sets is closed. Therefore
\[ A=[-2,3]\cup\{7\} \]
is closed.
Moreover, \(A\) is bounded, since all of its elements lie between \(-2\) and \(7\):
\[ -2\le x\le 7 \quad \text{for every } x\in A. \]
Thus \(A\) is closed and bounded. By the Heine–Borel theorem, \(A\) is compact.
Exercise 9 — level ★★☆☆☆
Determine whether the set
\[ A=\bigcup_{n=1}^{+\infty}\left[\frac1n,1\right] \]
is compact in \(\mathbb R\).
Answer
The set \(A\) is not compact.
Solution
First observe that
\[ \left[\frac1n,1\right]\subseteq(0,1] \]
for every \(n\ge 1\). Moreover, given any \(x\in(0,1]\), we may choose \(n\) large enough that
\[ \frac1n\le x. \]
Then
\[ x\in\left[\frac1n,1\right]. \]
Hence
\[ A=(0,1]. \]
The set \((0,1]\) is bounded but not closed, since \(0\) is an accumulation point that does not belong to the set.
Indeed,
\[ \frac1n\in A \quad \text{and} \quad \frac1n\to 0, \]
but \(0\notin A\).
Therefore \(A\) is not closed and hence not compact.
Exercise 10 — level ★★☆☆☆
Determine whether the set
\[ A=\bigcap_{n=1}^{+\infty}\left[-1,\frac1n\right] \]
is compact in \(\mathbb R\).
Answer
The set \(A=[-1,0]\) is compact.
Solution
We must first determine the set \(A\).
A number \(x\) belongs to \(A\) if and only if it belongs to all of the intervals
\[ \left[-1,\frac1n\right]. \]
This means that
\[ -1\le x\le \frac1n \]
for every \(n\ge 1\).
If \(x\le 0\) and \(x\ge -1\), then certainly
\[ x\le \frac1n \]
for every \(n\ge 1\). Hence \([-1,0]\subseteq A\).
Conversely, if \(x>0\), then by choosing \(n\) large enough we have
\[ \frac1n<x. \]
Then \(x\notin\left[-1,\displaystyle\frac1n\right]\), so \(x\notin A\).
Therefore
\[ A=[-1,0]. \]
The interval \([-1,0]\) is closed and bounded. Hence, by the Heine–Borel theorem, it is compact.
Exercise 11 — level ★★★☆☆
Prove that the set
\[ A=\left\{\frac{n}{n+1}:n\in\mathbb N,\ n\ge 1\right\}\cup\{1\} \]
is compact in \(\mathbb R\).
Answer
The set \(A\) is compact.
Solution
Let us write the general term in the form
\[ \frac{n}{n+1}=1-\frac1{n+1}. \]
From this expression it follows that
\[ 0<\frac{n}{n+1}<1 \]
for every \(n\ge 1\), and moreover
\[ \frac{n}{n+1}\to 1. \]
The set \(A\) is bounded, since all of its elements lie in the interval \([0,1]\).
Furthermore, the only accumulation point of the sequence
\[ \frac{n}{n+1} \]
is \(1\), and this point belongs to \(A\).
The points
\[ \frac{n}{n+1} \]
are isolated, while \(1\) is included in the set.
Hence \(A\) contains all of its accumulation points and is closed.
Being closed and bounded, \(A\) is compact by the Heine–Borel theorem.
Exercise 12 — level ★★★☆☆
Determine whether the set
\[ A=\left\{x\in\mathbb R: x^2<4\right\} \]
is compact in \(\mathbb R\).
Answer
The set \(A\) is not compact.
Solution
Let us first solve the inequality
\[ x^2<4. \]
It is equivalent to
\[ -2<x<2. \]
Hence
\[ A=(-2,2). \]
The set \(A\) is bounded, since it is contained in \([-2,2]\).
However, it is not closed, because it does not contain the points \(-2\) and \(2\), which are accumulation points of the set.
For instance, the sequence
\[ x_n=2-\frac1n \]
belongs to \(A\) for every sufficiently large \(n\ge 1\) and converges to \(2\), but \(2\notin A\).
Hence \(A\) is not closed. By the Heine–Borel theorem, \(A\) is not compact.
Exercise 13 — level ★★★☆☆
Determine whether the set
\[ A=\left\{x\in\mathbb R: x^2\le 4\right\} \]
is compact in \(\mathbb R\).
Answer
The set \(A\) is compact.
Solution
Let us solve the inequality
\[ x^2\le 4. \]
It is equivalent to
\[ -2\le x\le 2. \]
Hence
\[ A=[-2,2]. \]
The interval \([-2,2]\) is closed, since it contains its endpoints, and bounded, since every element \(x\) satisfies
\[ -2\le x\le 2. \]
By the Heine–Borel theorem, \(A\) is compact.
Exercise 14 — level ★★★☆☆
Let
\[ A=\left\{x\in\mathbb R: |x-3|\le 2\right\}. \]
Determine whether \(A\) is compact.
Answer
The set \(A=[1,5]\) is compact.
Solution
The inequality
\[ |x-3|\le 2 \]
states that the distance from \(x\) to \(3\) is at most \(2\). Equivalently,
\[ -2\le x-3\le 2. \]
Adding \(3\) to all three terms, we obtain
\[ 1\le x\le 5. \]
Hence
\[ A=[1,5]. \]
The interval \([1,5]\) is closed and bounded. By the Heine–Borel theorem, \(A\) is compact.
Exercise 15 — level ★★★☆☆
Prove that the intersection of two compact sets \(K_1,K_2\subseteq\mathbb R\) is compact.
Answer
The set \(K_1\cap K_2\) is compact.
Solution
Since \(K_1\) and \(K_2\) are compact in \(\mathbb R\), by the Heine–Borel theorem they are closed and bounded.
The intersection of two closed sets is closed. Hence
\[ K_1\cap K_2 \]
is closed.
Moreover, \(K_1\cap K_2\subseteq K_1\). Since \(K_1\) is bounded, every subset of it is bounded. Hence \(K_1\cap K_2\) is bounded.
We have shown that \(K_1\cap K_2\) is closed and bounded.
Therefore, by the Heine–Borel theorem, \(K_1\cap K_2\) is compact.
Exercise 16 — level ★★★☆☆
Prove that the union of two compact sets \(K_1,K_2\subseteq\mathbb R\) is compact.
Answer
The set \(K_1\cup K_2\) is compact.
Solution
Since \(K_1\) and \(K_2\) are compact in \(\mathbb R\), they are closed and bounded.
A finite union of closed sets is closed. Hence
\[ K_1\cup K_2 \]
is closed.
Since \(K_1\) is bounded, there exists \(M_1>0\) such that
\[ |x|\le M_1 \quad \text{for every } x\in K_1. \]
Since \(K_2\) is bounded, there exists \(M_2>0\) such that
\[ |x|\le M_2 \quad \text{for every } x\in K_2. \]
Set
\[ M=\max\{M_1,M_2\}. \]
Then, for every \(x\in K_1\cup K_2\), we have
\[ |x|\le M. \]
Hence \(K_1\cup K_2\) is bounded.
Being closed and bounded, \(K_1\cup K_2\) is compact.
Exercise 17 — level ★★★★☆
Prove that the set
\[ K=\left\{x\in[0,2]: x\neq 1\right\} \]
is not compact.
Answer
The set \(K=[0,2]\setminus\{1\}\) is not compact.
Solution
The set \(K\) is bounded, since it is contained in \([0,2]\).
However, it is not closed. Indeed, \(1\) is an accumulation point of \(K\), but it does not belong to \(K\).
To see this explicitly, consider the sequence
\[ x_n=1+\frac1n. \]
For every \(n\ge 1\) we have \(x_n\neq 1\), and for sufficiently large \(n\) we have \(x_n\in[0,2]\). Hence \(x_n\in K\).
Moreover,
\[ x_n\to 1. \]
But \(1\notin K\). Hence \(K\) is not closed.
Since every compact set in \(\mathbb R\) must be closed and bounded, \(K\) is not compact.
Exercise 18 — level ★★★★☆
Prove, using open covers, that the set
\[ A=(0,1) \]
is not compact.
Answer
The interval \((0,1)\) is not compact.
Solution
Consider the family of open sets
\[ \mathcal U=\left\{\left(\frac1n,1\right):n\in\mathbb N,\ n\ge 2\right\}. \]
This family covers \((0,1)\). Indeed, given \(x\in(0,1)\), we may choose \(n\) large enough that
\[ \frac1n<x. \]
Then
\[ x\in\left(\frac1n,1\right). \]
Hence
\[ (0,1)\subseteq\bigcup_{n=2}^{+\infty}\left(\frac1n,1\right). \]
Now suppose we select finitely many of these open sets:
\[ \left(\frac1{n_1},1\right),\ldots,\left(\frac1{n_k},1\right). \]
Let
\[ N=\max\{n_1,\ldots,n_k\}. \]
Among these intervals, the one whose left endpoint is farthest to the left is
\[ \left(\frac1N,1\right). \]
The chosen finite union is therefore equal to
\[ \left(\frac1N,1\right). \]
But the point
\[ x=\frac1{N+1} \]
belongs to \((0,1)\) and satisfies
\[ \frac1{N+1}<\frac1N. \]
Hence \(x\) does not belong to the chosen finite union.
We have produced an open cover of \((0,1)\) that admits no finite subcover. By definition, \((0,1)\) is not compact.
Exercise 19 — level ★★★★☆
Prove, using sequences, that the set
\[ A=(0,1] \]
is not compact.
Answer
The set \((0,1]\) is not compact.
Solution
In \(\mathbb R\), every sequence contained in a compact set has a subsequence converging to a point of the set.
Consider the sequence
\[ x_n=\frac1n. \]
For every \(n\ge 1\) we have
\[ x_n\in(0,1]. \]
Moreover,
\[ x_n\to 0. \]
Every subsequence of \((x_n)\) still converges to \(0\). Indeed, if \((x_{n_k})\) is a subsequence, then
\[ x_{n_k}=\frac1{n_k}\to 0. \]
But
\[ 0\notin(0,1]. \]
Hence the sequence \((x_n)\), although entirely contained in \((0,1]\), has no subsequence converging to a point of \((0,1]\).
Therefore \((0,1]\) is not compact.
Exercise 20 — level ★★★★★
Let \(K\subseteq\mathbb R\) be a compact set and let \(f:K\to\mathbb R\) be a continuous function. Prove that \(f(K)\) is compact.
Answer
The continuous image of a compact set is compact.
Solution
We want to prove that
\[ f(K)=\{f(x):x\in K\} \]
is compact.
We use the sequential criterion for compactness in \(\mathbb R\). Let \((y_n)\) be a sequence of points of \(f(K)\). By the definition of image, for each \(n\) there exists \(x_n\in K\) such that
\[ y_n=f(x_n). \]
Since \(K\) is compact, from the sequence \((x_n)\) we can extract a subsequence \((x_{n_k})\) converging to a point \(x_0\in K\):
\[ x_{n_k}\to x_0. \]
Since \(f\) is continuous at \(x_0\), passing to the limit we obtain
\[ f(x_{n_k})\to f(x_0). \]
But
\[ f(x_{n_k})=y_{n_k}. \]
Hence the sequence \((y_n)\) has a subsequence \((y_{n_k})\) converging to the point
\[ f(x_0)\in f(K). \]
We have shown that every sequence in \(f(K)\) has a subsequence converging to a point of \(f(K)\). Therefore \(f(K)\) is compact.