Heine-Cantor Theorem

Theorem
Let $$M_1$$ and $$M_2$$ be metric spaces.

Let $$f: M_1 \to M_2$$ be a continuous mapping.

If $$M_1$$ is compact, then $$f$$ is uniformly continuous on $$M_1$$.

Proof
Let $$M_1 = \left({A_1, d_1}\right)$$ and $$M_2 = \left({A_2, d_2}\right)$$ be metric spaces such that $$M_1$$ is compact.

Let $$f: M_1 \to M_2$$ be continuous.

Let $$\epsilon > 0$$.

Then $$\forall x \in M_1: \exists \delta \left({x}\right) > 0: \forall y \in M_1: d_1 \left({x, y}\right) < 2 \delta \left({x}\right) \Longrightarrow d_2 \left({f \left({x}\right), f \left({y}\right)}\right) < \frac \epsilon 2$$.

The set $$\left\{{N_{\delta \left({x}\right)} \left({x}\right): x \in M_1}\right\}$$ is an open cover for $$M_1$$.

As $$M_1$$ is compact, there is a finite subcover $$\left\{{N_{\delta \left({x_1}\right)} \left({x_1}\right), N_{\delta \left({x_2}\right)} \left({x_2}\right), \ldots, N_{\delta \left({x_r}\right)} \left({x_r}\right)}\right\}$$.

Now let $$\delta = \min \left\{{\delta \left({x_1}\right), \delta \left({x_2}\right), \ldots, \delta \left({x_r}\right)}\right\}$$.

Consider any $$x, y \in M_1$$ which satisfy $$d_1 \left({x, y}\right) < \delta$$.

There is some $$i \in \left\{{1, 2, \ldots, r}\right\}$$ such that $$d_1 \left({x, x_i}\right) < \delta \left({x_i}\right)$$.

$$ $$ $$

Thus:
 * From $$d_1 \left({x, x_i}\right) < \delta \left({x_i}\right)$$ we have $$d_2 \left({f \left({x}\right), f \left({x_1}\right)}\right) \le \frac \epsilon 2$$;
 * From $$d_1 \left({y, x_i}\right) \le 2 \delta$$ we have $$d_2 \left({f \left({y}\right), f \left({x_1}\right)}\right) \le \frac \epsilon 2$$.

So:

$$ $$ $$

Alternate proof
We can also prove the theorem using the notion of sequential compactness. To do so, take $$M_{1}$$ and $$M_{2}$$ as before, but assume $$M_{1}$$ is sequentially compact. If $$f:A_{1} \rightarrow A_{2}$$ is continuous but not uniformly continuous, then for some $$\epsilon > 0$$ and each number $$\frac{1}{n}$$, we can select points $$x_{n}, y_{n} \in A_{1}$$ such that $$ d_{1}(x_{n}, y_{n}) < \frac{1}{n}$$ but $$d_{2}(f(x_{n}), f(y_{n})) \geq \epsilon.$$ Since $$A_{1}$$ is sequentially compact, some subsequence $$x_{\phi(n)}$$ of $$x_{n}$$ converges to a point x; and since $$d_{1}(y_{\phi(n)}, x) \leq d_{1}(y_{\phi(n)}, x_{\phi(n)}) + d_{1}(x_{\phi(n)}, x) \rightarrow 0$$, we see that $$y_{\phi(n)}$$ converges to x as well. Since continuous functions send convergent sequences to convergent sequences, both $$f(x_{\phi(n)})$$ and $$f(y_{\phi(n)})$$ both converge to $$f(x)$$, hence they must grow arbitrarily close to each other. But this contradicts the fact that we chose $$x_{n}$$ and $$y_{n}$$ to always be at least $$\epsilon$$ apart.

Note
If a mapping is uniformly continuous it is not necessarily compact.

For example, the identity mapping is (trivially) uniformly continuous on a mapping from any metric space, whether compact or not.