7.2 Compactness in Metric Spaces
Finite up to $\varepsilon$: open covers, sequential compactness and total boundedness — why they agree in every metric space, why closed and bounded suffices in $\mathbb{R}^n$ but not in $\ell^2$ or $C[0,1]$, and what compactness does for continuous functions.
In §3.1 we met compactness on the real line: a set $K\subseteq\mathbb{R}$ is compact when every open cover has a finite subcover, and the Heine–Borel theorem identifies these sets as the closed bounded ones. Compactness is what turns local information into global information — "near every point $f$ is bounded" becomes "$f$ is bounded", "near every point one $\delta$ works" becomes "one $\delta$ works everywhere". The extreme value theorem, uniform continuity on $[a,b]$ and Dini's theorem are all instances.
In a general metric space three different ideas compete for the name "compact": every open cover has a finite subcover; every sequence has a convergent subsequence; and the space is complete and can be covered, for every $\varepsilon$, by finitely many $\varepsilon$-balls. The main theorem of this section is that in a metric space these are all the same. The other main point is a warning: "closed and bounded" is not on the list. It works in $\mathbb{R}^n$, but the closed unit ball of $\ell^2$, of $C[0,1]$ and of any infinite discrete space is closed, bounded and not compact — a fact that CSIR Part C tests in almost every paper, together with the Hilbert cube, which is compact although it is infinite-dimensional.
Compact Sets in a Metric Space
Let $(X,d)$ be a metric space and $K\subseteq X$. An open cover of $K$ is a family $\mathcal U=\{U_\alpha\}_{\alpha\in I}$ of open subsets of $X$ with $K\subseteq\bigcup_\alpha U_\alpha$; a subcover is a subfamily that still covers $K$. $K$ is compact if every open cover of $K$ has a finite subcover. The space $X$ is compact if $K=X$ is.
Compactness is intrinsic. If $K\subseteq Y\subseteq X$, then $K$ is compact as a subset of $Y$ (covers by sets open in $Y$) iff it is compact as a subset of $X$: a set open in $Y$ has the form $V\cap Y$ with $V$ open in $X$, so covers translate in both directions. Hence we may always regard a compact set as a compact metric space in its own right. Closedness, by contrast, is relative: $(0,1]$ is closed in $(0,1]$ but not in $\mathbb{R}$, and it is not compact.
Let $(X,d)$ be a metric space.
- A compact subset of $X$ is closed and bounded.
- A closed subset of a compact set is compact.
- A finite union of compact sets is compact; an arbitrary (nonempty) intersection of compact sets is compact.
- Every finite set is compact; a convergent sequence together with its limit is compact.
Proof. (1) Bounded: fix $a\in X$; the balls $B(a,n)$, $n\in\mathbb{N}$, cover $X\supseteq K$, and they increase, so one of them contains $K$. Closed: let $p\in X\setminus K$. The open sets $U_n=\{x:d(x,p)\gt\tfrac1n\}$ cover $X\setminus\{p\}\supseteq K$ and increase, so $K\subseteq U_N$ for some $N$; then $B(p,\tfrac1N)$ misses $K$. Thus $X\setminus K$ is open.
(2) Let $F\subseteq K$ be closed in $X$ and $\mathcal U$ an open cover of $F$. Then $\mathcal U\cup\{X\setminus F\}$ is an open cover of $K$; take a finite subcover and discard $X\setminus F$, which contains no point of $F$.
(3) For $K_1\cup\dots\cup K_m$, combine finite subcovers of each $K_i$. An intersection $\bigcap K_\alpha$ is closed by (1) and lies in one compact $K_{\alpha_0}$, so it is compact by (2).
(4) Finite sets: one member per point. If $x_n\to x$ and $\mathcal U$ covers $K=\{x\}\cup\{x_n\}$, some $U_0\in\mathcal U$ contains $x$, hence a ball $B(x,r)$, hence all $x_n$ with $n\ge N$; finitely many further members cover $x_1,\dots,x_{N-1}$. ∎
The converse of (1) is false in general (Theorem 7.17 below); it is true in $\mathbb{R}^n$ (Theorem 7.16). Note also that (1) uses the metric: compact subsets of a metric space are closed because two distinct points can be separated by balls.
Proof. Closed sets $F_\alpha$ have empty intersection iff their complements $U_\alpha=X\setminus F_\alpha$ cover $X$ (De Morgan). "Some finite subfamily of the $F_\alpha$ has empty intersection" says "some finite subfamily of the $U_\alpha$ covers $X$". So "every open cover has a finite subcover" is, word for word, "every family of closed sets with empty intersection fails the FIP" — the contrapositive of the stated condition. For the nested sequence, apply this inside the compact space $K_1$: the closed subsets $K_n$ of $K_1$ have the FIP because $K_{n_1}\cap\dots\cap K_{n_m}=K_{\max n_i}\ne\varnothing$. ∎
Compactness cannot be dropped: in $\mathbb{R}$ the closed sets $[n,\infty)$ are nested and nonempty with empty intersection. Compare Cantor's intersection theorem (Theorem 7.8), which trades compactness for completeness plus $\operatorname{diam}F_n\to0$.
Sequential Compactness and Total Boundedness
Totally bounded sets are bounded (if $\{a_1,\dots,a_N\}$ is a $1$-net, $\operatorname{diam}X\le2+\max_{i,j}d(a_i,a_j)$), and a subset of a totally bounded set is totally bounded (Exercise II.1). In $\mathbb{R}^n$ the converse holds: a bounded set lies in a cube, and a cube of side $L$ is covered by $m^n$ subcubes of side $L/m$, each inside a ball of radius $\sqrt n\,L/m$. In infinite dimensions bounded sets need not be totally bounded — Example 1(c) shows that the unit ball of $\ell^2$ has no $\tfrac{\sqrt2}2$-net. A good way to see total boundedness is to build nets: go through the points and keep a point as a new centre whenever it is at distance at least $\varepsilon$ from all the centres chosen so far. The centres end up pairwise $\ge\varepsilon$ apart, and every point is within $\varepsilon$ of one of them. Interactive 1 does exactly this.
Proof. Suppose the open cover $\mathcal U$ has no Lebesgue number. Then for each $n$ the number $\tfrac1n$ fails: there is $x_n$ such that $B(x_n,\tfrac1n)$ lies in no member of $\mathcal U$. By sequential compactness a subsequence $x_{n_k}\to x\in X$. Some $U\in\mathcal U$ contains $x$, hence a ball $B(x,r)$. Choose $k$ so large that $d(x_{n_k},x)\lt\tfrac r2$ and $\tfrac1{n_k}\lt\tfrac r2$. Then for $y\in B(x_{n_k},\tfrac1{n_k})$, $d(y,x)\lt\tfrac r2+\tfrac r2=r$, so $B(x_{n_k},\tfrac1{n_k})\subseteq B(x,r)\subseteq U$ — a contradiction. ∎
A second, more geometric proof for compact $X$: the function $\rho$, where $\rho(x)$ is the supremum of the $r\le1$ such that $B(x,r)$ lies in some member of $\mathcal U$, is positive, and it is $1$-Lipschitz (if $B(x,r)\subseteq U$ then $B(y,r-d(x,y))\subseteq U$); a positive continuous function on a compact space has a positive minimum (Theorem 7.18), and any $\lambda$ below that minimum works. Interactive 2 plots this function $\rho$.
For a metric space $X$ the following are equivalent:
- $X$ is compact (every open cover has a finite subcover);
- $X$ has the Bolzano–Weierstrass property (every infinite subset has a limit point in $X$);
- $X$ is sequentially compact;
- $X$ is complete and totally bounded.
Proof. (1)⇒(2). Let $E\subseteq X$ have no limit point in $X$. Then every $x\in X$ has a ball $B(x,r_x)$ containing no point of $E$ other than (possibly) $x$ itself. These balls cover $X$; finitely many of them cover $X$, and together they contain at most finitely many points of $E$. So $E$ is finite.
(2)⇒(3). Let $(x_n)$ be a sequence. If its range $E=\{x_n\}$ is finite, some value is taken infinitely often, giving a constant subsequence. Otherwise $E$ is infinite and has a limit point $p$. Every ball $B(p,r)$ then contains infinitely many points of $E$ (Exercise II.9 of §7.1), hence $x_n$ for infinitely many indices $n$. Choose $n_1$ with $d(x_{n_1},p)\lt1$ and, inductively, $n_{k+1}\gt n_k$ with $d(x_{n_{k+1}},p)\lt\tfrac1{k+1}$: then $x_{n_k}\to p$.
(3)⇒(4). A Cauchy sequence with a convergent subsequence converges (§7.1), so $X$ is complete. If $X$ were not totally bounded, some $\varepsilon\gt0$ would admit no finite $\varepsilon$-net. Pick any $x_1$; since $\{x_1\}$ is not an $\varepsilon$-net, there is $x_2$ with $d(x_2,x_1)\ge\varepsilon$; since $\{x_1,x_2\}$ is not, there is $x_3$ at distance $\ge\varepsilon$ from both; and so on. The sequence $(x_n)$ has $d(x_m,x_n)\ge\varepsilon$ for all $m\ne n$, so no subsequence is Cauchy, let alone convergent.
(4)⇒(3). Let $(x_n)$ be a sequence. Cover $X$ by finitely many balls of radius $1$; one of them, $B_1$, contains $x_n$ for infinitely many $n$. Cover $X$ by finitely many balls of radius $\tfrac12$; one of them, $B_2$, contains infinitely many of the terms lying in $B_1$. Continuing, we get balls $B_k$ of radius $\tfrac1k$ such that $B_1\cap\dots\cap B_k$ contains $x_n$ for infinitely many $n$. Choose $n_1\lt n_2\lt\cdots$ with $x_{n_k}\in B_1\cap\dots\cap B_k$. For $j,k\ge m$ both $x_{n_j}$ and $x_{n_k}$ lie in $B_m$, so $d(x_{n_j},x_{n_k})\lt\tfrac2m$: the subsequence is Cauchy, and it converges because $X$ is complete. (This is the Bolzano–Weierstrass bisection argument of §2.2 with "halve the interval" replaced by "use a finer net".)
(3)⇒(1). Let $\mathcal U$ be an open cover. By Theorem 7.14 it has a Lebesgue number $\lambda$, and by (3)⇒(4) $X$ is totally bounded, so it has a $\lambda$-net $\{a_1,\dots,a_N\}$. Each $B(a_i,\lambda)$ lies in some $U_i\in\mathcal U$, and then $U_1,\dots,U_N$ cover $X$. ∎
Proof. The metrics $d_p$ are strongly equivalent (Theorem 7.5), so they have the same open sets, bounded sets and compact sets; use $d_2$. Compact ⇒ closed and bounded is Theorem 7.12(1). Conversely, let $K$ be closed and bounded. As a closed subset of the complete space $\mathbb{R}^n$, $K$ is complete (Theorem 7.7). As a bounded set it lies in a cube $[-M,M]^n$, which for any $\varepsilon\gt0$ is covered by finitely many closed cubes of diameter $\varepsilon/2$. In each cube that meets $K$ choose a point of $K$; these finitely many points form an $\varepsilon$-net of $K$, because every point of $K$ shares a cube with one of them. So $K$ is totally bounded. By Theorem 7.15, $K$ is compact. For the sequence form, a bounded sequence lies in a closed ball, which is compact. ∎
A second route avoids Theorem 7.15: by the one-dimensional Bolzano–Weierstrass theorem, extract a subsequence whose first coordinates converge, then a further subsequence whose second coordinates converge, and so on through the $n$ coordinates. Either way, the proof uses exactly two facts about $\mathbb{R}^n$ — completeness and the fact that a bounded set can be chopped into finitely many small pieces — and the second fails in every infinite-dimensional space.
Compactness Beyond $\mathbb{R}^n$
Theorem 7.15 says that compactness = completeness + total boundedness. In the classical infinite-dimensional spaces completeness is free (Theorem 7.6), so the question is always whether a set is totally bounded — whether it is "essentially finite-dimensional up to $\varepsilon$".
- The closed unit balls of $\ell^p$ ($1\le p\le\infty$), $c_0$ and $(C[a,b],d_\infty)$ are closed and bounded but not compact. So is every infinite set with the discrete metric.
- Let $(c_n)$ be a sequence of non-negative numbers with $\sum c_n^2\lt\infty$. Then the "box" $H=\{x\in\ell^2:\ |x_n|\le c_n\text{ for all }n\}$ is compact. For $c_n=\tfrac1n$ this is the Hilbert cube.
- More generally, a closed set $S\subseteq\ell^p$ ($1\le p\lt\infty$) is compact if and only if it is bounded and has uniformly small tails: for every $\varepsilon\gt0$ there is $N$ with $\sum_{n\gt N}|x_n|^p\lt\varepsilon^p$ for all $x\in S$.
Proof. (1) In $\ell^p$ ($p\lt\infty$) the unit vectors satisfy $\|e_n-e_m\|_p=2^{1/p}$; in $\ell^\infty$ and $c_0$, $\|e_n-e_m\|_\infty=1$. In $C[a,b]$ take "tents" $f_n$ of height $1$ supported on disjoint subintervals $\left[a+\tfrac{(b-a)}{n+1},a+\tfrac{(b-a)}{n}\right]$; then $d_\infty(f_n,f_m)=1$ for $n\ne m$. In a discrete space distinct points are at distance $1$. In each case there is a sequence in the ball with all mutual distances at least some $c\gt0$, which has no Cauchy subsequence; by Theorem 7.15 the ball is not compact.
(3) Let $S$ be closed, bounded with uniformly small tails. $S$ is complete (closed in the complete $\ell^p$). Given $\varepsilon$, choose $N$ for the tails. The set $P=\{(x_1,\dots,x_N):x\in S\}$ is bounded in $\mathbb{R}^N$ (or $\mathbb{C}^N$), so it has a finite $\varepsilon$-net $\{y^{(1)},\dots,y^{(m)}\}$ (regard $y^{(i)}$ as sequences ending in zeros). For $x\in S$ pick $i$ with $\left(\sum_{n\le N}|x_n-y^{(i)}_n|^p\right)^{1/p}\lt\varepsilon$; then $\|x-y^{(i)}\|_p^p\lt\varepsilon^p+\varepsilon^p$. So $S$ has a finite $2^{1/p}\varepsilon$-net — it is totally bounded, hence compact. Conversely, if $S$ is compact, take a finite $\varepsilon$-net $\{a^{(1)},\dots,a^{(m)}\}$ of $S$ and $N$ with all tails of the $a^{(i)}$ below $\varepsilon^p$; Minkowski's inequality on the tail coordinates gives tails of every $x\in S$ below $(2\varepsilon)^p$.
(2) $H$ is closed (coordinatewise limits preserve $|x_n|\le c_n$) and bounded ($\|x\|_2^2\le\sum c_n^2$), and $\sum_{n\gt N}|x_n|^2\le\sum_{n\gt N}c_n^2\to0$ uniformly in $x\in H$. Apply (3). ∎
The contrast between (1) and (2) is exactly the content of many exam questions: the unit ball of $\ell^2$ is not compact, but the Hilbert cube — infinite-dimensional, closed, bounded, sitting inside that ball — is. The difference is uniform control of the tails. For $C[a,b]$ the analogous criterion is the Arzelà–Ascoli theorem (§7.4): a closed set of functions is compact iff it is bounded and equicontinuous. And Riesz's lemma (§7.4) shows that the failure in (1) is universal: the closed unit ball of a normed space is compact iff the space is finite-dimensional.
Continuous Functions on Compact Metric Spaces
Let $f:X\to Y$ be continuous and $K\subseteq X$ compact.
- $f(K)$ is compact. In particular, if $Y=\mathbb{R}$, then $f$ is bounded on $K$ and attains its maximum and minimum there (extreme value theorem).
- For each $x\in X$ there is $k_0\in K$ with $d(x,k_0)=d(x,K)$ (if $K\ne\varnothing$).
- If $K\ne\varnothing$ is compact, $F$ is closed and $K\cap F=\varnothing$, then $d(K,F)\gt0$.
- If $K$ is compact and $F$ is closed in $\mathbb{R}^n$, then $K+F=\{k+f:k\in K,\ f\in F\}$ is closed; if both are compact, $K+F$ is compact.
Proof. (1) If $\{V_\alpha\}$ is an open cover of $f(K)$, the sets $f^{-1}(V_\alpha)$ are open (Theorem 7.4) and cover $K$; finitely many cover $K$, and the corresponding $V_\alpha$ cover $f(K)$. A compact subset of $\mathbb{R}$ is closed and bounded, so it contains its supremum and infimum.
(2) For fixed $x$, the function $k\mapsto d(x,k)$ is continuous on $K$ (Theorem 7.4), so by (1) it attains its minimum, which is $d(x,K)$.
(3) The function $k\mapsto d(k,F)$ is continuous and positive on $K$ (positive because $F$ is closed and $k\notin F$, Theorem 7.3(3)); by (1) its minimum $d(K,F)$ is attained, hence positive.
(4) Let $k_j+f_j\to z$ with $k_j\in K$, $f_j\in F$. By sequential compactness a subsequence $k_{j_i}\to k\in K$; then $f_{j_i}=(k_{j_i}+f_{j_i})-k_{j_i}\to z-k$, and $z-k\in F$ because $F$ is closed. So $z=k+(z-k)\in K+F$. If both are compact, $K+F$ is the image of the compact set $K\times F\subseteq\mathbb{R}^{2n}$ under the continuous map $(k,f)\mapsto k+f$. ∎
Each conclusion fails without compactness: the closed sets $F_1=\{(x,0)\}$ and $F_2=\{(x,\tfrac1x):x\gt0\}$ in $\mathbb{R}^2$ are disjoint with $d(F_1,F_2)=0$, and $F_1+F_2=\{(s,y):y\gt0\}$ is not closed; the projection of the closed set $F_2$ onto the $x$-axis is $(0,\infty)$, not closed; and $f(x)=x$ on $(0,1)$ attains neither its supremum nor its infimum.
Let $X$ be a compact metric space and $f:X\to Y$ continuous, $Y$ a metric space.
- Heine–Cantor: $f$ is uniformly continuous.
- If $f$ is a bijection onto $Y$, then $f^{-1}$ is continuous: $f$ is a homeomorphism. More generally, $f$ maps closed sets to closed sets.
Proof. (1) Suppose not. Then there is $\varepsilon\gt0$ and, for each $n$, points $x_n,y_n$ with $d(x_n,y_n)\lt\tfrac1n$ but $\rho(f(x_n),f(y_n))\ge\varepsilon$. By sequential compactness $x_{n_k}\to x$, and then $y_{n_k}\to x$ too. Continuity at $x$ gives $f(x_{n_k})\to f(x)$ and $f(y_{n_k})\to f(x)$, so $\rho(f(x_{n_k}),f(y_{n_k}))\to0$ — contradiction. (Alternatively: for each $x$ choose $\delta_x$ for $\tfrac\varepsilon2$; a Lebesgue number of the cover $\{B(x,\delta_x)\}$ is a uniform $\delta$.)
(2) A closed $F\subseteq X$ is compact (Theorem 7.12(2)), so $f(F)$ is compact (Theorem 7.18), hence closed in $Y$ (Theorem 7.12(1)). For a bijection, $(f^{-1})^{-1}(F)=f(F)$, so preimages of closed sets under $f^{-1}$ are closed and $f^{-1}$ is continuous by Theorem 7.4. ∎
Compactness of the domain is essential in (2): $t\mapsto(\cos t,\sin t)$ is a continuous bijection of $[0,2\pi)$ onto the circle whose inverse is discontinuous at $(1,0)$ (points just below $(1,0)$ on the circle come from $t$ near $2\pi$, points just above from $t$ near $0$). And in (1): $x^2$ on $\mathbb{R}$ and $\sin\tfrac1x$ on $(0,1]$ are continuous but not uniformly continuous (§3.2).
Proof. The function $g(x)=d(x,Tx)$ is continuous ($T$ is $1$-Lipschitz, so $|g(x)-g(y)|\le2d(x,y)$). By Theorem 7.18 it attains its minimum at some $x^*$. If $Tx^*\ne x^*$, then $g(Tx^*)=d(Tx^*,T^2x^*)$ is less than $d(x^*,Tx^*)=g(x^*)$, contradicting minimality. So $Tx^*=x^*$; two fixed points $x\ne y$ would give $d(x,y)=d(Tx,Ty)\lt d(x,y)$. For convergence, $a_n=d(x_n,x^*)$ is non-increasing ($a_{n+1}=d(Tx_n,Tx^*)\le a_n$), so $a_n\downarrow a\ge0$. A subsequence $x_{n_k}\to z$; then $d(z,x^*)=a$ and $d(Tz,x^*)=\lim d(x_{n_k+1},x^*)=a$. If $a\gt0$ then $z\ne x^*$ and $d(Tz,x^*)=d(Tz,Tx^*)\lt d(z,x^*)=a$ — contradiction. So $a=0$. ∎
Compare Banach's theorem (§7.1): there completeness and a uniform $k\lt1$; here compactness and the weaker strict inequality. The map $x+\tfrac1x$ on $[1,\infty)$ shows that compactness cannot be replaced by completeness, and $\sin x$ on $[0,1]$ (fixed point $0$, but $\sup_{x\ne y}\tfrac{|\sin x-\sin y|}{|x-y|}=1$) is a contractive map that is not a contraction. Its iterates converge very slowly: $\sin^{(n)}(1)\approx\sqrt{3/n}$, about $0.0546$ after $1000$ steps.
- In $\mathbb{R}^n$ (or $M_n(\mathbb{R})\cong\mathbb{R}^{n^2}$): check closed (preimage of a closed set under continuous maps; or exhibit a sequence escaping to a missing limit) and bounded (or exhibit an unbounded sequence). That is all (Theorem 7.16).
- Image of a compact set? If the set is $f(K)$ with $K$ compact and $f$ continuous, it is compact — the fastest route for parametrised curves, matrix groups given by $\theta\mapsto$ rotations, and sets like $\{c\sin x:c\in[0,1]\}$.
- In an infinite-dimensional space: first look for a sequence with all mutual distances $\ge c\gt0$ (unit vectors, disjoint tents, $x^n$-type functions). If you find one, the set is not compact. Otherwise prove total boundedness — uniformly small tails in $\ell^p$, equicontinuity in $C[a,b]$ — plus closedness.
- Discrete-type spaces: a set all of whose points are isolated is compact iff finite.
- Watch the ambient space. "Closed" means closed in a complete space before Heine–Borel thinking applies; $[0,1]\cap\mathbb{Q}$ is closed in $\mathbb{Q}$ but not compact.
- Closed + bounded $\not\Rightarrow$ compact. Infinite discrete spaces; $\mathbb{R}$ with $\min(1,|x-y|)$; the closed unit balls of $\ell^p$, $c_0$, $C[0,1]$; the unit sphere of $\ell^2$.
- Bounded $\not\Rightarrow$ totally bounded. $\{e_n\}$ in $\ell^2$ is bounded with no finite $1$-net. In $\mathbb{R}^n$ the two notions coincide.
- Totally bounded $\not\Rightarrow$ compact. $(0,1)$, $\mathbb{Q}\cap[0,1]$: completeness is missing.
- Infinite-dimensional need not mean non-compact. The Hilbert cube $\{|x_n|\le\tfrac1n\}\subseteq\ell^2$ and $\{\sum n^2x_n^2\le1\}$ are compact; what they have is uniformly small tails.
- Continuous images, not preimages. $f(K)$ is compact for compact $K$, but a constant map $\mathbb{R}\to\mathbb{R}$ has non-compact preimage $\mathbb{R}$ of the compact set $\{0\}$; and images of closed sets need not be closed (projection of $xy=1$).
- Disjoint closed sets can be at distance $0$. $\mathbb{N}$ and $\{n+\tfrac1n\}$; the $x$-axis and the hyperbola $y=1/x$. One of the two must be compact for $d(K,F)\gt0$.
- Continuous bijection $\not\Rightarrow$ homeomorphism unless the domain is compact: $[0,2\pi)\to S^1$.
- Infinite unions. $\bigcup_n[-n,n]=\mathbb{R}$ is a countable union of compact sets that is not compact; intersections of compact sets are always compact.
- Contractive is not enough without compactness. $x+\tfrac1x$ on $[1,\infty)$; with compactness it is (Edelstein), even though $\sin x$ on $[0,1]$ is not a contraction.
- Lebesgue numbers: ball version vs diameter version. For $[0,\tfrac12),(\tfrac14,\tfrac34),(\tfrac12,1]$ the best ball radius is $\tfrac18$ but the best diameter bound is $\tfrac14$. A non-compact space can still have a Lebesgue number for a particular cover.
- Compact subsets are closed only in the ambient metric space. $[0,1]$ is compact and closed in $\mathbb{R}$; a compact set is never "open and compact" in $\mathbb{R}^n$ unless empty — but in a discrete space every finite set is open and compact.
Exercises
- 1 Prove from the definition that $\{\tfrac1n:n\in\mathbb{N}\}$ is not compact, and that $\{0\}\cup\{\tfrac1n\}$ is.
- 2 Which subsets of $\mathbb{R}^2$ are compact? (a) $\{x^2+y^2=1\}$; (b) $\{x^2-y^2=1\}$; (c) $\{(x,y):|x|+|y|\le1,\ x\in\mathbb{Q}\}$; (d) $\{(x,y):0\le x\le1,\ 0\le y\le x^2\}$; (e) $\{(x,y):x^2+y^2\le1,\ y\gt0\}$.
- 3 Which are compact in $M_2(\mathbb{R})\cong\mathbb{R}^4$? (a) $SO(2)$; (b) the nilpotent matrices; (c) the matrices with $\det A=0$ and all entries in $[0,1]$; (d) $\{A: A^{T}=A,\ A^2=I\}$.
- 4 Show that a subset of a discrete metric space is compact iff it is finite.
- 5 Use Theorem 7.13 to show that a decreasing sequence of nonempty compact sets has nonempty intersection, and give decreasing nonempty closed sets in $\mathbb{R}$ with empty intersection.
- 6 Let $K\subseteq\mathbb{R}$ be compact and nonempty. Prove that $\sup K\in K$, and that $K$ has a smallest element.
- 7 Prove that the union of a compact set $K\subseteq\mathbb{R}^n$ and finitely many convergent sequences (with their limits) is compact.
- 8 Let $X=\mathbb{Q}$ with the usual metric. Show that $[0,1]\cap\mathbb{Q}$ is closed and bounded in $X$ but not compact, and that every compact subset of $\mathbb{Q}$ has empty interior in $\mathbb{Q}$.
- 1 Prove that a subset of a totally bounded space is totally bounded, and that a totally bounded set is bounded. Show that $\mathbb{N}$ with the discrete metric is bounded but not totally bounded.
- 2 Let $N(\varepsilon)$ be the least number of closed $d_\infty$-balls of radius $\varepsilon$ needed to cover $[0,1]^2$. Show that $N(\varepsilon)=\lceil\tfrac1{2\varepsilon}\rceil^2$ for $0\lt\varepsilon\le\tfrac12$, and evaluate $N(0.1)$ and $N(0.15)$.
- 3 Compute $\|e_n-e_m\|_p$ in $\ell^p$ ($n\ne m$) for $1\le p\lt\infty$ and in $\ell^\infty$, and deduce that no closed ball of positive radius in these spaces is compact.
- 4 Prove that the Hilbert cube $H=\{x\in\ell^2:|x_n|\le\tfrac1n\}$ is compact by extracting, for a given sequence in $H$, a convergent subsequence with a diagonal argument.
- 5 Is $\{x\in\ell^\infty:|x_n|\le\tfrac1n\}$ compact in $\ell^\infty$? Is $\{x\in\ell^\infty:|x_n|\le1\}$?
- 6 Find the largest Lebesgue number (ball version) of the cover $(-1,\tfrac13)$, $(\tfrac15,\tfrac45)$, $(\tfrac23,2)$ of $[0,1]$.
- 7 Show that the cover $\{(\tfrac1n,1):n\ge2\}$ of $(0,1)$ has no Lebesgue number, while the cover $\{(0,\tfrac23),(\tfrac13,1)\}$ of $(0,1)$ has one.
- 8 Prove that $X$ is totally bounded iff every sequence in $X$ has a Cauchy subsequence.
- 1 Find $d(p,C)$ for $p=(0,2)$ and $C$ the parabola $y=x^2$, and explain why the minimum is attained although $C$ is not compact.
- 2 Give a bounded continuous function on $(0,1)$ that attains neither its supremum nor its infimum, and an unbounded continuous function on the bounded set $(0,1)$.
- 3 Show that $t\mapsto(\cos t,\sin t)$ from $[0,2\pi)$ onto the unit circle is a continuous bijection whose inverse is not continuous. Which hypothesis of Theorem 7.19(2) fails?
- 4 Let $K\subseteq\mathbb{R}^n$ be compact and $U\supseteq K$ open. Prove that there is $\varepsilon\gt0$ with $\{x:d(x,K)\lt\varepsilon\}\subseteq U$.
- 5 Show that the sum of the $x$-axis and the branch $\{(x,\tfrac1x):x\gt0\}$ of a hyperbola is not closed in $\mathbb{R}^2$.
- 6 Let $f:[0,1]\to[0,1]$ satisfy $|f(x)-f(y)|\lt|x-y|$ for $x\ne y$. Prove that $f$ has a unique fixed point and that $x_{n+1}=f(x_n)$ converges to it. Apply this to $f(x)=\sin x$.
- 7 Prove that a continuous $f:X\to Y$ from a compact metric space is proper: preimages of compact sets are compact. Show that $f(x)=x^2$ on $\mathbb{R}$ is also proper, but $f(x)=\sin x$ is not.
- 8 Let $K\subseteq\mathbb{R}^2$ be compact and $f:K\to\mathbb{R}$ continuous. Show that the graph $\{(x,f(x)):x\in K\}$ is compact in $\mathbb{R}^3$. Conversely, show that if $f:[0,1]\to\mathbb{R}$ has a compact graph, then $f$ is continuous.
- 1 Prove that every compact metric space is separable.
- 2 Let $X$ be compact and $f:X\to X$ continuous with $f(x)\ne x$ for all $x$. Prove that there is $c\gt0$ with $d(x,f(x))\ge c$ for all $x$.
- 3 Prove that a metric space $X$ is compact if and only if every continuous function $f:X\to\mathbb{R}$ is bounded.
- 4 Let $(K_n)$ be a decreasing sequence of nonempty compact sets and $U$ an open set containing $\bigcap_nK_n$. Prove that $K_n\subseteq U$ for some $n$.
- 5 Prove that if $X$ is compact and $f:X\to X$ satisfies $d(f(x),f(y))\ge d(x,y)$ for all $x,y$, then $f$ is an isometry onto $X$. (Hint: consider $(f^n(x),f^n(y))$ in $X\times X$.)
- 6 Let $\mathcal L$ be the set of $f\in C[0,1]$ with $f(0)=0$ and $|f(x)-f(y)|\le|x-y|$ for all $x,y$. Show that $\mathcal L$ is compact in $(C[0,1],d_\infty)$. (Use Theorem 7.15: show it is complete and totally bounded, approximating by piecewise linear functions.)
E1. CSIR Part B GATE MA Which of the following subsets of $\mathbb{R}^2$ is compact? (A) $\{(x,y):xy=1\}$; (B) $\{(x,y):x^2+y^4\le1\}$; (C) $\{(x,y):x^2+y^2\lt1\}$; (D) $\{(x,\sin\tfrac1x):0\lt x\le1\}$.
E2. CSIR Part B Let $S=\{x\in\ell^2:\ \sum_{n\ge1}n^2x_n^2\le1\}$ and $B=\{x\in\ell^2:\|x\|_2\le1\}$. Then (A) both $S$ and $B$ are compact; (B) $S$ is compact and $B$ is not; (C) $B$ is compact and $S$ is not; (D) neither is compact.
E3. CSIR Part B Let $X$ be a compact metric space. Which statement is necessarily true? (A) Every closed subset of $X$ is countable. (B) Every continuous $f:X\to\mathbb{R}$ is uniformly continuous. (C) Every bounded subset of $X$ is compact. (D) Every Cauchy sequence in $X$ is eventually constant.
E4. CSIR Part C In $C[0,1]$ with the sup metric, which of the following sets are compact? (One or more options may be correct.) (A) $\{f:\ \max|f|\le1\}$; (B) $\{x^n:n\in\mathbb{N}\}$; (C) $\{\tfrac{x^n}n:n\in\mathbb{N}\}\cup\{0\}$; (D) $\{c\,e^x:\ c\in[-1,1]\}$.
E5. CSIR Part C Let $(X,d)$ be a metric space. Which of the following are true? (A) If $X$ is complete and totally bounded, every continuous $f:X\to\mathbb{R}$ attains its maximum. (B) If every closed and bounded subset of $X$ is compact, then $X$ is complete. (C) If $X$ is complete and bounded, then $X$ is compact. (D) If every sequence in $X$ has a Cauchy subsequence, then $X$ is compact.
E6. CSIR Part C Let $K\subseteq\mathbb{R}^2$ be nonempty and compact, $F\subseteq\mathbb{R}^2$ nonempty and closed, with $K\cap F=\varnothing$, and let $\pi(x,y)=x$. Which of the following are necessarily true? (A) $d(K,F)\gt0$. (B) $K+F$ is closed. (C) $\pi(F)$ is closed. (D) $\pi(K)$ is compact.
Suggested plan — 3 lectures × 60 min.
- Compactness by covers. Recall §3.1. Definition 7.11, intrinsic nature, Theorem 7.12 with full proofs, FIP (Theorem 7.13). Example 1 — make the class find the cover that fails in each case. Ten minutes on "closedness is relative, compactness is not".
- The equivalence theorem. Definitions 7.13–7.15; project Interactive 1 (square, then circle, then the Cantor set; ask for the slope before revealing it; finish with $e_n$). Lebesgue lemma and Interactive 2 (mode 1, then 2, then 3). Theorem 7.15 in full — the four implications fit on two boards. Heine–Borel in $\mathbb{R}^n$ as a corollary.
- Infinite dimensions and continuous maps. Theorem 7.17 (unit balls versus the Hilbert cube), Examples 3–4 as a quiz; Theorems 7.18–7.20 with Example 5 and Example 6; close with Exam-corner E2 and E6.
Discussion questions. (1) Which of the four conditions in Theorem 7.15 is easiest to check, and which is easiest to use? Give an example of each use. (2) The Hilbert cube is infinite-dimensional yet compact. In what precise sense is it "almost finite-dimensional"? (3) Why does the proof that compact sets are closed fail for a "distance" that does not separate points?
Misconceptions to watch for. "Closed and bounded means compact" in every space; "bounded means totally bounded"; believing that preimages of compact sets are compact; forgetting that the definition of compactness quantifies over every open cover (exhibiting one cover with a finite subcover proves nothing); mixing up the ball and diameter versions of the Lebesgue number; assuming a contractive map on a complete space has a fixed point.
Suggested homework. I(1, 2, 3, 6, 8), II(1, 2, 4, 6, 8), III(1, 3, 4, 6, 7), IV(1, 3); Exam corner E2, E4, E5.
Research question. How fast does the number $N(\varepsilon)$ of $\varepsilon$-balls needed to cover a compact set grow as $\varepsilon\to0$, and can that growth rate measure the "dimension" of a coastline, a fractal or a data set?
Why it matters. Total boundedness is not only a yes/no property: the covering numbers $N(\varepsilon)$ quantify how compact a set is. Lewis Fry Richardson's measurements of the coastline of Britain and of the border between Spain and Portugal (1950s–60s) showed that the measured length grows as the ruler shrinks, leading to Mandelbrot's fractal dimension; today covering numbers control the sample complexity of machine-learning models, the resolution needed in medical imaging, and the "intrinsic dimension" of high-dimensional data.
What to do.
- For $[0,1]^2$ prove $c_1\varepsilon^{-2}\le N(\varepsilon)\le c_2\varepsilon^{-2}$, and for the middle-thirds Cantor set prove $N(3^{-k})$ is between $2^{k-1}$ and $2^{k+1}$. Deduce $\lim\frac{\log N(\varepsilon)}{\log(1/\varepsilon)}$ in both cases.
- Write a short program that builds greedy $\varepsilon$-nets (as in Interactive 1) for: the Sierpiński triangle (from the chaos game, $20\,000$ points), the Koch curve, and a random walk of $10\,000$ steps in the plane. Fit the slope of $\log N$ against $\log(1/\varepsilon)$.
- Download (or digitise from a map) the coordinates of a stretch of coastline — Norway, Kerala or the west coast of Ireland work well — and estimate its covering dimension.
- Compare with the "dimension" of the unit ball of $\ell^2$: show that it needs infinitely many balls of radius $\tfrac12$, and that its compact subset $\{\sum n^2x_n^2\le1\}$ has $\log N(\varepsilon)$ growing faster than any multiple of $\log(1/\varepsilon)$ — an infinite-dimensional compact set. Estimate the actual growth rate.
Tools: Python (NumPy, Matplotlib) or any spreadsheet; a free map service for coastline coordinates.
Hand in: A two-page report with the three log–log plots, your fitted slopes with an honest error estimate, and the proof of step 1.
Going further. Read about Kolmogorov's $\varepsilon$-entropy $\log_2N(\varepsilon)$ of function classes (how many bits are needed to describe a Lipschitz function to accuracy $\varepsilon$ — compare Exercise IV.6) and about the box-counting versus Hausdorff dimension.
🧪 Self-check quiz
Q1. In a general metric space, a compact set is always
Q2. A metric space is compact if and only if it is
Q3. Which subset of $\ell^2$ is compact?
Q4. The continuous bijection $t\mapsto(\cos t,\sin t)$ from $[0,2\pi)$ onto the circle is not a homeomorphism because
Q5. For two disjoint nonempty closed sets $A,B\subseteq\mathbb{R}^2$, $d(A,B)\gt0$ is guaranteed when