Intermediate value theorem (source code)

= Intermediate value theorem
{wiki}

The <intermediate value theorem> says that a real-valued <continuous function> cannot skip a value between two of its outputs. Let $a<b$ and let $f:[a,b]\to\mathbb R$ be a <continuous function> on the entire <closed interval> $[a,b]$. Then
$$
\min\{f(a),f(b)\}\leq y\leq\max\{f(a),f(b)\}
\quad\Longrightarrow\quad
\text{there exists }c\in[a,b]\text{ with }f(c)=y.
$$
The word "between" includes both endpoint values: choose $c=a$ when $y=f(a)$, or $c=b$ when $y=f(b)$. If $y$ is strictly between them, every such $c$ lies in the <open interval> $(a,b)$. <Continuity> on $[a,b]$ means <continuity> at every interior point, together with the endpoint <one-sided limits> $\lim_{x\to a^+}f(x)=f(a)$ and $\lim_{x\to b^-}f(x)=f(b)$. No <derivative> is required.<Calculus Volume 1 by Gilbert Strang and others>[§2.4, Continuity over an Interval and Theorem 2.11, The Intermediate Value Theorem]{ref}

For finding a <zero of a function>, the useful special case is
$$
f(a)f(b)<0\quad\Longrightarrow\quad
\text{there exists }c\in(a,b)\text{ with }f(c)=0.
$$
Strictly opposite endpoint signs certify a <root bracket>, because zero is strictly between $f(a)$ and $f(b)$. If an endpoint value is already zero, that endpoint supplies a <zero of a function> directly; an interior <zero of a function> need not exist. For example, $f(x)=x$ on $[0,1]$ has its only <zero of a function> at the left endpoint. The <intermediate value theorem> guarantees existence, but neither uniqueness nor a necessary sign-change test. Its numerical usefulness is that the <bisection method> can turn existence into successively tighter <root brackets>.