Skip to main content

Section 7.5 Continuous functions

Note: 1.5–2 lectures

Subsection 7.5.1 Continuity

Definition 7.5.1.

Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces and \(c \in X\text{.}\) 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\text{,}\) then \(d_Y\bigl(f(x),f(c)\bigr) < \epsilon\text{.}\)

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

The definition agrees with the definition from Chapter 3 when \(f\) is a real-valued function on the real line—as long as we take the standard metric on \(\R\text{,}\) of course.


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

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

Example 7.5.3.

Suppose \(f \colon \R^2 \to \R\) is a polynomial. That is,

\begin{equation*} f(x,y) = \sum_{j=0}^d \sum_{k=0}^{d-j} a_{jk}\,x^jy^k = a_{0\,0} + a_{1\,0} \, x + a_{0\,1} \, y+ a_{2\,0} \, x^2+ a_{1\,1} \, xy+ a_{0\,2} \, y^2+ \cdots + a_{0\,d} \, y^d , \end{equation*}

for some \(d \in \N\) (the degree) and \(a_{jk} \in \R\text{.}\) Then we claim \(f\) is continuous. Let \(\bigl\{ (x_n,y_n) \bigr\}_{n=1}^\infty\) be a sequence in \(\R^2\) that converges to \((x,y) \in \R^2\text{.}\) We proved that this means \(\lim\, x_n = x\) and \(\lim\, y_n = y\text{.}\) By Proposition 2.2.5, we have

\begin{equation*} \lim_{n\to\infty} f(x_n,y_n) = \lim_{n\to\infty} \sum_{j=0}^d \sum_{k=0}^{d-j} a_{jk} \, x_n^jy_n^k = \sum_{j=0}^d \sum_{k=0}^{d-j} a_{jk} \, x^jy^k = f(x,y) . \end{equation*}

So \(f\) is continuous at \((x,y)\text{,}\) and as \((x,y)\) was arbitrary \(f\) is continuous everywhere. Similarly, a polynomial in \(n\) variables is continuous.

Be careful about taking limits separately. Consider the function defined by \(f(x,y) := \frac{xy}{x^2+y^2}\) outside the origin and \(f(0,0) := 0\text{.}\) See Figure 7.13. In Exercise 7.5.2, you are asked to prove that \(f\) is not continuous at the origin. However, for every \(y\text{,}\) the function \(g(x) := f(x,y)\) is continuous, and for every \(x\text{,}\) the function \(h(y) := f(x,y)\) is continuous.

Figure 7.13. Graph of \(\frac{xy}{x^2+y^2}\text{.}\)

Example 7.5.4.

Let \(X\) be a metric space and \(f \colon X \to \C\) a complex-valued function. We write \(f(p) = g(p) + i h(p)\text{,}\) where \(g \colon X \to \R\) and \(h \colon X \to \R\) are the real and imaginary parts of \(f\text{.}\) Then \(f\) is continuous at \(c \in X\) if and only if its real and imaginary parts are continuous at \(c\text{.}\) This fact follows because \(\bigl\{ f(p_n) = g(p_n) + i h(p_n) \bigr\}_{n=1}^\infty\) converges to \(f(p) = g(p) + i h(p)\) if and only if \(\bigl\{ g(p_n) \bigr\}\) converges to \(g(p)\) and \(\bigl\{ h(p_n) \bigr\}\) converges to \(h(p)\text{.}\)

Subsection 7.5.2 Compactness and continuity

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


A sequence in \(f(K)\) can be written as \(\bigl\{ f(x_n) \bigr\}_{n=1}^\infty\text{,}\) where \(\{ x_n \}_{n=1}^\infty\) is a sequence in \(K\text{.}\) The set \(K\) is compact and therefore there is a subsequence \(\{ x_{n_j} \}_{j=1}^\infty\) that converges to some \(x \in K\text{.}\) By continuity,

\begin{equation*} \lim_{j\to\infty} f(x_{n_j}) = f(x) \in f(K) . \end{equation*}

So every sequence in \(f(K)\) has a subsequence convergent to a point in \(f(K)\text{,}\) and \(f(K)\) is compact by Theorem 7.4.11.

As before, \(f \colon X \to \R\) achieves an absolute minimum at \(c \in X\) if

\begin{equation*} f(x) \geq f(c) \qquad \text{for all } x \in X. \end{equation*}

