17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

48
17: Iteration using 17: Iteration using © Christine Crisp Teach A Level Maths” Teach A Level Maths” Vol. 2: A2 Core Vol. 2: A2 Core Modules Modules ) ( x g x

Transcript of 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Page 1: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

17: Iteration using 17: Iteration using

© Christine Crisp

““Teach A Level Maths”Teach A Level Maths”

Vol. 2: A2 Core Vol. 2: A2 Core ModulesModules

)(xgx

Page 2: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

Module C3

"Certain images and/or photos on this presentation are the copyrighted property of JupiterImages and are being used with permission under license. These images and/or photos may not be copied or downloaded without permission from JupiterImages"

Page 3: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationThere are some equations that we can’t solve.

However, we can find an approximate solution to some of these equations.

31 xx e.g.

There are several methods of finding approximate solutions and in this presentation we will study one of them.

The approximation can be very accurate, say to 6 or more decimal places.

Page 4: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationThere are 2 stages to getting a solution:

Stage 1. Find a 1st estimateStage 2. Find a formula to improve the estimate.

Sometimes we can just spot an approximate solution to an equation.Can you spot the approximate value of the solution to

?123 xx

If we can’t quickly spot an approximation, we can use a method involving finding bounds for the solution.

Ans: It’s quite close to 0 as the l.h.s. is then 0 and the r.h.s. is 1.

Page 5: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xy

31 xy

where andxy 31 xy This is the point . .

. 31 xx so the x coordinate gives the

solution to

Bounds are numbers which lie on either side of the solution. If these are integers we call them integer bounds.

e.g. To find integer bounds for we can sketch and

31 xx xy 31 xy

Page 6: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xy

31 xy The solution lies between 0 and 1.

0 and 1 are the integer bounds.10 We usually call the solution , so

.

e.g. To find integer bounds for we can sketch and

31 xx xy 31 xy

Bounds are numbers which lie on either side of the solution. If these are integers we call them integer bounds.

Page 7: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xy

31 xy The solution lies between 0 and 1.

e.g. To find integer bounds for we can sketch and

31 xx xy 31 xy

0 and 1 are the integer bounds.

Our first approximation to, is any number between the bounds, say .50

10 We usually call the solution , so .

Bounds are numbers which lie on either side of the solution. If these are integers we call them integer bounds.

Page 8: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

If we can use Autograph or a graphical calculator, sketching is a good method of finding the integer bounds.

However, if we can spot likely bounds, or if we are given values and want to show they are bounds, we can use the algebraic method that follows and avoid sketching.

Even without a graph plotter you may have been able to sketch these 2 graphs.

Page 9: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xxxf 1)( 3

Rearrange the equation to get zero on one side.

0)( xfthis CallTo show how the method works I’m going to sketch

( but you won’t usually have to do this ).

)(xfy

At , 0)( xf

To the left of , e.g. at x = 0, To the right of , e.g. at x = 1,

The solution, , is now where

0)( xf

31 xx 013 xxe.g. For , get

1)( xf 001)( xf

Page 10: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xxxf 1)( 3

Rearrange the equation to get zero on one side.

0)( xfthis CallTo show how the method works I’m going to sketch

( but you won’t usually have to do this ).

)(xfy

To the left of , e.g. at x = 0, To the right of , e.g. at x = 1,

31 xx 013 xxe.g. For , get

1)( xf 001)( xf

has opposite signs on the left and right of

)(xf

Page 11: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

31 xx e.g.

The Algebraic Method:

• Rearrange the equation to the form 0)( xfxx 13 0

• Find :)0(f• Define :)(xf xxxf 1)( 3Let

If we want to show that 0 and 1 are integer bounds, we show that has different signs at 0 and 1.

)(xf

Page 12: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

31 xx e.g.

• Rearrange the equation to the form 0)( xfxx 13 0

• Find :)0(f Change of sign

0

1 11113 )(f)1(f• Find :• The change of

sign

• Define :)(xf xxxf 1)( 3Let

The Algebraic Method: If we want to show that 0 and 1 are integer

bounds, we show that has different signs at 0 and 1.

)(xf

)(f 10103

Page 13: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

31 xx e.g.

• Rearrange the equation to the form 0)( xfxx 13 0

• Find :)0(f Change of sign

10103 0)(f

11113 1)(f• The change of

sign 0 1

Our 1st estimate of is between these values, say 50

• Define :)(xf xxxf 1)( 3Let

)1(f• Find :

The Algebraic Method: If we want to show that 0 and 1 are integer

bounds, we show that has different signs at 0 and 1.

)(xf

You must always include this line.

Page 14: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

It is possible to find bounds that are closer than the nearest integers.For example, to find bounds accurate to 1 decimal place, we could use a decimal search.

10 So if we had , a decimal search would calculate

...)30(),20(),10( ffflooking for a change of sign.However, integer bounds are good enough for the method of iteration we are studying.

Page 15: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xy 5

e.g. 1 (a) Using a graphical calculator, or otherwise, sketch, on the same axes, the graphs of an

d23 xy

(b) From the sketch, find integer bounds for the solution, , of the equation xx 523

23 xy

xy 5(b) is the x-

value at the point of intersection, so 0 and 1 are integer bounds.

Solution:(a)

(c) Use an algebraic method to confirm these are correct and give a 1st approximate solution.

Page 16: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xy 5

e.g. 1 (a) Using a graphical calculator, or otherwise, sketch, on the same axes, the graphs of an

d23 xy

0253 xx• Rearrange equation

to :0)( xf

• Define :)(xf 25)( 3 xxxf

02251)1( f• The change of

sign 10

(b) From the sketch, find integer bounds for the solution, , of the equation xx 523

(c) Use an algebraic method to confirm these are correct and give a 1st approximate solution.

• A 1st approximation is any number between 0 and 1.

02)0( fSo,

(c) ( Confirm bounds are 0 and 1 )

Page 17: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

)(xfy

Look at this function:,2)0( f 2)1( f

There is a change of sign . . .

Do you notice anything that explains this?We couldn’t draw the curve without lifting

the pencil off the paper. We say it is discontinuous.

Not all functions that have a sign change between 2 numbers have a solution to between the numbers.

)(xf0)( xf

Ans: The function has an asymptote between 0 and 1.

but no solution between 0 and 1.

21x

Page 18: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

2)1( f,2)0( f

)(xfy

Look at this function:

Not all functions that have a sign change between 2 numbers have a solution to between the numbers.

)(xf0)( xf

You are unlikely to meet discontinuous functions in this work so just remember the

effect on solutions.

There is a change of sign . . .

Do you notice anything that explains this?

but no solution between 0 and 1.

21x

Page 19: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationExercis

e1. Using a graphical calculator or otherwise,

sketch suitable graphs to find integer bounds for the solution to

.12 xex

2. Use the algebraic method to show that

has a root between 2 and 3.

xx 4ln

An equation has a solution which may consist of one or more roots.

Give a 1st approximation to the solution.

Give an approximation to this root.

Page 20: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

12 xy

xey

Solution:

1.

xex 12

Sketch and12 xy xey

The integer bounds for are 1 and 2. So,

21

Any number between 1 and 2 could be used as the 1st approximation.

Page 21: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

Solution: xx 4ln

04ln xx

4ln)( xxxf

• Rearrange to :0)( xf

• Define :)(xf

2. Use the algebraic method to show that

has a root between 2 and 3.

xx 4ln

31422ln)2( f10433ln)3( f

• Change of sign (continuous function) 32 Any number between 2 and 3 could be used as the 1st approximation.

Page 22: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

The 1st approximate solution lies anywhere between the bounds. The next stage is to improve this estimate.

)(xg• Rearrange the equation to the form .xYou may spot lots of ways of doing this. e.g.

31 xx e.g. For the equation :

Page 23: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

31

1 x x

2

1

x

x x

You may spot lots of ways of doing this. e.g.

x )(xg• Rearrange the equation to the form .

x 23 )1( x 31 xx

The 1st approximate solution lies anywhere between the bounds. The next stage is to improve this estimate.

(i) Square:or (ii) Rearrange:

Cube root:or (iii) Rearrange:

2xDivide by :

xx 13 31 xx

xx 13 31 xx

31 xx e.g. For the equation :

Page 24: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

to iterate means to repeat

Let’s take the 2nd arrangement: 31

1 xx Our 1st estimate of we will call x0.We substitute x0 into the r.h.s. of the formula

and the result gives the new estimate x1.

We now have

31

01 1 xx

31

1 1 nn xx

We will then keep repeating the process so we write the formula as

This is called an iterative formula.

( Some people start with x1 which is just as good. )

Page 25: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

31

131

01 5011 xxx

Starting with we get500 x

Because we are going to repeat the calculation, we use the ANS function on the calculator.

31

1 1 nn xx So,

• Type and press ENTER

50• Type the r.h.s. of the equation, replacing

x with ANS, using the ANS button, giving 31

1 ANS• Press ENTER and you get ( 6

d.p. ) 6641050

• Pressing ENTER again replaces with and gives the next estimate and so on.

664105050

66410501 x( 6

d.p. )

Page 26: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

500 x66410501 x

56987802 x

If we continue to iterate we eventually get

6054230 ( to 6

d.p. )

Although I’ve only written down 6 decimal places, the calculator is using the greatest possible accuracy.

We get

6105000000050 orof our answer.

Since the answer is correct to 6 decimal places, the exact value of must be within

Error Bounds

Tip: The index equals the number of d.ps. in the answer.

Page 27: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationSUMMARY To find an approximation to a solution ( or root ) of an equation: Find a 1st approximation, often by finding

integer bounds for the solution. Let this be x0 .

Rearrange the equation into the form )(xgx Write the arrangement as an iterative

formula:)(1 nn xgx

Key x0 into a calculator and ENTER. Key the r.h.s. of the formula into the

calculator, replacing x with ANS. Press ENTER as many times as required to

get the solution to the specified accuracy.

Page 28: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

e.g. 1(a) Show that the equation has a root in the interval .

32 xx 4131

(b) Using the arrangement write down an iterative formula and use it to find the root correct to 4 decimal places.

3 2 xx

Solution: (a) Let )(xf

270312)31( 33.1 f

100412)41( 34.1 f

4131 Change of sign

Then,

02 3 xx

Page 29: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

e.g. 1(a) Show that the equation has a root in the interval .

32 xx 21

(b) Using the arrangement write down an iterative formula and use it to find the root correct to 4 decimal places.

3 2 xx

Solution: (b) gives3 2 xx 3

1 2 nxnx

Let 510x 3 5131 22 0 xx

4141386512 x377613 x

37351It takes about 7 iterations to reach (4 d.p.)

Page 30: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationExercise

3 21 25 nn xx

1. (a) Show that the equation has a solution between 2 and 3.

2523 xx

(b) Use the iterative formulawith to find the solution, giving your answer correct to 4 d.p.

2. (a) Show that the equation has a solution between 1 and 2.

32ln xx

520 x

3ln1 nnn xxx(b) Use the iterative formulawith to find the solution, giving your answer correct to 4 d.p.

510 x

Page 31: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationSolutions 1. (a) Show that the equation has

a solution between 2 and 3.2523 xx

Solution: (a) Let

025)( 23 xxxf

0132522)2( 23 f

0112533)3( 23 f

Change of sign 32 3 2

1 25 nn xx (b) Use the iterative formulawith to find the solution, giving your answer correct to 4 d.p.

520 x

62582...,65662,52 10 xx( 4

d.p. )

Page 32: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

2. (a) Show that the equation has a solution between 1 and 2.

32ln xx

Solution: Let 32ln)( xxxf

01321ln)1( f030342ln)2( f

3ln1 nnn xxx(b) Use the iterative formulawith to find the solution, giving your answer correct to 4 d.p.

510 x

Change of sign 21 α

79151...,90551,51 10 xx( 4

d.p. )

3ln( ANSANS)Solution: We need

Solutions

Page 33: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationSome arrangements of an equation give formulae which do not give a solution.

31 xx We earlier met 3 arrangements of

6054230 ( to 6

d.p. )

We used (ii) with to find the solution

500 x

Now try (i) with 500 xWe get

...,940,300,770 321 xxx

and after a while the sequence just oscillates between 1 and 0.

This iterative sequence does not converge.

x 23 )1( x(i) 3

1

1 xx(ii)2

1

x

xx

(iii)

Page 34: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

We get

,060,171 21 xx

21

1

n

nn

x

xx

Now try the formula with .500 x

The iteration then fails because we are trying to square root a negative number.

Some arrangements of an equation give an iterative sequence which converges to a solution; others do not converge.

The next presentation investigates convergence of iterative sequences.

Page 35: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

Page 36: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

The following slides contain repeats of information on earlier slides, shown without colour, so that they can be printed and photocopied.For most purposes the slides can be printed as “Handouts” with up to 6 slides per sheet.

Page 37: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationThere are some equations that we can’t solve.

However, we can find an approximate solution to some of these equations.

31 xx e.g.

There are several methods of finding approximate solutions and in this presentation we will study one of them.

The approximation can be very accurate, say to 6 or more decimal places.

Page 38: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationThere are 2 stages to getting a solution:

Stage 1. Find a 1st estimateStage 2. Find a formula to improve the estimate.

Sometimes we can just spot an approximate solution to an equation.

The solution to123 xx

If we can’t quickly spot an approximation, we can use a method involving finding bounds for the solution.

is quite close to 0 as the l.h.s. is then 0 and the r.h.s. is 1.

Page 39: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xy

31 xy The solution lies between 0 and 1.

e.g. To find integer bounds for we can sketch and

31 xx xy 31 xy

0 and 1 are the integer bounds.

We often start by finding numbers ( bounds ) that lie on either side of the solution. If these are integers we call them integer bounds.

Our first approximation to, is any number between the bounds, say .50

10 We usually call the solution , so .

Page 40: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

31 xx e.g.

• Rearrange the equation to the form 0)( xfxx 13 0

• Find :)0(f Change of sign

10103 0)(f

11113 1)(f• The change of

sign 0 1

Our 1st estimate of is between these values, say 50

• Define :)(xf xxxf 1)( 3Let

)1(f• Find :

The Algebraic Method: If we want to show that 0 and 1 are integer

bounds, we show that has different signs at 0 and 1.

)(xf

Page 41: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

Solution: (c) ( Confirm bounds are 0 and

1 )

xy 5

e.g. 1 (a) Using a graphical calculator, or otherwise, sketch, on the same axes, the graphs of an

d23 xy

0253 xx• Rearrange equation

to :0)( xf

• Define :)(xf 25)( 3 xxxf

02251)1( f• The change of

sign 10

(b) From the sketch, find integer bounds for the solution, , of the equation xx 523

(c) Use an algebraic method to confirm these are correct and give a 1st approximate solution.

• A 1st approximation is any number between 0 and 1.

02)0( fSo,

Page 42: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

31

1 x x

2

1

x

x x

You may spot lots of ways of doing this. e.g.

x )(xg• Rearrange the equation to the form .

x 23 )1( x 31 xx

The 1st approximate solution lies anywhere between the bounds. The next stage is to improve this estimate.

(i) Square:(ii) Rearrange:

Cube root:(iii) Rearrange: 2xDivide by :

xx 13 31 xx

xx 13 31 xx

31 xx e.g. For the equation :

Page 43: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

to iterate means to repeat

Let’s take the 2nd arrangement: 31

1 xx Our 1st estimate of we will call x0.

We substitute x0 into the r.h.s. of the formula

and the result gives the new estimate x1.

We now have

31

01 1 xx

31

1 1 nn xx

We will then keep repeating the process so we write the formula as

This is called an iterative formula.

( Some people start with x1 which is just as good. )

Page 44: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

IterationSUMMARY To find an approximation to a solution ( or root ) of an equation: Find a 1st approximation, often by finding

integer bounds for the solution. Let this be x0 .

Rearrange the equation into the form )(xgx Write the arrangement as an iterative

formula:)(1 nn xgx

Key x0 into a calculator and ENTER. Key the r.h.s. of the formula into the

calculator, replacing x with ANS. Press ENTER as many times as required to

get the solution to the specified accuracy.

Page 45: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

e.g. 1(a) Show that the equation has a root in the interval .

32 xx 4131

(b) Using the arrangement write down an iterative formula and use it to find the root correct to 4 decimal places.

3 2 xx

Solution: (a) Let 02)( 3 xxf x

270312)31( 33.1 f

100412)41( 34.1 f

4131 Change of sign

Page 46: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

Solution: (b) gives3 2 xx 3

1 2 nxnx

Let 510x 3 5131 22 0 xx

4141386512 x377613 x

37351It takes about 7 iterations to reach (4 d.p.)

Page 47: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

xx 13(ii) xx 13(iii)23 )1( xx (i)

31

1 xx 2

1

x

xx

Some arrangements of an equation give formulae which do not give a solution.

31 xx We earlier met 3 arrangements of

6054230 ( to 6

d.p. )

We used (ii) with to find the solution

500 x

Trying (i) with 500 x

gives ...,940,300,770 321 xxxand after a while the sequence just oscillates between 1 and 0.

The iterative sequence does not converge.

Page 48: 17: Iteration using © Christine Crisp “Teach A Level Maths” Vol. 2: A2 Core Modules.

Iteration

gives ,060,171 21 xx

2

1

x

xx

Trying the arrangement with 500 x

The iteration then fails because we are trying to square root a negative number.

Some arrangements of an equation give an iterative sequence which converges to a solution; others do not converge.