TITLE: Give another proof of intermediate value theorem
QUESTION [6 upvotes]: Give another proof of intermediate value theorem by completing the
  following argument: If $f$ is a continuous real-valued function on the
  closed interval $[a,b]$ in $\mathbb{R}$ and $f(a)<\gamma < f(b)$ then
  $$f(\sup \{x\in [a,b]: f(x)\le \gamma\})=\gamma \mbox{.}$$

Denote $S=\{x\in [a,b]: f(x)\le \gamma\}$. First note that $\sup S$ exists since $a\in S$ and $S$ is bounded from above by $b$. Since $S$ is closed (because of the continuity of $f$) it must be the case that $s=\sup S \in S$. If $f(s)<\gamma$ then there would exist some small $\epsilon>0$ such that $f(s + \epsilon)<\gamma$ and that would mean $s$ is not the supremum of $S$, contradiction. Thus $f(s)=\gamma$.
Is my reasoning correct?

REPLY [3 votes]: You need to state that $s < b$, which follows from $\gamma < f(b)$ and the definition of S. That's what entitles you to say that there's a positive $\varepsilon$ such that $f(s+\varepsilon) < \gamma$, if $f(s) < \gamma$.
You should also address the possibility of $f(s) > \gamma$. It's easily handled: there is a sequence $(s_n)$ in S converging to $s$, and $f(s_n)\le \gamma$ for all $n$, so by continuity $f(s) = \lim_n f(s_n) \le \gamma$.