Year 2 Pure · Chapter 14

Numerical Methods

Specification: Edexcel Pure 9.1–9.5 — Numerical methods  ·  AQA section I1–I4

In this chapter
  1. 1. Locating roots by a change of sign
  2. 2. Iteration
  3. 3. The Newton–Raphson method
  4. 4. The trapezium rule
  5. Practice

Key facts — this chapter

  • If ff is continuous on [a,b][a, b] and f(a)f(a) and f(b)f(b) have opposite signs, then f(x)=0f(x) = 0 has a root between aa and bb.
  • A change of sign can mislead: an asymptote gives a sign change with no root, and a repeated root or two close roots can give none.
  • Iteration: rearrange f(x)=0f(x) = 0 as x=g(x)x = g(x) and use xn+1=g(xn)x_{n+1} = g(x_n). The steps make a staircase or a cobweb, and some rearrangements diverge.
  • Newton–Raphson: xn+1=xn−f(xn)f′(xn)x_{n+1} = x_n - \dfrac{f(x_n)}{f'(x_n)}. It is fast, but fails if f′(xn)=0f'(x_n) = 0 and can jump to another root if f′(xn)f'(x_n) is small.
  • Trapezium rule: ∫aby dx≈h2[y0+2(y1+⋯+yn−1)+yn]\displaystyle\int_a^b y\,dx \approx \tfrac{h}{2}\big[y_0 + 2(y_1 + \dots + y_{n-1}) + y_n\big], with h=b−anh = \frac{b - a}{n}.
  • It overestimates where the curve is convex and underestimates where it is concave.

Most equations can’t be solved exactly. x3−2x−5=0x^3 - 2x - 5 = 0 has one real root, and no rearranging will produce a neat formula for it. Numerical methods find such roots, and the areas under curves you can’t integrate, to any accuracy you need: each step gets closer, and you stop when the answer is good enough.

1. Locating roots by a change of sign

Key result

If f(x)f(x) is continuous on the interval [a,b][a, b], and f(a)f(a) and f(b)f(b) have opposite signs, then there is at least one root of f(x)=0f(x) = 0 between aa and bb.

The graph of a continuous function has no gaps, so to get from below the axis to above it, it has to cross the axis somewhere in between.

Worked example 14.1 · Locating and refining a root

Show that x3−2x−5=0x^3 - 2x - 5 = 0 has a root between 22 and 33, and show that it is 2.092.09 to 2 decimal places.


  1. Let f(x)=x3−2x−5f(x) = x^3 - 2x - 5. Then f(2)=−1<0f(2) = -1 < 0 and f(3)=16>0f(3) = 16 > 0. ff is a polynomial, so it is continuous, and the change of sign shows there is a root between 22 and 33.

  2. To show the root is 2.092.09 to 2 d.p., test either side of the interval that rounds to 2.092.09:

    f(2.085)=−0.106 (3 s.f.)<0f(2.095)=0.00501 (3 s.f.)>0\begin{aligned} f(2.085) &= -0.106 \text{ (3 s.f.)} < 0 \\ f(2.095) &= 0.00501 \text{ (3 s.f.)} > 0 \end{aligned}
  3. There is a change of sign, so the root lies between 2.0852.085 and 2.0952.095, and is 2.092.09 to 2 decimal places.

Three graphs showing how a change of sign can mislead. Left: a curve with an asymptote at x = 2, negative just left of it and positive just right, but no root. Middle: a curve that just touches the axis at a repeated root, with no change of sign. Right: a curve that crosses the axis twice between a and b, so f(a) and f(b) have the same sign
Three ways a change of sign misleads: an asymptote (left), a repeated root (middle) and two roots in one interval (right).

Common mistake

Check that the function is continuous on the interval. f(x)=1x−2f(x) = \frac{1}{x - 2} changes sign between 11 and 33, but has no root there: the sign change comes from the asymptote at x=2x = 2.

2. Iteration

To solve f(x)=0f(x) = 0 by iteration, rearrange it into the form x=g(x)x = g(x), pick a starting value x0x_0, and use the rule over and over:

Key result

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

If the values settle down, they settle on a root, where the line y=xy = x meets the curve y=g(x)y = g(x). On a diagram the steps form a staircase when they approach the root from one side, and a cobweb when they spiral round it.

Worked example 14.2 · A rearrangement that works

Use the iteration xn+1=2xn+53x_{n+1} = \sqrt[3]{2x_n + 5} with x0=2x_0 = 2 to find the root of x3−2x−5=0x^3 - 2x - 5 = 0.


  1. x3=2x+5x^3 = 2x + 5, so the root satisfies x=2x+53x = \sqrt[3]{2x + 5}.

  2. Iterate, keeping the calculator’s full value each time:

    x1=93=2.0801x2=2.0924x3=2.0942x4=2.0945\begin{aligned} x_1 &= \sqrt[3]{9} = 2.0801 \\ x_2 &= 2.0924 \\ x_3 &= 2.0942 \\ x_4 &= 2.0945 \end{aligned}

    (all to 4 d.p.).

  3. The values climb steadily and settle, so the root is 2.092.09 to 2 decimal places, agreeing with Example 14.1.

Left: a staircase diagram for x = 3 ln x, with steps climbing between the curve and the line y = x towards the root. Right: a cobweb diagram for x = cos x, with the path spiralling in towards the root
A staircase for x = 3 ln x (left) and a cobweb for x = cos x (right). Both close in on the root where the curve meets y = x.

Worked example 14.3 · A rearrangement that fails

Show that the rearrangement xn+1=xn3−52x_{n+1} = \dfrac{x_n^3 - 5}{2} of the same equation does not find the root, starting from x0=2x_0 = 2.


  1. Iterate: x1=1.5x_1 = 1.5, x2=−0.8125x_2 = -0.8125, x3=−2.768x_3 = -2.768, x4=−13.11x_4 = -13.11 (4 s.f.).

  2. The values run further and further from the root at about 2.092.09: this iteration diverges.

Which rearrangements work

Near the root, each step multiplies the error by about g′(x)g'(x). So the iteration closes in when ∣g′(x)∣<1|g'(x)| < 1 near the root, and moves away when ∣g′(x)∣>1|g'(x)| > 1. At the root, g(x)=2x+53g(x) = \sqrt[3]{2x + 5} has g′(x)≈0.15g'(x) \approx 0.15, but g(x)=x3−52g(x) = \frac{x^3 - 5}{2} has g′(x)=3x22≈6.6g'(x) = \frac{3x^2}{2} \approx 6.6. A positive g′g' gives a staircase, and a negative one gives a cobweb.

Choose a method and a starting value, then add steps. Iteration bounces between the curve and the line y = x; Newton–Raphson slides down tangents to the axis. Some choices close in on the root, and some don't.

3. The Newton–Raphson method

Newton–Raphson follows the tangent. From a point on the curve, slide down the tangent to where it meets the xx-axis. That is usually much closer to the root, so repeat from there.

Key result

xn+1=xn−f(xn)f′(xn)x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}