On the other hand, \(f\) achieves an absolute maximum at \(c \in X\) if

\begin{equation*} f(x) \leq f(c) \qquad \text{for all } x \in X. \end{equation*}


As \(X\) is compact and \(f\) is continuous, \(f(X) \subset \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)\text{,}\) because both the sup and the 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)\text{.}\)

Subsection 7.5.3 Continuity and topology

Let us see how to define continuity in terms of the 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.

Figure 7.14. For every neighborhood \(U\) of \(f(c)\text{,}\) the set \(f^{-1}(U)\) contains an open neighborhood \(W\) of \(c\text{.}\)


First suppose that \(f\) is continuous at \(c\text{.}\) Let \(U\) be an open neighborhood of \(f(c)\) in \(Y\text{,}\) then \(B_Y\bigl(f(c),\epsilon\bigr) \subset U\) for some \(\epsilon > 0\text{.}\) By continuity of \(f\text{,}\) there exists a \(\delta > 0\) such that whenever \(x\) is such that \(d_X(x,c) < \delta\text{,}\) then \(d_Y\bigl(f(x),f(c)\bigr) < \epsilon\text{.}\) In other words,

\begin{equation*} B_X(c,\delta) \subset f^{-1}\bigl(B_Y\bigl(f(c),\epsilon\bigr)\bigr) \subset f^{-1}(U) , \end{equation*}

and \(B_X(c,\delta)\) is an open neighborhood of \(c\text{.}\)

For the other direction, let \(\epsilon > 0\) be given. If \(f^{-1}\bigl(B_Y\bigl(f(c),\epsilon\bigr)\bigr)\) contains an open neighborhood \(W\) of \(c\text{,}\) it contains a ball. That is, there is some \(\delta > 0\) such that

\begin{equation*} B_X(c,\delta) \subset W \subset f^{-1}\bigl(B_Y\bigl(f(c),\epsilon\bigr)\bigr) . \end{equation*}

That means precisely that if \(d_X(x,c) < \delta\text{,}\) then \(d_Y\bigl(f(x),f(c)\bigr) < \epsilon\text{,}\) and so \(f\) is continuous at \(c\text{.}\)

The proof follows from Lemma 7.5.7 and is left as an exercise.

Example 7.5.9.

Let \(f \colon X \to Y\) be a continuous function. Theorem 7.5.8 tells us that if \(E \subset Y\) is closed, then \(f^{-1}(E) = X \setminus f^{-1}(E^c)\) is also closed. Therefore, if we have a continuous function \(f \colon X \to \R\text{,}\) then the zero set of \(f\text{,}\) that is, \(f^{-1}(0) = \bigl\{ x \in X : f(x) = 0 \bigr\}\text{,}\) is closed. We have just proved the most basic result in algebraic geometry, the study of zero sets of polynomials: The zero set of a polynomial is closed.

Similarly the set where \(f\) is nonnegative, that is, \(f^{-1}\bigl( [0,\infty) \bigr) = \bigl\{ x \in X : f(x) \geq 0 \bigr\}\text{,}\) is closed. On the other hand the set where \(f\) is positive, \(f^{-1}\bigl( (0,\infty) \bigr) = \bigl\{ x \in X : f(x) > 0 \bigr\}\text{,}\) is open.

Subsection 7.5.4 Uniform continuity

As for continuous functions on the real line, in the definition of continuity it is sometimes convenient to be able to pick one \(\delta\) for all points.

Definition 7.5.10.

Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces. Then \(f \colon X \to Y\) is uniformly continuous if for every \(\epsilon > 0\) there is a \(\delta > 0\) such that whenever \(p,q \in X\) and \(d_X(p,q) < \delta\text{,}\) we have \(d_Y\bigl(f(p),f(q)\bigr) < \epsilon\text{.}\)

A uniformly continuous function is continuous, but not necessarily vice versa as we have seen.


Let \(\epsilon > 0\) be given. For each \(c \in X\text{,}\) pick \(\delta_c > 0\) such that \(d_Y\bigl(f(x),f(c)\bigr) < \nicefrac{\epsilon}{2}\) whenever \(x \in B(c,\delta_c)\text{.}\) The balls \(B(c,\delta_c)\) cover \(X\text{,}\) and the space \(X\) is compact. Apply the Lebesgue covering lemma to obtain a \(\delta > 0\) such that for every \(x \in X\text{,}\) there is a \(c \in X\) for which \(B(x,\delta) \subset B(c,\delta_c)\text{.}\)

