# 7.5: Continuous Functions

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

### Continuity

Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces and \(c \in X\). Then \(f \colon X \to Y\) is *continuous at \(c\)* if for every \(\epsilon > 0\) there is a \(\delta > 0\) such that whenever \(x \in X\) and \(d_X(x,c) < \delta\), then \(d_Y\bigl(f(x),f(c)\bigr) < \epsilon\).

When \(f \colon X \to Y\) is continuous at all \(c \in X\), then we simply say that \(f\) is a *continuous function*.

The definition agrees with the definition from when \(f\) is a real-valued function on the real line, when we take the standard metric on \({\mathbb{R}}\).

[prop:contiscont] Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces and \(c \in X\). Then \(f \colon X \to Y\) is continuous at \(c\) if and only if for every sequence \(\{ x_n \}\) in \(X\) converging to \(c\), the sequence \(\{ f(x_n) \}\) converges to \(f(c)\).

Suppose that \(f\) is continuous at \(c\). Let \(\{ x_n \}\) be a sequence in \(X\) converging to \(c\). Given \(\epsilon > 0\), there is a \(\delta > 0\) such that \(d(x,c) < \delta\) implies \(d\bigl(f(x),f(c)\bigr) < \epsilon\). So take \(M\) such that for all \(n \geq M\), we have \(d(x_n,c) < \delta\), then \(d\bigl(f(x_n),f(c)\bigr) < \epsilon\). Hence \(\{ f(x_n) \}\) converges to \(f(c)\).

On the other hand suppose that \(f\) is not continuous at \(c\). Then there exists an \(\epsilon > 0\), such that for every \(\nicefrac{1}{n}\) there exists an \(x_n \in X\), \(d(x_n,c) < \nicefrac{1}{n}\) such that \(d\bigl(f(x_n),f(c)\bigr) \geq \epsilon\). Therefore \(\{ f(x_n) \}\) does not converge to \(f(c)\).

### Compactness and continuity

Continuous maps do not map closed sets to closed sets. For example, \(f \colon (0,1) \to {\mathbb{R}}\) defined by \(f(x) := x\) takes the set \((0,1)\), which is closed in \((0,1)\), to the set \((0,1)\), which is not closed in \({\mathbb{R}}\). On the other hand continuous maps do preserve compact sets.

Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces, and \(f \colon X \to Y\) is a continuous function. If \(K \subset X\) is a compact set, then \(f(K)\) is a compact set.

Let \(\{ f(x_n) \}_{n=1}^\infty\) be a sequence in \(f(K)\), then \(\{ x_n \}_{n=1}^\infty\) is a sequence in \(K\). The set \(K\) is compact and therefore has a subsequence \(\{ x_{n_i} \}_{i=1}^\infty\) that converges to some \(x \in K\). By continuity, \[\lim_{i\to\infty} f(x_{n_i}) = f(x) \in f(K) .\] Therefore every sequence in \(f(K)\) has a subsequence convergent to a point in \(f(K)\), so \(f(K)\) is compact by .

As before, \(f \colon X \to {\mathbb{R}}\) achieves an *absolute minimum* at \(c \in X\) if \[f(x) \geq f(c) \qquad \text{ for all $x \in X$.}\] On the other hand, \(f\) achieves an *absolute maximum* at \(c \in X\) if \[f(x) \leq f(c) \qquad \text{ for all $x \in X$.}\]

Let \((X,d)\) and be a compact metric space, and \(f \colon X \to {\mathbb{R}}\) is a continuous function. Then \(f(X)\) is compact and in fact \(f\) achieves an absolute minimum and an absolute maximum on \(X\).

As \(X\) is compact and \(f\) is continuous, we have that \(f(X) \subset {\mathbb{R}}\) is compact. Hence \(f(X)\) is closed and bounded. In particular, \(\sup f(X) \in f(X)\) and \(\inf f(X) \in f(X)\). That is because both the sup and inf can be achieved by sequences in \(f(X)\) and \(f(X)\) is closed. Therefore there is some \(x \in X\) such that \(f(x) = \sup f(X)\) and some \(y \in X\) such that \(f(y) = \inf f(X)\).

### Continuity and topology

Let us see how to define continuity just in the terms of topology, that is, the open sets. We have already seen that topology determines which sequences converge, and so it is no wonder that the topology also determines continuity of functions.

[lemma:mstopocontloc] Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces. A function \(f \colon X \to Y\) is continuous at \(c \in X\) if and only if for every open neighbourhood \(U\) of \(f(c)\) in \(Y\), the set \(f^{-1}(U)\) contains an open neighbourhood of \(c\) in \(X\).