The tangent at (xn,f(xn))\big(x_n, f(x_n)\big) has gradient f′(xn)f'(x_n), so it meets the axis after a horizontal distance of f(xn)f′(xn)\frac{f(x_n)}{f'(x_n)}.

The curve y = x cubed minus 2x minus 5 near its root. From x0 = 3, the tangent to the curve meets the x-axis at x1, and the tangent there meets the axis at x2, already very close to the root
Newton–Raphson for y = x³ − 2x − 5, starting from x₀ = 3: each tangent lands closer to the root.

Worked example 14.4 · Newton–Raphson

Use the Newton–Raphson method with x0=2x_0 = 2 to find the root of x3−2x−5=0x^3 - 2x - 5 = 0 to 6 decimal places.


  1. f(x)=x3−2x−5f(x) = x^3 - 2x - 5 and f′(x)=3x2−2f'(x) = 3x^2 - 2, so

    xn+1=xn−xn3−2xn−53xn2−2x_{n+1} = x_n - \frac{x_n^3 - 2x_n - 5}{3x_n^2 - 2}
  2. x1=2−−110=2.1x_1 = 2 - \tfrac{-1}{10} = 2.1, then x2=2.094568x_2 = 2.094568 and x3=2.094551x_3 = 2.094551 (6 d.p.).

  3. x4=2.094551x_4 = 2.094551 too, so the root is 2.0945512.094551 to 6 decimal places.

The number of correct digits roughly doubles at each step, far faster than the iteration in Example 14.2.

Common mistake

Newton–Raphson fails if f′(xn)=0f'(x_n) = 0: the tangent is horizontal and never meets the axis. For f(x)=x3−3x+1f(x) = x^3 - 3x + 1, starting at x0=1x_0 = 1 gives f′(1)=0f'(1) = 0. A start near a stationary point is almost as bad: the tangent is nearly flat, so the next value lands far away, perhaps near a different root.

4. The trapezium rule

