Tutorials › Real Analysis › Prove Uniform Continuity on a Compact Set

Comprehensive Proof Practicum · Tutorial 972 of 1000

Prove Uniform Continuity on a Compact Set

Use continuity neighborhoods and compactness to obtain one distance bound that works throughout the domain, then describe uniform continuity through a modulus.

Advanced 9 min read

What You'll Learn

  • Turn pointwise continuity neighborhoods into a single uniform distance bound using a finite-cover argument
  • Apply the Lebesgue Number Lemma to control pairs of nearby points
  • Find explicit uniform-continuity bounds for functions on compact intervals
  • Define the modulus of continuity and prove its connection to uniform continuity
  • Identify why compactness matters by testing a function on a noncompact domain

From Pointwise Control to One Uniform Bound

Continuity at a point allows the required input distance to depend on that point. Uniform continuity asks for more: for each tolerance in the function values, one input distance must work at every point of the domain. The compactness argument in this tutorial explains how to pass from the first kind of control to the second.

The result that continuous functions on compact metric spaces are uniformly continuous was established earlier in this course as the Continuous Functions on Compact Metric Spaces Are Uniformly Continuous theorem. Here we develop a finite-cover proof of that conclusion. The proof makes the role of compactness explicit: continuity supplies a neighborhood around each point, and the Lebesgue Number Lemma turns that collection of neighborhoods into one distance that controls every sufficiently close pair.

Definition: Let \((X,d)\) be a metric space, \(A\subseteq X\), and \(f:A\to\mathbb R\). The function \(f\) is uniformly continuous on \(A\) if for every \(\varepsilon>0\), there is a \(\delta>0\) such that, for all \(x,y\in A\), \(d(x,y)<\delta\) implies \(|f(x)-f(y)|<\varepsilon\). The same \(\delta\) must work for every pair \(x,y\) in the domain.

For comparison, continuity at a fixed \(a\in A\) asks that for every \(\varepsilon>0\), there be a \(\delta>0\) such that \(x\in A\) and \(d(x,a)<\delta\) imply \(|f(x)-f(a)|<\varepsilon\). This \(\delta\) may depend on \(a\). The proof below begins with such point-dependent neighborhoods and uses compactness to coordinate them.

A Finite-Cover Proof

Theorem (Uniform Continuity on a Compact Set): Let \(K\) be a compact metric space, and let \(f:K\to\mathbb R\) be continuous. Then \(f\) is uniformly continuous on \(K\).

Proof. If \(K\) is empty, the defining implication for uniform continuity has no pairs \(x,y\in K\) to check, so any \(\delta>0\) works. Suppose now that \(K\) is nonempty, and fix \(\varepsilon>0\).

For each \(z\in K\), continuity at \(z\), applied with tolerance \(\varepsilon/2\), gives a number \(r_z>0\) such that \(|f(w)-f(z)|<\varepsilon/2\) whenever \(w\in K\) and \(d(w,z)<r_z\). Consider the open sets \(U_z=B(z,r_z/2)\cap K\), for \(z\in K\). They cover \(K\), since \(z\in U_z\) for every \(z\in K\).

By the Lebesgue Number Lemma, this open cover has a Lebesgue number \(\lambda>0\): every subset of \(K\) with diameter less than \(\lambda\) is contained in some member of the cover. Set \(\delta=\lambda\). Take any \(x,y\in K\) with \(d(x,y)<\delta\). The set \(\{x,y\}\) has diameter \(d(x,y)<\lambda\), so it is contained in \(U_z\) for some \(z\in K\). In particular, \(d(x,z)<r_z/2<r_z\) and \(d(y,z)<r_z/2<r_z\). The choice of \(r_z\) therefore gives \(|f(x)-f(z)|<\varepsilon/2\) and \(|f(y)-f(z)|<\varepsilon/2\). By the triangle inequality,

$$ |f(x)-f(y)| \leq |f(x)-f(z)|+|f(z)-f(y)| <\frac{\varepsilon}{2}+\frac{\varepsilon}{2} =\varepsilon. $$

The number \(\delta\) depends on \(\varepsilon\) and on the cover, but not on the particular pair \(x,y\). This is precisely uniform continuity. \(\square\)

Notice why the proof uses neighborhoods of radius \(r_z/2\) in the cover but continuity on the larger radius \(r_z\). The Lebesgue Number Lemma places both points inside one smaller neighborhood. Each point is then close enough to the same center \(z\) for the continuity estimate to apply. The triangle inequality compares their function values through that common center.

Worked Examples with Explicit Bounds

Worked Example: A Quadratic on a Closed Interval

