Skip to content

← Grade 11 Mathematics

Numerical Computation

Unit 20 · Computational Methods (one option)

Hide the stories, facts, photos, activities and interactives, for revising before an exam
What this builds on from class
In this unit 4 sections
  1. 20.1 Roots of equations
  2. 20.2 Bisection method
  3. 20.3 Newton–Raphson method
  4. Exercise

Area 7 of the course is Computational Methods or Mechanics: each school teaches one. This unit and Unit 21 are Computational Methods; Units 22–23 are Mechanics.

Suppose you borrow Rs 1,00,000 for a motorbike and pay it back at Rs 4,800 a month for two years. You pay Rs 1,15,200 in all, Rs 15,200 more than you borrowed: 7.6% a year for two years, it seems. But each month you owe less, so the interest is charged on less and less. What rate is the lender really charging? The rate r a month is the one that makes the 24 payments worth the loan:
4800⋅1−(1+r)−24r=100000 4800 \cdot \frac{1 - (1 + r)^{-24}}{r} = 100000
No formula gives r. Yet a spreadsheet’s RATE function answers in a blink, “by iteration”: it guesses, checks how wrong the guess is, and guesses better. This unit is how. The answer comes at the end of 20.3. (The loan’s numbers are made up; the method is how a lender’s and a spreadsheet’s rate is found.)

20.1 Roots of equations

A root of the equation f(x) = 0 is a number that makes it true; on the graph of y = f(x), it is where the curve meets the X-axis.

An equation is algebraic if f(x) is a polynomial, such as x3−2x−5=0 x^3 - 2x - 5 = 0 (or can be made one, as x=x−2 \sqrt{x} = x - 2 can by squaring). It is transcendental if it has a trigonometric, exponential or logarithmic function of x in it, such as x =  cos x, e−x=x e^{-x} = x or xlog⁡10x=1.2 x\log_{10} x = 1.2 .

Quadratics have a formula, and cubics and quartics have long ones. But in 1824 Niels Abel proved that no formula of roots and the four operations solves every equation of degree 5 or more, and a transcendental equation such as x =  cos x has no formula at all. So we find roots numerically: a rough value first, then a rule that makes it better, step by step, until it is as accurate as we need. Each step is an iteration.

Locating a root

The first job is a rough place. Unit 17 gave the tool, the intermediate value theorem: if f is continuous on [a, b], and f(a) and f(b) have opposite signs, then f(x) = 0 at least once between a and b. An unbroken curve can’t get from below the axis to above it without crossing.

Approximate error

A method gives approximations x₁, x₂, x₃, … to a root α. The error of xn x_n is α−xn \alpha - x_n ; its size ∣α−xn∣ |\alpha - x_n| is the absolute error, and ∣α−xnα∣ \left| \frac{\alpha - x_n}{\alpha} \right| the relative error (× 100 for a percentage error).

But we don’t know α: that is what we are looking for. So we judge a step by how much it changed the answer. The approximate error of xn+1 x_{n+1} is
Ea=∣xn+1−xn∣,and the relative approximate error is εa=∣xn+1−xnxn+1∣×100% E_a = |x_{n+1} - x_n|, \qquad \text{and the relative approximate error is } \varepsilon_a = \left| \frac{x_{n+1} - x_n}{x_{n+1}} \right| \times 100\%
When the steps close in on the root, a small change means we are close. We stop when Ea E_a (or εa \varepsilon_a ) is below a set tolerance, or, for “correct to k decimal places”, when two successive values agree to k places.

Two successive approximations to a root are 2.7465 and 2.7406. The relative approximate error of the second is about:

Pick an answer to see why.

20.2 Bisection method

Example 1 trapped the root of x =  cos x in (0, 1). Cut the interval in half: the root is in one half, and the signs say which. Cut that half in half, and so on. Each cut halves the trap. That is the bisection method (bisect: cut in two).

The steps. Start with a, b where f(a) and f(b) have opposite signs.

  1. Find the midpoint c=a+b2 c = \frac{a + b}{2} and f(c).
  2. If f(c) = 0, c is the root. Otherwise, if f(a) and f(c) have opposite signs, the root is in [a, c]: put b = c. If not, it is in [c, b]: put a = c.
  3. Repeat with the new [a, b]. For “correct to k decimal places”, stop when a and b round to the same k places: the root between them rounds the same way.

The error of bisection

