Use the Bolzano-Weierstrass Theorem to prove the following Use the Bolzano-Weierstrass Theorem which is Every bounded sequence has a convergent subsequence to prove the following:
A continuous function deﬁned on a closed, bounded interval must be bounded. That is, let $f$ be a continuous function deﬁned on $[a,b]$. Then there exists a positive real number $B$ such that $|f(x)|≤ B$ for all $x ∈ [a,b]$.
could you please help me how can I prove it?
 A: The prototypical proof is a proof by contradiction.  We assume that $f$ is continuous and unbounded on $[a,b]$.
Then, for any $n$ there exists a number $x_n\in [a,b]$ such that $f(x_n)>n$.
Since $x_n$ is bounded, there exists a subsequence, say $x_{n_k}$ that converges to a number $x_0\in [a,b]$.
Inasmuch as $f$ is continuous on $[a,b]$, it is continuous at $x_0$ and hence $f(x_{n_k})\to f(x_0)$.
This means that $f(x_{n_k})$ is bounded which contradicts the statement that $f(x_{n_k})>n_k$.
Therefore, $f$ is bounded on $[a,b]$. 
A: Let $M=\sup f([a,b])$ ($M$ can eventually be $\infty$), we will show that this $M$ is reached for a certain $x\in[a,b]$ thus $M$ will be finite. 
By definitions of $M$, $\exists (x_n)_{n\in\mathbb{N}}\in[a,b]$ such that $f(x_n)\rightarrow M$.
$x_n$ is bounded so we can apply Bolzano-Weierstrass theorem, let $x_{\phi(n)}\rightarrow d\in [a,b]$, where $(x_{\phi(n)})_{n\in\mathbb{N}}$ is a subsequence.
$f$ is continuous in $d$ so $f(x_{\phi(n)})\rightarrow f(d)$. By unicity of the limit $M=f(d)$ thus $M$ is finite. Can do the same with $m=\inf f([a,b])$. And finally take $B=\max(|m|,|M|)$ and $B<\infty$ as required.
