No direct proofs of “if $f: (X, d_X) \to (Y, d_Y)$ is continuous and $X$ is compact then $f$ is uniformly continuous.”

I am studying the theorem "if $f:(X,d_X)\to (Y,d_Y)$ is continuous and $X$ is compact, then $f$ is uniformly continuous." I am not looking for a proof, but I have an argument against any attempt at a direct proof (which was my original attempt at proving this statement).

Why a direct proof fails: Since $X$ is open, for each $x\in X$ there is a $\delta_x$ such that the open ball $B(x,\delta_x)$ is contained in $X$. Hence, I can write $X=\bigcup_{x\in X}B(x,\delta_x)$. Moreover, since once we are given a particular $\delta_x$ any smaller radii will suffice, I can cover $X$ in such a way that $\inf\lbrace \delta_x:x\in X\rbrace=0$ by choosing arbitrarily small balls. If given $\varepsilon>0$ how can I ever expect to find a $\delta>0$ such that $$d_X(x,y)<\delta\Rightarrow d_Y(f(x),f(y))<\varepsilon\,\,\,\,\forall x,y\in X$$ if the balls on which $f$ is continuous can be of arbitrarily small radii?

• If $X$ has only finitely many elements, then it's not true that you can achieve $\inf\{\delta_x : x \in X\} = 0$. Compact sets are in some sense "almost finite" because you can reduce an infinite cover (where the inf might be zero) to a finite one (where it cannot be). – Bungo Sep 5 '14 at 4:17
• First of all, $X$ cannot be open because it is compact. – Jango Dec 28 '17 at 0:28

Let $\epsilon > 0$ be given. Since $f$ is continuous, for each $x \in X$ there is $\delta_x$ such that $d_X(x,y) < \delta$ implies $d_Y(f(x),f(y)) < \epsilon/3$. The balls $B(x,\delta_x/2)$ cover $X$, therefore so does some finite subcover $\{B(x_i,\delta_{x_i}/2): i=1\ldots n\}$. Take $\delta = \min(\delta_{x_i}/2: i=1\ldots n)$. Suppose $d(x,y) < \delta$. There is some $i$ such that $d(x, x_i) < \delta_{x_i}/2$, and $d(y,x_i) \le d(y,x) + d(x,x_i) < \delta_{x_i}$. Therefore $d(f(x),f(y)) \le d(f(x),f(x_i)) + d(f(y),f(x_i)) < \epsilon$.