Tutorials › Topology (Undergraduate) › Uniform Continuity On Compact Metric Spaces

Compactness in Metric Spaces · Tutorial 516 of 799

Uniform Continuity On Compact Metric Spaces

Learn how compactness turns pointwise continuity into one distance bound that works across the entire domain.

Intermediate 9 min read

What You'll Learn

  • State uniform continuity using the two metrics on the domain and codomain
  • Prove uniform continuity from compactness by a sequential contradiction
  • Track how nearby domain points yield nearby image sequences
  • Apply the theorem to the identity, a polynomial, and the square-root function
  • Identify why continuous functions on noncompact spaces need not be uniformly continuous

From Pointwise Control to One Global Bound

Continuity controls a function near each individual point. Uniform continuity asks for more: for a chosen output tolerance, one distance threshold must work at every point of the domain. Compactness supplies the key ingredient. If such a global threshold did not exist, we could find pairs of increasingly close domain points whose images stay separated. Compactness then gives a convergent subsequence, and continuity at its limit contradicts that separation.

Throughout, \((X,d_X)\) and \((Y,d_Y)\) are metric spaces, each with its metric topology, and \(f:X\to Y\). Recall that \(f\) is continuous at \(x\in X\) if, for every \(\varepsilon>0\), there is a \(\delta>0\) such that \(d_X(x,z)<\delta\) implies \(d_Y(f(x),f(z))<\varepsilon\). This \(\delta\) may depend on \(x\). A space is compact if every open cover has a finite subcover.

Definition: The map \(f:X\to Y\) is uniformly continuous if, for every \(\varepsilon>0\), there exists \(\delta>0\) such that for all \(x,y\in X\), \(d_X(x,y)<\delta\) implies \(d_Y(f(x),f(y))<\varepsilon\). The same \(\delta\) must work for every pair \(x,y\).

If \(X=\varnothing\), the condition is vacuously true: there are no pairs \(x,y\in X\) to test. In the main result, therefore, we may assume \(X\ne\varnothing\). We use the standard metric-space compactness result that every sequence in a compact metric space has a convergent subsequence; this equivalence between compactness and sequential compactness was established in the earlier material on compactness in metric spaces.

The Compact-Domain Theorem

Theorem: If \(X\) is a compact metric space, \(Y\) is a metric space, and \(f:X\to Y\) is continuous, then \(f\) is uniformly continuous.

Proof. Suppose, for contradiction, that \(f\) is not uniformly continuous. Negating the definition gives an \(\varepsilon_0>0\) such that for every \(\delta>0\), there are \(x,y\in X\) satisfying \(d_X(x,y)<\delta\) but \(d_Y(f(x),f(y))\ge\varepsilon_0\). For each \(n\in\mathbb{N}\), use \(\delta=1/n\) to choose \(x_n,y_n\in X\) with $$ d_X(x_n,y_n)<\frac{1}{n} \qquad\text{and}\qquad d_Y(f(x_n),f(y_n))\ge\varepsilon_0. $$ By compactness, \((x_n)\) has a convergent subsequence \((x_{n_k})\), with \(x_{n_k}\to x\in X\). The triangle inequality gives $$ d_X(y_{n_k},x) \le d_X(y_{n_k},x_{n_k})+d_X(x_{n_k},x) <\frac{1}{n_k}+d_X(x_{n_k},x). $$ Both terms on the right tend to \(0\), so \(y_{n_k}\to x\) as well. By continuity of \(f\) at \(x\), both \(f(x_{n_k})\to f(x)\) and \(f(y_{n_k})\to f(x)\). More explicitly, continuity with tolerance \(\varepsilon_0/3\) gives a radius \(r>0\) such that \(d_X(z,x)<r\) implies \(d_Y(f(z),f(x))<\varepsilon_0/3\). For all sufficiently large \(k\), both \(x_{n_k}\) and \(y_{n_k}\) are within \(r\) of \(x\). Therefore $$ d_Y(f(x_{n_k}),f(y_{n_k})) \le d_Y(f(x_{n_k}),f(x))+d_Y(f(x),f(y_{n_k})) <\frac{\varepsilon_0}{3}+\frac{\varepsilon_0}{3} =\frac{2\varepsilon_0}{3} <\varepsilon_0. $$ This contradicts the lower bound \(d_Y(f(x_{n_k}),f(y_{n_k}))\ge\varepsilon_0\) for every \(k\). Hence \(f\) is uniformly continuous. \(\square\)

The proof uses compactness only to obtain a convergent subsequence of one sequence of points. The second sequence is forced to have the same limit because its distance from the first is less than \(1/n\). Continuity at that common limit then makes the image distances small, contradicting the fixed positive separation.

Worked Applications

Worked Example: The Identity on a Closed Interval

Let \(X=[-1,2]\) with the usual metric \(d_X(x,y)=|x-y|\), and let \(f:X\to\mathbb{R}\) be \(f(x)=x\), where \(\mathbb{R}\) has its usual metric. The interval is compact by the Heine–Borel theorem, and \(f\) is continuous. To see the uniform bound directly, let \(\varepsilon>0\) and choose \(\delta=\varepsilon\). If \(x,y\in[-1,2]\) and \(|x-y|<\delta\), then $$ |f(x)-f(y)|=|x-y|<\delta=\varepsilon. $$ Thus this single choice works for every pair in the interval.

Check: substituting \(f(x)=x\) into the output distance gives \(|f(x)-f(y)|=|x-y|\), exactly the input distance. Therefore \(\delta=\varepsilon\) gives the required strict inequality, including when one of the points is an endpoint.

Worked Example: A Polynomial on a Compact Interval