The root α is always inside the interval. The first midpoint c₁ is at most half the interval, b−a2 \frac{b - a}{2} , from it, and each step halves that. So after n steps
∣α−cn∣≤b−a2n |\alpha - c_n| \le \frac{b - a}{2^n}
This bound is known before you start: to make the error less than a tolerance E, you need b−a2n<E \frac{b - a}{2^n} < E , that is 2n>b−aE 2^n > \frac{b - a}{E} . From an interval of width 1, an error below 0.001 needs 2n>1000 2^n > 1000 : n = 10 steps (210=1024 2^{10} = 1024 ). Its approximate error is fixed too: ∣cn+1−cn∣=b−a2n+1 |c_{n+1} - c_n| = \frac{b - a}{2^{n+1}} , half the bound.

To find the root of x3+x−3=0 x^3 + x - 3 = 0 by bisection, which interval should you start with?

Pick an answer to see why.

20.3 Newton–Raphson method

Bisection uses only the signs of f. Newton–Raphson uses its slope too. Near a root, a smooth curve looks almost like its tangent, and the tangent’s root is easy to find. So follow the tangent down to the X-axis, and take where it lands as the next guess.

The formula. Let x₀ be a guess near a root of f(x) = 0.

  1. The tangent at P(x₀, f(x₀)) has slope f′(x₀) Grade 11: Unit 18, 18.6.
  2. So its equation is y − f(x₀) = f′(x₀)(x − x₀) (the line through a point with a given slope).
  3. It meets the X-axis where y = 0: −f(x₀) = f′(x₀)(x − x₀).
  4. If f′(x₀) ≠ 0, divide: x=x0−f(x0)f′(x0) x = x_0 - \dfrac{f(x_0)}{f'(x_0)} . Call that x₁, and repeat from it:

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

Try it

Follow the tangents to the root

Pick an equation and a start, then Step. Try the third from 0.

−1123−112XYOx0​
nxnf(xn)|xn − xn−1|
01.0000000.4597

Press Step: the tangent’s foot on the X-axis is the next guess.

When Newton–Raphson fails

Bisection never fails once a root is trapped. Newton–Raphson can:

  • A flat tangent. If f′(xn)=0 f'(x_n) = 0 , the tangent is parallel to the X-axis and never meets it: the formula divides by zero. Near such a point the tangent is almost flat, and the next guess is thrown far away.
  • A cycle. For x3−2x+2=0 x^3 - 2x + 2 = 0 from x₀ = 0, the guesses go 0, 1, 0, 1, … for ever (short question 4 shows why), though there is a root near −1.77.
  • Running away. For tan⁡−1x=0 \tan^{-1} x = 0 (root 0) from x₀ = 1.5, the guesses are −1.69, 2.32, −5.11, 32.3: each tangent lands farther out. From x₀ = 1 they close in (−0.571, 0.117, −0.001).

So start close: locate the root first with a sign change, and if the guesses jump about, go back to bisection for a few steps. A flat or near-flat start, or a root next to a turning point, is a bad start.

Running it on a computer

Both methods are a few lines of a program (Python, on this page) or a spreadsheet. In a spreadsheet, put 1 in A1, then in A2 =A1-(A1-COS(A1))/(1+SIN(A1)), and fill it down: each row is the next guess (spreadsheets use radians).

from math import cos, sin def f(x):    return x - cos(x) def df(x):    return 1 + sin(x) # Bisection on [0, 1]: f(0) < 0 < f(1)a, b = 0, 1for n in range<span class="lm-pt">(1, 21)</span>:    c = (a + b) / 2    if f(a) * f(c) < 0:        b = c    else:        a = cprint("Bisection, 20 steps:", c, "error at most", 1 / 2**20) # Newton-Raphson from x0 = 1, until two values agree to 1e-10x = 1for n in range<span class="lm-pt">(1, 21)</span>:    new = x - f(x) / df(x)    print(n, new, abs(new - x))    if abs(new - x) < 1e-10:        break    x = new

Twenty halvings give 0.7390852 (error under 0.000001); Newton–Raphson gives 0.7390851332151607 in five.

Back to the loan

Exercise

Choose the correct option

The bisection method can be started on [a, b] when f is continuous there and:

Pick an answer to see why.

The Newton–Raphson formula is:

Pick an answer to see why.

Which of these equations is transcendental?

Pick an answer to see why.

Bisection for x3−x−1=0 x^3 - x - 1 = 0 starts on [1, 2]. After the first step the root is in:

Pick an answer to see why.

Newton–Raphson for f(x) = 0 fails at a step where:

Pick an answer to see why.

Two successive Newton–Raphson values are x₃ = 1.41422 and x₄ = 1.41421. The approximate error of x₄ is:

Pick an answer to see why.

After 5 steps of bisection that started on [2, 3], the error of the midpoint is at most:

Pick an answer to see why.

One step of Newton–Raphson for x2−5=0 x^2 - 5 = 0 from x₀ = 2 gives:

Pick an answer to see why.

To find a root trapped in [0, 1] with error less than 0.01, bisection needs at least:

Pick an answer to see why.

Newton–Raphson applied to f(x)=1x−a f(x) = \frac{1}{x} - a (a > 0) gives the rule:

Pick an answer to see why.

Bisection is used on tan x = 0 with [1, 2] (tan 1 > 0, tan 2 < 0). The midpoints close in on:

Pick an answer to see why.

Short questions

1.

Show that x3−4x−7=0 x^3 - 4x - 7 = 0 has a root between 2 and 3, and find it correct to two decimal places by bisection. (5 marks)

Hint
Answer
2.

Find the root of xlog⁡10x=1.2 x\log_{10} x = 1.2 correct to four decimal places by Newton–Raphson, starting from x₀ = 2.5. (5 marks)

Hint
Answer
3.
  • a.Show that Newton–Raphson for N3 \sqrt[3]{N} is xn+1=13(2xn+Nxn2) x_{n+1} = \dfrac{1}{3}\left( 2x_n + \dfrac{N}{x_n^2} \right) . (2 marks)
  • b.Use it to find 173 \sqrt[3]{17} correct to four decimal places, from x₀ = 2.5. (3 marks)
Answer
4.

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

  • a.Show that Newton–Raphson from x₀ = 0 never reaches a root. (2 marks)
  • b.Find the root correct to three decimal places, starting from x₀ = −2. (3 marks)
Answer
5.
  • a.An interval of width 1 traps a root. How many bisection steps make the error less than 0.00005 (four decimal places)? (2 marks)
  • b.Newton–Raphson for e−x=x e^{-x} = x from x₀ = 0.5 gives 0.566311, 0.567143, 0.567143. Find the approximate error and the relative approximate error of each step, and say which method you would use and why. (3 marks)
Answer

Long question

NEB’s grid gives this area no long question; this one joins the unit’s methods for practice.

6.

The equation 3x −  cos x − 1 = 0 (x in radians).

  • a.Show that it has a root in (0, 1). (1 mark)
  • b.Do four steps of bisection, and give the interval the root is in and the greatest possible error. (3 marks)
  • c.Find the root correct to four decimal places by Newton–Raphson from x₀ = 0.5. (3 marks)
  • d.Compare the two methods’ approximate errors. (1 mark)
Answer

Project work

Where these facts come from
  • Excel’s RATE function “is calculated by iteration”, and gives up with #NUM! if successive results don’t agree within 0.0000001 after 20 iterations (the opening, Example 4): Microsoft Support, “RATE function”, read November 2026.
  • Newton’s example x3−2x−5=0 x^3 - 2x - 5 = 0 in the Method of Fluxions (written 1671, printed 1736); Raphson’s Analysis aequationum universalis (1690) and the Royal Society’s minutes of 17 December 1690, “doubles the known figures of the Root” (20.3): MacTutor, “Joseph Raphson”; Simpson’s general form (1740), and the cycle of x3−2x+2 x^3 - 2x + 2 from 0: Wikipedia, “Newton’s method”, History and Oscillatory behavior, read November 2026.
  • Abel’s proof (1824) that equations of degree five and more have no general formula in radicals (20.1): MacTutor, “Niels Henrik Abel”.
  • The methods and their errors checked against OpenStax, Calculus Volume 1, 4.9 “Newton’s Method”, which lists the flat tangent and the cycle of x3−2x+2 x^3 - 2x + 2 from 0 (CC BY 4.0); the run-away of tan⁡−1x \tan^{-1} x is our own working.
  • The unit’s items and project work: CDC, Secondary Education Curriculum 2078, Mathematics, Grades 11–12, 7.1 and sample project 16; the marks: CDC, Specification Grid 2078, Mathematics, Grade 11.

Found a mistake? Please tell us.