Intermediate value theorem and supremum Suppose that $f:[a,b]\rightarrow \mathbb{R}$ is continuous and that $f(a)<0$ and $f(b)>0$. By the intermediate-value theorem, the set $S=\{x\in [a,b]:f(x)=0\}$ is nonempty. If $c=\sup S$, prove that $c\in S$.
My first thought was to show that $S$ is finite therefore $c\in S$, but there is no guarantee that $f$ doesn't have infinitely many zeros. 
A thought I have now is to show that $c>\max(S)$ can not be true, but I do not know how to show this, is this even the correct thing to show? Thank you in advance for any input.
 A: HINT: There are elements $s\in S$ such that $|s-c|<\epsilon$ for every $\epsilon$. Extract a sequence $s_n$ contained in $S$ and converging to $c$, and use the continuity of $f$ to compute $f(c)$.
A: You've noted that when $S$ is finite, then $c=\sup S \in S.$
Now what if $S$ is infinite? Then there exists a sequence in $S$ that converges to $\sup S.$ (There are several ways to prove this. Try it on your own if you don't already know how. But a standard proof would be to choose $c_0,$ then choose $c_1$ such that it's bigger than $c_0$ but less than $c.$ We know such a number must exist because if not, $c_0$ would be a smaller upper bound than $c.$ And we continue on in this fashion.) Call this sequence ${c_n}.$ Now as $f$ is continuous, $$f(c)=\lim_{n\to\infty} f(c_n).$$
Thus $f(c)=0.$
A: Here's a thought: show that $$\{x\in[a,b]:f(x)<0\}$$ and $$\{x\in[a,b]:f(x)>0\}$$ are relatively open in $[a,b]$ by continuity of $f,$ and so $C$ is closed.
Edit Since you don't have the notion of open sets, yet, then instead, consider the set $$B:=\bigl\{x\in[a,b]:f(x)>0\text{ for all }x\le t\le b\bigr\}.$$ You should be able to see that $b\in B,$ and by continuity and definition of $B,$ we have for each $x\in B$ that $(x-\delta_x,b]\subseteq B$ for some $0<\delta_x<x-a.$
Furthermore, every element of $B$ is an upper bound of $C,$ and so is a strict upper bound of $C.$ Next, show that $\inf B=\sup C.$ The definition of $B$ and another application of IVT rules out the possibilities that $f(\sup C)>0$ or $f(\sup C)<0,$ and we're done.
A: The idea is simple. For each $x \in S$ we have $f(x) = 0$ and let $c = \sup S$. We show that $f(c) = 0$ so that $c \in S$. First of all note that $c \in [a, b]$.
How do go about showing $f(c) = 0$? A simple way out is to apply the method of contradiction. Let's assume that $f(c) > 0$. Then by continuity of $f$ at $c$, there is a $\delta > 0$ such that $[c - \delta, c] \subseteq [a, b]$ and $f(x) > 0$ for all $x \in [c - \delta, c]$. However $c = \sup S$ and hence there is a member $x \in S$ with $c - \delta < x < c$ and therefore $f(x) = 0$. This contradiction shows that we can't have $f(c) > 0$. Similarly we can show (via contradiction) that $f(c) \not \lt 0$. Hence the only option is that $f(c) = 0$.
