Tutorials › Real Analysis › Proof of Heine-Cantor

Uniform Continuity · Tutorial 372 of 1000

Proof of Heine-Cantor

See how compactness turns pointwise continuity into one common input tolerance, and learn two proof techniques that make this passage precise.

Intermediate 10 min read

What You'll Learn

  • Use compactness and Bolzano-Weierstrass to obtain a convergent subsequence in a compact real set
  • Prove the Heine-Cantor Theorem by contradiction with sequences of increasingly close inputs
  • Establish a Lebesgue number for an open cover of a compact subset of the real line
  • Use a Lebesgue number to give a finite-cover proof of uniform continuity
  • Distinguish pointwise neighborhoods from control that works for every nearby pair

Turning Pointwise Control into Uniform Control

The Heine-Cantor Theorem states that a continuous function on a compact subset of the real line is uniformly continuous. The theorem was stated in “Heine-Cantor Theorem”; here we prove it. The key is to see what compactness prevents: there cannot be pairs of inputs that get arbitrarily close while their outputs stay separated by a fixed positive amount.

We will first record how compactness supplies convergent subsequences. Then we use that fact to prove the theorem by contradiction. A second argument uses a useful consequence of compactness: every open cover has a positive scale below which each small subset fits inside one cover member.

Lemma (Sequential Compactness in \(\mathbb{R}\)): If \(E\subseteq\mathbb{R}\) is compact, then every sequence in \(E\) has a subsequence converging to a point of \(E\).

Proof. By the Heine-Borel Theorem, \(E\) is bounded and closed. Let \((x_n)\) be a sequence in \(E\). Since it is bounded, the Bolzano-Weierstrass Theorem gives a convergent subsequence \((x_{n_k})\), with limit \(a\in\mathbb{R}\). Since every \(x_{n_k}\) belongs to the closed set \(E\), its limit \(a\) belongs to \(E\). Thus the subsequence converges to a point of \(E\). \(\square\)

The Sequential Proof of Heine-Cantor

Theorem (Heine-Cantor Theorem): Let \(E\subseteq\mathbb{R}\) be compact, and let \(f:E\to\mathbb{R}\) be continuous at every point of \(E\). Then \(f\) is uniformly continuous on \(E\).

Proof. Suppose, to the contrary, that \(f\) is not uniformly continuous on \(E\). Negating the definition of uniform continuity gives an \(\varepsilon_0>0\) such that, for every \(\delta>0\), there are \(x,y\in E\) with \(|x-y|<\delta\) but \(|f(x)-f(y)|\geq\varepsilon_0\). For each positive integer \(n\), apply this statement with \(\delta=1/n\). We obtain \(x_n,y_n\in E\) such that

$$ |x_n-y_n|<\frac1n \qquad\text{and}\qquad |f(x_n)-f(y_n)|\geq\varepsilon_0. $$

By the sequential compactness lemma, \((x_n)\) has a subsequence \((x_{n_k})\) converging to some \(a\in E\). The corresponding \(y\)-subsequence converges to the same point: the triangle inequality gives

$$ |y_{n_k}-a| \leq |y_{n_k}-x_{n_k}|+|x_{n_k}-a| <\frac{1}{n_k}+|x_{n_k}-a| \longrightarrow 0. $$

Continuity of \(f\) at \(a\) therefore implies \(f(x_{n_k})\to f(a)\) and \(f(y_{n_k})\to f(a)\). In particular,

$$ |f(x_{n_k})-f(y_{n_k})| \leq |f(x_{n_k})-f(a)|+|f(y_{n_k})-f(a)| \longrightarrow 0. $$

This contradicts \(|f(x_{n_k})-f(y_{n_k})|\geq\varepsilon_0\) for every \(k\), since \(\varepsilon_0>0\). The assumption that \(f\) is not uniformly continuous must be false. Hence \(f\) is uniformly continuous on \(E\). \(\square\)

