Continuous functions I have a question for you. 
Let $f\colon\mathbb{R}\rightarrow \mathbb{R}$ continuous. Assume that there exists $s,t\in\mathbb{R}$, with $t>s$, such that $f(s)=0$ and $f(t)>0$.
I want to prove that there exists an interval $I=[a,b]$ contained in $[s,t]$ such that $f(a)=0$ and $f(x)>0$ for each $x\in(a,b]$.
 To me it sounds correct, by I would like to have a formal proof.
Thanks! 
 A: Ussing the theorem of sing conservation, there is $\epsilon >0,$ such that for any $x\in [t-\epsilon,t+\epsilon]=I_\epsilon$ $f(x)>0,$ then $I_\epsilon\cap[s,t]=I\subset [s,t]$.
A: Edit: the question has changed -- this argument does not guarantee the $f(a)=0$ part.
By the Intermediate Value Theorem, there exists $r\in(s,t)$ such that $f(r)>0$. Take $\varepsilon\stackrel{\rm def}{=}\frac{f(r)}{2}$, and use the definition of continuity on $r$ with $\varepsilon$: there exists $\delta >0$ such that for all $x\in [r-\delta,r+\delta]$, $$\lvert f(x)-f(r) \rvert \leq \varepsilon.$$
Now, take $\delta^\prime \stackrel{\rm def}{=} \min(\delta, t-r,r-s)$, so that $I\stackrel{\rm def}{=}[r-\delta^\prime,r+\delta^\prime]\subseteq [s,t]$ (and the equation above still holds, clearly, for all $x\in I$) . This interval $I$ is a good candidate — can you see why?
Second edit: tackling the new question. Starting from above, for instance (with the $r$ guaranteed by the IVT)
Let $$S \stackrel{\rm def}{=} \{  x \in [s,r) \mid f(x) \leq 0 \}$$ and $u\stackrel{\rm def}{=}\sup S$. Since $s\in S$, it is a non-empty bounded set, and thus has an supremum: $u$ is well-defined. By definition, $(u,r]\subseteq [s,t]$, and any $x\in (u,r]$ satisfies $f(x)>0$ as $x\neq S$. It remains to show $f(u)=0$. This can be shown in two steps:


*

*First, $f(u)\geq 0$: indeed, suppose by contradiction that $f(u) < 0$. Then, by the IVT there is a $u^\prime \in (u,r)$ such that $f(u^\prime) = 0$, so that $u^\prime\in S$ and $u$ cannot be the supremum. Contradiction.

*Second, $f(u) \leq 0$. This follows from the definition of $S$, the fact that $u=\sup S$ and continuity of $f$ (take any sequence $u_n\to u$ in $S$: $0 \geq f(u_n)\to f(u)$).
This being done, define $I=[u,r]\subseteq [s,t]$.
A: Just use $b:=t$ and $a:=\sup\{u\in[s,t): f(u)=0\}$. By the continuity of $f$, $f(a)=0$. Also, $a<b$ and if $x\in(a,b]$ then $f(x)\not=0$. If $f(x)$ were $<0$ for some $x\in(a,b]$ then there would be $y\in(x,b)$ with $f(y)=0$ (Intermediate Value Theorem) in violation of the definition of $a$.
