Show that a function $f:\mathbb{R} \rightarrow \mathbb{R}$ that is continuous on a compact set $K$ is uniformly continuous on $K$.
Is the proof below correct?
Proof:
Let $\epsilon > 0$ and let $x \in K$. Because $f$ is continuous on $K$ there exists a $\delta(x)$ such that whenever $|y - x| < \delta(x)$ it follows that $|f(y) - f(x)| < \epsilon / 3$. Now consider the collection of sets,
$$\mathcal{C}_K = \{ V_{\delta(x)}(x) : x \in K \} $$
where $V_{\delta(x)}(x)$ is the open neighborhood $(x - \delta(x), x + \delta(x))$. The collection $\mathcal{C}_k$ form an open cover of $K$ and because we are given that $K$ is compact there exists a finite subcover of $K$:
$$\mathcal{C}'_K = \{ V_{\delta(x_n)}(x_n) : n \in \{1, 2, \ldots, N\}\}$$
Before we can find a suitable choice of $\delta$ for the given $\epsilon$ it might be that $K$ is disconnected which can lead to a situation in which there exist $x, y \in K$ such that there exists no open interval contained entirely within $K$ which also contains $x$ and $y$. This will allow the possibility that $x$ and $y$ can be arbitrarily close to each other and yet also allow $|f(x) - f(y)|$ to be larger than our desired maximum value of $\epsilon$. To prevent this situation from occurring define,
$$ D = \{ |x_m - x_n| - \delta(x_m) - \delta(x_n) : \forall m, n \in \{1, 2, \ldots, N \} \mathrm{\ such\ that\ } |x_m - x_n| > \delta(x_m) + \delta(x_n) \} $$
Now take,
$$ \delta_{\epsilon} = \min \{ \{ \delta(x_n) : n \in \{1, \ldots, N \}\} \cup D \}$$
Now whenever $|x - y| < \delta_\epsilon$ it must be that $x \in V_{\delta(x_n)}$ and $y \in V_{\delta(x_m)}$ for some $m, n \in \{1, \ldots, N\}$ and there must exist a $l \in \{1, \ldots, N\}$ such that,
$$ A = V_{\delta(x_n)}(x_n) \cap V_{\delta(x_l)}(x_l) \neq \emptyset$$
and,
$$ B = V_{\delta(x_m)}(x_m) \cap V_{\delta(x_l)}(x_l) \neq \emptyset$$
Let $a$ be a point in $A$ and $b$ be a point in $B$. Then it follows from the way that we have constructed the open cover $\mathcal{C}'_K$ that,
$$ \begin{align} |f(x) - f(y)| &= |f(x) - f(a) + f(a) - f(b) + f(b) - f(y)| \\ &\leq |f(x) - f(a)| + |f(a) - f(b)| + |f(b) - f(y)| \\ &< \epsilon / 3 + \epsilon / 3 + \epsilon / 3 \\ &< \epsilon \end{align} $$
Since $\delta_\epsilon$ is independent of $x$ and $y$ we can conclude that $f$ is uniformly continuous on $K$.