The contradiction has a specific structure. Failure of uniform continuity produces a sequence of pairs whose input distances tend to zero but whose output distances stay at least \(\varepsilon_0\). Compactness gives a convergent subsequence of one sequence of inputs. The other inputs must converge to the same point, where continuity forces both output sequences to approach the same value.

Worked Example: A Cubic on a Compact Interval

Let \(f(x)=x^3\) on \(E=[-1,1]\). The domain is closed and bounded, hence compact, and \(f\) is continuous there because it is a polynomial. Heine-Cantor guarantees that \(f\) is uniformly continuous. In this example we can see the common tolerance directly. For \(x,y\in[-1,1]\),

$$ |x^3-y^3| =|x-y|\,|x^2+xy+y^2| \leq 3|x-y|, $$

because \(x^2\leq1\), \(|xy|\leq1\), and \(y^2\leq1\). Given \(\varepsilon>0\), choose \(\delta=\varepsilon/3\). If \(|x-y|<\delta\), then \(|f(x)-f(y)|\leq3|x-y|<\varepsilon\). The estimate supplies a specific \(\delta\); the theorem guarantees existence even when such a simple estimate is not apparent.

Worked Example: A Composition on a Compact Interval

Consider \(g(x)=\sin(x^2)\) on \(E=[-2,2]\). This domain is compact, and \(g\) is continuous as a composition of continuous functions. For \(x,y\in E\), the Lipschitz estimate for sine and the difference-of-squares identity give

$$ |\sin(x^2)-\sin(y^2)| \leq |x^2-y^2| =|x-y||x+y| \leq 4|x-y|, $$

since \(|x+y|\leq |x|+|y|\leq4\). Thus \(\delta=\varepsilon/4\) works for every \(\varepsilon>0\). This verifies uniform continuity directly, while Heine-Cantor gives the conclusion from compactness and continuity alone.

A Compactness Tool: The Lebesgue Number Lemma

There is another way to express the uniform control supplied by compactness. An open cover may have members of very different sizes, and no single cover member need contain all of \(E\). Nevertheless, on a compact set there is a positive scale such that any subset smaller than that scale lies inside some one member of the cover.

Theorem (Lebesgue Number Lemma): Let \(E\subseteq\mathbb{R}\) be compact, and let \(\mathcal{U}\) be an open cover of \(E\). There exists \(\lambda>0\) such that every nonempty subset \(A\subseteq E\) with diameter less than \(\lambda\) is contained in some member of \(\mathcal{U}\). Here the diameter of \(A\) is \(\sup\{|x-y|:x,y\in A\}\).

Proof. If \(E\) is empty, the conclusion is vacuous, so suppose \(E\) is nonempty. Assume no such \(\lambda\) exists. For each positive integer \(n\), there must then be a nonempty set \(A_n\subseteq E\) with diameter less than \(1/n\) that is not contained in any member of \(\mathcal{U}\). Choose \(x_n\in A_n\). By the sequential compactness lemma, some subsequence \((x_{n_k})\) converges to a point \(a\in E\). Since \(\mathcal{U}\) covers \(E\), there is a set \(U\in\mathcal{U}\) containing \(a\). Because \(U\) is open relative to \(E\), there exists \(r>0\) such that \(E\cap(a-r,a+r)\subseteq U\).

For sufficiently large \(k\), both \(|x_{n_k}-a|<r/2\) and \(1/n_k<r/2\). If \(z\in A_{n_k}\), then the diameter bound and \(x_{n_k},z\in A_{n_k}\) imply \(|z-x_{n_k}|<1/n_k<r/2\). Consequently,

$$ |z-a|\leq |z-x_{n_k}|+|x_{n_k}-a|<r. $$

Thus every \(z\in A_{n_k}\) lies in \(E\cap(a-r,a+r)\subseteq U\), so \(A_{n_k}\subseteq U\). This contradicts the choice of \(A_{n_k}\). Therefore some \(\lambda>0\) has the required property. \(\square\)

