impera Open Impera

A levels Mathematics · Pure: calculus and numerical methods

Iteration and the Newton-Raphson method

1Locating roots

Many equations cannot be solved exactly. Numerical methods find approximate roots.

Change of sign: if $f(x)$ is continuous on $[a, b]$ and $f(a)$ and $f(b)$ have opposite signs, then there is at least one root between $a$ and $b$.

Worked example

Locating a root

  1. Show that $x^3 - 2x - 5 = 0$ has a root between 2 and 3.
  2. $f(2) = 8 - 4 - 5 = -1 < 0$ and $f(3) = 27 - 6 - 5 = 16 > 0$.
  3. $f$ is continuous, and there is a change of sign, so there is a root in $(2, 3)$.

To show a root is $2.09$ to 2 decimal places, check the signs at $2.085$ and $2.095$.

Check yourself

Why must f be continuous for the change of sign method?

  • A jump (like an asymptote) can change sign without a root

  • It makes the numbers in the method smaller and easier

  • Continuous functions have no roots, so the method fails

  • Because continuity is required for any integration

Show the answer

A jump (like an asymptote) can change sign without a root

y = 1/x changes sign at 0 but has no root.

2When change of sign fails

The change of sign method can fail:

  • Repeated roots or two close roots: $f(x)$ touches the axis or crosses twice, so the sign may not change over the interval.
  • Asymptotes: $f(x) = \dfrac{1}{x - 2}$ changes sign between 1 and 3 but has no root.
  • An interval that is too wide may contain several roots.
Worked example

A missed root

  1. $f(x) = (x - 1)^2$: $f(0) = 1$ and $f(2) = 1$, both positive.
  2. Yet there is a root at $x = 1$: the curve only touches the axis.
Check yourself

Which function changes sign on [1, 3] without having a root?

  • 1/(x − 2)

  • x − 2

  • x² − 4

  • (x − 2)²

Show the answer

1/(x − 2)

There is an asymptote at x = 2.

3Fixed point iteration

Rearrange $f(x) = 0$ into the form $x = g(x)$, then iterate:

$$x_{n+1} = g(x_n)$$

If the sequence converges, its limit is a root.

Worked example

Iterating

  1. $x^3 - 2x - 5 = 0$ rearranges to $x = \sqrt[3]{2x + 5}$.
  2. $x_0 = 2$: $x_1 = \sqrt[3]{9} = 2.0801$, $x_2 = 2.0924$, $x_3 = 2.0942$, $x_4 = 2.0945$.
  3. The sequence converges to about $2.0946$.

On a graph of $y = x$ and $y = g(x)$, the iterations make a staircase (when $g'$ is positive) or a cobweb (when $g'$ is negative).

Check yourself

What does x_(n+1) = g(x_n) do if it converges?

  • It finds the maximum of g

  • It gives the area under g

  • It always diverges

  • It approaches a root of x = g(x)

Show the answer

It approaches a root of x = g(x)

Its limit satisfies x = g(x).

4Convergence

Not every rearrangement works. Near the root $\alpha$, the iteration converges if

$$|g'(\alpha)| < 1$$

and diverges if $|g'(\alpha)| > 1$.

Worked example

A rearrangement that fails

  1. $x^3 - 2x - 5 = 0$ also rearranges to $x = \dfrac{x^3 - 5}{2}$.
  2. $x_0 = 2$: $x_1 = 1.5$, $x_2 = -0.8125$, $x_3 = -2.77$, $x_4 = -13.1$: it diverges.
  3. Here $g'(x) = \frac{3x^2}{2}$, and $g'(2.09) \approx 6.6 > 1$.

The smaller $|g'(\alpha)|$ is, the faster the iteration converges.

Check yourself

When does fixed point iteration converge near a root α?

  • When g(α) = 0

  • When |g'(α)| < 1

  • Always

  • When |g'(α)| > 1

Show the answer

When |g'(α)| < 1

Steep g makes the iterations move away.

5The Newton-Raphson method

Newton-Raphson uses the tangent to the curve to get closer to a root:

$$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$$

The tangent at x₀ meets the x-axis at x₁, closer to the root. Repeating gives x₂, closer again.

Each new value is where the tangent at the previous point crosses the $x$-axis.

Worked example

Newton-Raphson

  1. $f(x) = x^3 - 2x - 5$, $f'(x) = 3x^2 - 2$, $x_0 = 2$.
  2. $x_1 = 2 - \dfrac{-1}{10} = 2.1$.
  3. $x_2 = 2.1 - \dfrac{0.061}{11.23} = 2.09457$.
  4. $x_3 = 2.09455$: correct to 5 d.p. after only three steps.

Newton-Raphson usually converges much faster than fixed point iteration.

Check yourself

Where does x_(n+1) lie in Newton-Raphson?

  • Where the normal at x_n crosses the y-axis

  • At the maximum of f

  • Where the tangent at x_n crosses the x-axis

  • Halfway between x_n and the root

Show the answer

Where the tangent at x_n crosses the x-axis

The tangent approximates the curve.

6When Newton-Raphson fails

Newton-Raphson can fail when:

  • $f'(x_n) = 0$: the tangent is horizontal and never meets the axis (division by zero);
  • $f'(x_n)$ is close to zero: the next value shoots far away;
  • the starting value is near a turning point or another root: it may converge to the wrong root.
Worked example

A bad start

  1. For $f(x) = x^3 - 2x - 5$, $f'(x) = 0$ when $x = \pm 0.816$.
  2. Starting at $x_0 = 0.8$: $f'(0.8) = -0.08$, so $x_1 = 0.8 - \dfrac{-6.088}{-0.08} \approx -75.3$, far from the root.

Choose a starting value close to the root, often found by a change of sign.

Check yourself

Why does Newton-Raphson fail when f'(x_n) = 0?

  • The iteration converges much too quickly

  • The function has no roots that can be found

  • f(x_n) must also be zero at that point

  • The tangent is horizontal and never meets the x-axis

Show the answer

The tangent is horizontal and never meets the x-axis

You would divide by zero.

Now test yourself

This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.

Practise in Impera