# $f$ continuous, $a\lt b$, $y$ between $f(a)$ and $f(b)$, then exists $x$, $a\lt x\lt b$, $f(x)=y$

If $f$ is continuous on $I$, then: whenever $a, b \in I$, $a < b$ and $y$ lies between $f(a)$ and $f(b)$, then there exists at least one $x \in (a,b)$ such that $f(x) = y$.

Proof: Suppose $f(b) < y < f(a)$. Let $S := \{x \in [a,b] : y < f(x)\}$. Since obviously $a \in S$, then $S$ is not empty, therefore $\inf S = x_0 \in [a,b]$. Now, for every positive integer $n$, $x_0 + \frac{1}{n}$ is not a lower bound for $S$. hence, there exists $(s_n) \subseteq S$ such that $$x_0 \leq s_n < x_0 + \frac{1}{n}$$

By the squeeze rule, obviously $\lim s_n = x_0$. By continuity of $f$, $\lim f(s_n) = f(x_0)$. Hence since $f(s_n) > y$, then

\begin{align} f(x_0) \geq y. \tag{I} \end{align}

Now, let $t_n = \max\{b, x_0 - \frac{1}{n}\}$. Then, we have that $x_0 - \frac{1}{n} \leq t_n \leq x_0$. So, by squeeze rule, $\lim t_n = x_0$. But, we also have $t_n \notin S$, therefore, $f(t_n) \leq y$ for all $n$. The continuity of $f$ implies that $\lim f(t_n)$ =

\begin{align} f(x_0) \leq y. \tag{II} \end{align}

(I) and (II) gives desired result.

Is this proof correct? Is there a better way to solve this problem? Thanks.

-
Yes, it looks ok. This is the standard proof of the Intermediate Value Theorem. Another popular proof is by the method of bisection. –  Siminore Oct 22 '12 at 9:36
What if a=b? Should probably make an assertion about that or else a=x=b. –  Emmad Kareem Oct 22 '12 at 9:59
The quoted problem has $a<b$. –  Kevin Carlson Oct 22 '12 at 10:21
It’s not quite right: as you’ve defined $S$, $\inf S=a$. You want to let $x_0=\sup S$ and choose a sequence $\langle s_n:n\in\Bbb Z^+\rangle$ in $S$ such that $$x_0-\frac1n<s_n\le x_0$$ for each $n\in\Bbb Z^+$. You still get $f(x_0)\ge y$, and then you want to let $t_n=\min\left\{b,x_0+\frac1n\right\}$ to get $f(x_0)\le y$.
In other words, you somehow got the picture turned around at the beginning, but the logic is otherwise correct. You could also fix it by assuming that $f(a)<y<f(b)$, defining $S$ exactly as you did, and noting that $b\in S$, so $S\ne\varnothing$. The rest is then correct as it stands.