If \(p, q \in X\) where \(d_X(p,q) < \delta\text{,}\) find a \(c \in X\) such that \(B(p,\delta) \subset B(c,\delta_c)\text{.}\) Then \(q \in B(c,\delta_c)\text{.}\) By the triangle inequality and the definition of \(\delta_c\text{,}\) we have

\begin{equation*} d_Y\bigl(f(p),f(q)\bigr) \leq d_Y\bigl(f(p),f(c)\bigr) + d_Y\bigl(f(c),f(q)\bigr) < \nicefrac{\epsilon}{2}+ \nicefrac{\epsilon}{2} = \epsilon . \qedhere \end{equation*}

As an application of uniform continuity, let us prove a useful criterion for continuity of functions defined by integrals. Let \(f(x,y)\) be a function of two variables and define

\begin{equation*} g(y) := \int_a^b f(x,y) \,dx . \end{equation*}

Question is, is \(g\) is continuous? We are really asking when do two limiting operations commute, which is not always possible, so some extra hypothesis is necessary. A useful sufficient (but not necessary) condition is that \(f\) is continuous on a closed rectangle.


Fix \(y \in [c,d]\text{,}\) and let \(\{ y_n \}\) be a sequence in \([c,d]\) converging to \(y\text{.}\) Let \(\epsilon > 0\) be given. As \(f\) is continuous on \([a,b] \times [c,d]\text{,}\) which is compact, \(f\) is uniformly continuous. In particular, there exists a \(\delta > 0\) such that whenever \(\widetilde{y} \in [c,d]\) and \(\abs{\widetilde{y}-y} < \delta\text{,}\) we have \(\abs{f(x,\widetilde{y})-f(x,y)} < \frac{\epsilon}{b-a}\) for all \(x \in [a,b]\text{.}\) So suppose \(\abs{\widetilde{y}-y} < \delta\text{.}\) Then

\begin{multline*} \abs{ g(\widetilde{y})- g(y) } = \abs{ \int_a^b f(x,\widetilde{y}) \,dx - \int_a^b f(x,y) \,dx } \\ = \abs{ \int_a^b \bigl( f(x,\widetilde{y}) - f(x,y) \bigr) \,dx } \leq (b-a) \frac{\epsilon}{b-a} = \epsilon . \qedhere \end{multline*}

In applications, if we are interested in continuity at \(y_0\text{,}\) we just need to apply the proposition in \([a,b] \times [y_0-\epsilon,y_0+\epsilon]\) for some small \(\epsilon > 0\text{.}\) For example, if \(f\) is continuous in \([a,b] \times \R\text{,}\) then \(g\) is continuous on \(\R\text{.}\)

Example 7.5.13.

Useful examples of uniformly continuous functions are again the so-called Lipschitz continuous functions. That is, if \((X,d_X)\) and \((Y,d_Y)\) are metric spaces, then \(f \colon X \to Y\) is called Lipschitz or \(K\)-Lipschitz if there exists a \(K \in \R\) such that

\begin{equation*} d_Y\bigl(f(p),f(q)\bigr) \leq K d_X(p,q) \qquad \text{for all } p,q \in X. \end{equation*}

A Lipschitz function is uniformly continuous: Take \(\delta = \nicefrac{\epsilon}{K}\text{.}\) A function can be uniformly continuous but not Lipschitz, as we already saw: \(\sqrt{x}\) on \([0,1]\) is uniformly continuous but not Lipschitz.

It is worth mentioning that, if a function is Lipschitz, it tends to be easiest to simply show it is Lipschitz even if we are only interested in knowing continuity.

Subsection 7.5.5 Cluster points and limits of functions

While we haven't started the discussion of continuity with them and we won't need them until volume II, let us also translate the idea of a limit of a function from the real line to metric spaces. Again we need to start with cluster points.

Definition 7.5.14.

Let \((X,d)\) be a metric space and \(S \subset X\text{.}\) A point \(p \in X\) is called a cluster point of \(S\) if for every \(\epsilon > 0\text{,}\) the set \(B(p,\epsilon) \cap S \setminus \{ p \}\) is not empty.

