From Local Continuity to One Global Scale
Continuity at a point allows the input distance required for a given output tolerance to depend on that point. Uniform continuity is stronger: one input distance works at every point of the domain. Compactness is what lets us pass from many local choices to one global choice. In this tutorial, we use the Lebesgue Number Lemma to prove the Heine-Cantor theorem, and then see how compactness also ensures that continuous real-valued functions attain their extreme values.
Recall that \(f:X\to Y\), between metric spaces \((X,d_X)\) and \((Y,d_Y)\), is uniformly continuous if for every \(\varepsilon>0\) there is a \(\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 regardless of where \(x\) and \(y\) lie. By contrast, continuity at each \(x\) allows the corresponding \(\delta\) to depend on \(x\).
Earlier in the course, the Complete and Totally Bounded Metric Spaces Are Compact theorem and the result that a continuous map from a complete, totally bounded metric space is uniformly continuous established a route to this conclusion. The compactness proof below gives a different useful perspective: it identifies how an open cover of the domain supplies a single scale for all points.
The Heine-Cantor Theorem
Fix an output tolerance \(\varepsilon>0\). Continuity at each point \(z\in X\) gives a radius \(r_z>0\) such that points within \(r_z\) of \(z\) have images within \(\varepsilon/3\) of \(f(z)\). The balls with half these radii cover \(X\). Compactness supplies a finite subcover, and the Lebesgue Number Lemma supplies a positive scale for that cover. The triangle inequality then compares the images of any two sufficiently close points to the image of one common center.
Proof. If \(X\) is empty, the definition of uniform continuity holds vacuously, so suppose \(X\) is nonempty. Let \(\varepsilon>0\). For each \(z\in X\), continuity at \(z\) gives \(r_z>0\) such that \(d_X(w,z)<r_z\) implies \(d_Y(f(w),f(z))<\varepsilon/3\). The collection of open balls \(\{B_{r_z/2}(z):z\in X\}\) covers \(X\). By compactness, finitely many of these balls cover \(X\). The Lebesgue Number Lemma gives a number \(\lambda>0\) such that every subset of \(X\) with diameter less than \(\lambda\) is contained in one member of this finite cover.
Set \(\delta=\lambda\). Take any \(x,y\in X\) with \(d_X(x,y)<\delta\). The set \(\{x,y\}\) has diameter less than \(\lambda\), so it is contained in one of the covering balls, say \(B_{r_z/2}(z)\). Thus \(d_X(x,z)<r_z/2<r_z\) and \(d_X(y,z)<r_z/2<r_z\). The choice of \(r_z\) gives
The chosen \(\delta\) depends on \(\varepsilon\) and the cover, not on \(x\) or \(y\). This is uniform continuity. \(\square\)
The factor of \(1/3\) is simply convenient: it leaves room to apply the triangle inequality through the common center \(f(z)\). The crucial step is not the particular fraction but finding one Lebesgue number for a cover built from local continuity neighborhoods. Continuity supplies those neighborhoods; compactness makes a global scale possible.
Worked Examples: Uniform Control in Practice
Worked Example: A Polynomial on a Compact Interval
Consider \(f(x)=x^2\) on \(K=[-2,1]\), with the usual metric. The function is continuous and \(K\) is compact, so the Heine-Cantor theorem guarantees uniform continuity. We can also find an explicit scale. For \(x,y\in K\), the factorization of the difference of squares gives
because \(|x|\leq2\) and \(|y|\leq2\), so \(|x+y|\leq|x|+|y|\leq4\). Given \(\varepsilon>0\), choose \(\delta=\varepsilon/4\). If \(|x-y|<\delta\), then \(|f(x)-f(y)|\leq4|x-y|<4\delta=\varepsilon\). This verifies uniform continuity directly and provides a concrete choice of \(\delta\).
Worked Example: A Square-Root Function at the Endpoint
Consider \(g(x)=\sqrt{x}\) on \([0,4]\). This function is continuous, including at \(0\), and the domain is compact. For \(x\geq y\geq0\), we have \(\sqrt{x}\geq\sqrt{y}\), and
where the inequality is equivalent to \(y\leq\sqrt{xy}\). This holds because both sides are nonnegative and \(y^2\leq xy\), which follows from \(y\leq x\). Taking square roots gives \(|\sqrt{x}-\sqrt{y}|\leq\sqrt{x-y}\). Interchanging \(x\) and \(y\) when necessary yields \[ |\sqrt{x}-\sqrt{y}|\leq\sqrt{|x-y|} \] for all \(x,y\in[0,4]\). Choose \(\delta=\varepsilon^2\). Then \(|x-y|<\delta\) implies \(|g(x)-g(y)|\leq\sqrt{|x-y|}<\sqrt{\delta}=\varepsilon\). The endpoint causes no failure of uniform continuity; the direct estimate works there as well.
Worked Example: Continuity Without Uniform Continuity on the Whole Line
The function \(h(x)=x^2\) is continuous at every point of \(\mathbb{R}\), but it is not uniformly continuous on \(\mathbb{R}\). To see why, take \(x_n=n\) and \(y_n=n+1/n\). Their input distances satisfy
whereas their output distances are
Thus the outputs do not become arbitrarily close even though the inputs do. The Sequential Criterion for Uniform Continuity gives the same diagnosis: these two sequences have input distance tending to zero, but their image distance does not tend to zero. There is no contradiction with Heine-Cantor, since \(\mathbb{R}\) is not compact.
Compactness and Attainment of Extreme Values
Uniform continuity is not the only useful consequence of compactness for continuous functions. For real-valued functions, compactness also ensures that the largest and smallest values are actually reached. This is stronger than merely saying the values are bounded: a bounded set of values can have a supremum or infimum that it never attains.
Proof. By the theorem that Continuous Images of Compact Sets Are Compact, \(f[K]\) is compact in \(\mathbb{R}\). Compact subsets of metric spaces are bounded, so \(f[K]\) is nonempty and bounded. Let \(M=\sup f[K]\). For each positive integer \(n\), the definition of supremum gives \(t_n\in f[K]\) such that \(M-1/n<t_n\leq M\). Consequently, \(t_n\to M\). Compact subsets of the Hausdorff space \(\mathbb{R}\) are closed, so \(M\in f[K]\). Hence \(M=f(b)\) for some \(b\in K\).
Likewise, let \(m=\inf f[K]\). For each positive integer \(n\), choose \(s_n\in f[K]\) with \(m\leq s_n<m+1/n\). Then \(s_n\to m\), and closedness of \(f[K]\) implies \(m\in f[K]\). Thus \(m=f(a)\) for some \(a\in K\). Since \(m\) and \(M\) are the infimum and supremum of the image, \(f(a)\leq f(x)\leq f(b)\) for all \(x\in K\). \(\square\)
Worked Example: Finding the Minimum and Maximum
Let \(q(x)=3-(x-1)^2\) on \(K=[0,2]\). The function is continuous and the interval is nonempty and compact, so the Extreme Value Theorem guarantees a minimum and a maximum. The explicit identity
shows that \(q(x)\leq3\), with equality at \(x=1\). Also, for \(x\in[0,2]\), we have \(|x-1|\leq1\), so \((x-1)^2\leq1\) and \(q(x)\geq2\). Equality holds at both endpoints: \(q(0)=3-1=2\) and \(q(2)=3-1=2\). Therefore the minimum is \(2\), attained at \(0\) and \(2\), and the maximum is \(3\), attained at \(1\).
What Compactness Adds—and What It Does Not
The Heine-Cantor theorem does not say that every continuous function on every metric space is uniformly continuous. Continuity controls behavior near each point separately; without compactness, those local controls may become less effective as the point moves through the domain. The sequence example on \(\mathbb{R}\) makes that failure explicit. On a compact domain, finite coverage and a Lebesgue number prevent the local scales from degenerating without a global bound.
A second distinction is between uniform continuity and a Lipschitz estimate. A Lipschitz bound such as \(|f(x)-f(y)|\leq L|x-y|\) is a particularly strong way to prove uniform continuity, as in the polynomial example. The Heine-Cantor theorem guarantees uniform continuity for continuous maps on compact metric spaces, but it does not promise one global Lipschitz constant. The square-root estimate illustrates a different modulus of control: the output distance is bounded by the square root of the input distance.
When applying the theorem, check both hypotheses: the domain must be compact and the function must be continuous on that domain. A restriction to a compact subset can be uniformly continuous even when the same formula is not uniformly continuous on a larger, noncompact domain. For real-valued functions, the Extreme Value Theorem adds another conclusion: boundedness of the image becomes actual attainment of its upper and lower bounds.
Check Your Understanding
Use the compactness arguments and examples above to answer the following questions.
- In the proof of the Heine-Cantor theorem, what role does the Lebesgue number play?
- Why is the set \(\{x,y\}\) contained in one member of the cover when \(d_X(x,y)<\lambda\)?
- Why does the sequence example for \(x^2\) on \(\mathbb{R}\) not contradict the Heine-Cantor theorem?
- What additional property of compact subsets of \(\mathbb{R}\) ensures that the supremum of \(f[K]\) is attained?
- How does a Lipschitz estimate differ from the general conclusion of uniform continuity?