A continuous function $f$ from a closed bounded interval $[a, b]$ into $\mathbb{R}$ is uniformly continuous I am reading (as a supplement) the book Basic Real Analysis, by Anthony Knapp. Before I proceed into reading a proof, I want to be sure that the result seems obvious. Yet, I am having trouble seeing through this one. It annoys me too much in order to disregard it:
Theorem.
A continuous function $f$ from a closed bounded interval $[a, b]$ into $\mathbb{R}$ is uniformly continuous.
What gives? Why can't we provide the counterexample $f(x)=x^2$ and $[a,b] \subset [1,+\infty)$, for $b < +\infty$ sufficiently large and show that the theorem is incorrect? 
Doesn't it seem to be an insufficient statement? 
I'm having trouble picturing it, is all.
Hints are fine.
 A: In this case, intuitively, no matter how large the interval is, as long as it is closed and bounded, the function is still controlled. This is a special case of a more general result: a continuous function on a compact metric space is uniformly continuous, and we know that a subset of Euclidean space is compact if and only if it is closed and bounded.
A: I can provide you with a proof. We use the lemma that $[a,b]$ is compact. The general statement is that if $f:X\to Y$ is continuous and $X$ is a compact metric space, then i$f$ is uniformly continuous. This is usually known as the Heine Cantor theorem, while the fact that $[a,b]$is compact might be found as Borel's Lemma, if memory serves. So
THEOREM (Spivak) Let $f:[a,b]\to \Bbb R$ be continuous. Then it is uniformly continuous.
We first prove the 
LEMMA Let $f$ be a continuous function defined on $[a,c]$. If, given $\epsilon >0$, there exists $\delta_1>0$ such that, for each pair $$x,y\in[a,b]\text{ ; } |x-y|<\delta_1 \implies |f(x)-f(y)|<\epsilon$$  and $\delta_2>0$ such that for each
$$x,y\in[b,c]\text{ ; } |x-y|<\delta_2 \implies |f(x)-f(y)|<\epsilon$$
Then there exists $\delta $ such that for each 
$$x,y\in[a,c]\text{ ; } |x-y|<\delta  \implies |f(x)-f(y)|<\epsilon$$
P
Since $f$ is continuous at $x=b$, there exists a $\delta_3$ such that for every $x$ with $|b-x|<\delta_3$, we have $|f(b)-f(x)|<\frac{\epsilon}2$.
Thus, whenever $|x-b|<\delta_3$ and $|y-b|<\delta_3$ we will certainly have $$|f(x)-f(y)|<\epsilon$$ 
We take $\delta=\min\{\delta_1,\delta_2,\delta_3\}$. Then $\delta$ works: indeed, consider any pair $x,y\in[a,c]$. If $x,y\in[a,b]$ or $x,y\in[b,c]$, we're done. If $x<b<y$ or $y<b<x$. In any case, since $|x-y|<\delta$, we must have $|x-b|,|y-b|<\delta$, so that $|f(x)-f(y)|<\epsilon$, as claimed.
PROOF1 Fix $\epsilon >0$. Let's agree to call $f$ $\epsilon$-good on an interval $[a,b]$ if for this $\epsilon$ there exists a $\delta$ such that for any $x,y\in[a,b]$, $|x-y|<\delta\implies |f(x)-f(y)|<\epsilon$. We thus want to prove that $f$ is $\epsilon$-good on $[a,b]$ for any $\epsilon >0$. Let $\epsilon >0$ be given, and consider the set $$A(\epsilon)=\{x\in[a,b]:f \text{ is } \epsilon \text{-good on}: [a,x]\}$$ Then $A\neq \varnothing$ for $a\in A(\epsilon)$, and $A(\epsilon)$ is bounded above by $b$. Thus $\sup A=\alpha $ exists. Suppose that $\alpha <b$. Since $f$ is continuous at $\alpha$ there exists a $\delta'$ such that $|y-\alpha|<\delta'$ implies $|f(y)-f(\alpha)|<\epsilon/2$. Thus, if $|y-\alpha|,|x-\alpha|<\delta'$, we'll have  $|f(y)-f(x)|<\epsilon$. Thus $f$ is $\epsilon$-good on $[\alpha-\delta,\alpha+\delta]$. Since $\alpha=\sup A(\epsilon)$, it is clear $f$ is $\epsilon$-good on $[a,\alpha+\delta]$, which is absurd. Thus $\alpha\geq b$, which means $\alpha =b$. It suffices to show that $b$ is also an element of $A(\epsilon)$. But since $f$ is continuous on $b$, there exists a $\delta_0$ such that $|b-y|<\delta_0$ implies $|f(b)-f(y)|<\epsilon/2$. Thus, $f$ is $\epsilon$-good on $[b-\delta_0,b]$. The lemma implies $f$ is $\epsilon$-good on $[a,b]$. Since $\epsilon$ was arbitrary, the result follows. $\blacktriangle$ 

