# Heine–Cantor theorem

In mathematics, the Heine–Cantor theorem, named after Eduard Heine and Georg Cantor, states that if ${\displaystyle f\colon M\to N}$ is a continuous function between two metric spaces ${\displaystyle M}$ and ${\displaystyle N}$, and ${\displaystyle M}$ is compact, then ${\displaystyle 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 ${\displaystyle M}$ and ${\displaystyle N}$ are two metric spaces with metrics ${\displaystyle d_{M}}$ and ${\displaystyle d_{N}}$, respectively. Suppose further that a function ${\displaystyle f:M\to N}$ is continuous and ${\displaystyle M}$ is compact. We want to show that ${\displaystyle f}$ is uniformly continuous, that is, for every positive real number ${\displaystyle \varepsilon >0}$ there exists a positive real number ${\displaystyle \delta >0}$ such that for all points ${\displaystyle x,y}$ in the function domain ${\displaystyle M}$, ${\displaystyle d_{M}(x,y)<\delta }$ implies that ${\displaystyle d_{N}(f(x),f(y))<\varepsilon }$.

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

Let ${\displaystyle U_{x}}$ be the open ${\displaystyle \delta _{x}/2}$-neighborhood of ${\displaystyle x}$, i.e. the set

${\displaystyle U_{x}=\left\{y\mid d_{M}(x,y)<{\frac {1}{2}}\delta _{x}\right\}.}$

Since each point ${\displaystyle x}$ is contained in its own ${\displaystyle U_{x}}$, we find that the collection ${\displaystyle \{U_{x}\mid x\in M\}}$ is an open cover of ${\displaystyle M}$. Since ${\displaystyle M}$ is compact, this cover has a finite subcover ${\displaystyle \{U_{x_{1}},U_{x_{2}},\ldots ,U_{x_{n}}\}}$ where ${\displaystyle x_{1},x_{2},\ldots ,x_{n}\in M}$. Each of these open sets has an associated radius ${\displaystyle \delta _{x_{i}}/2}$. Let us now define ${\displaystyle \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 ${\displaystyle \delta }$ is well-defined and positive. We now show that this ${\displaystyle \delta }$ works for the definition of uniform continuity.

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

${\displaystyle 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 ${\displaystyle x}$ and ${\displaystyle y}$ are both at most ${\displaystyle \delta _{x_{i}}}$ away from ${\displaystyle x_{i}}$. By definition of ${\displaystyle \delta _{x_{i}}}$, this implies that ${\displaystyle d_{N}(f(x_{i}),f(x))}$ and ${\displaystyle d_{N}(f(x_{i}),f(y))}$ are both less than ${\displaystyle \varepsilon /2}$. Applying the triangle inequality then yields the desired

${\displaystyle 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 ${\displaystyle M=[a,b]}$, a closed interval, see the article Non-standard calculus.