Apply the lemma to a continuous function \(f:E\to\mathbb{R}\). Fix \(\varepsilon>0\). For each \(a\in E\), continuity gives a relative neighborhood

$$ U_a=\{x\in E:|f(x)-f(a)|<\varepsilon/3\} $$

of \(a\). These neighborhoods form an open cover of \(E\). Let \(\lambda>0\) be a Lebesgue number for this cover, and choose \(\delta=\lambda\). If \(x,y\in E\) and \(|x-y|<\delta\), the set \(\{x,y\}\) has diameter less than \(\lambda\). It is therefore contained in some \(U_a\). Hence

$$ |f(x)-f(y)| \leq |f(x)-f(a)|+|f(a)-f(y)| <\frac{\varepsilon}{3}+\frac{\varepsilon}{3} <\varepsilon. $$

This proves uniform continuity by a finite-scale argument: nearby inputs are placed together in a neighborhood where both function values are close to the same reference value.

Worked Example: A Continuous Function on Two Separate Intervals

Let \(E=[-3,-2]\cup[1,2]\), and define \(f:E\to\mathbb{R}\) by \(f(x)=x^2\) on \([-3,-2]\) and \(f(x)=3x\) on \([1,2]\). The domain is a finite union of closed bounded intervals, so it is compact. Every point has a neighborhood relative to \(E\) on which only one of the two formulas applies: the intervals are separated by a distance of \(3\). Each formula is a polynomial and is continuous, so \(f\) is continuous at every point of \(E\). Heine-Cantor implies that \(f\) is uniformly continuous, despite the domain having a gap and the formulas differing on its two pieces.

For a direct check, inputs in the same interval satisfy a Lipschitz estimate. On \([-3,-2]\), \(|x^2-y^2|=|x-y||x+y|\leq6|x-y|\). On \([1,2]\), \(|3x-3y|=3|x-y|\). For inputs in different intervals, \(|x-y|\geq3\), while the function values lie in \([3,9]\) on the left and \([3,6]\) on the right, so \(|f(x)-f(y)|\leq6\leq2|x-y|\). Thus \(f\) is Lipschitz with constant \(6\) on all of \(E\), which also proves uniform continuity.

Why the Proof Needs Compactness

Pointwise continuity gives neighborhoods centered at individual points. It does not, by itself, say that nearby pairs anywhere in the domain lie together in a neighborhood with useful output control. The sequential proof addresses that gap by showing that a hypothetical failure of uniform continuity would force both inputs of a bad pair to converge to one point. Continuity at that point rules out the persistent output separation.

The Lebesgue number proof makes the same transition in a different way. A cover by local continuity neighborhoods is not enough on its own; one must know that sufficiently small pairs fit inside one such neighborhood. Compactness supplies precisely that scale. This is why merely taking a finite subcover and then asserting that all close points belong to the same member would be an incomplete argument: a finite cover need not have that property without an additional justification such as the Lebesgue Number Lemma.

These proofs also clarify what the theorem does and does not provide. It guarantees a common \(\delta\) for each \(\varepsilon\), but may not give a convenient formula for that \(\delta\). A direct estimate, as in the examples, can make the tolerance explicit. When no such estimate is available, compactness still ensures that the required uniform tolerance exists.

Check Your Understanding

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

  1. How does failure of uniform continuity produce pairs of sequences with input distances tending to zero and output distances bounded below?
  2. In the sequential proof, why does \(y_{n_k}\) converge to the same point as \(x_{n_k}\)?
  3. Where are closedness and boundedness used to establish sequential compactness in \(\mathbb{R}\)?
  4. What property of an open cover does the Lebesgue Number Lemma provide that a finite subcover alone does not?
  5. In the two-interval example, why must inputs from different intervals be at least \(3\) apart?