Proof that if $f(x)$ is continuous on $[a,b]$ it is uniformly continuous on $[a,b]$ My textbook gave a proof by contradiction of the following theorem:
Theorem: If $f(x)$ is a real-valued function that is continuous on $[a,b]$ then it is uniformly continuous on $[a,b]$
The proof by contradiction seemed overly complex and indirect. Was wondering if the following direct proof is valid.
Direct proof of Theorem
Since $f(x)$ is continuous on $[a,b]$ then for any $\epsilon > 0$ and $y,x \in [a,b],\; \exists \delta_x(\epsilon)>0 $ such that $|y-x|<\delta_x(\epsilon) \implies |f(y)-f(x)|< \epsilon$.
Letting $\delta(\epsilon) := \min_{x \in [a,b]} \delta_x(\epsilon)$ Then for each $\epsilon > 0$ and $x,y \in [a,b]$, we have $|x-y|<\delta(\epsilon) \leq \delta_x(\epsilon) \implies |f(x)-f(y)|< \epsilon\;\square$
This seems pretty direct to me and was wondering if I am missing something in this proof.
EDIT: As the great answers and comments have shown, my mistake/challenge is due to the ill-defined $\delta_x(\epsilon)$ function. I was assuming there was some (undefined) process that would select a finite positive number for each $\delta_x(\epsilon)$, but I did not specify it. I also rely on the continuity of $\delta_x(\epsilon)$ and that is not assured or proved.
 A: The problem is in the argument that $\delta(\epsilon)$ exists because the minimum exists. Here, you are using a theorem that says that a minimum of a continuous function over a compact set always exists.
However, you don't have any reason to believe that the function $x\mapsto \delta_x(\epsilon)$ is continuous, so the argument is incorrect.
A: There are numerous problems with this approach:

*

*You are defining a function $\delta$ which depends on $x$ and $\varepsilon$—in your notation, $\delta_x(\varepsilon)$.  However, it is not clear that this function is well-defined.  For example, if $f(x) = C$ is a constant function on $[a,b]$, then it is possible to take $\delta_x(\varepsilon)$ to be any positive value you like for any $x \in [a,b]$.  You are going to have similar problems for any assignment of $\delta_x(\varepsilon)$:  if $\delta$ gets the job done for some particular choice of $x$ and $\varepsilon$, then $\delta/2$ will also get the job done.
How do you choose $\delta_x(\varepsilon)$?


*You are attempting to invoke a version of the Extreme Value Theorem, which states

If $g : [a,b] \to \mathbb{R}$ is continuous, then there are $c, d \in [a,b]$ such that
$$ g(c) \le g(x) \le g(d)$$
for all $x \in [a,b]$.

That is, continuous functions on closed, bounded (i.e. compact) domains attain their extreme values.  But, as noted above, you have no control over the choice $\delta_x(\varepsilon)$, which means that you have no control on whether or not $\delta_x(\varepsilon)$ is a continuous function of $x$.
For a rather extreme example, suppose that $f : [a,b] \to \mathbb{R} : x\mapsto C$ is constant function.  Then for any $\varepsilon > 0$, any $\delta > 0$, and any $x\in [a,b]$, it will follow that if $y\in [a,b]$, then
$$ |x-y| < \delta \implies |f(x) - f(y)| = 0 < \varepsilon. $$
So, for example, I could define
$$ \delta_x(\varepsilon) = \begin{cases}
\dfrac{1}{p} & \text{if $x = \frac{p}{q} \in \mathbb{Q} \cap [a,b]$ and $\gcd(p,q)=1$, and} \\[1ex]
1 & \text{if $x \not\in\mathbb{Q} \cap [a,b]$.}
\end{cases} $$
(If $0 \in [a,b]$, adopt some convention regarding the assignment of $\delta_0(\varepsilon)$).  This function does not attain a minimum on the interval $[a,b]$.
How do you know that it is possible to choose $\delta_x(\varepsilon)$ so that it is a continuous function of $x$?
