# 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$.

• Basic real analysis should be a source of at least some intuition (which is misleading at times, granted). Can you think of some compact sets in $\mathbf R$? Are continuous functions on those sets uniformly continuous? Can you remember any theorems regarding those? Another idea is to start to try to prove the statement and see whether things start to fall apart. Feb 18, 2012 at 6:49
• Hint: Continuity tells you that for every $\epsilon\gt 0$ and every $x$, you can find a $\delta_x\gt 0$ such that $f(B(x,\delta_x))\subseteq B(f(x),\epsilon)$; for uniform continuity, you need a $\delta$ that does not depend on $x$. Now, if there were only finitely many values of $\delta_x$, then you could just pick the smallest one... Feb 18, 2012 at 7:19
• @ArturoMagidin Actually, just picking the smallest one is not good enough because then the two points might not lie in the same delta ball. Feb 18, 2012 at 8:12

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.

• The question being homework, isn't it better to give hints rather than a full answer? Feb 18, 2012 at 13:45
• Matt, I think you've missed another factor of 2. You have namely shown $y \in B(\delta_{x_i}, x_i)$, so that $d(x_{i},y) < \delta \implies d(f(x_{i}), f(y)) < \epsilon$, but you also need to show that $d(x,y) < \delta \implies d(f(x), f(y)) < \epsilon$. Mar 12, 2013 at 19:55
• @MattN., I think the original $\delta_{x_{i}}$ need to be chosen in such a way so as to satisfy the continuity condition for $\frac{\epsilon}{2}$ rather than $\epsilon$. Then you can use the triangle inequality in the final step after you've shown both x and y lie in the same ball. Mar 12, 2013 at 20:30
• @MattN.: Hmm, we chose $\delta_{x_{i}}$ in relation to a particular $x_{i}$, and the original condition is $d(x_{i},y)< \delta_{x_{i}} \implies d(f(x_{i}), f(y)) < \epsilon$. x, y in that ball are arbitrary and continuity of f at x would only imply we can find $\delta_{x}$, as well. But x is not one of the $x_{i}$ picked out by compactness, so $\delta$ doesn't necessarily relate to the $\delta_{x}$ needed. The one thing we do, however, know is that $d(x,y) \leq d(x, x_{i}) + d(x_{i}, y) < \epsilon + \epsilon = 2\epsilon$. Mar 12, 2013 at 23:41
• @RudytheReindeer Ryker is right, you are missing a factor of 2. You say in a comment that $\delta_{x_i}$ is such that $d(x,y)<\delta_{x_i}$ implies that $d(f(x),f(y))<\epsilon$. But that's not true. From continuity, $\delta_{x_i}$ is such that if both $x$ and $y$ are in the $B(\delta_{x_i},x_i)$, then $f(x)$ and $f(y)$ are both in the $B(\epsilon,f(x_i))$, which gives the distance between $f(x)$ and $f(y)$ at most $2\epsilon$, not $\epsilon$ .
– Theo
Mar 17, 2016 at 2:46

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$.

• at the third line, shouldn't it be $B(x, \frac{\delta_{x}}{2})$? Jun 25, 2016 at 15:32
• @GuerlandoOCs Do you mean when we find $\delta_{x} > 0$ so that $f(B(x, \delta_{x})) \subseteq B(f(x), \frac{\epsilon}{2})$? Jun 26, 2016 at 3:02
• yes thats it .. Jun 26, 2016 at 3:24
• @GuerlandoOCs It doesn't matter. The way the proof is written is correct. But you can also say "Let $\delta_{x} > 0$ be such that $f(B(x, \frac{\delta_{x}}{2})) \subseteq B(f(x), \frac{\epsilon}{2})$". It doesn't change the rest of the proof as it is written. I recommend you spend time thinking about this and drawing some pictures of the proof so you can see for yourself that it doesn't matter which one you say. :) Jun 26, 2016 at 3:34

$$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.

• You only prove there exist subsequences such that $d(f(a_{n_{k_l}}),f(b_{n_{k_l}}))\rightarrow 0$. But this doesn't guarantee $d(f(x_n),f(y_n))\rightarrow 0$ Aug 13, 2022 at 21:51
• @MathFail Thanks for the downvote! I proved that every subsequence of the sequence $d(f(x_n), f(y_n))$ has a further subsequence converging to $0$. This proves $d(f(x_n), f(y_n))$ itself converges to $0$. This is pretty elementary so I thought any reader would comprehend this. Aug 14, 2022 at 13:05
• Can you add this proof? Aug 14, 2022 at 15:04
• This is Cauchy continuity right? How is equivalence to uniform continuity established? Nov 12, 2022 at 3:59
• @Tavin The criterion I am using is stated in my first sentence. Nov 16, 2022 at 11:29

I offer a proof by contradiction.

Suppose $$f$$ is not uniformly continuous. Then for some $$\varepsilon > 0$$, there is a sequence of positive real $$\delta_n \to 0$$ with associated $$x_n \in X$$ such that

$$\forall n : f[B(x_n, \delta_n)] \nsubseteq B(f(x_n), \varepsilon). \tag{1}$$

$$X$$ is compact so $$x_n$$ contains a convergent subsequence $$x_m \to x \in X$$. By pointwise continuity, $$\exists \delta_x > 0$$ such that

$$f[B(x, \delta_x)] \subseteq B(f(x), \frac{1}{2} \varepsilon). \tag{2}$$

The convergence of $$x_m$$ implies $$x_{m \ge M} \in B(x, \frac{1}{2} \delta_x)$$ for some $$M < \infty$$. In such cases $$B(x_m, \frac{1}{2} \delta_x) \subseteq B(x, \delta_x)$$ and then using $$(2)$$,

\begin{align} y \in B(x_m, \frac{1}{2} \delta_x) & \implies d(f(x_m), f(y)) \le d(f(x_m), f(x)) + d(f(x), f(y)) < \frac{1}{2} \varepsilon + \frac{1}{2} \varepsilon \\ & \implies f(y) \in B(f(x_m), \varepsilon). \tag{3} \end{align}

For some finite $$m \ge M$$ it holds that $$\delta_m < \frac{1}{2} \delta_x$$ where $$\delta_m$$ is given by the original sequences $$\delta_n$$ and $$x_n$$. A contradiction with $$(1)$$ follows from $$(3)$$ and uniform continuity is proven.

$$\exists m : f[B(x_m, \delta_m)] \subseteq f[B(x_m, \frac{1}{2} \delta_x)] \subseteq B(f(x_m), \varepsilon) \tag{4}$$

• I believe your contradiction assumption is stronger than you may take - uniform continuity gives only for each $n$ the existence of one particular $y_n \in f(B(x_n,\delta_n))$ such that $y_n \not \in B(f(x),\dfrac{1}{2} \epsilon)$. (This does match up with your contradiction: (3) is $f(B(x_m,\delta_m) \subseteq B(f(x_m),\epsilon)$, so $y_m \in B(f(x_m,\epsilon))$.) Sep 9, 2023 at 13:42
• Thanks @George. Sep 14, 2023 at 21:03