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

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

## Theorem

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

### Proof

We consider the situation ${\displaystyle {}f(a)\leq u\leq f(b)}$, and show the existence of such an ${\displaystyle {}x}$ with the bisection method. For that, we put ${\displaystyle {}a_{0}:=a}$ and ${\displaystyle {}b_{0}:=b}$, we consider the arithmetic mean ${\displaystyle {}x_{0}:={\frac {a_{0}+b_{0}}{2}}}$, and we compute

${\displaystyle f{\left(x_{0}\right)}.}$

If ${\displaystyle {}f{\left(x_{0}\right)}\leq u}$, then we put

${\displaystyle a_{1}:=x_{0}\,\,{\text{ and }}\,\,b_{1}:=b_{0}}$

and if ${\displaystyle {}f{\left(x_{0}\right)}>u}$, then we put

${\displaystyle a_{1}:=a_{0}\,\,{\text{ and }}\,\,b_{1}:=x_{0}.}$

In each case, the new interval ${\displaystyle {}[a_{1},b_{1}]}$ is lying inside the initial interval and has half of its length. It fulfills again the condition ${\displaystyle {}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 ${\displaystyle {}x}$ denote the real number which is determined by these nested intervals. For the lower bounds of the intervals, we have ${\displaystyle {}f{\left(a_{n}\right)}\leq u}$, and this carries over to the limit ${\displaystyle {}x}$, due to the criterion for continuity in terms of sequences. Hence, ${\displaystyle {}f{\left(x\right)}\leq u}$. For the upper bounds, we have ${\displaystyle {}f{\left(b_{n}\right)}\geq u}$, and this again carries over to ${\displaystyle {}x}$, so ${\displaystyle {}f(x)\geq u}$.  Therefore, ${\displaystyle {}f(x)=u}$.

${\displaystyle \Box }$

The method described in this proof is constructive and can be used to give an explicit numerical method.

## Corollary

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

### Proof

This follows immediately from fact.

${\displaystyle \Box }$

## Method

Let ${\displaystyle {}a\leq b}$ be real numbers, and let ${\displaystyle {}f\colon [a,b]\rightarrow \mathbb {R} }$ denote a continuous function such that ${\displaystyle {}f(a)\leq 0}$ and ${\displaystyle {}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 ${\displaystyle {}a_{0}=a}$ and ${\displaystyle {}b_{0}=b}$, and the other interval bounds are inductively defined in such a way that ${\displaystyle {}f(a_{n})\leq 0}$ and ${\displaystyle {}f(b_{n})\geq 0}$ hold. Define ${\displaystyle {}x_{n}={\frac {a_{n}+b_{n}}{2}}}$ and compute ${\displaystyle {}f(x_{n})}$. If ${\displaystyle {}f{\left(x_{n}\right)}\leq 0}$, then we set

${\displaystyle a_{n+1}:=x_{n}\,\,{\text{ and }}\,\,b_{n+1}:=b_{n},}$

and if ${\displaystyle {}f{\left(x_{n}\right)}>0}$, then we set

${\displaystyle a_{n+1}:=a_{n}\,\,{\text{ and }}\,\,b_{n+1}:=x_{n}.}$

In both cases, the new interval ${\displaystyle {}[a_{n+1},b_{n+1}]}$ has half the length of the preceding interval and so we have bisected intervals. The real number ${\displaystyle {}x}$ defined by these nested intervals is a zero of the function.

## Example

We want to determine approximately a zero for the polynomial

${\displaystyle {}f(x)=x^{3}-4x+2\,}$

with the help of the method given by the Intermediate value theorem. We have ${\displaystyle {}f(1)=-1}$ and ${\displaystyle {}f(2)=2}$, hence by fact, there must be a zero inside the interval ${\displaystyle {}[1,2]}$. We compute the value of the function at the arithmetic mean of the interval, which is ${\displaystyle {}{\frac {3}{2}}}$, and get

${\displaystyle {}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 ${\displaystyle {}[{\frac {3}{2}},2]}$. The arithmetic mean thereof is ${\displaystyle {}{\frac {7}{4}}}$. The value of the function at this point is

${\displaystyle {}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 ${\displaystyle {}[{\frac {3}{2}},{\frac {7}{4}}]}$. Its arithmetic mean is ${\displaystyle {}{\frac {13}{8}}}$. The value of the function at this point is

${\displaystyle {}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 ${\displaystyle {}{\frac {13}{8}}}$ and ${\displaystyle {}{\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 ${\displaystyle {}c\geq 0}$, the continuous function ${\displaystyle {}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 ${\displaystyle {}A,B,C,D}$ is standing on an uneven but stepfree underground. At the moment, it stands on the legs ${\displaystyle {}A,B,C}$, and the leg ${\displaystyle {}D}$ does not touch the ground (if we leave ${\displaystyle {}B,C}$ in their positions and put ${\displaystyle {}D}$ down to the ground, then ${\displaystyle {}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 ${\displaystyle {}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 ${\displaystyle {}0}$, the height is positive. In degree ${\displaystyle {}90}$, we get a situation which is symmetric to the initial position, but still the legs ${\displaystyle {}A,B,C}$ are supposed to be on the ground. Hence, the height of ${\displaystyle {}D}$ is now negative. The function has, on the interval ${\displaystyle {}[0,90]}$, positive and also negative values. Since the function is continuous, by the Intermediate value theorem, it also has a zero.