# Continuous function on a compact metric space is uniformly continuous

I am struggling with this question:

Prove or give a counterexample: If $f$ is a continuous function on a compact subset $Y$ of a metric space $X$, then $f$ is uniformly continuous on $Y$.

-
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. –  Dylan Moreland Feb 18 '12 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... –  Arturo Magidin Feb 18 '12 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. –  Rudy the Reindeer Feb 18 '12 at 8:12
@thecode: Do you know how to accept answers? –  Rudy the Reindeer Feb 19 '12 at 10:03

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, f(x))$. The balls $\{B(\delta_x, x)\}_{x \in X}$ form an open cover of $X$. So do the balls $\{B(\frac{\delta_x}{2}, x)\}_{x \in X}$. Since $X$ is compact you can find a finite subcover $\{B(\frac{\delta_{x_i}}{2}, x_i)\}_{i=1}^n$. (You will see in a second why we are choosing the radii to be half only.)

Now 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(\frac{\delta_{x_i}}{2}, 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? –  wildildildlife Feb 18 '12 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$. –  Ryker Mar 12 '13 at 19:55
@Ryker The $\delta$ was constructed such that $x,y$ with $d(x,y) < \delta$ are in the same ball $B(\delta_{x_i}, x_i)$. It follows that $d(x,y) < \delta_{x_i}$. But $\delta_{x_i}$ is such that $d(x,y) < \delta_{x_i}$ implies $d(f(x), f(y)) < \varepsilon$. I cannot find where I am missing the factor of $2$, perhaps you could point out where? –  Rudy the Reindeer Mar 12 '13 at 20:12
@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. –  Ryker Mar 12 '13 at 20:30
@Ryker But we want to show $d(f(x),f(y)) < \varepsilon$ and if we chose $\delta$ to be half of the min $\delta_{x_i}$ then $x$ and $y$ are everywhere no further apart than $\delta_{x_i}$ if $d(x,y) < \delta$ from which $d(f(x),f(y)) < \varepsilon$ follows. –  Rudy the Reindeer Mar 12 '13 at 20:52