Continuous mapping on a compact metric space is uniformly continuous

I am struggling with this question:

Prove or give a counterexample: If $f : X \to Y$ is a continuous mapping from a compact metric space $X$, then $f$ is uniformly continuous on $X$.

Thanks for your help in advance.


The answer is yes, if $f$ is continuous on a compact space then it is uniformly continuous:

Let $f: X \to Y$ be continuous, let $\varepsilon > 0$ and let $X$ be a compact metric space. Because $f$ is continuous, for every $x$ in $X$ you can find a $\delta_x$ such that $f(B(\delta_x, x)) \subset B({\varepsilon\over 2}, f(x))$. The balls $\{B(\delta_x, x)\}_{x \in X}$ form an open cover of $X$. So do the balls $\left\{B \left(\frac{\delta_x}{2}, x\right)\right\}_{x \in X}$. Since $X$ is compact you can find a finite subcover $\left\{B \left( \frac{\delta_{x_i}}{2}, x_i \right) \right\}_{i=1}^n$. (You will see in a second why we are choosing the radii to be half only.)

Now let $\delta_{x_i}' = {\delta_{x_i}\over 2}$.

You want to choose a distance $\delta$ such that for any two $x,y$ they lie in the same $B(\delta_{x_i}', x_i)$ if their distance is less than $\delta$.

How do you do that?

Note that now that you have finitely many $\delta_{x_i}'$ you can take the minimum over all of them: $\min_i \delta_{x_i}'$. Consider two points $x$ and $y$. Surely $x$ lies in one of the $B(\delta_{x_i}', x_i) $ since they cover the whole space and hence $x$ also lies in $B(\delta_{x_i}', x_i)$ for some $i$.

Now we want $y$ to also lie in $B(\delta_{x_i}', x_i)$. And this is where it comes in handy that we chose a subcover with radii divided by two:

If you pick $\delta : = \min_i \delta_{x_i}'$ (i.e. $\delta = \frac{\delta_{x_i}}{2}$ for some $i$) then $y$ will also lie in $B(\delta_{x_i}, x_i)$:

$d(x_i, y) \leq d(x_i, x) + d(x,y) < \frac{\delta_{x_i}}{2} + \min_k \delta_{x_k} \leq \frac{\delta_{x_i}}{2} + \frac{\delta_{x_i}}{2} = \delta_{x_i}$.

Hope this helps.


Let $(X, d)$ be a compact metric space, and $(Y, \rho)$ be a metric space. Suppose $f : X \to Y$ is continuous. We want to show that it is uniformly continuous.

Let $\epsilon > 0$. We want to find $\delta > 0$ such that $d(x,y) < \delta \implies \rho(f(x), f(y))< \epsilon$.

Ok, well since $f$ is continuous at each $x \in X$, then there is some $\delta_{x} > 0$ so that $f(B(x, \delta_{x})) \subseteq B(f(x), \frac{\epsilon}{2})$.

Now, $\{B(x, \frac{\delta_{x}}{2})\}_{x \in X}$ is an open cover of $X$, so there is a finite subcover $\{B(x_{i}, \frac{\delta_{x_{i}}}{2})\}_{i =1}^{n}$.

If we take $\delta := \min_{i} (\frac{\delta_{x_{i}}}{2})$, then we claim $d(x,y) < \delta \implies \rho(f(x), f(y)) < \epsilon$. Why?

Well, suppose $d(x,y) < \delta$. Since $x \in B(x_{i}, \frac{\delta_{x_{i}}}{2})$ for some $i$, we get $y \in B(x_{i}, \delta_{x_{i}})$. Why? $d(y, x_{i}) \leq d(y,x) + d(x,x_{i}) < \frac{\delta_{x_{i}}}{2} + \frac{\delta_{x_{i}}}{2} = \delta_{x_{i}}$.

Ok, finally, if $d(x,y) < \delta$, then we claim $\rho(f(x), f(y)) < \epsilon$. This is because $\rho(f(x), f(y)) \leq \rho(f(x), f(x_{i})) + \rho(f(x_{i}), f(y)) < \frac{\epsilon}{2} + \frac{\epsilon}{2} = \epsilon$.


$f:X\rightarrow Y$ is uniformly continuous iff for every pair of sequences $(x_n),(y_n)$ in $X$ satisfying $d(x_n,y_n)\rightarrow 0$ we have $d(f(x_n),f(y_n))\rightarrow 0$. Now let $(a_n)$ be any subsequence of $(x_n)$ and $(b_n)$ be that of $(y_n)$. X being compact, $(a_n)$ has a convergent subsequence $(a_{n_k})$ and $(b_{n_k})$ has a convergent subsequence $(b_{n_{k_l}})$. But since $d(x_n,y_n)\rightarrow 0$ the limits must be the same, say, $l$. And since $f$ is continuous, $f(a_{n_{k_l}})\rightarrow f(l)$ and $f(b_{n_{k_l}})\rightarrow f(l)$. Hence, $d(f(a_{n_{k_l}}),f(b_{n_{k_l}}))\rightarrow 0$. So that every subsequence of $d(f(x_n),f(y_n))$ has a further subsequence converging to $0$. This proves $f$ to be uniformly continuous.