# Continuous function/R/Intermediate value theorem/Constructive/Section

We want to know what happens to an interval $[a,b]$ under a continuous function $f\colon \mathbb {R} \rightarrow \mathbb {R}$. The values $f(a)$ and $f(b)$ belong to the image. The Intermediate value theorem tells us that all numbers between $f(a)$ and $f(b)$ do also belong to the image of the interval.

## Theorem

Let $a\leq b$ be real numbers, and let $f\colon [a,b]\rightarrow \mathbb {R}$ be a continuous function. Let $u\in \mathbb {R}$ be a real number between $f(a)$ and $f(b)$. Then there exists an $x\in [a,b]$ such that
$f(x)=u$

### Proof

We consider the situation $f(a)\leq u\leq f(b)$, and show the existence of such an $x$ with the bisection method. For that, we put $a_{0}:=a$ and $b_{0}:=b$, we consider the arithmetic mean $x_{0}:={\frac {a_{0}+b_{0}}{2}}$, and we compute
    $f{\left(x_{0}\right)}.$
If $f{\left(x_{0}\right)}\leq u$, then we put
    $a_{1}:=x_{0}\,\,{\text{ and }}\,\,b_{1}:=b_{0}$
and if $f{\left(x_{0}\right)}>u$, then we put
    $a_{1}:=a_{0}\,\,{\text{ and }}\,\,b_{1}:=x_{0}.$
In each case, the new interval $[a_{1},b_{1}]$ is lying inside the initial interval and has half of its length. It fulfills again the condition $f{\left(a_{1}\right)}\leq u\leq f{\left(b_{1}\right)}$, therefore we can apply the same defining method again and get recursively a family of nested intervals. Let $x$ denote the real number which is determined by these nested intervals. For the lower bounds of the intervals, we have $f{\left(a_{n}\right)}\leq u$, and this carries over to the limit $x$, due to the criterion for continuity in terms of sequences. Hence, $f{\left(x\right)}\leq u$. For the upper bounds, we have $f{\left(b_{n}\right)}\geq u$, and this again carries over to $x$, so $f(x)\geq u$. Therefore, $f(x)=u$.
$\Box$
The method described in this proof is constructive and can be used to give an explicit numerical method.

## Corollary

Let $a\leq b$ be real numbers, and let $f\colon [a,b]\rightarrow \mathbb {R}$ be a continuous function with $f(a)\leq 0$ and $f(b)\geq 0$. Then there exists an $x\in [a,b]$ such that
$f(x)=0$

### Proof

This follows immediately from fact.
$\Box$

## Method

Let $a\leq b$ be real numbers, and let $f\colon [a,b]\rightarrow \mathbb {R}$ denote a continuous function such that $f(a)\leq 0$ and $f(b)\geq 0$. Then the function has a zero within the interval, due to the Intermediate value theorem. Such a zero can be found by the bisection method, as described in the proof of the Intermediate value theorem. We put $a_{0}=a$ and $b_{0}=b$, and the other interval bounds are inductively defined in such a way that $f(a_{n})\leq 0$ and $f(b_{n})\geq 0$ hold. Define $x_{n}={\frac {a_{n}+b_{n}}{2}}$ and compute $f(x_{n})$. If $f{\left(x_{n}\right)}\leq 0$, then we set
    $a_{n+1}:=x_{n}\,\,{\text{ and }}\,\,b_{n+1}:=b_{n},$
and if $f{\left(x_{n}\right)}>0$, then we set
    $a_{n+1}:=a_{n}\,\,{\text{ and }}\,\,b_{n+1}:=x_{n}.$
In both cases, the new interval $[a_{n+1},b_{n+1}]$ has half the length of the preceding interval and so we have bisected intervals. The real number $x$ defined by these nested intervals is a zero of the function.

## Example

We want to determine approximately a zero for the polynomial
    $f(x)=x^{3}-4x+2\,$
with the help of the method given by the Intermediate value theorem. We have $f(1)=-1$ and $f(2)=2$, hence by fact, there must be a zero inside the interval $[1,2]$. We compute the value of the function at the arithmetic mean of the interval, which is ${\frac {3}{2}}$, and get
    $f{\left({\frac {3}{2}}\right)}={\frac {27}{8}}-4\cdot {\frac {3}{2}}+2={\frac {27-48+16}{8}}={\frac {-5}{8}}<0\,.$
Hence, we have to continue with the right half of the interval $[{\frac {3}{2}},2]$. The arithmetic mean thereof is ${\frac {7}{4}}$. The value of the function at this point is
    $f{\left({\frac {7}{4}}\right)}={\left({\frac {7}{4}}\right)}^{3}-4\cdot {\frac {7}{4}}+2={\frac {343}{64}}-5={\frac {343-320}{64}}={\frac {23}{64}}>0\,.$
So now we have to continue with the left part of the interval, namely $[{\frac {3}{2}},{\frac {7}{4}}]$. Its arithmetic mean is ${\frac {13}{8}}$. The value of the function at this point is
    $f{\left({\frac {13}{8}}\right)}={\left({\frac {13}{8}}\right)}^{3}-4\cdot {\frac {13}{8}}+2={\frac {2197}{512}}-{\frac {13}{2}}+2={\frac {2197-3328+1024}{512}}={\frac {-107}{512}}<0\,.$
Therefore, we know that there is a zero between ${\frac {13}{8}}$ and ${\frac {7}{4}}={\frac {14}{8}}$.

## Remark

The existence of arbitrary roots of nonnegative real numbers follows also from the Intermediate value theorem, since, for $c\geq 0$, the continuous function $X^{k}-c$ attains negative and positive values and has therefore also a zero. The proof of fact rests on the method of the Intermediate value theorem, even though continuity is not explicitly used.

## Example

Suppose that a regular quadratic table with four table legs $A,B,C,D$ is standing on an uneven but stepfree underground. At the moment, it stands on the legs $A,B,C$, and the leg $D$ does not touch the ground (if we leave $B,C$ in their positions and put $D$ down to the ground, then $A$ would sink into the ground). We claim that we can bring the table, by turning it around its middle axis, into a position such that it stands on all four legs (we do not claim that the table is then horizontal). To see this, we consider the function which assigns to the angle of rotation, the height of $D$ above the ground, when the three other legs are (or would be) on the ground. This height might be negative (if we are on sand, this can be realized, else think of this "ideally“). In degree $0$, the height is positive. In degree $90$, we get a situation which is symmetric to the initial position, but still the legs $A,B,C$ are supposed to be on the ground. Hence, the height of $D$ is now negative. The function has, on the interval $[0,90]$, positive and also negative values. Since the function is continuous, by the Intermediate value theorem, it also has a zero.