Course Webpage

Consider the function

$$h(x)=\left(x^{3}-x\right)e^{-x}$$
  1. Prove that it has a unique local extreme in $\left[3,4\right].$
  2. May it be approximated by the bisection method using this interval?
  3. Approximate the minimum with four iterations.
  4. Give an error bound for the approximation.
  5. How many iterations guarantee an error less than $10^{-8}$?

Prove that it has a unique local extreme in $\left[3,4\right]$

If we are looking for the extremes of $h,$ since the necessary condition for extreme for a differentiable function is that $h'(x)=0,$ we are looking for the zeros of $h'.$

$$ h'(x)=(3x^2-1)e^{-x}+(x^3-x)e^{-x}(-1)= e^{-x}(-x^3 + 3x^2 + x - 1) $$

Since the exponential is always positive and different from zero, if we want the roots of $h'$ we have to find the zeros of

$$f(x)=-x^3 + 3x^2 + x - 1$$

We see that the three sufficient conditions to exist a single root in the interval are met:

  1. $f$ is continuous.
  2. $f$ has different signs at the endpoints.
  3. $f$ is strictly increasing (or decreasing) in this interval.

Let us also prove it analytically:

  1. $f$ is a polynomial and therefore, it is continuous.
  2. $f(3)=2$ and $f(4)=-13$
  3. $f$ is strictly decreasing in $[3,4]$ because $f'<0$ in $(3,4)$, as we can see if we factorize the derivative
$$f'(x)=-3x^2+6x+1$$

We compute the zeros of this second degree polynomial $ax^2+bx+c=0$ with

$$x_{1,2} = \frac{-b\pm \sqrt{b^2-4ac}}{2a}$$

as $a=-3$, $b=6$ and $c=1$ we have

$$x_{1,2} = \frac{-6\pm \sqrt{6^2-4(-3)}}{2(-3)}\quad x_1= -0.15 \quad x_2 = 2.15$$

Therefore

$$f'(x)=a(x-x_1)(x-x_2)=-3(x+0.15)(x-2.2)$$

and, as the first factor factor, $-3$, is negative, and the second, $(x+0.15)$ and third, $(x-2.2)$ positive in $(3,4)$, we have

$$f'(x)=-3(x+0.15)(x-2.2)= (-)(+)(+)\lt 0 \quad \mathrm{in} \quad (3,4)$$

May it be approximated by the bisection method using this interval?

The conditions to apply the Bisection method are Bolzano's conditions, that is, conditions 1 and 2 of the previous section.

As we demonstrated, these two conditions are met and therefore, we can apply the Bisection method.

Approximate the extreme with four iterations

We iterate taking into account that given $a$ and $b$ the midpoint is

$$m = \frac{a+b}{2}$$

and that the error boundary is given by

$$c = b-a$$

of the next iteration.

Iteration 1

The interval is $[3,4]$ and its midpoint is

$$m = \frac{a+b}{2}=\frac{3+4}{2}=3.5$$

As $f(3)=2$ and $f(3.5)=-3.63$ the sign of the function is different at the next interval boundaries that is $[3,3.5]$ and the error boundary is the length of this interval, 0.5.

Iteration 2

The interval is $[3,3.5]$ and its midpoint is

$$m = \frac{a+b}{2}=\frac{3+3.5}{2}=3.25$$

As $f(3)=2$ and $f(3.25)=-0.39$ the sign of the function is different at the next interval boundaries that is $[3,3.25]$ and the error boundary is the length of this interval, 0.25.

Iteration 3

The interval is $[3,3.25]$ and its midpoint is

$$m = \frac{a+b}{2}=\frac{3+3.25}{2}=3.125$$

As $f(3.125)=0.9$ and $f(3.25)=-0.39$ tienen signo distinto el siguiente intervalo es $[3.125,3.25]$ and the error boundary is the length of this interval, 0.125.

Iteration 4

The interval is $[3.125,3.25]$ and its midpoint is

$$m = \frac{a+b}{2}=\frac{3.125+3.25}{2}=3.1875$$

and the error boundary is half the length of the previous interval, that is, 0.0625.

\begin{array}{|r|rrr|rrr|r|} \hline \mathrm{iteration} & a & m & b & f(a) & f(m) & f(b) & \mathrm{error}\; \mathrm{bound}\\ \hline 1 &{\color{red}{3.000}} &{\color{blue}{3.5000}} & 4.000 &{\color{red}{2.00}} & {\color{blue}{-3.63}} & -13.00 & 0.500\\ 2 &{\color{red}{3.000}} &{\color{blue}{3.2500}} & 3.500 &{\color{red}{2.00}} & {\color{blue}{-0.39}} & -3.62 & 0.250\\ 3 &3.000 &{\color{red}{3.1250}} &{\color{blue}{3.250}} & 2.00 &{\color{red}{0.90}} & {\color{blue}{-0.39}} & 0.125\\ 4 &3.125 &\mathbf{3.1875} &3.250 & 0.90 & & -0.39 & 0.0625\\ \hline \end{array}

Give an error bound for the approximation

We already calculated the error bound along with the iterations but, taking into account that the number of iterations is $k = 4$, we could also have used the formula

$$c_k=\frac{b_0-a_0}{2^k}=\frac{4-3}{2^4}=\frac{1}{2^4}=\frac{1}{2^4}=\frac{1}{16} = 0.0625$$

Let's check that the error is less than the error boundary. Since the exact solution is $\alpha= 3.2143$, the absolute error is

$$e_4 = |x_4-\alpha|=|3.1875-3.2143|=0.0268$$

which is less than the error boundary, as expected.

How many iterations guarantee an error less than $10^{-8}$?

We want that

$$ e_{a}=\left|\alpha-x_{n}\right|\lt 10^{-8}. $$

Since the error (unknown) is less than the error bound (known)

$$ e_{a}=\left|\alpha-x_n\right|\lt\dfrac{b_{0}-a_{0}}{2^n}. $$

a sufficient condition for the error to be less than $10^{-8}$ is that the error bound is less than $10^{-8}$

$$ \dfrac{b_{0}-a_{0}}{2^n}\lt 10^{-8}. $$

We will work with this inequality and apply the following properties

  1. If $a\lt b$ and $c\gt 0$ $\Longrightarrow a\,c\lt b\,c$
  2. If $f$ is and strictly increasing function then, if $x\lt y\Longrightarrow f(x)\lt f(y)$
  3. $\log A^B = B \log A$

Taking into account property 1 and multiplying both members of the inequality first by $2^n$ and then $10^8$ we have

$$ \frac{4-3}{2^{n}} \lt 10^{-8} \Longleftrightarrow 1 \lt 2^n 10^{-8} \Longleftrightarrow 10^8\lt 2^{n} $$

Since $f(x)=\log(x)$ is a strictly increasing function, applying property 2 we have

$$ \log\left(10^8\right)\lt\log\left(2^{n}\right) $$

and taking into account property 3

$$ \log\left(10^8\right)\lt n\log2. $$

As $\log2 \gt 0$, applying property 1 with $c=1/\log2$

$$ \frac{\log\left(10^8\right)}{\log2}\lt n $$

$\log$ represents here any logarithm in base greater than 1. We will use, for example, natural logarithms

$$26.6\lt n$$

And if we iterate $\fbox{$n=27$}$ times, we can guarantee that the error is less than $10^{-8}.$