Proof writing: Let $f:[a,b]\to \Bbb{R}$ be continuous. Then $f$ is uniformly continuous I'm currently practicing how to approach problems in my own without mimicking solutions in textbooks. So, the problem I am solving is this: Let $f:[a,b]\to \Bbb{R}$ be continuous. Then $f$ is uniformly continuous
Here is what I have done:
Let $x_0\in[a,b]$ be arbitrary, such that for every $\{x_n\}\subset [a,b],\;\;x_n\to x_0$ as $n\to\infty.$ By the continuity of $f$ at $x_0$, $f(x_n)\to f(x_0)$ as $n\to\infty$ for some $f(x_0)\in \Bbb{R}$. Since $[a,b]$ is compact, i.e., closed and bounded, then for any $\{x_n\},\{y_n\}\subset [a,b]$ with $x_n\to x_0$ and $y_n\to x_0$ as $n\to\infty,$ we must have $f(x_n)\to f(x_0)$ and $f(y_n)\to f(x_0)$ as $n\to\infty$. So, let $\epsilon>0$ be given, then $\exists\;\delta=\delta(x_0,\epsilon)>0$ s.t. $|x_n-x_0|<\delta/2$ and $|y_n-x_0|<\delta/2 \implies|f(x_n)-f(x_0)|<\epsilon/2$ and $|f(y_n)-f(x_0)|<\epsilon/2$. 
Now, $|x_n-y_n|=|x_n-x_0+x_0-y_n|\leq |x_n-x_0|+|y_n-x_0|<\delta/2+<\delta/2=\delta$.
Remark: This new $\delta$ only depends on $\epsilon.$ 
Thus, for every $\{x_n\},\{y_n\}\subset [a,b]$ with $|x_n-y_n|<\delta$, we have
$$|f(x_n)-f(y_n)|=|f(x_n)-f(x_0)+f(x_0)-f(y_n)|$$
$$\leq|f(x_n)-f(x_0)|+|f(y_n)-f(x_0)|$$
$$<\epsilon/2+\epsilon/2=\epsilon$$
Hence, for any $\epsilon>0,\;\exists\;\delta=\delta(\epsilon)$ such that, for every $\{x_n\},\{y_n\}\subset [a,b]$ with $|x_n-y_n|<\delta$, we have $|f(x_n)-f(y_n)|<\epsilon$. So, $f$ is uniformly continuous.
So, can anyone help me debug this? What are my errors? Any better way of going about this? Kindly provide what I should have incorporated instead, if I was wrong!
 A: It has several errors:


*

*You wrote “such that for every $\{x_n\}\subset [a,b],\;\;x_n\to x_0$ as $n\to\infty.$” What this means is that every sequence of elements of $[a,b]$ converges to $x_0$. This is impossible.

*You wrote “Since $[a,b]$ is compact, i.e., closed and bounded, then for any $\{x_n\},\{y_n\}\subset [a,b]$ with $x_n\to x_0$ and $y_n\to x_0$ as $n\to\infty,$ we must have $f(x_n)\to f(x_0)$ and $f(y_n)\to f(x_0)$ as $n\to\infty$.” Actually, the fact that $[a,b]$ is compact is irrelevant here. The only thing that matters is that $f$ is continuous.

*The $\delta$ that you chose depends on $x_0$ too, obviously.

A: The errors of the proposed proof (the choice of sequences $(x_n), (y_n)$ doesn't capture the premise of the sequential criterion for uniform-continuity (i.e. two arbitrary sequences which satisfy $\lim\limits_{n\to\infty} x_n - y_n = 0$)) has been analysed by another answer (which I upvoted), so I'll focus on the last prompt.

Any better way of going about this?

The compactness of $[a,b]$, which you mention in your proposed proof, is a good way to condense the proof.  This proof is classic and you can find it in many real analysis textbooks (e.g. in Royden's book).


*

*Use the continuity of $f$ to get an open cover $\{I_x\}_{x \in [a,b]}$ for $[a,b]$ so that $I_x = (x-\delta_x/2,x+\delta_x/2)$, where $\delta_x$ responds to the $\epsilon > 0$ challenge. (i.e. $\forall x \in [a,b] \forall \epsilon > 0 \exists \delta_x > 0\forall x' \in [a,b]: (|x'-x|<\delta_x \implies |f(x')-f(x)| < \epsilon$)

*Use Heine-Borel Theorem to obtain a finite subcover $\{I_{x_k}\}_{k\in\{1,\dots,n\}}$ of $\{I_x\}_{x \in [a,b]}$.

*Claim that $\delta = \frac12\min\limits_{k \in \{1,\dots,n\}} \delta_{x_k}$ responds to the $2\epsilon$ challenge.


*

*Given $|x'-x| < \delta$.  $x \in I_{x_k}$ for some $k$, so $|x-x_k|<\delta_{x_k}/2$ and $|f(x)-f(x_k)| < \epsilon$

*It remains to show that $|f(x')-f(x_k)| < \epsilon$.  Similarly, a sufficient condition is $|x'-x_k| < \delta_{x_k}$.  To prove this, note that $|x'-x_k| \le |x'-x|+|x-x_k|<\delta+\delta_{x_k}/2 \le \delta_{x_k}$.