PROOF2 Let $\epsilon >0$ be given. Assign, to each $x\in [a,b]$ a $\delta_x>0$ such that for each $y\in(x-2\delta_x,x+2\delta_x)$, we have $|f(x)-f(y)|< \epsilon/2$, to obtain a open cover of $[a,b]$, namely the set $\mathcal O$ of intervals $(x-\delta_x,x+\delta_x)$. This is possible since $f$ is continuous at each $x$. Since $[a,b]$ is compact, there is a finite number of $x_i\in [a,b]$ such that $$\bigcup_{i=1}^n (x_i-\delta_{x_i},x_i+\delta_{x_i})\supset [a,b]$$
Choose now $\delta =\min{\delta_{x_i}}$, and let $x,y\in [a,b]$ with $ |y-x|<\delta$. Since $\mathcal O$ is a cover, for some $x_i$ we have that $|x-x_i|<\delta_{x_i}$. Then, we'll have $$|y-x_i|\leq |y-x|+|x-x_i|<\delta+\delta_i\leq 2\delta_i$$ It follows that $$|f(x_i)-f(x)|<\epsilon/2$$
$$|f(y)-f(x)|<\epsilon/2$$
which means by the triangle inequality that $$|f(x)-f(y)|<\epsilon$$
Then for any $x,y\in[a,b]$,  $|x-y|<\delta$ will imply $|f(x)-f(y)|<\epsilon$; and $f$ is uniformly continuous. $\blacktriangle$ 

There is yet another way of proving this. 
LEMMA (Mendelson) Let $X$ be a metric space such that every infinite subset of $X$ has an accumulation point in $X$. Then for each covering $\mathcal O=\{O_\beta\}_{\beta\in I}$ there exists a positive $\epsilon$ such that each ball $B(x;\epsilon)$ is contained in an element $O_\beta$ of this covering. 
PROOF  If it wasn't the case, we'd obtain for each $n$ an point $x_n$ and an open ball $B(x_n;1/n)\not\subseteq O_\beta$ for each $\beta \in I$. Let $A=\{x_1,\dots\}$. If $A$ is finite, $x_n=x$ infinitely often for some $x\in X$. Since $\mathcal O$ is a cover, $x\in O_\alpha$ for some $\alpha$. Since the cover is open, there is a $\delta >0$ for which $B(x;\delta)\subseteq O_\alpha$. We can take $n$ such that $1/n<\delta$ and $x_n=x$, in whichcase we get a contradiction $$B\left(x;\frac 1n \right)\subseteq B\left(x;\delta\right)\subseteq O_\alpha$$ If $A$ is infinite, there is an accumulation point $x\in X$. Thus $x\in O_\beta$ for some index, and there are infinitely many points of $A$ in $B(x:\delta /2)\subseteq O_\beta$. We can take $n$ such that $1/n<\delta /2$ and we'd have $B(x_n;1/n)\subseteq B(x;\delta)\subseteq O_\beta$, a contradiction. 
After having proven that for metric spaces, the existence of accumulation points for infinite subsets is equivalent to compactness. 
PROOF3 Let $f:X\to Y$ be a continuous function from a compactum $X$ to a metric space $Y$. Then $f$ is uniformly continuous.
PROOF Given $\epsilon >0$, for each $x\in X$ there is a $\delta_x>0$ such that if $y\in B(x:\delta_x)$, $f(y)\in B\left(f(x);\epsilon /2\right)$. These balls are an open cover for $X$, thus there exists such a number $\delta_L$ as in the previous lemma (usually called a Lebesgue number). Choose $\delta$ to be positive yet smaller than $\delta_L$. If $z,z'\in X$ and $d(z,z')<\delta$ (so that $z,z'$ are in a ball of radius less than $\delta$), we have $z,z'\in B(x,\delta_x)$ for some $x\in X$. In that case $f(z),f(z')\in B(f(x),\epsilon/2)$ so $d'(f(z),f(z'))<\epsilon$ by the triangle inequality. $\blacktriangle$.