It is not enough that \(p\) is in the closure of \(S\text{,}\) it must be in the closure of \(S \setminus \{ p \}\) (exercise). So, \(p\) is a cluster point if and only if there exists a sequence in \(S \setminus \{ p \}\) that converges to \(p\text{.}\)

Definition 7.5.15.

Let \((X,d_X)\text{,}\) \((Y,d_Y)\) be metric spaces, \(S \subset X\text{,}\) \(p \in X\) a cluster point of \(S\text{,}\) and \(f \colon S \to Y\) a function. Suppose there exists an \(L \in Y\) and for every \(\epsilon > 0\text{,}\) there exists a \(\delta > 0\) such that whenever \(x \in S \setminus \{ p \}\) and \(d_X(x,p) < \delta\text{,}\) then

\begin{equation*} d_Y\bigl(f(x),L\bigr) < \epsilon . \end{equation*}

Then we say \(f(x)\) converges to \(L\) as \(x\) goes to \(p\text{,}\) and \(L\) is the limit of \(f(x)\) as \(x\) goes to \(p\text{.}\) We write

\begin{equation*} \lim_{x \to p} f(x) := L . \end{equation*}

If \(f(x)\) does not converge as \(x\) goes to \(p\text{,}\) we say \(f\) diverges at \(p\text{.}\)

As usual, we used the definite article without showing that the limit is unique. The proof is a direct translation of the proof from Chapter 3, so we leave it as an exercise.

In any metric space, just like in \(\R\text{,}\) continuous limits may be replaced by sequential limits. The proof is again a direct translation of the proof from Chapter 3, and we leave it as an exercise. The upshot is that we really only need to prove things for sequential limits.

By applying Proposition 7.5.2 or the definition directly we find (exercise) as in Chapter 3, that for cluster points \(p\) of \(S \subset X\text{,}\) the function \(f \colon S \to Y\) is continuous at \(p\) if and only if

\begin{equation*} \lim_{x \to p} f(x) = f(p) . \end{equation*}

Subsection 7.5.6 Exercises

Exercise 7.5.1.

Consider \(\N \subset \R\) with the standard metric. Let \((X,d)\) be a metric space and \(f \colon X \to \N\) a continuous function.

  1. Prove that if \(X\) is connected, then \(f\) is constant (the range of \(f\) is a single value).

  2. Find an example where \(X\) is disconnected and \(f\) is not constant.

Exercise 7.5.2.

Let \(f \colon \R^2 \to \R\) be defined by \(f(0,0) := 0\text{,}\) and \(f(x,y) := \frac{xy}{x^2+y^2}\) if \((x,y) \not= (0,0)\text{.}\)

  1. Show that for every fixed \(x\text{,}\) the function that takes \(y\) to \(f(x,y)\) is continuous. Similarly for every fixed \(y\text{,}\) the function that takes \(x\) to \(f(x,y)\) is continuous.

  2. Show that \(f\) is not continuous.

Exercise 7.5.3.

Suppose \((X,d_X)\text{,}\) \((Y,d_Y)\) are metric spaces and \(f \colon X \to Y\) is continuous. Let \(A \subset X\text{.}\)

  1. Show that \(f(\widebar{A}) \subset \overline{f(A)}\text{.}\)

  2. Show that the subset can be proper.

Exercise 7.5.5.

Suppose \(f \colon X \to Y\) is continuous for metric spaces \((X,d_X)\) and \((Y,d_Y)\text{.}\) Show that if \(X\) is connected, then \(f(X)\) is connected.

Exercise 7.5.6.

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

Exercise 7.5.7.

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

Exercise 7.5.8.

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

Exercise 7.5.9.

Take the metric space of continuous functions \(C([0,1],\R)\text{.}\) Let \(k \colon [0,1] \times [0,1] \to \R\) be a continuous function. Given \(f \in C([0,1],\R)\) define

\begin{equation*} \varphi_f(x) := \int_0^1 k(x,y) f(y) \,dy . \end{equation*}
  1. Show that \(T(f) := \varphi_f\) defines a function \(T \colon C([0,1],\R) \to C([0,1],\R)\text{.}\)

  2. Show that \(T\) is continuous.

Exercise 7.5.10.