To estimate ∫aby dx\int_a^b y\,dx, split the area into nn strips of width hh and treat each strip as a trapezium.

Key result

With h=b−anh = \dfrac{b - a}{n} and y0,y1,…,yny_0, y_1, \dots, y_n the heights at the n+1n + 1 equally spaced xx-values,

∫aby dx≈h2[y0+2(y1+⋯+yn−1)+yn]\begin{aligned} \int_a^b y\,dx \approx \frac{h}{2}\big[&y_0 + 2(y_1 + \dots + y_{n-1}) \\ &+ y_n\big] \end{aligned}

The first and last heights are counted once and the rest twice, because each inner height is shared by two trapezia. More strips give a better estimate.

Worked example 14.5 · Estimating an area

Use the trapezium rule with 44 strips to estimate ∫13ln⁡x dx\displaystyle\int_1^3 \ln x\,dx. State whether it is an overestimate or an underestimate.


h=3−14=0.5h = \frac{3 - 1}{4} = 0.5, so the heights are at x=1,1.5,2,2.5,3x = 1, 1.5, 2, 2.5, 3:

xxln⁡x\ln x
1100
1.51.50.4054650.405465
220.6931470.693147
2.52.50.9162910.916291
331.0986121.098612

Apply the rule:

0.52[0+2(0.405465+0.693147+0.916291)+1.098612]=1.2821 (4 d.p.)\begin{aligned} &\tfrac{0.5}{2}\big[0 + 2(0.405465 + 0.693147 \\ &\qquad + 0.916291) + 1.098612\big] \\ &= 1.2821 \text{ (4 d.p.)} \end{aligned}

y=ln⁡xy = \ln x is concave, so each trapezium’s slanted top lies below the curve, and 1.28211.2821 is an underestimate. The exact value, found by a method in Chapter 15, is 3ln⁡3−2=1.29583\ln 3 - 2 = 1.2958 (4 d.p.).

The curve y = ln x from x = 1 to 3 with four trapezia under it. Their slanted tops lie just below the curve, because the curve is concave
Four trapezia under y = ln x. The curve is concave, so the trapezia miss a sliver of area and underestimate the integral.

Over or under?

  • Where the curve is convex, the tops of the trapezia lie above it, so the rule overestimates.
  • Where the curve is concave, they lie below it, so the rule underestimates.

Practice

Twelve questions in three tiers. Try each one properly before opening the solution — the solutions show full method, not just answers.

Warm-up

1 [2 marks]

Show that ex−3x=0e^x - 3x = 0 has a root between x=1x = 1 and x=2x = 2.

Show solution

Let f(x)=ex−3xf(x) = e^x - 3x. Then f(1)=e−3=−0.282<0f(1) = e - 3 = -0.282 < 0 and f(2)=e2−6=1.39>0f(2) = e^2 - 6 = 1.39 > 0 (3 s.f.). ff is continuous, so the change of sign shows there is a root between 11 and 22.

2 [2 marks]

tan⁡1>0\tan 1 > 0 and tan⁡2<0\tan 2 < 0. Explain why this does not show that tan⁡x=0\tan x = 0 has a root between 11 and 22.

Show solution

tan⁡x\tan x is not continuous on [1,2][1, 2]: it has an asymptote at x=π2≈1.57x = \tfrac{\pi}{2} \approx 1.57. The change of sign comes from the asymptote, not a root.

3 [2 marks]

Use the iteration xn+1=xn+3x_{n+1} = \sqrt{x_n + 3} with x0=2x_0 = 2 to find x1x_1, x2x_2 and x3x_3 to 4 decimal places.

Show solution

x1=5=2.2361x_1 = \sqrt5 = 2.2361, x2=2.2882x_2 = 2.2882 and x3=2.2996x_3 = 2.2996 (4 d.p.), keeping full calculator values between steps.

4 [3 marks]

Use the trapezium rule with 44 strips to estimate ∫02x2 dx\displaystyle\int_0^2 x^2\,dx. State whether your answer is an overestimate or an underestimate, and explain why.

Show solution

h=0.5h = 0.5, and the heights at x=0,0.5,1,1.5,2x = 0, 0.5, 1, 1.5, 2 are 0,0.25,1,2.25,40, 0.25, 1, 2.25, 4:

0.52[0+2(0.25+1+2.25)+4]=0.25×11=2.75\begin{aligned} &\tfrac{0.5}{2}\big[0 + 2(0.25 + 1 + 2.25) + 4\big] \\ &= 0.25 \times 11 = 2.75 \end{aligned}

