Introduction
Most equations cannot be solved exactly: try or . Numerical methods find approximate answers to any accuracy you like. This topic covers locating a root by a change of sign, improving it by iteration or the Newton–Raphson method, and approximating areas with the trapezium rule. You also need to know when each method fails.
Why it matters
Every calculator, spreadsheet and engineering program solves equations numerically. When your calculator gives , it has run something very like Newton–Raphson. Weather forecasts, bridge designs and computer games all rely on these ideas.
Intuitive explanation
If a continuous graph is below the axis at one point and above it at another, it must cross the axis in between. So if and have opposite signs, there is a root between and .
From a guess , draw the tangent to the curve and see where it hits the -axis. That is the next guess. Near a root the curve looks almost straight, so each guess is much better than the last: the number of correct digits roughly doubles each step.
To solve , keep feeding the output back in. On a graph you bounce between and , forming a staircase or cobweb. It converges if is not too steep near the root: .
Formal definitions
If is continuous on and , then has at least one root in .
Rearrange as and generate from a starting value .
Notation
- (or ) is the starting value; is the th iterate.
- "Correct to 3 d.p." means you must show the true root lies in the interval , usually by a change of sign.
- is the strip width in the trapezium rule.
Key formulae
Key results
If near the root and is close enough, converges to . If it diverges. If you see a staircase; if a cobweb.
- Change of sign fails with a repeated root (the curve touches the axis), with two roots close together, or at an asymptote such as (sign change but no root).
- Newton–Raphson fails if (horizontal tangent) or diverges from a poor start.
- Trapezium rule overestimates when the curve is convex (bends upward) and underestimates when it is concave.
Deriving Newton–Raphson
The tangent at is . It meets when . That point is .
∎Each strip is approximately a trapezium of width and parallel sides and , with area . Adding all strips counts each interior ordinate twice and the end ones once.
∎Suppose on an interval around , and . By the mean value theorem there is a between and with
So : the next iterate is closer, so it is still in . By induction . As , too, so : each error is about times the last. If the errors keep their sign (a staircase); if they alternate (a cobweb).
∎Let be a root with , and . By Taylor's theorem with remainder,
for some between and . Divide by and rearrange:
Near the root the error is squared each step (times about ), so the number of correct digits roughly doubles. The formula also shows the failures: a tiny makes the step huge, and at a repeated root and the argument breaks (the convergence becomes merely linear: see Q55).
∎Take one strip and let . Integrating by parts with , :
Integrate by parts again, now with , which vanishes at both ends:
using the mean value theorem for integrals (the weight is never negative). Adding strips:
So the error is proportional to (halving quarters it), and its sign is the sign of : convex curves are overestimated.
∎Methods
To show to 3 d.p., evaluate and , show they have opposite signs, state that is continuous, and conclude the root lies in , so rounds to .
Isolate an in any convenient way. Different rearrangements behave differently: one may converge and another diverge. Check with near the root.
List values and values in a table, keep at least 4 or 5 significant figures, then apply the formula once at the end.
Examples
: and . is continuous, so there is a root between 2 and 3.
Full worked examples are in the Worked examples tab.
Common mistakes
A sign change only proves a root if the function is continuous on the interval. Say so.
Any trig function in a numerical method must be evaluated in radians.
strips need ordinates .
Keep full calculator values between iterations; round only the final answer.
Applications
- Engineering: solving equations for stresses and flows that have no closed form.
- Finance: finding an interest rate from repayments (IRR) is a root-finding problem.
- Science: areas under experimental curves (distance from a velocity–time graph) by the trapezium rule.
Connections
- Differentiation: Newton–Raphson uses .
- Integration: the trapezium rule estimates integrals that cannot be done exactly.
- Sequences: iteration is a recurrence relation.
- Further numerical methods (Further Maths): Simpson's rule, Euler's method.
Summary
- Continuous with : a root in . Watch for repeated roots and asymptotes.
- Iteration converges if near the root; staircase or cobweb diagrams.
- Newton–Raphson ; fails when .
- Trapezium rule ; over-estimates for convex curves.
Worked examples
Try each one yourself first, then open the solution.
Show that has a root between and .
Show the solution
- 1Evaluate at both ends
and .
- 2Sign change
One is negative and one is positive.
- 3Conclude
is continuous, so there is a root in .
. Explain why does not show a root in .
Show the solution
- 1Check the values
and : there is a sign change.
- 2Check continuity
has a vertical asymptote at , so it is not continuous on .
- 3Conclude
is never zero. The sign change is caused by the asymptote, not a root.
Not continuous: an asymptote at , and no root
Use with to find to 4 decimal places.
Show the solution
- 1
.
- 2
.
- 3
.
- 4Interpret
The values converge to the root of , which is to 4 d.p.
can be rearranged to or . Near the root , which iteration converges?
Show the solution
- 1First rearrangement
, at . : diverges.
- 2Second rearrangement
, . : converges.
- 3Shape
, so the diagram is a staircase.
converges (staircase)
Use the Newton–Raphson method with to find a root of to 4 decimal places.
Show the solution
- 1Formula
, so .
- 2Iterate
, , , .
- 3Conclude
The root is to 4 d.p. (Check: .)
Explain why is a bad starting value for Newton–Raphson on .
Show the solution
- 1Compute
, so .
- 2Consequence
The formula divides by : the tangent is horizontal and never meets the -axis.
: a stationary point
Use the trapezium rule with 4 strips to estimate to 3 decimal places.
Show the solution
- 1Strip width
.
- 2Table
0 0.5 1 1.5 2 1 1.11803 1.41421 1.80278 2.23607 - 3Apply the rule
.
- 4Over or under?
is convex, so this is an overestimate (true value ).
(overestimate)
University-level ideas and the deeper mathematics behind this topic. Not needed for exams, but this is where the subject really opens up.
Why a sign change finds a root, and how fast methods converge (university)
The change-of-sign rule is the intermediate value theorem (IVT). It looks obvious, but it is a genuine theorem about the real numbers.
If is continuous on and , then for some .
Let . It contains and is bounded above by , so by the completeness axiom it has a least upper bound .
- If : by continuity on some , so contains points beyond . Contradiction.
- If : by continuity on some , so is already an upper bound of , smaller than . Contradiction.
So .
∎On the rational numbers, has , yet no rational has . The IVT fails because has no rational supremum. Completeness is exactly what rules this out in .
The proof suggests an algorithm. Bisection halves the interval each time, keeping the half with a sign change (see Q49). After steps the root is pinned to an interval of width : about steps per decimal digit, slow but guaranteed for any continuous .
A sequence converges with order if for some constant .
- (with ): linear. Bisection () and fixed-point iteration ().
- : quadratic. Newton–Raphson at a simple root.
Replace in Newton–Raphson by the gradient of the chord through the last two points:
A Taylor expansion gives . Trying forces , so
the golden ratio. It is slower than Newton per step, but needs no derivative and only one new function value per step, so in practice it is often faster.
The bisection idea is in Bolzano's 1817 proof of the IVT, one of the first rigorous proofs in analysis. Before then, "a continuous curve that goes from below the axis to above it must cross it" was simply taken as obvious.
Newton–Raphson in the complex plane and in many dimensions (university)
Newton–Raphson makes sense for complex numbers: . The natural question, first asked by Arthur Cayley in 1879, is: for each starting point, which root do we end up at? The set of starting points that lead to a given root is its basin of attraction.
For , Newton–Raphson converges to from every with , and to from every with .
The iteration is . Then
Put . In terms of , Newton–Raphson is just squaring: . Now exactly when is closer to than to , i.e. . Then , which means . Symmetrically, gives , and . On the imaginary axis for ever, and the iterates never settle.
∎Cayley could not solve the cubic case , and wrote that it "presents considerable difficulty". It was only understood a century later, with computer pictures: the three basins are fractals. Every boundary point of one basin is also a boundary point of both others, so near any boundary all three colours are packed together at every scale. The real 2-cycle at for (Q58) is a glimpse of this.
To solve for , replace the tangent line by the tangent (linear) approximation , where is the Jacobian matrix of partial derivatives . Setting it to zero:
In practice one solves the linear system rather than inverting . Convergence is again quadratic near a root where is invertible.
Solve , , i.e. , with . From : , and solving gives , so . The exact solution is already close.
Applying Newton–Raphson to gives Newton's method for optimisation, (Q36 is an example). In many dimensions becomes the Hessian matrix. Training large machine-learning models uses cheaper relatives of this idea, because a Hessian with a billion rows is far too big to store.
Beyond the trapezium rule: Euler–Maclaurin, Romberg and Gauss (university)
The error formula is the first term of something much more precise.
For smooth , the trapezium estimate of satisfies
The coefficients are , where , are the Bernoulli numbers. Only even powers of appear. (The series usually diverges, but truncating it gives an excellent approximation.)
Two consequences:
If is smooth and periodic with period , then for every , so every term vanishes: the error falls faster than any power of . That is why the trapezium rule was exact for with only strips (Q57). It is the method of choice for periodic integrals, and the reason the discrete Fourier transform works so well.
Since , combine two estimates to kill the term:
This is exactly Simpson's rule (Q60). Repeat with to kill , and so on. The resulting triangle of estimates is Romberg integration: a handful of trapezium sums can give ten correct digits.
, , , . First column: . Second: . Third: . The best entries agree with to about 6 digits, from only function values.
The trapezium and Simpson rules sample at equally spaced points. Choosing the points cleverly does much better.
is exact for every cubic, using only two function values. Check: for the rule gives , matching the exact integrals. More generally, with points at the roots of the Legendre polynomial and suitable weights, the rule is exact for all polynomials of degree up to , the best possible.
No -point rule can be exact for the polynomial , of degree : the rule gives , but and is not identically zero, so .
∎Why does this work?
If is the root, the mean value theorem gives for some between them. If near , the error shrinks by a factor each step, so .
Newton–Raphson is fixed-point iteration with , and . With the error is roughly squared each step (quadratic convergence), so the number of correct digits doubles.
Beyond the syllabus
Mathematical curiosities
Run Newton–Raphson on in the complex plane and colour each starting point by which of the three cube roots it reaches. The boundaries between the colours are fractals: near every boundary point, all three colours appear.