Heine–Cantor theorem

In mathematics, the Heine–Cantor theorem, named after Eduard Heine and Georg Cantor, states that if $$f \colon M \to N$$ is a continuous function between two metric spaces $$M$$ and $$N$$, and $$M$$ is compact, then $$f$$ is uniformly continuous. An important special case is that every continuous function from a closed bounded interval to the real numbers is uniformly continuous.

Proof
Suppose that $$M$$ and $$N$$ are two metric spaces with metrics $$d_M$$ and $$d_N$$, respectively. Suppose further that a function $$f: M \to N$$ is continuous and $$ M $$ is compact. We want to show that $$f$$ is uniformly continuous, that is, for every positive real number $$\varepsilon > 0$$ there exists a positive real number $$\delta > 0$$ such that for all points $$x, y$$ in the function domain $$M$$, $$d_M(x,y) < \delta$$ implies that $$d_N(f(x), f(y)) < \varepsilon$$.

Consider some positive real number $$\varepsilon > 0$$. By continuity, for any point $$x$$ in the domain $$M$$, there exists some positive real number $$\delta_x > 0$$ such that $$d_N(f(x),f(y)) < \varepsilon/2$$ when $$d_M(x,y) < \delta _x$$, i.e., a fact that $$y$$ is within $$\delta_x$$ of $$x$$ implies that $$f(y)$$ is within $$\varepsilon / 2$$ of $$f(x)$$.

Let $$U_x$$ be the open $$\delta_x/2$$-neighborhood of $$x$$, i.e. the set


 * $$U_x = \left\{ y \mid d_M(x,y) < \frac 1 2 \delta_x \right\}.$$

Since each point $$x$$ is contained in its own $$U_x$$, we find that the collection $$\{U_x \mid x \in M\}$$ is an open cover of $$M$$. Since $$M$$ is compact, this cover has a finite subcover $$\{U_{x_1}, U_{x_2}, \ldots, U_{x_n}\}$$ where $$x_1, x_2, \ldots, x_n \in M$$. Each of these open sets has an associated radius $$\delta_{x_i}/2$$. Let us now define $$\delta = \min_{1 \leq i \leq n} \delta_{x_i}/2$$, i.e. the minimum radius of these open sets. Since we have a finite number of positive radii, this minimum $$\delta$$ is well-defined and positive. We now show that this $$\delta$$ works for the definition of uniform continuity.

Suppose that $$d_M(x,y) < \delta$$ for any two $$x, y$$ in $$M$$. Since the sets $$U_{x_i}$$ form an open (sub)cover of our space $$M$$, we know that $$x$$ must lie within one of them, say $$U_{x_i}$$. Then we have that $$d_M(x, x_i) < \frac{1}{2}\delta_{x_i}$$. The triangle inequality then implies that


 * $$d_M(x_i, y) \leq d_M(x_i, x) + d_M(x, y) < \frac{1}{2} \delta_{x_i} + \delta \leq \delta_{x_i},$$

implying that $$x$$ and $$y$$ are both at most $$\delta_{x_i}$$ away from $$x_i$$. By definition of $$\delta_{x_i}$$, this implies that $$d_N(f(x_i),f(x))$$ and $$d_N(f(x_i), f(y))$$ are both less than $$\varepsilon/2$$. Applying the triangle inequality then yields the desired


 * $$d_N(f(x), f(y)) \leq d_N(f(x_i), f(x)) + d_N(f(x_i), f(y)) < \frac{\varepsilon}{2} + \frac{\varepsilon}{2} = \varepsilon.$$

For an alternative proof in the case of $$M = [a, b]$$, a closed interval, see the article Non-standard calculus.