Let \(f(x)=x^2\) on \(K=[-3,2]\). The Heine-Borel Theorem says that \(K\) is compact, and \(f\) is continuous, so the compact-set theorem guarantees uniform continuity. In this case we can give an explicit bound.

For \(x,y\in[-3,2]\), factor the difference and bound the sum: \(|f(x)-f(y)|=|x^2-y^2|=|x-y||x+y|\). Since \(|x|\leq3\) and \(|y|\leq3\), we have \(|x+y|\leq|x|+|y|\leq6\). Thus \(|f(x)-f(y)|\leq6|x-y|\). Given \(\varepsilon>0\), choose \(\delta=\varepsilon/6\). If \(|x-y|<\delta\), then \(|f(x)-f(y)|\leq6|x-y|<6\delta=\varepsilon\). This proves uniform continuity directly.

The bound works because the inputs are restricted to a bounded interval. The factor \(|x+y|\), which could grow without bound on all of \(\mathbb R\), has a single bound on this domain.

Worked Example: The Square-Root Function at the Endpoint

Consider \(f(x)=\sqrt{x}\) on \([0,4]\). This function is continuous on the compact interval, including at \(0\), so the theorem applies. A direct inequality also gives a uniform bound without needing a separate continuity calculation at the endpoint.

Suppose first that \(x\geq y\geq0\). Then \((\sqrt{x}-\sqrt{y})^2=x+y-2\sqrt{xy}\). Since \(y\leq\sqrt{xy}\) when \(x\geq y\geq0\), it follows that \((\sqrt{x}-\sqrt{y})^2\leq x+y-2y=x-y\). Taking nonnegative square roots gives \(|\sqrt{x}-\sqrt{y}|\leq\sqrt{x-y}\). If \(y\geq x\), the same argument with \(x\) and \(y\) exchanged gives the combined inequality \(|\sqrt{x}-\sqrt{y}|\leq\sqrt{|x-y|}\) for all \(x,y\geq0\).

Given \(\varepsilon>0\), choose \(\delta=\varepsilon^2\). Whenever \(x,y\in[0,4]\) and \(|x-y|<\delta\), the inequality above gives \(|f(x)-f(y)|\leq\sqrt{|x-y|}<\sqrt{\delta}=\varepsilon\). Thus \(f\) is uniformly continuous. This example shows that uniform continuity does not require a linear bound of the form \(C|x-y|\).

Worked Example: A Finite Compact Domain

Let \(K=\{0,2,7\}\), with the usual distance inherited from \(\mathbb R\), and define \(f(0)=4\), \(f(2)=-1\), and \(f(7)=3\). A finite set is compact: from any open cover, choose one covering set for each point, obtaining a finite subcover. Every function on this finite set is continuous, since each point has a neighborhood containing no other points of \(K\).

The smallest distance between distinct points of \(K\) is \(2\). Choose \(\delta=2\). If \(x,y\in K\) and \(|x-y|<2\), then \(x=y\), because distinct points are at least distance \(2\) apart. Consequently, \(|f(x)-f(y)|=0<\varepsilon\) for every \(\varepsilon>0\). This verifies uniform continuity directly, regardless of the assigned function values.

The example illustrates that uniform continuity on a finite domain can follow from separation of the distinct points, rather than from any special behavior of the function.

The Modulus of Continuity

Uniform continuity can also be recorded by measuring the largest change in function values among pairs whose inputs are at most a prescribed distance apart. This gives a useful quantitative summary of the estimates in the examples. The next result is a characterization in terms of that summary.

Definition: Let \(K\) be a nonempty compact metric space and \(f:K\to\mathbb R\) be continuous. For \(t\geq0\), define the modulus of continuity of \(f\) on \(K\) by \(\omega_f(t)=\sup\{|f(x)-f(y)|:x,y\in K,\ d(x,y)\leq t\}\).
Theorem (Modulus Characterization of Uniform Continuity): For a continuous function \(f\) on a nonempty compact metric space \(K\), the modulus \(\omega_f(t)\) is finite for every \(t\geq0\), is nondecreasing, and satisfies \(\omega_f(t)\to0\) as \(t\) decreases to \(0\). More generally, for any bounded real-valued function on a nonempty metric space, uniform continuity is equivalent to its modulus, defined by the same formula, tending to \(0\) as \(t\) decreases to \(0\).

