Let $f$ be continuous on $I=[a,b]$ such that $f(a)<0$, $f(b)>0$, $W= \{x\in I: f(x)<0\}$, $w=\sup W$ Prove that $f(w)=0$ Let $f$ be continuous on $I=[a,b]$ such that $f(a)<0, f(b)>0, W= \{x\in I: f(x)<0\}$, $w=\sup W$ Prove that $f(w)=0$
[I can see that this is an alternate proof for the Location of roots theorem]
My progress: 
If possible, let $f(w)>0$. Since $f$ is continuous at $w, \exists \delta_1>0$ such that $f(x)>0, \forall x\in V_{\delta_1}(w)$.
Similarly, letting let $f(w)<0,\exists \delta_2>0$ such that $f(x)<0, \forall x\in V_{\delta_2}(w)$.
[I have been able to prove the existence of such $\delta_1, \delta_2$.]
I know I'm supposed to arrive at a contradiction here, but I can't figure out what the contradiction is. Please help!
 A: Suppose $f(w)<0$. Then there is a $\delta>0$ such that $|x-w|<\delta\implies |f(x)-f(w)|<\epsilon$ where $\epsilon=|f(w)|$. So for any $x$ such that $w<x<w+\delta$, $f(x)<0$ which contradicts that $w$ is an upper bound of $W$.
If $f(w)>0$, defining $\delta$,$\epsilon$, and $x$ such that $w-\delta<x<w$. We have $f(x)>0$ for all such $x$. This contradicts that $w$ is the least upper bound of $W$.
A: Note that $f(b) > 0$ so there is a neighborhood of $b$ where $f(x)$ is positive and hence $w = \sup W < b$. And clearly $w \geq a$ as $a \in W$. Thus $w \in I$.
Proceeding exactly as OP let us assume that $f(w) > 0$. So there is a neighborhood $V_{\delta_{1}}(w) = (w - \delta_{1}, w + \delta_{1})$ such that $f(x)$ is positive in this neighborhood. Clearly $W = \{x \mid x \in I, f(x) < 0\}$ and hence $V_{\delta_{1}}(w)$ is disjoint from $W$.
Also by definition of $w = \sup W$ it is clear that there is a member $c \in W$ such that $w - \delta_{1} < c \leq w$. So then $f(c) < 0$. And since $c \in V_{\delta_{1}}(w)$ so $f(c) > 0$. Contradiction.
Similarly try $f(w) < 0$. In this case you will need $\delta_{2}$.
