# Question about proof of intermediate value theorem

I have a question about proof of intermediate value theorem. I will post the entire proof here.

Let $I\subset \Bbb{R}$ be interval $I=(a,b)$, and $f:I\rightarrow\Bbb{R}$ be a continous function. then if some $u$ is between $f(a),f(b)$, then there exists some $c\in (a,b)$ such that $f(c)=u$.

WLOG assume $f(a)<f(b)$. For $f(a)>f(b)$ the proof is very simillar.

Let $S=\{x\in(a,b);f(x)<u\}$. S is non-empty, because $a\in S$ and $S$ is bounded above by $b$. By completeness, $\sup{S}$ exists, call it $c$. We claim, that $f(c)=u$.

Choose some $\epsilon>0$. $f$ is continuous, thus $$f(x)-\epsilon<f(c)<f(x)+\epsilon$$ for all $x\in (c-\delta,c+\delta)$.

By the properties of the supremum, we can chose some $a^*$ from $(c-\delta,c)$ such that $a^*\in S$. We have $$f(c)<f(a^*)+\epsilon\leq u+\epsilon$$

Similarly we can chose $a^{**}$ from $(c,c+\delta)$ such that $a^{**}\notin S$. We have $$f(c)>f(a^{**})-\epsilon\geq u-\epsilon$$

which together gives $$u-\epsilon<f(c)<u+\epsilon$$ which holds for all $\epsilon >0$, thus $f(c)=u$ is the only possible value, as claimed.

My question is: Why can't we conclude the proof after saying that the supremum exist? I don't understand in which sense we used the fact that $f$ is continuous. As I know, if we don't use all assumptions in a proof, it is somehow wrong. Would anyone please explain me, what could happen if $f$ wasn't continuous? Why can't we say directly from definition of $S$ that $\sup{S}=u=f(c)$, I must be missing something.

The continuity of the function $f$ is used to choose some $a^*$ and $a^{**}$ that are within $\epsilon$ of the value $f(c)$. You cannot assume that any choice of $a^*\in(c-\delta,c)$ will satisfy $f(c)<f(a^*)+\epsilon$ without the continuity of $f$ (the continuity of $f$ implies $|f(x)-f(c)|< \epsilon$ for all $x\in(c-\delta,c+\delta)$). Similarly with the choice of $a^{**}$.
• Yeah, that makes sense. But why do i have to work with the continuity part at all? By the definition of $S$ itself, i have that $\sup S=u=f(c)$. What am i missing? – Michal Dvořák Jul 4 '18 at 15:53
• This is not quite correct. You only know that $c\ge x$ for all $x\in S$. This is the definition of $\sup S$. In other words, $c$ is the least upper bound on all of the values $x$ for which $f(x)<u$. This doesn't allow you to immediately conclude anything about the value $f(u)$ itself. In short, the supremum of a set allows you to conclude things about $\textit{that set}$. You cannot jump to facts about a function's behavior on the set, etc. – Beckham Myers Jul 4 '18 at 16:03
• Ah, that's it. So basically we can have that anywhere close to $f(u)$, the function is well behaving, and if $f$ was discontinuous at $u$, then i would be wrong, is that correct? – Michal Dvořák Jul 4 '18 at 16:07
• Yes, the continuous behavior of $f$ around $c$ allows you to "shrink" the interval of possible values around $u$ arbitrarily small so that you can conclude that $f(c)=u$ as desired. – Beckham Myers Jul 4 '18 at 16:10
Suppose that $a=-1$, $b=1$, and $f\colon[-1,1]\longrightarrow\mathbb R$ is defined by$$f(x)=\begin{cases}-1&\text{ if }x<0\\1&\text{ otherwise.}\end{cases}$$Take $u=0$. Then $S=[-1,0)$ and therefore $c=0$. However, $f(c)=f(0)=1\neq0$.
The problem here is that $f$ is discontinuous at $0$. Otherwise, we would necessarily have $f(c)=0$.