Problem: Let $f : [a,b] \to \mathbb{R} $ be a continuous function. Show that $f$ is uniformly continuous. In general, if $f: K \subset \mathbb{R} ^n \to \mathbb{R} $ is continuous for $K$ being compact, then show that $f$ is uniformly continuous.
Solution: Let us prove the general statement, that is, given any compact set $K$, if $f: K \to \mathbb{R} $ is continuous, then $f$ is uniformly continuous. Let $\varepsilon >0$ be given and take $x, y \in K$. Let $B(x,r)$ denotes the open ball of radius $r$ centered at $x$. Since $f$ is continuous, so for $\varepsilon > 0$ and for any $y \in K$, there exists $\delta_y > 0$ such that $x \in B\left( y, \delta _y \right) $ implies $f(x) \in B\left( f(y), \varepsilon \right) $. Consider the open cover of $K$
\[
\mathcal{C} = \left\{ B\left( y,\delta _y \right): y\in K \right\}.
\]
As $K$ is a compact set, $\mathcal{C} $ must admit a finite subcover, say,
\[
\left\{ B\left( y_i, \delta _{i} \right): i = 1,2,\dots, n \right\}.
\]
Now choose $\delta = \max \left\{ \delta _i : i = 1,2,\dots,n \right\} $. Now we have
\[
x \in B\left( y,\delta \right) \implies f(x) \in B\left( f(x), \varepsilon \right).
\]
Thus, $f$ is uniformly continuous on $K$.