Proof. First let \(f\) be continuous on the compact space \(K\). By the boundedness conclusion of the Extreme Value Theorem, \(f\) is bounded. Thus there is \(M\geq0\) such that \(|f(x)|\leq M\) for every \(x\in K\). For every pair \(x,y\in K\), \(|f(x)-f(y)|\leq|f(x)|+|f(y)|\leq2M\). The set in the definition of \(\omega_f(t)\) is nonempty, since it includes the pair \((x,x)\) for any \(x\in K\); it is bounded above by \(2M\), so its supremum is finite.

If \(0\leq s\leq t\), every pair satisfying \(d(x,y)\leq s\) also satisfies \(d(x,y)\leq t\). The set of values used to define \(\omega_f(s)\) is therefore contained in the set used to define \(\omega_f(t)\), which implies \(\omega_f(s)\leq\omega_f(t)\). Hence the modulus is nondecreasing.

Now let \(\eta>0\). Uniform continuity, proved above, supplies \(\delta>0\) such that \(d(x,y)<\delta\) implies \(|f(x)-f(y)|<\eta/2\). If \(0\leq t<\delta\), every pair with \(d(x,y)\leq t\) has \(d(x,y)<\delta\). Thus every value in the set defining \(\omega_f(t)\) is less than \(\eta/2\), so \(\omega_f(t)\leq\eta/2<\eta\). This proves \(\omega_f(t)\to0\) as \(t\) decreases to \(0\).

For the general equivalence, let \(f\) be bounded on a nonempty metric space \(A\), so the same supremum is finite for each \(t\). If \(f\) is uniformly continuous, the preceding argument shows that for every \(\eta>0\), sufficiently small \(t\) gives \(\omega_f(t)<\eta\). Conversely, suppose \(\omega_f(t)\to0\) as \(t\) decreases to \(0\). Given \(\varepsilon>0\), choose \(\delta>0\) such that \(\omega_f(\delta)<\varepsilon\). If \(x,y\in A\) and \(d(x,y)<\delta\), then \(d(x,y)\leq\delta\), so \(|f(x)-f(y)|\leq\omega_f(\delta)<\varepsilon\). This is uniform continuity. \(\square\)

For example, the quadratic estimate above gives \(\omega_f(t)\leq6t\) on \([-3,2]\), and the square-root estimate gives \(\omega_f(t)\leq\sqrt{t}\) on \([0,4]\). These bounds describe not only that the functions are uniformly continuous, but also how quickly their maximum possible change decreases as the input distance shrinks.

Why Compactness Matters

Pointwise continuity on a noncompact set need not provide one distance bound for the whole domain. Consider \(f(x)=x^2\) on \([0,\infty)\). For each positive integer \(n\), take \(x_n=n\) and \(y_n=n+1/n\). Their distance is \(|x_n-y_n|=1/n\), which tends to zero, but \[ |f(y_n)-f(x_n)| =\left(n+\frac1n\right)^2-n^2 =2+\frac1{n^2} \geq2. \] Taking \(\varepsilon=1\), no positive \(\delta\) can work for all pairs: choose \(n\) large enough that \(1/n<\delta\), and this pair has input distance below \(\delta\) but function-value difference at least \(2>1\). The domain is not compact, so this does not contradict the theorem.

A common proof error is to use continuity at each point and then assume that the resulting \(\delta\) is automatically independent of the point. It is not. The finite-cover step is essential: it gathers all the local estimates into a cover, and compactness provides a single Lebesgue number for that cover. In a proof, check the quantifiers carefully: the final distance must be selected after \(\varepsilon\), but before choosing \(x\) and \(y\).

1
Fix the output tolerance.
Start with an arbitrary \(\varepsilon>0\), and use pointwise continuity with a smaller tolerance such as \(\varepsilon/2\).
2
Form a cover from local neighborhoods.
Choose neighborhoods around each center that are small enough for the continuity estimate to apply to every point inside them.
3
Use compactness once.
Apply the Lebesgue Number Lemma to obtain a single positive distance that controls every sufficiently small pair.
4
Compare through a common center.
Bound the two function-value changes separately and add them with the triangle inequality.

Check Your Understanding

Use the proof and examples above to answer the following questions.

  1. Why does the finite-cover proof use continuity with tolerance \(\varepsilon/2\) rather than \(\varepsilon\)?
  2. How does the Lebesgue Number Lemma ensure that two sufficiently close points can be compared with the same center?
  3. For \(f(x)=x^2\) on \([-3,2]\), which bound on \(|x+y|\) leads to the explicit choice \(\delta=\varepsilon/6\)?
  4. Why does \(\omega_f(t)\to0\) imply uniform continuity for a bounded function on a metric space?
  5. What feature of the pairs \(n\) and \(n+1/n\) prevents \(x^2\) from being uniformly continuous on \([0,\infty)\)?