Proving that $f(\sup A) = 0$ if $f$ is continuous. I have the following problem on problem set (first course on Real Analysis):

Let $f:[0,1] \rightarrow \mathbb{R}$ be a continous function such that $f(0) < 0$ and $f(1)>0$. Let $A = \{x \in [0,1]: f(x) < 0\}$ and $s = \sup A$. Prove that $f(s) = 0$.

I think I should use the Interemidiate Value Theorem. Although I have another [similar] approach and I would like to know if everything is alright.
$\textbf{My attempt}$: Divide the problem in two cases.
Case $1$: suppose that $f(s) < 0$. Since $s < 1$ in this case and using the fact that $f$ is coutinuous, we can find $\delta > 0$ such that $|f(x) - f(s)| < \frac{-f(s)}{2}$ whenever $|x - s| < \delta$, noting that $\frac{-f(s)}{2} > 0$. Well, if this is case, then $f(x) < 0$ for every $x \in [0,1)\cap (s-\delta, s+\delta)$ and we can find $x>s$ such that $x \in A$, a contradiction.
Case $2$: suppose that $f(s) > 0$. A similar argument gives us that we can find a whole neighborhood of $s$ such that $f(x) > 0$ for all $x$ in this neighborhood. So, we can find a smaller upper bound for $A$, a contradiction.
The argument seems fair? How to improve it? Thanks a lot in advance!
 A: Your proof is good, but it's cheating. ;-) Indeed, this is the intermediate value theorem, in the form

If $f\colon [a,b]\to\mathbb{R}$ is continuous, $f(a)<0$ and $f(b)>0$, then there exists $c\in(a,b)$ with $f(c)=0$.

This is easily seen to be equivalent to the intermediate value theorem.
Since $f(0)<0$, there exists $\delta_0>0$ such that, for $x\in[0,\delta_0)$, $f(x)<0$. In particular, $s>\delta_0/2>0$. Set $c=\delta_0/2$.
Since $f(1)>0$, there exists $\delta_1>0$ such that, for $1-\delta_1<x<1$, $f(x)>0$. Set $d=(1-\delta_1)/2$.
We can conclude that $c<s<d$.
Suppose $f(s)<0$. Then there exists $\delta>0$ such that $(s-\delta,s+\delta)\subseteq(c,d)$ and, for $s-\delta<x<s+\delta$, $f(x)<0$. Therefore $(s+\delta/2)<0$: since $s<s+\delta/2$, this contradicts $s$ being an upper bound of $A$.
Suppose $f(s)>0$. Then there exists $\delta>0$ such that $(s-\delta,s+\delta)\subseteq(c,d)$ and, for $s-\delta<x<s+\delta$, $f(x)>0$.
On the other hand, since $s=\sup A$, there exists $y\in A$ with $y>s-\delta$. A contradiction to $s$ being the least upper bound of $A$.
