$f:[a,b] \rightarrow \mathbb{R}$ continuous is limited 
Show that every continuous function $f:[a,b] \rightarrow \mathbb{R}$ is bounded.

My attempt: 
Let $f:[a,b] \rightarrow \mathbb{R}$ be a continuous function. Denote by $X$ the set $X = \{x\in[a,b]: f\vert [a,x] \mbox{ is bounded}\}$. Clearly $X\neq \emptyset$, since $a\in X$. To see that, we take any $\epsilon>0$ and since $f$ is continuous at $a$, there corresponds a $\delta>0$ such that $x\in(a-\delta,a+\delta)$ implies $f(a)-\epsilon<f(x)<f(a)+\epsilon$, i.e,$ |f(x)|<|f(a)|+\varepsilon.$ So we have that $|f(x)|<M = |f(a)|+\epsilon$ for every $x\in[a,a]$. We note that $X\subseteq[a,b]$, so there exists $c=\mbox{sup}X$.
We note that $b$ is a upper bound. Since $c$ is sup, we must have $c\leq b$ which shows that $c$ lies in the interval $[a,b]$. We argue that $f\vert [a,c]$ is bounded. If not, given $M>0$ there exists $y\in[a,c]$ such that $|f(y)|\geq M$. Since $y$ lies in the interval $[a,c]$ and $f$ is continuous at $y$, we can apply the same argument used before to show that $|f(y)|<M$ near $y$. Therefore, we must have $c\in X$. So $c$ is max$X$, and hence $X=[a,b]$
Is this proof fine?
 A: We have that the set $X$ you defined is non-empty because $a \in X$ and bounded above from $b$ thus it has a supremum.
Let $c=\sup X $ 
To finish the proof  you have to show that $c=\sup X=b$.
Assume that $c<b$.
$(1)$Since $f$ is continupous at $c$,exists $t>0$ such that $f$ is bounded on the interval $(c-t,c+t)$. We can choose $t>0$  such that $(c-t,c+t) \subseteq [a,b]$
From the property of supremum and the fact that $c= \sup X$
exists $p\in X$ such that  $c>p>c-t$ and $f$ is bounded on $[a,p]$ 
and from this and $(1)$ we have that $f$ is bounded on $[a,c+t]$ so $c+t \in X$ which contradicts the fact that $\sup X =c$
(Note that from our choice of $t$ we have that $c+t \in [a,b]$ and $f$ is defined on $c+t$)
Thus $c=b$ and also you proved that $c=\sup X \in X$ therefore $b \in X$
We conclude that $f$ is bounded on $[a,b]$
A: An easy proof
By contradiction, if it's not bounded, then there is a sequence $(x_n)\subset [a,b]$ s.t. $|f(x_n)|\geq n$ for all $n$. By Bolzano-Weierstrass, there is a subsequence $(x_{n_k})$ that converge in $[a,b]$. Let denote $x\in [a,b]$ it's limit. Then
$$|f(x)|\geq -\underbrace{|f(x_{n_k})-f(x)|}_{\to 0\ by\ continuity}+\underbrace{|f(x_{n_k})|}_{\geq n_k}\underset{n\to \infty }{\longrightarrow }\infty,$$
which is a contradiction with the fact that $f$ is continuous at $x$. 
A: I formalized a better answer:
Denote by $X=\{x\in[a,b]: f\vert [a,x] \mbox{is limited}\}$. We note that $X\neq \emptyset$, since $a\in X$. In order to see that, given $\epsilon>0$, there corresponds a $\delta>0$ such that $x\in[a,a+\delta)\implies |f(x)|<|f(a)|+\epsilon.$ In particular, we have shown that $|f(x)|<|f(a)|+\epsilon$ for all $x\in[a,a]$. Therefore, $a\in X$. Since $X\subseteq[a,b]$, let $c=\mbox{sup}X$.
We also note that $b$ is an upper bound for $X$. Being $c$ the supremum, we must have $c\leq b$, and therefore $c$ must lie in $[a,b]$. So given $\epsilon_0>0$, since $f$ is continous at $c$, we must have $|f(x)|<|f(c)|+\epsilon_0$ for all $x\in(c-\delta_0,c+\delta_0)$ and for some $\delta_0>0$.  Since $c-\delta_0<c$, exists $y\in X$ such that $c-\delta<y\leq c$ and $f\vert [a,y]$ is limited. Also $f\vert (y,c]$ is limited, since $(y,c]\subseteq(c-\delta_0,c+\delta_0)$ and since $|f(x)|<|f(c)|+\epsilon_0$ for all $x\in (c-\delta_0,c+\delta_0)$. Therefore, we have shown that $f\vert [a,c]$ is limited, and hence $c\in X$.
We argue that $c=b$. Otherwise, we would have $c<b$. Denoting by $d=\mbox{min}\{c+\delta_0,b\}$, we take $z\in(c,d)$. Noticing that $(c,d)\subseteq(c-\delta_0,c+\delta_0)$, by the same argument we have that $f\vert (c,z]$ is limited. Also $f\vert[a,c]$ is limited, and hece $f\vert[a,z]$ is limited. So $z\in X$, but we have $c<z$, which contradicts $c$ being the supremum. Therefore, we must have $c=b$ and this proves that $f\vert [a,b]$ is limited.
