## Proof of the Intermediate Value Theorem

If $f(x)$ is continuous on $[a,b]$ and $k$ is strictly between $f(a)$ and $f(b)$, then there exists some $c$ in $(a,b)$ where $f(c)=k$.

Proof:

Without loss of generality, let us assume that $k$ is between $f(a)$ and $f(b)$ in the following way: $f(a) \lt k \lt f(b)$. The case were $f(b) \lt k \lt f(a)$ is handled similarly.

Define a set $S = \{x \in [a,b] : f(x) \lt k\}$, and let $c$ be the supremum of $S$ (i.e., the smallest value that is greater than or equal to every value of $S$).

Note, due to continuity at $a$, we can keep $f(x)$ within any $\epsilon \gt 0$ of $f(a)$ by keeping $x$ sufficiently close to $a$. Since $f(a) \lt k$ is a strict inequality, consider the implication when $\epsilon$ is half the distance between $k$ and $f(a)$. No value sufficiently close to $a$ can then be greater than $k$, which means there are values larger than $a$ in $S$. Hence, $a$ cannot be the supremum $c$ -- some value to its right must be..

Likewise, due to the continuity at $b$, we can keep $f(x)$ within any $\epsilon \gt 0$ of $f(b)$ by keeping $x$ sufficiently close to $b$. Since $k \lt f(b)$ is a strict inequality, consider the similar implication when $\epsilon$ is half the distance between $k$ and $f(b)$. Every value sufficiently close to $b$ must then be greater than $k$, which means $b$ cannot be the supremum $c$ -- some value to its left must be.

With $c \ne a$ and $c \ne b$, but $c \in [a,b]$, it must be the case that $c$ is in $(a,b)$.

Now we hope to show that $f(c) = k$.

Since $f(x)$ is assumed to be continuous on $[a,b]$ and $c \in [a,b]$, we know that $\lim_{x \rightarrow c} f(x) = f(c)$. Thus, by the epsilon-delta definition, we know that for any $\epsilon > 0$, we can find a $\delta > 0$ so that (with the exception of $x=c$) whenever $c-\delta \lt x \lt c+\delta$, we must have $f(c) - \epsilon \lt f(x) \lt f(c) + \epsilon$.

Consider any such value $\epsilon \gt 0$ and the value of $\delta$ that goes with it.

Now that there must exist some $x_0 \in (c - \delta, c]$ where $f(x_0) \lt k$. If there wasn't, then $c$ would not have been the supremum of $S$ -- some value to the left of $c$ would have been.

However, since $c-\delta \lt x_0 \lt c+\delta$, we also know that $f(c) - \epsilon \lt f(x_0) \lt f(c) + \epsilon$. Note, that in the case not inferred by the continuity of $f$ (i.e., when $x = c$), this just says $f(c) - \epsilon < f(c) < f(c) + \epsilon$, which should be obvious.

Focusing on the left side of this string inequality, $f(c) - \epsilon \lt f(c)$, we add $\epsilon$ to both sides to obtain $f(c) \lt f(x_0) + \epsilon$. Remembering that $f(x_0) \lt k$ we have

$$$$f(c) \lt k + \epsilon$$$$

There also must exist some $x_1 \in [c, c + \delta)$ where $f(x_1) \ge k$. If there wasn't, then $c$ would not have been the supremum of $S$ -- some value to the right of $c$ would have been.

However, since $c - \delta \lt x_1 \lt c + \delta$, we also know that $f(c) - \epsilon \lt f(x_1) \lt f(c) + \epsilon$. (As above, the case not inferred by the continuity of $f$ is an obvious one.)

Focusing on the right side of this string inequality, $f(x_1) \lt f(c) + \epsilon$, we subtract $\epsilon$ from both sides to obtain $f(x_1) - \epsilon \lt f(c)$. Remembering that $f(x_1) \ge k$ we have

$$$$k - \epsilon \lt f(c)$$$$

Then combining $(1)$ and $(2)$, we have

$$k - \epsilon \lt f(c) \lt k + \epsilon$$

However, the only way this holds for any $\epsilon \gt 0$, is for $f(c) = k$.

QED.