y=x2y = x^2 is convex, so the trapezia lie above the curve and 2.752.75 is an overestimate. (The exact value is 83\tfrac{8}{3}.)

Standard

5 [4 marks]
  1. Show that x3+x−3=0x^3 + x - 3 = 0 has a root α\alpha between 11 and 22. [2]
  2. Show that α=1.21\alpha = 1.21 to 2 decimal places. [2]
Show solution

(a) Let f(x)=x3+x−3f(x) = x^3 + x - 3. f(1)=−1<0f(1) = -1 < 0 and f(2)=7>0f(2) = 7 > 0. ff is continuous, so there is a root between 11 and 22.

(b) f(1.205)=−0.0453<0f(1.205) = -0.0453 < 0 and f(1.215)=0.00861>0f(1.215) = 0.00861 > 0 (3 s.f.). The change of sign shows 1.205<α<1.2151.205 < \alpha < 1.215, so α=1.21\alpha = 1.21 to 2 decimal places.

6 [4 marks]

Use the Newton–Raphson method with x0=1x_0 = 1 to find the root of x3+x−3=0x^3 + x - 3 = 0 to 4 decimal places.

Show solution

f(x)=x3+x−3f(x) = x^3 + x - 3 and f′(x)=3x2+1f'(x) = 3x^2 + 1, so

xn+1=xn−xn3+xn−33xn2+1x_{n+1} = x_n - \frac{x_n^3 + x_n - 3}{3x_n^2 + 1}

x1=1−−14=1.25x_1 = 1 - \tfrac{-1}{4} = 1.25, x2=1.2143x_2 = 1.2143, x3=1.2134x_3 = 1.2134 and x4=1.2134x_4 = 1.2134 (4 d.p.). So the root is 1.21341.2134 to 4 decimal places.

7 [5 marks]
  1. Show that x3+x−3=0x^3 + x - 3 = 0 can be written as x=3−x3x = \sqrt[3]{3 - x}. [1]
  2. Use xn+1=3−xn3x_{n+1} = \sqrt[3]{3 - x_n} with x0=1x_0 = 1 to find x1x_1 to x4x_4, to 4 decimal places. [2]
  3. Say whether the iteration makes a staircase or a cobweb diagram, and why. [2]
Show solution

(a) x3=3−xx^3 = 3 - x, so x=3−x3x = \sqrt[3]{3 - x}.

(b) x1=1.2599x_1 = 1.2599, x2=1.2028x_2 = 1.2028, x3=1.2158x_3 = 1.2158, x4=1.2129x_4 = 1.2129 (4 d.p.).

(c) A cobweb: the values go above and below the root in turn, closing in from alternate sides.

8 [5 marks]
  1. Use the trapezium rule with 44 strips to estimate ∫011+x2 dx\displaystyle\int_0^1 \sqrt{1 + x^2}\,dx, to 4 decimal places. [3]
  2. Given that d2dx21+x2=(1+x2)−32\dfrac{d^2}{dx^2}\sqrt{1 + x^2} = (1 + x^2)^{-\frac{3}{2}}, state whether your estimate is too big or too small. [2]
Show solution

(a) h=0.25h = 0.25. The heights at x=0,0.25,0.5,0.75,1x = 0, 0.25, 0.5, 0.75, 1 are 11, 1.0307761.030776, 1.1180341.118034, 1.251.25 and 1.4142141.414214, so the estimate is

0.252[1+2(1.030776+1.118034+1.25)+1.414214]=1.1515 (4 d.p.)\begin{aligned} &\tfrac{0.25}{2}\big[1 + 2(1.030776 + 1.118034 \\ &\qquad + 1.25) + 1.414214\big] \\ &= 1.1515 \text{ (4 d.p.)} \end{aligned}

(b) The second derivative is positive, so the curve is convex and the estimate is too big.

9 [4 marks]

f(x)=x3−3x+1f(x) = x^3 - 3x + 1.

  1. Explain why the Newton–Raphson method fails with x0=1x_0 = 1. [2]
  2. Using x0=0.9x_0 = 0.9, find x1x_1, and comment on your answer. [2]
Show solution

(a) f′(x)=3x2−3f'(x) = 3x^2 - 3, so f′(1)=0f'(1) = 0. The formula would divide by zero: the tangent at x=1x = 1 is horizontal and never meets the xx-axis.

(b) f(0.9)=−0.971f(0.9) = -0.971 and f′(0.9)=−0.57f'(0.9) = -0.57, so

