You are on page 1of 35

A-Level Maths:

Core 3
for Edexcel

C3.7 Numerical
methods
This icon indicates the slide contains activities created in Flash. These activities are not editable.
For more detailed instructions, see the Getting Started presentation.

1 of 35 © Boardworks Ltd 2006


Contents Using graphs to solve equations

Using graphs to solve equations


The change-of-sign rule
Solving equations by iteration
Examination-style question

2 of 35 © Boardworks Ltd 2006


Using graphs to solve equations

Most of the equations we have looked at so far have had exact


solutions (or roots) that could be found using a series of
algebraic manipulations.

However, this is not true of all equations. For example:

x3 + 5x – 3 = 0, ex = x – 2, sin x = ln x + 1

cannot be solved exactly by any obvious algebraic method.


The first step in solving most equations of this type is to sketch
a graph.

The graph will tell us how many roots there are and their
approximate locations.

3 of 35 © Boardworks Ltd 2006


Using graphs to solve equations

By sketching an appropriate graph find approximate roots to


the equation x3 = 3x + 1.

There are two ways to approach this.


The first is to consider the left-hand side and the right-hand
side of the equation as two separate functions.

x3 = 3x + 1

y = x3 y = 3x + 1
The points where these two functions intersect will give us the
roots to the equation x3 = 3x + 1.

4 of 35 © Boardworks Ltd 2006


Using graphs to solve equations

10 The graphs of
y=x 3
y = x3 and y = 3x + 1
8
y = 3x + 1 intersect at three points.
6 This means that the
4 equation x3 = 3x + 1 has
three solutions.
2
The graph shows that
–4 –3 –2 –1 0 1 2 3 4
these solutions are
–2 approximately:
x = –1.5
–4
x = –0.3
–6
x = 1.9

5 of 35 © Boardworks Ltd 2006


Using graphs to solve equations

The second approach is to rearrange the equation so that all


the terms are on the left-hand side:

x3 – 3x – 1 = 0

y = x3 – 3x – 1 y=0

The line y = 0 is the x-axis. This means that the roots to the
equation x3 – 3x – 1 = 0 are given by the x-coordinates of the
points where the function y = x3 – 3x – 1 crosses the x-axis.

6 of 35 © Boardworks Ltd 2006


Using graphs to solve equations

10 Again, the roots are to be


found approximately:
8

6 x = –1.5

4 x = –0.3

2
x = 1.9
These roots can be found
–4 –3 –2 –1 0 1 2 3 4 to a greater degree of
–2 accuracy by using a
y = x3 – 3x – 1 graphical calculator or
–4
graph-plotting program to
–6 ‘zoom in’ on them.

7 of 35 © Boardworks Ltd 2006


Using graphs to solve equations

8 of 35 © Boardworks Ltd 2006


Contents The change-of-sign rule

Using graphs to solve equations


The change-of-sign rule
Solving equations by iteration
Examination-style question

9 of 35 © Boardworks Ltd 2006


The change-of-sign rule

Suppose a function f(x) is continuous. In other words it has no


breaks in it.
The solution (or solutions) to f(x) = 0 are given by the x-values
of the points where y = f(x) crosses the x–axis.
The change-of-sign rule states that:
If two values of x, a and b, can be found such that f(a) and
f(b) are of different sign then f(x) = 0 must have at least one
root in the interval [a, b].

10 of 35 © Boardworks Ltd 2006


The change-of-sign rule

To see how this works in practice consider the equation


x – cos x = 0
We can start by sketching a graph to see how many roots there
are and their approximate locations.
Rather than try to sketch the graph of y = x – cos x we can
sketch the graphs of y = x and y = cos x.

y y=x We can see from this


1 graph that there is one
root about half-way

 2 0 
2
x between x = 0 and x = 2
–1 y = cos x 
That is, around 4 ≈ 0.8.

11 of 35 © Boardworks Ltd 2006


The change-of-sign rule

Now, let f(x) = x – cos x.


When x = 0.8,
f(0.8) = 0.8 – cos 0.8 ≈ 0.1
So f(0.8) is positive.
Let’s try x = 0.7 next.
f(0.7) = 0.7 – cos 0.7 ≈ –0.06
So f(0.7) is negative.
The sign changes from positive to negative and so f(x) must
equal 0 somewhere between x = 0.7 and x = 0.8.
We can therefore conclude that the equation x – cos x = 0
has a root between 0.7 and 0.8.