Let \((X,d)\) be a metric space.

  1. If \(p \in X\text{,}\) show that \(f \colon X \to \R\) defined by \(f(x) := d(x,p)\) is continuous.

  2. Define a metric on \(X \times X\) as in Exercise 7.1.6 part b, and show that \(g \colon X \times X \to \R\) defined by \(g(x,y) := d(x,y)\) is continuous.

  3. Show that if \(K_1\) and \(K_2\) are compact subsets of \(X\text{,}\) then there exists a \(p \in K_1\) and \(q \in K_2\) such that \(d(p,q)\) is minimal, that is, \(d(p,q) = \inf \{ d(x,y) \colon x \in K_1, y \in K_2 \}\text{.}\)

Exercise 7.5.11.

Let \((X,d)\) be a compact metric space, let \(C(X,\R)\) be the set of real-valued continuous functions. Define

\begin{equation*} d(f,g) := \snorm{f-g}_u := \sup_{x \in X} \abs{f(x)-g(x)} . \end{equation*}
  1. Show that \(d\) makes \(C(X,\R)\) into a metric space.

  2. Show that for every \(x \in X\text{,}\) the evaluation function \(E_x \colon C(X,\R) \to \R\) defined by \(E_x(f) := f(x)\) is a continuous function.

Exercise 7.5.12.

Let \(C([a,b],\R)\) be the set of continuous functions and \(C^1([a,b],\R)\) the set of once continuously differentiable functions on \([a,b]\text{.}\) Define

\begin{equation*} d_{C}(f,g) := \snorm{f-g}_u \qquad \text{and} \qquad d_{C^1}(f,g) := \snorm{f-g}_u + \snorm{f'-g'}_u, \end{equation*}

where \(\snorm{\cdot}_u\) is the uniform norm. By Example 7.1.8 and Exercise 7.1.12 we know that \(C([a,b],\R)\) with \(d_C\) is a metric space and so is \(C^1([a,b],\R)\) with \(d_{C^1}\text{.}\)

  1. Prove that the derivative operator \(D \colon C^1([a,b],\R) \to C([a,b],\R)\) defined by \(D(f) := f'\) is continuous.

  2. On the other hand if we consider the metric \(d_C\) on \(C^1([a,b],\R)\text{,}\) then prove the derivative operator is no longer continuous. Hint: Consider \(\sin(n x)\text{.}\)

Exercise 7.5.13.

Let \((X,d)\) be a metric space, \(S \subset X\text{,}\) and \(p \in X\text{.}\) Prove that \(p\) is a cluster point of \(S\) if and only if \(p \in \overline{S \setminus \{ p \}}\text{.}\)

Exercise 7.5.16.

Let \((X,d_X)\) and \((Y,d_Y)\) be metric spaces, \(S \subset X\text{,}\) \(p \in X\) a cluster point of \(S\text{,}\) and let \(f \colon S \to Y\) be a function. Prove that \(f \colon S \to Y\) is continuous at \(p\) if and only if

\begin{equation*} \lim_{x \to p} f(x) = f(p) . \end{equation*}

Exercise 7.5.17.


\begin{equation*} f(x,y) := \begin{cases} \frac{2xy}{x^4+y^2} & \text{if } (x,y) \not= (0,0), \\ 0 & \text{if } (x,y) = (0,0) . \end{cases} \end{equation*}
  1. Show that for every fixed \(y\) the function that takes \(x\) to \(f(x,y)\) is continuous and hence Riemann integrable.

  2. For every fixed \(x\text{,}\) the function that takes \(y\) to \(f(x,y)\) is continuous.

  3. Show that \(f\) is not continuous at \((0,0)\text{.}\)

  4. Now show that \(g(y) := \int_0^1 f(x,y)\,dx\) is not continuous at \(y=0\text{.}\)

Note: Feel free to use what you know about \(\arctan\) from calculus, in particular that \(\frac{d}{ds} \bigl[ \arctan(s) \bigr] = \frac{1}{1+s^2}\text{.}\)

Exercise 7.5.18.

Prove a stronger version of Proposition 7.5.12: If \(f \colon (a,b) \times (c,d) \to \R\) is a bounded continuous function, then \(g \colon (c,d) \to \R\) defined by

\begin{equation*} g(y) := \int_a^b f(x,y) \,dx \qquad \text{is continuous}. \end{equation*}

Hint: First integrate over \([a+\nicefrac{1}{n},b-\nicefrac{1}{n}]\text{.}\)

For a higher quality printout use the PDF versions: or