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:

$$ $$ $$

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.