12 of 35 © Boardworks Ltd 2006


The change-of-sign rule

Show that the equation x3 + 2 = 4x has a root between x = 1


and x = 2.

Start by rearranging the equation into the form f(x) = 0.


x3 – 4x + 2 = 0

Now let f(x) = x3 – 4x + 2.

f(1) = (1)3 – 4(1) + 2 = –1


f(2) = (2)3 – 4(2) + 2 = 2

Since f(1) < 0 and f(2) > 0, there must be a root to the equation
f(x) = 0 between x = 1 and x = 2.

13 of 35 © Boardworks Ltd 2006


Decimal search

The change-of-sign-rule can be used to find the roots to any


required degree of accuracy.
However, a large number of calculations is required to
progressively narrow down the interval.
Using a decimal search is the traditional method of doing this.

14 of 35 © Boardworks Ltd 2006


Problems with the change-of-sign rule

There are some potential problems with using the change-of-


sign method to locate roots. These include cases where:
y = f(x) has a repeated root
In this situation the graph of y = f(x) touches the x-axis without
crossing it:
Here we can see that f(a) and f(b)
have the same sign even though there
a b is a root between x = a and x = b.

y = f(x) We would therefore have to find this


root using an alternative method.

15 of 35 © Boardworks Ltd 2006


Problems with the change-of-sign rule

There is more than one root in a given interval


In some cases there may be several
roots close together.
In this example there are three roots b
between x = a and x = b. a
y = f(x)

There is a discontinuity in a given interval


If there is a discontinuity in a given
interval then f(a) and f(b) may have
different signs even though there y = f(x)
b
isn’t a root between a and b. a

16 of 35 © Boardworks Ltd 2006


Contents Solving equations by iteration

Using graphs to solve equations


The change-of-sign rule
Solving equations by iteration
Examination-style question

17 of 35 © Boardworks Ltd 2006


Solving equations by iteration

This method works by using a recurrence relation to generate


a sequence of approximations that get closer to the root each
time.
The first step is to write the equation we are trying to solve in
the form x = f(x).
We then write this as an iterative formula of the form:
xn+1 = f ( xn )

If the resulting sequence converges then this limiting value


will be a root of x = f(x).
Note that several different formulae are usually possible.
Some may produce convergent sequences and some may not.

18 of 35 © Boardworks Ltd 2006


Solving equations by iteration

For example, suppose we want to solve the equation


5x – ex = 0
One way to write this equation in the form x = f(x) is:
ex
x=
5

This gives us the iterative formula:


e xn
xn+1 =
5
Now we can substitute an initial value for x0 into this formula in
the hope of generating a sequence that converges towards the
root of the original equation.

19 of 35 © Boardworks Ltd 2006


Solving equations by iteration

Let’s try an initial value of x0 = 1:

x0 = 1
e1
x1 = = 0.54365...
5
e0.54365...
x2 = = 0.34445...
5
e0.34445...
x3 = = 0.28224...
5
e0.28224...
x4 = = 0.26522...
5
e0.26522...
x5 = = 0.26074...
5
20 of 35 © Boardworks Ltd 2006
Solving equations by iteration

Continuing this process gives:


x6 = 0.25957…, x7 = 0.25927…, x8 = 0.25919…, x8 = 0.25917…
The values are converging towards 0.259 (to 3 d.p.).
We can conclude that this is a root of our original equation.
To prove that this is a root of 5x – ex = 0 we can show that if
f(x) = 5x – ex there is a change of sign between f(0.2585)
and f(0.2595):
f(0.2585) = 5(0.2585) – e0.2585 ≈ –0.002 negative
f(0.2595) = 5(0.2595) – e0.2595 ≈ 0.001 positive
There is a change of sign and so 0.259 (to 3 d.p.) is a root of
5x – ex = 0.

21 of 35 © Boardworks Ltd 2006


Solving equations by iteration

If you have a calculator with an ANS key then the iterative


process can be made much quicker.
In this example you would start by keying in the initial value 1,
followed by the = key.
You then key in the formula as: eANS ÷ 5
Now, each time you press the equals key you will be given the
next value in the sequence.
To see why these values are converging towards the root,
consider the equation again in the form:
ex
x=
5
ex
Plotting the graphs of y = x and y = will show that there are
5
two points of intersection.

22 of 35 © Boardworks Ltd 2006


Solving equations by iteration

