๐Ÿ”ข Numerical Methods Overview

A Level Maths Year 2 ยท Overview of the whole topic

Level 3 · Ages 17–18
1 The Big Idea

Numerical methods (DfE content area I) are what you do when algebra runs out. Equations such as $x^3 - x - 4 = 0$, $\mathrm{e}^{-x} = x$ or $\theta = \tfrac{\pi}{2} + \sin\theta$ have no exact solution you can write down, and integrals such as $\displaystyle\int_0^1 \mathrm{e}^{x^2}\,\mathrm{d}x$ cannot be done by any standard technique. But we can find their values to any accuracy we like.

Every numerical method is a trade: you give up an exact answer and get a process that produces better and better approximations. The skills examined are carrying out the process accurately, proving how accurate the result is, and explaining when the process fails.
The four tools in this topic
Change of sign · Fixed point iteration · The Newton-Raphson method · The trapezium rule
Calculators are essential here โ€” learn to use the Ans key for iterations and the table mode for sign checks. Put the calculator in radians whenever trigonometric functions appear. Write down enough working (each iterate, each ordinate) for an examiner to follow your method.
2 The Language You Need
WordMeaningExample
RootA solution of $\mathrm{f}(x) = 0$; where $y = \mathrm{f}(x)$ meets the $x$-axis.$\alpha \approx 1.796$ for $x^3 - x - 4 = 0$
ContinuousThe graph has no breaks, jumps or asymptotes over the range considered.Polynomials, $\mathrm{e}^x$; not $\tfrac1x$ near $0$
Change of sign$\mathrm{f}(a)$ and $\mathrm{f}(b)$ have opposite signs.$\mathrm{f}(1) = -4$, $\mathrm{f}(2) = 2$
IterationRepeatedly applying a formula to its own output.$x_{n+1} = \sqrt[3]{x_n + 4}$
Fixed pointA value with $\mathrm{g}(\alpha) = \alpha$ โ€” where $y = \mathrm{g}(x)$ meets $y = x$.$\alpha = \sqrt[3]{\alpha + 4}$
Converge / divergeThe terms approach a limit / move away without settling.$|\mathrm{g}'(\alpha)| < 1$ / $> 1$
Staircase / cobwebDiagrams showing one-sided / alternating iterations.$\mathrm{g}'(\alpha) > 0$ / $\mathrm{g}'(\alpha) < 0$
OrdinateA $y$-value used in the trapezium rule.$n$ strips use $n + 1$ ordinates
Upper / lower boundThe limits of values that round to a given answer.$1.7955$ and $1.7965$ for $1.796$
3 The Four Core Techniques
1 โ€” Change of sign
$\mathrm{f}$ continuous for $a \leqslant x \leqslant b$ and $\mathrm{f}(a)$, $\mathrm{f}(b)$ of opposite signs $\Rightarrow$ a root between $a$ and $b$
2 โ€” Fixed point iteration
$\mathrm{f}(x) = 0 \;\to\; x = \mathrm{g}(x)$,   $x_{n+1} = \mathrm{g}(x_n)$;  converges if $|\mathrm{g}'(\alpha)| < 1$
3 โ€” The Newton-Raphson method
$x_{n+1} = x_n - \dfrac{\mathrm{f}(x_n)}{\mathrm{f}'(x_n)}$;  fails if $\mathrm{f}'(x_n) = 0$ or is close to $0$
4 โ€” The trapezium rule
$\displaystyle\int_a^b y\,\mathrm{d}x \approx \frac{h}{2}\Big[y_0 + y_n + 2(y_1 + \cdots + y_{n-1})\Big]$,  $h = \dfrac{b-a}{n}$
Worked Example โ€” Three methods on one equation

$\mathrm{f}(x) = x^3 + x - 3$. (a) Show that $\mathrm{f}(x) = 0$ has a root $\alpha$ between $1$ and $2$. (b) Use $x_{n+1} = \sqrt[3]{3 - x_n}$ with $x_1 = 1$ to find $x_2$, $x_3$, $x_4$. (c) Use the Newton-Raphson method with $x_0 = 1$ to find $\alpha$ to $3$ d.p. (d) Prove your answer is correct to $3$ d.p.

โ‘ (a) $\mathrm{f}(1) = -1 < 0$, $\mathrm{f}(2) = 7 > 0$; change of sign and $\mathrm{f}$ is continuous, so $1 < \alpha < 2$.
โ‘ก(b) $x_2 = \sqrt[3]{2} = 1.2599$, $x_3 = 1.2028$, $x_4 = 1.2158$ โ€” a cobweb, closing in slowly.
โ‘ข(c) $\mathrm{f}'(x) = 3x^2 + 1$. $x_1 = 1 - \dfrac{-1}{4} = 1.25$, $x_2 = 1.21429$, $x_3 = 1.21341$, $x_4 = 1.21341$. So $\alpha \approx 1.213$.
โ‘ฃ(d) $\mathrm{f}(1.2125) = -0.00494 < 0$ and $\mathrm{f}(1.2135) = 0.00048 > 0$. Change of sign, so $1.2125 < \alpha < 1.2135$ and $\alpha = 1.213$ to $3$ d.p.
This is the typical shape of an exam question: locate with a sign change, refine with iteration or Newton-Raphson, then prove the accuracy with a sign change on the bounds.
4 The Numerical Methods Subtopics

Each part of DfE content area I, and the page that covers it.

Numerical methods lean on other topics: Newton-Raphson and the convergence test need differentiation, and judging a trapezium estimate needs concavity.
5 Common Mistakes to Avoid
No conclusion after a sign change. Two values are not an answer. Finish with "change of sign and $\mathrm{f}$ is continuous, so there is a root between $a$ and $b$."
Testing the wrong values for accuracy. To show $\alpha = 2.208$ to 3 d.p., test $2.2075$ and $2.2085$ โ€” not $2.207$ and $2.209$.
Degrees mode. Every trigonometric calculation in this topic is in radians.
Rounding iterates and re-entering them. Use the full calculator value (Ans) and round only what you write down.
Strips versus ordinates. "$6$ ordinates" means $5$ strips. Work out $h$ carefully.
Trusting a sign change across an asymptote, or assuming no sign change means no root. Sketch the graph.
6 Quick Reference

Sign change

Continuous $\mathrm{f}$, opposite signs $\Rightarrow$ a root between.

Accuracy proof

Sign change across the rounding bounds.

Fails

Asymptotes (false root); repeated or paired roots (no sign change).

Iteration

$x_{n+1} = \mathrm{g}(x_n)$ converges if $|\mathrm{g}'(\alpha)| < 1$.

Diagrams

$\mathrm{g}' > 0$ staircase; $\mathrm{g}' < 0$ cobweb.

Newton-Raphson

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

N-R fails

$\mathrm{f}'(x_n) \approx 0$: start away from stationary points.

Trapezium

$\frac h2[\text{ends} + 2 \times \text{middles}]$

Over or under

Convex: over. Concave: under.

7 Practice Questions

Ten questions drawing on the whole Numerical Methods topic. Work each one through before opening the solution.

Question 1

Show that $x^3 - 4x + 1 = 0$ has a root between $x = 1$ and $x = 2$.

โ–ถ Show solution

Let $\mathrm{f}(x) = x^3 - 4x + 1$. $\mathrm{f}(1) = -2 < 0$ and $\mathrm{f}(2) = 1 > 0$.

Change of sign and $\mathrm{f}$ is continuous, so there is a root between $1$ and $2$.

Question 2

Show that the equation $\cos x = x$ has a root between $0.7$ and $0.8$.

โ–ถ Show solution

Let $\mathrm{f}(x) = x - \cos x$ (radians).

$\mathrm{f}(0.7) = -0.0648\ldots < 0$ and $\mathrm{f}(0.8) = 0.1033\ldots > 0$.

Change of sign and $\mathrm{f}$ continuous, so there is a root with $0.7 < x < 0.8$.

Question 3

Use $x_{n+1} = 2 + \dfrac{1}{x_n}$ with $x_1 = 2$ to find $x_2$ to $x_5$. Find the exact limit.

โ–ถ Show solution

$x_2 = 2.5$, $x_3 = 2.4$, $x_4 = 2.41667$, $x_5 = 2.41379$.

The limit satisfies $\alpha = 2 + \dfrac1\alpha$, so $\alpha^2 - 2\alpha - 1 = 0$ and $\alpha = 1 \pm \sqrt2$. The terms are positive, so $\alpha = 1 + \sqrt2 = 2.41421\ldots$

The terms alternate above and below the limit โ€” a cobweb, since $\mathrm{g}'(x) = -\dfrac{1}{x^2} < 0$.

Question 4

$x^3 - 4x + 1 = 0$ has roots near $-2.11$, $0.254$ and $1.861$. It is rearranged to $x = \dfrac{x^3 + 1}{4}$. Show that the iteration $x_{n+1} = \dfrac{x_n^3 + 1}{4}$ can converge to the root near $0.254$ but not to the root near $1.861$.

โ–ถ Show solution

$\mathrm{g}'(x) = \dfrac{3x^2}{4}$.

At $0.254$: $\mathrm{g}'(\alpha) \approx 0.048$, between $-1$ and $1$, so it converges (and very quickly: from $x_1 = 0.5$ we get $0.28125,\ 0.25556,\ 0.25417, \ldots$).

At $1.861$: $\mathrm{g}'(\beta) \approx 2.60 > 1$, so it diverges from this root (from $1.9$: $1.9648,\ 2.1461,\ 2.7211, \ldots$).

Question 5

Use the Newton-Raphson method with $x_0 = 2$ to find the largest root of $x^3 - 4x + 1 = 0$ to $4$ d.p.

โ–ถ Show solution

$\mathrm{f}'(x) = 3x^2 - 4$. $x_1 = 2 - \dfrac{1}{8} = 1.875$.

$x_2 = 1.860979\ldots$, $x_3 = 1.860806\ldots$, $x_4 = 1.860806\ldots$

Root $= 1.8608$ to $4$ d.p.

Question 6

Explain why $x_0 = \dfrac{2}{\sqrt3}$ is not a suitable starting value for the Newton-Raphson method on $\mathrm{f}(x) = x^3 - 4x + 1$.

โ–ถ Show solution

$\mathrm{f}'\!\left(\tfrac{2}{\sqrt3}\right) = 3 \times \tfrac43 - 4 = 0$. This is a stationary point: the tangent is horizontal and does not meet the $x$-axis, so $x_1$ cannot be found (division by zero).

Question 7

Use the trapezium rule with $4$ strips to estimate $\displaystyle\int_0^1 2^x\,\mathrm{d}x$ to $4$ d.p.

โ–ถ Show solution

$h = 0.25$; ordinates $1,\ 1.18921,\ 1.41421,\ 1.68179,\ 2$.

$0.125\big[1 + 2 + 2(1.18921 + 1.41421 + 1.68179)\big] = 0.125 \times 11.57042 = 1.4463$.

Question 8

The exact value of the integral in Question 7 is $\dfrac{1}{\ln 2}$. Explain why the estimate is too large, and find the percentage error.

โ–ถ Show solution

$\dfrac{\mathrm{d}^2}{\mathrm{d}x^2}2^x = (\ln 2)^2\, 2^x > 0$, so the curve is convex and the chords lie above it: an overestimate.

$\dfrac{1}{\ln 2} = 1.44270$. Error $= \dfrac{1.44630 - 1.44270}{1.44270} \times 100 = 0.25\%$.

Question 9

$\mathrm{f}(x) = \dfrac{3x - 1}{x - 2}$. Show that $\mathrm{f}(1)$ and $\mathrm{f}(3)$ have opposite signs, and explain why $\mathrm{f}(x) = 0$ has no root between $1$ and $3$.

โ–ถ Show solution

$\mathrm{f}(1) = \dfrac{2}{-1} = -2$ and $\mathrm{f}(3) = \dfrac{8}{1} = 8$: opposite signs.

The only root is where the numerator is zero, $x = \tfrac13$, which is not between $1$ and $3$. The sign change is caused by the vertical asymptote $x = 2$: $\mathrm{f}$ is not continuous for $1 \leqslant x \leqslant 3$.

Question 10

$\mathrm{f}(x) = \ln x + x - 3$.

(a) Show that $\mathrm{f}(x) = 0$ has a root $\alpha$ between $2$ and $3$.
(b) Use $x_{n+1} = 3 - \ln x_n$ with $x_1 = 2$ to find $x_2$, $x_3$ and $x_4$ to $4$ d.p.
(c) Use the Newton-Raphson method with $x_0 = 2$ to find $x_1$ and $x_2$.
(d) Show that $\alpha = 2.208$ to $3$ d.p.
(e) Comment on the two methods.

โ–ถ Show solution

(a) $\mathrm{f}(2) = -0.307 < 0$, $\mathrm{f}(3) = 1.099 > 0$. Change of sign and $\mathrm{f}$ continuous for $x > 0$, so $2 < \alpha < 3$.

(b) $x_2 = 3 - \ln 2 = 2.3069$, $x_3 = 2.1641$, $x_4 = 2.2280$.

(c) $\mathrm{f}'(x) = \dfrac1x + 1$. $x_1 = 2 - \dfrac{-0.30685}{1.5} = 2.20457$, $x_2 = 2.20794$.

(d) $\mathrm{f}(2.2075) = -0.00064 < 0$ and $\mathrm{f}(2.2085) = 0.00081 > 0$. Change of sign, so $2.2075 < \alpha < 2.2085$ and $\alpha = 2.208$ to $3$ d.p.

(e) The iteration oscillates (a cobweb, as $\mathrm{g}'(x) = -\tfrac1x \approx -0.45$ near $\alpha$) and after three steps is only accurate to $1$ d.p. Newton-Raphson is correct to $4$ d.p. after two steps โ€” much faster, at the cost of needing $\mathrm{f}'(x)$.

Numerical Methods Overview · A Level Maths Year 2 · Created with MathJax