Let \(X=[-2,3]\) with the usual metric, and define \(f(x)=x^2\) as a map to \(\mathbb{R}\). The interval is compact by Heine–Borel, and the polynomial is continuous. Given \(\varepsilon>0\), set \(\delta=\varepsilon/6\). For any \(x,y\in[-2,3]\), the sum \(x+y\) lies between \(-4\) and \(6\), so \(|x+y|\le6\). Factoring the difference of squares gives $$ |f(x)-f(y)| =|x^2-y^2| =|x-y||x+y| \le 6|x-y|. $$ Consequently, if \(|x-y|<\delta\), then $$ |f(x)-f(y)|\le 6|x-y|<6\delta =6\left(\frac{\varepsilon}{6}\right) =\varepsilon. $$ So \(f\) is uniformly continuous on this interval.

Check: the bound \(|x+y|\le6\) includes the pair \(x=y=3\), for which \(|x+y|=|3+3|=6\). The estimate allows equality at this intermediate step, but the assumption \(|x-y|<\delta\) makes the final output inequality strict.

Worked Example: The Square-Root Function at the Endpoint

Let \(X=[0,1]\) with the usual metric, and define \(f(x)=\sqrt{x}\) into \(\mathbb{R}\). The function is continuous on this compact interval. For \(x,y\in[0,1]\), suppose first that \(x\ge y\). Both square roots are nonnegative, and $$ (\sqrt{x}-\sqrt{y})^2 \le(\sqrt{x}-\sqrt{y})(\sqrt{x}+\sqrt{y}) =x-y. $$ The inequality holds because \(\sqrt{x}-\sqrt{y}\ge0\) and \(\sqrt{x}+\sqrt{y}\ge\sqrt{x}-\sqrt{y}\). Taking nonnegative square roots gives \(|\sqrt{x}-\sqrt{y}|\le\sqrt{x-y}\). If \(y\ge x\), interchanging \(x\) and \(y\) gives the same estimate. Thus, for all \(x,y\in[0,1]\), $$ |f(x)-f(y)|\le\sqrt{|x-y|}. $$ Given \(\varepsilon>0\), choose \(\delta=\varepsilon^2\). If \(|x-y|<\delta\), then $$ |f(x)-f(y)|\le\sqrt{|x-y|}<\sqrt{\delta} =\sqrt{\varepsilon^2}=\varepsilon. $$ This proves uniform continuity, including for pairs near \(0\).

Check: the chosen \(\delta\) is positive because \(\varepsilon>0\). The strict input inequality \(|x-y|<\varepsilon^2\) yields \(\sqrt{|x-y|}<\varepsilon\), not merely a non-strict bound.

Why Compactness Matters

Continuity alone does not supply one distance threshold for all points. A common error is to apply continuity at each \(x\in X\), obtain a radius \(\delta_x\), and then assume that the radii have a positive lower bound. Pointwise continuity does not provide such a bound on a noncompact domain. The sequential proof avoids this unsupported step: compactness acts on a sequence of counterexample points and produces one limit at which continuity can be used.

Worked Example: A Continuous Function That Is Not Uniformly Continuous

Consider \(f:\mathbb{R}\to\mathbb{R}\), \(f(x)=x^2\), with the usual metric on both spaces. This function is continuous: at a fixed \(a\in\mathbb{R}\), $$ |x^2-a^2|=|x-a||x+a|. $$ If \(|x-a|<1\), then \(|x+a|\le |x-a|+2|a|<1+2|a|\). Given \(\varepsilon>0\), taking \(|x-a|<\min\{1,\varepsilon/(2|a|+1)\}\) therefore gives \(|x^2-a^2|<\varepsilon\).

To test uniform continuity, let \(\varepsilon_0=1\). For any proposed \(\delta>0\), choose \(n\in\mathbb{N}\) with \(n>1/\delta\), and set \(x_n=n\) and \(y_n=n+1/n\). Then $$ |x_n-y_n|=\frac{1}{n}<\delta, $$ while $$ |f(x_n)-f(y_n)| =\left|(n+1/n)^2-n^2\right| =2+\frac{1}{n^2} >1=\varepsilon_0. $$ Thus every proposed \(\delta\) fails for this same output tolerance, and \(f\) is not uniformly continuous on \(\mathbb{R}\).

Check: the input distances \(1/n\) can be made smaller than any prescribed positive \(\delta\), whereas the output distances \(2+1/n^2\) are always greater than \(1\). The contradiction is exactly the negation of uniform continuity. The domain \(\mathbb{R}\) is not compact, so this example does not conflict with the theorem.

Common pitfall. In the example above, pointwise continuity gives a radius depending on \(a\); it does not justify choosing one positive radius for every \(a\in\mathbb{R}\). The concrete pairs \(n,n+1/n\) show why such a choice would fail: their input distance tends to \(0\), but their output distance stays above \(1\). On a compact metric domain, the theorem supplies the missing global conclusion, through the convergent-subsequence argument rather than an unjustified minimum of pointwise radii.

Check Your Understanding

For each question, keep the quantifiers in the definition visible: a uniform \(\delta\) must work for every pair of domain points.

  1. Write the negation of uniform continuity using an \(\varepsilon_0>0\) and pairs \(x,y\in X\).
  2. In the theorem’s proof, why do \(x_{n_k}\to x\) and \(d_X(x_{n_k},y_{n_k})<1/n_k\) imply \(y_{n_k}\to x\)?
  3. For \(f(x)=3x+1\) on \([0,1]\), find a choice of \(\delta\) in terms of \(\varepsilon\) and verify the required inequality.
  4. Why does the estimate for \(\sqrt{x}\) still work when one of \(x,y\) is \(0\)?
  5. For \(f(x)=x^2\) on \(\mathbb{R}\), explain why the pairs \(n,n+1/n\) disprove uniform continuity for \(\varepsilon_0=1\).