7. Continuity and Compactness
≪ 6. Homework 2, Problem 3 | Table of Contents | 8. Completeness of \(\ell^2\) ≫Today’s goal will be to refresh our memories of what continuous functions are, as well as some topological properties of metric spaces such as compactness and connectedenss. Then, we’ll look at how these topological properties interact with continuous functions.
Continuous Functions
You might remember from high school math that continuous functions are those whose graphs you can draw without lifting your pencil. This lends us some good intuition, but it’s not the most rigorous.
Definition 1.
Let \(\left( X, d_X \right)\) and \(\left( Y, d_Y \right)\) be two metric spaces. A function \(f:X\to Y\) is continuous at a point \(x_0\in X\) if for every \(\epsilon>0\), there exists a \(\delta>0\) such that for any \(x\in X\) such that \(d_X\left( x, x_0 \right)<\delta\), then \(d_Y\left( f(x), f\left( x_0 \right) \right)<\epsilon\). \(f\) is continuous if it is continuous at each \(x_0\in X\).
Put in (very loose) words, a function is continuous if it maps nearby points to nearby points. Note that this does not say that if \(d_Y\left( f(x), f\left( x_0 \right) \right)< \epsilon\), then \(d_X\left( x, x_0 \right)< \delta\)! This goes the wrong way, as it’s possible for continuous functions to take points in \(X\) that are far apart to points in \(Y\) that are close together.
Really continuity is a statement about how \(f\) interacts with the topologies of \(X\) and \(Y\)! This can be formalised in the following proposition, which you should be able to prove on your own.
Proposition 2.
Let \(\left( X, d_X \right)\) and \(\left( Y, d_Y \right)\) be two metric spaces, and let \(f:X\to Y\) a function. Show that \(f\) is continuous if and only if for all open sets \(U\subseteq Y\), \(f ^{-1}(U) = \left\lbrace x\in X:f(x)\in U \right\rbrace\) is an open subset of \(X\).
Proof
First, suppose \(f\) is continuous. Let \(U\subseteq Y\). Let \(x_0\in f ^{-1}(U)\); we wish to show that there exists some \(r>0\) such that \(B \left( x_0,r \right)\subseteq f ^{-1}(U)\).
Since \(U\) is open and \(f\left( x_0 \right)\in U\) by definition, there exists some \(\epsilon>0\) such that \(B \left( f\left( x_0 \right), \epsilon \right)\subseteq U\). By definition of continuity, there exists some \(\delta>0\) so that: \[ \begin{align*} x\in B\left( x_0, \delta \right) &\implies d_X\left( x, x_0 \right)< \delta \\ &\implies d_Y\left( f(x), f\left( x_0 \right) \right) < \epsilon \\ &\implies f(x)\in B\left( f\left( x_0 \right), \epsilon \right)\subseteq U \\ &\implies x\in f ^{-1}(U). \end{align*} \] Thus \(B \left( x_0, \delta \right)\subseteq f^{-1}(U)\), and \(f^{-1}(U)\) is open.
Now suppose \(f ^{-1}(U)\) is open for all open \(U\subseteq Y\). Let \(x_0\in X\), and let \(\epsilon>0\). We wish to show that there is some \(\delta>0\) such that \(d_X\left( x,x_0 \right)<\delta\) implies \(d_Y\left( f(x), f\left( x_0 \right) \right)<\epsilon\).
Let \(U=B\left( f\left( x_0, \right),\epsilon \right)\), which is an open set (open balls are open in metric spaces). By assumption, \(f ^{-1}(U)\) is open, and clearly \(x_0\in f ^{-1}(U)\). So, there exists some \(\delta>0\) such that \(B\left( x_0,\delta \right)\subseteq f ^{-1}(U)\). Then, we get \[ \begin{align*} d_X\left( x, x_0 \right)< \delta &\implies x\in B\left( x_0, \delta \right)\subseteq f ^{-1}(U) \\ &\implies f(x) \in U = B \left( f\left( x_0 \right),\epsilon \right) \\ &\implies d_Y\left( f(x), f\left( x_0 \right) \right)<\epsilon. \end{align*} \] In particular, \(f\) is continuous at \(x_0\), and since this argument works for any \(x_0\in X\), we conclude \(f\) is continuous. \(\square\)
There’s not too much to say about this proof — it primarily consists of keeping track of all the right definitions.
Common Mistake 3.
This proposition says that the inverse image of open sets is open. It does not say that the image of an open set is open, i.e. if \(U\subseteq X\) is open, then \(f(U)\) is not necessarily open. For example, consider \(f:\mathbb{R}\to \mathbb{R}\) (under the usual metric) via \(f(x)=x^2\). Trust me when I say \(f\) is continuous. Let \(U=(-1, 1)\), which is open; is \(f(U)\) open?
Using this last proposition, you can also show if \(f\) is continuous and \(C\subseteq Y\) is closed, then \(f ^{-1}(C)\) is also closed. Recall from last week that closed sets contain all their limit points — perhaps this suggests that \(f\) interacts with limits in some way. In fact,
Exercise 4.
Let \(\left( X, d_X \right)\) and \(\left( Y, d_Y \right)\) be metric spaces. Show that a function \(f\) is continuous if and only if it preserves limits — that is, if \(x_n\to x\) in \(X\), then \(f\left( x_n \right)\to f(x)\) in \(Y\).
Try this exercise on your own! Like the previous proposition, it mostly amounts to pushing some definitions around.
One of the most important theorems involving continuous functions is the intermediate value theorem. Its proof involves ideas of connectedness (see one of the following sections), though it’s possible to provide more elementary proofs.
Theorem 5. Intermediate Value Theorem
Let \(f:[a, b]\to \mathbb{R}\) be a continuous function such that \(f(a)<0\) and \(f(b)>0\). Then, there exists some \(c\in (a, b)\) such that \(f(c)=0\).
One can state this theorem in greater generality, but it’s always possible to reduce to this case. Importantly, this only applies to functions whose domain contains an interval and whose codomain is \(\mathbb{R}\)! Do not try to apply the theorem to arbitrary metric spaces.
I stole the following exercise from a past basic exam.
Exercise 6.
Suppose \(f:\mathbb{R}\to \mathbb{R}\) is a function that satisfies the “intermediate value property”: for each \(a< b\in \mathbb{R}\) and \(y\) between \(f(a)\) and \(f(b)\), there exists some \(c\in (a, b)\) such that \(f(c)=y\). Suppose additionally that for any \(x\in \mathbb{R}\) that \(f ^{-1}(c)\) is closed. Prove that \(f\) is continuous.
Compactness
Let’s now recall the definition of compactness:
Definition 7.
Let \((X, d)\) be a metric space. \((X, d)\) is sequentially compact if every sequence has a converging subsequence. That is, if \(\left\lbrace x_n \right\rbrace\subseteq X\), then there is some subsequence \(\left\lbrace x _{n_j} \right\rbrace\) and some \(x_\infty\in X\) such that \(x _{n_j}\to x_\infty\). A subset \(C\subseteq X\) is sequentially compact if every sequence of elements in \(C\) has a subsequence that converges to an element of \(C\).
One way to think about compact sets is that they don’t have a lot of space in them. In noncompact metric spaces (such as \(\mathbb R\)), there’s enough room for sequences to “spread out” and thus not have any convergent subsequences. In compact metric spaces, on the other hand, there’s just no space for this to happen — elements of a sequence have to eventually “clump up”.
You guys have started showing that compactness can be characterised by another definition: covering compactness.
Definition 8.
Let \(\left( X,d \right)\) be a metric space. \(\left( X,d \right)\) is covering compact if for every open cover \(X=\bigcup _{\lambda\in \Lambda}U _{\lambda}\) (where each \(U_\lambda\) is open and \(\Lambda\) is any indexing set) there exists some finite subcover \(X=U _{\lambda_1}\cup\cdots\cup U _{\lambda_n}\).
Theorem 9.
A metric space is sequentially compact if and only if it is covering compact.
As of today, you have not finished proving this theorem, but it’s a very useful characterisation. We’ll often say “compact” without specifying sequential or covering compactness from now on, since that’s a distinction without a difference.
You should keep both sequential compactness and covering compactness in mind when you see compact sets. In many problems, only one of the two characterisations will be useful. Some problems can be solved by constructing the right sequence; others by finding a suitable open cover.
Exercise 10.
Show that the finite union of compact sets is compact.
Exercise 11.
Let \(X\) be a compact metric space, and let \(f:X\to \mathbb{R}\) be continuous. Show that it attains its maximum value and minimum value. That is, show that there exist some \(m, M\in X\) such that \(f(m)\leq f(x)\leq f(M)\) for all \(x\in X\).
Exercise 12.
Let \(\left( X, d_X \right)\) and \(\left( Y, d_Y \right)\) be metric spaces. A function \(f:X\to Y\) is “uniformly continuous” if for every \(\epsilon>0\), there exists some \(\delta>0\) such that for all \(x, y\in X\) with \(d_X\left( x, y \right)<\delta\), then \(d_Y\left( f(x),f(y) \right)<\epsilon\).
Explain how this differs from the definition of continuity. Show that if \(f:X\to Y\) is continuous and \(X\) is compact, then \(f\) is uniformly continuous.
A great theorem about compactness is particularly useful when working in Euclidean space:
Theorem 13. Heine-Borel
A subset \(C\subseteq \mathbb{R}^n\) is compact (with respect to the usual metric) if and only if it is closed and bounded.
This does not generalise to arbitrary metric spaces. Please do not try to use Heine-Borel on metric spaces in general. A good counterexample the closed unit ball in \(\ell^2\) — this set is closed and bounded, yet it is not compact. Try to find a sequence with no converging subsequence youself.