Using the starting value of x = 1 we get progressively closer to


the first intersection point. We can demonstrate this graphically:

23 of 35 © Boardworks Ltd 2006


Looking a different arrangements

Suppose we had arranged our original equation, 5x – ex = 0,


in another form. For example:
5x  ex = 0  e x =5 x  x = ln(5 x )
This leads to the iterative formula:
xn+1 = ln(5 xn )
If we use the same start value of x0 = 1 we get:
x1 = 1.6064…, x2 = 2.0853…, x3 = 2.3443…, x4 = 2.4614…,
x5 = 2.5101…, x6 = 2.5297…, x7 = 2.5375…, x8 = 2.5406…,
x9 = 2.5418…, x10 = 2.5423…, x11 = 2.5425…
This time, using the same start value but a different formula,
the sequence converges towards 2.542 (to 3 d.p.).

24 of 35 © Boardworks Ltd 2006


Solving equations by iteration

We can illustrate this convergence graphically using different


starting points.

25 of 35 © Boardworks Ltd 2006


Staircase diagrams

Some iterative processes may result in a staircase diagram:

26 of 35 © Boardworks Ltd 2006


Cobweb diagrams

Other iterative processes may result in a cobweb diagram:

27 of 35 © Boardworks Ltd 2006


Solving equations by iteration

In most cases you will be told what starting value and


rearrangement to use.
a) Show that the equation x3 + 5x – 2 = 0 can be rearranged in
the form 2  x3
x=
5
b) Use the iterative formula
2  xn 3
xn+1 =
5
with x0 = 1 to find a root of the equation to 5 decimal places.

a) Rearrange the equation:


2  x3
x3 + 5 x  2 = 0  5 x = 2  x3  x=
5
28 of 35 © Boardworks Ltd 2006
Solving equations by iteration

b) The start value is x0 = 1. Therefore:


x1 = 0.2
x2 = 0.3984
x3 = 0.387352…
x4 = 0.388376…
x5 = 0.388283…
x6 = 0.388292…
x7 = 0.388291…

The sequence converges towards 0.38829 (to 5 d.p.).

29 of 35 © Boardworks Ltd 2006


Problems with iterative methods

Not all iterations will converge towards a root. Here are some
examples:

30 of 35 © Boardworks Ltd 2006


Contents Examination-style question

Using graphs to solve equations


The change-of-sign rule
Solving equations by iteration
Examination-style question

31 of 35 © Boardworks Ltd 2006


Examination-style question

a) Show that the equation


ex + x = 8
has a root between and 1 and 2.
b) Show that this equation can be arranged to give the
iterative formula
xn + 1 = ln(8 – xn)
c) Use the iterative formula found in part b) with x0 = 2 to find
the value of x1, x2, x3, x4 and x5 to 5 decimal places.
d) Prove that the value found for x5 is a root of ex + x = 8
correct to 4 decimal places.

32 of 35 © Boardworks Ltd 2006


Examination-style question

a) Rearrange the equation in the form f(x) = 0:


ex + x – 8 = 0
If f(x) = ex + x – 8 then
f(1) = e1 + 1 – 8 ≈ –4.3
f(2) = e2 + 2 – 8 ≈ 1.4
Since f(1) < 0 and f(2) > 0 there must be a root to the equation
f(x) = 0 between x = 1 and x = 2.

b) Rearrange ex + x = 8 in the form x = f(x):


ex = 8 – x
x = ln(8 – x)

33 of 35 © Boardworks Ltd 2006


Examination-style question

Now write this as an iterative formula of the form xn + 1 = f(xn):


xn + 1 = ln(8 – xn)

c) The starting value is x0 = 2, therefore:


x1 = 1.79176
x2 = 1.82588
x3 = 1.82037
x4 = 1.82126
x5 = 1.82111

34 of 35 © Boardworks Ltd 2006


Examination-style question

d) x5 = 1.8211 is a root of ex + x = 8 correct to 4 decimal places


if f(1.82115) and f(1.82105) are of different sign where
f(x) = ex + x – 8.
f(1.82115) = e1.82115 + 1.82115 – 8 ≈ 0.0001

f(1.82105) = e1.82105 + 1.82105 – 8 ≈ –0.0006

f(1.82115) > 0 and f(1.82105) < 0 and so x5 is a root of the


equation to 4 decimal places.

35 of 35 © Boardworks Ltd 2006

You might also like