Suppose that \(f\) is continuous at \(c\). Let \(U\) be an open neighbourhood of \(f(c)\) in \(Y\), then \(B_Y\bigl(f(c),\epsilon\bigr) \subset U\) for some \(\epsilon > 0\). As \(f\) is continuous, then there exists a \(\delta > 0\) such that whenever \(x\) is such that \(d_X(x,c) < \delta\), then \(d_Y\bigl(f(x),f(c)\bigr) < \epsilon\). In other words, \[B_X(c,\delta) \subset f^{-1}\bigl(B_Y\bigl(f(c),\epsilon\bigr)\bigr) .\] and \(B_X(c,\delta)\) is an open neighbourhood of \(c\).

For the other direction, let \(\epsilon > 0\) be given. If \(f^{-1}\bigl(B_Y\bigl(f(c),\epsilon\bigr)\bigr)\) contains an open neighbourhood, it contains a ball, that is there is some \(\delta > 0\) such that \[B_X(c,\delta) \subset f^{-1}\bigl(B_Y\bigl(f(c),\epsilon\bigr)\bigr) .\] That means precisely that if \(d_X(x,c) < \delta\) then \(d_Y\bigl(f(x),f(c)\bigr) < \epsilon\) and so \(f\) is continuous at \(c\).

[thm:mstopocont] Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces. A function \(f \colon X \to Y\) is continuous if and only if for every open \(U \subset Y\), \(f^{-1}(U)\) is open in \(X\).

The proof follows from and is left as an exercise.

### Exercises

Consider \({\mathbb{N}}\subset {\mathbb{R}}\) with the standard metric. Let \((X,d)\) be a metric space and \(f \colon X \to {\mathbb{N}}\) a continuous function. a) Prove that if \(X\) is connected, then \(f\) is constant (the range of \(f\) is a single value). b) Find an example where \(X\) is disconnected and \(f\) is not constant.

Let \(f \colon {\mathbb{R}}^2 \to {\mathbb{R}}\) be defined by \(f(0,0) := 0\), and \(f(x,y) := \frac{xy}{x^2+y^2}\) if \((x,y) \not= (0,0)\). a) Show that for any fixed \(x\), the function that takes \(y\) to \(f(x,y)\) is continuous. Similarly for any fixed \(y\), the function that takes \(x\) to \(f(x,y)\) is continuous. b) Show that \(f\) is not continuous.

Suppose that \(f \colon X \to Y\) is continuous for metric spaces \((X,d_X)\) and \((Y,d_Y)\). Let \(A \subset X\). a) Show that \(f(\overline{A}) \subset \overline{f(A)}\). b) Show that the subset can be proper.

Prove . Hint: Use .

[exercise:msconnconn] Suppose that \(f \colon X \to Y\) is continuous for metric spaces \((X,d_X)\) and \((Y,d_Y)\). Show that if \(X\) is connected, then \(f(X)\) is connected.

Prove the following version of the intermediate value theorem. Let \((X,d)\) be a connected metric space and \(f \colon X \to {\mathbb{R}}\) a continuous function. Suppose that there exist \(x_0,x_1 \in X\) and \(y \in {\mathbb{R}}\) such that \(f(x_0) < y < f(x_1)\). Then prove that there exists a \(z \in X\) such that \(f(z) = y\). Hint: see .

A continuous function \(f \colon X \to Y\) for metric spaces \((X,d_X)\) and \((Y,d_Y)\) is said to be *proper* if for every compact set \(K \subset Y\), the set \(f^{-1}(K)\) is compact. Suppose that a continuous \(f \colon (0,1) \to (0,1)\) is proper and \(\{ x_n \}\) is a sequence in \((0,1)\) that converges to \(0\). Show that \(\{ f(x_n) \}\) has no subsequence that converges in \((0,1)\).

Let \((X,d_X)\) and \((Y,d_Y)\) be metric space and \(f \colon X \to Y\) be a one to one and onto continuous function. Suppose that \(X\) is compact. Prove that the inverse \(f^{-1} \colon Y \to X\) is continuous.

Take the metric space of continuous functions \(C([0,1])\). Let \(k \colon [0,1] \times [0,1] \to {\mathbb{R}}\) be a continuous function. Given \(f \in C([0,1])\) define \[\varphi_f(x) := \int_0^1 k(x,y) f(y) ~dy .\] a) Show that \(T(f) := \varphi_f\) defines a function \(T \colon C([0,1]) \to C([0,1])\). b) Show that \(T\) is continuous.