Skip to main content

Section 7.5 Examples and questions

These are additional examples for reviewing the topic we have covered. When reading each example, try to find your own solution before clicking “Answer”. There are also questions for reviewing the concepts of this section.

For the function \(f(x) = 30x e^{10x} + 1\text{,}\) use the derivative \(f'\) determine the number of roots and find a bracketing interval for each of them. (No programming is needed.)

Solution

The derivative \(f'(x) = 30( 10x + 1) e^{10x}\) has the same sign as \(10x+1\text{.}\) Therefore, the function has a minimum at \(x = -1/10\text{.}\) Its value there is \(f(-1/10) = - 3e^{-1} + 1 = 1-3/e \lt 0 \text{.}\)

On the interval \((-\infty, -1/10)\) the function is decreasing, so there is at most one root here. Since \(f(-1) = -30e^{-10} + 1 > 0\text{,}\) there is a root with bracketing interval \([-1, -1/10]\text{.}\)

On the interval \((-1/10, \infty)\) the function is increasing, so there is at most one root here. Since \(f(0) = 1 > 0\text{,}\) there is a root with bracketing interval \([-1/10, 0]\text{.}\)

Answer: two roots, with bracketing intervals \([-1, -1/10]\) and \([-1/10, 0]\text{.}\)

Run the code in Example 7.3.3 with the following modification:

f = @(x) tan(x);
a = 1;
b = 2;

Note that \(\tan(1) \approx 1.5574 > 0\) and \(\tan(2) \approx -2.1850 \lt 0\text{,}\) so the bisection algorithm can run. What is its output, and what is wrong with it? How could this error be avoided?

Solution

The program output is “Found a root x = 1.57079632679”. But this value is not a solution of equation \(\tan x = 0\text{.}\) It is a point of discontinuity, where the tangent has vertical asymptote \(x = \pi/2\text{.}\) Because of discontinuity, the tangent function changes sign without passing through 0.

One way to avoid this error is to check whether the function has a “small” value at the root that we found, for example as follows.

x = (a+b)/2;
if abs(f(x)) < 1e-9
    fprintf('Found a root x = %.12g\n', x);
else 
    fprintf('Suspected discontinuity at x = %.12g\n', x);
end

Then the output is “Suspected discontinuity at x = 1.57079632679”

The word “bisection” means dividing something into two parts, usually equal ones. In the bisection method, an interval is divided into two equal parts, of which we keep one. This means that the length of the interval is divided by 2 at each step.

One can imagine a similar “trisection method” where an interval is divided into three equal parts, and one of them is kept. With this method, the length of the interval is divided by 3 at each step, so the interval shrinks faster. Does this make the trisection method faster than the bisection method? Why or why not?

In Example 7.5.2 we avoid mistaking discontinuity for a root by adding the check abs(f(x)) < 1e-9. What could go wrong with this approach? Think of some situation where this additional check will reject a valid solution. Could it be replaced by a better one?