x1=0.9−−0.971−0.57=−0.804 (3 s.f.)x_1 = 0.9 - \frac{-0.971}{-0.57} = -0.804 \text{ (3 s.f.)}

The tangent is nearly flat, so x1x_1 lands far away, past the root near 0.350.35 and nowhere near the one near 1.531.53.

Exam style

10 [7 marks]

A town’s population tt years from now is modelled by 200e0.1t200e^{0.1t} thousand, and the number of homes it can support by 800+50t800 + 50t thousand. Let f(t)=200e0.1t−50t−800f(t) = 200e^{0.1t} - 50t - 800.

  1. Show that f(t)=0f(t) = 0 has a root between t=20t = 20 and t=25t = 25. [2]
  2. Use the Newton–Raphson method with t0=22t_0 = 22 to find this root to 2 decimal places. [4]
  3. Interpret your answer. [1]
Show solution

(a) f(20)=−322f(20) = -322 and f(25)=386f(25) = 386 (3 s.f.). ff is continuous, so there is a root between 2020 and 2525.

(b) f′(t)=20e0.1t−50f'(t) = 20e^{0.1t} - 50, so

tn+1=tn−200e0.1tn−50tn−80020e0.1tn−50t_{n+1} = t_n - \frac{200e^{0.1t_n} - 50t_n - 800}{20e^{0.1t_n} - 50}

t1=22.7279t_1 = 22.7279, t2=22.6939t_2 = 22.6939 and t3=22.6939t_3 = 22.6939 (4 d.p.), so the root is 22.6922.69 to 2 decimal places.

(c) After about 22.722.7 years the population outgrows the homes available.

11 [7 marks]

x2−5x+3=0x^2 - 5x + 3 = 0 has two roots, near 0.700.70 and 4.304.30.

  1. Show that the equation can be written as x=x2+35x = \dfrac{x^2 + 3}{5} and as x=5−3xx = 5 - \dfrac{3}{x}. [2]
  2. Starting from x0=1x_0 = 1, find x1x_1, x2x_2 and x3x_3 for each rearrangement, to 4 decimal places. [3]
  3. Explain why the two iterations lead to different roots. [2]
Show solution

(a) 5x=x2+35x = x^2 + 3, so x=x2+35x = \dfrac{x^2 + 3}{5}. Dividing x2=5x−3x^2 = 5x - 3 by xx gives x=5−3xx = 5 - \dfrac{3}{x}.

(b) The first gives 0.80.8, 0.7280.728, 0.70600.7060 (4 d.p.), heading for the root near 0.700.70. The second gives 22, 3.53.5, 4.14294.1429 (4 d.p.), heading for the root near 4.304.30.

(c) An iteration closes in on a root where ∣g′(x)∣<1|g'(x)| < 1. For g(x)=x2+35g(x) = \frac{x^2 + 3}{5}, g′(x)=2x5g'(x) = \frac{2x}{5}, which is about 0.280.28 at the small root but 1.71.7 at the large one. For g(x)=5−3xg(x) = 5 - \frac{3}{x}, g′(x)=3x2g'(x) = \frac{3}{x^2}, about 6.26.2 at the small root but 0.160.16 at the large one. So each iteration can only find one of the roots.

12 [7 marks]
  1. Use the trapezium rule with 44 strips to estimate ∫121x dx\displaystyle\int_1^2 \frac{1}{x}\,dx, to 4 decimal places. [3]
  2. Given that the exact value is ln⁡2\ln 2, find the percentage error in your estimate. [2]
  3. Explain why the estimate is too big, and say how it could be improved. [2]
Show solution

(a) h=0.25h = 0.25. The heights at x=1,1.25,1.5,1.75,2x = 1, 1.25, 1.5, 1.75, 2 are 11, 0.80.8, 0.6666670.666667, 0.5714290.571429 and 0.50.5:

0.252[1+2(0.8+0.666667+0.571429)+0.5]=0.6970 (4 d.p.)\begin{aligned} &\tfrac{0.25}{2}\big[1 + 2(0.8 + 0.666667 \\ &\qquad + 0.571429) + 0.5\big] \\ &= 0.6970 \text{ (4 d.p.)} \end{aligned}

(b) ln⁡2=0.693147…\ln 2 = 0.693147\ldots, so the percentage error is

0.697024−0.6931470.693147×100=0.56%\frac{0.697024 - 0.693147}{0.693147} \times 100 = 0.56\%

to 2 significant figures.

(c) y=1xy = \frac{1}{x} is convex for x>0x > 0, so the trapezia lie above the curve. More, narrower strips would give a better estimate.