You are on page 1of 13

Study Notes: Roots of Equations – Open Methods

This study note covers the following three methods that can be found in the prescribed book in
chapter 6:

6.1 Simple fixed-point iteration


6.2 The Newton-Raphson method (including the modified NR method for multiple roots)
6.3 The Secant method

Remember: you will never be asked to derive a method but you must know how to use them! You
should know formulas too!

6.1 Simple fixed-point iteration

Please read the introduction to this method in the book.

Open methods employ a formula to predict the root you are searching for. In the case of fixed-point
iteration, we rearrange the function f(x) = 0 so that x is on the left-hand side of the equation: x = g(x).
You then start with a good guess of the root, set that equal to xi and determine g(xi). Then let xi equal
g(xi) and iterate again.

Example 6.1

Question: Locate the root of f(x) = e-x – x

Answer:

Step A. Graph the function:

1.0 0.5 0.5 1.0

As you can see from the plot, the root is near 0.5. The root is actually 0.567

Step B. Rearrange f(x) = 0 ie rearrange e-x – x = 0 so that x is on the LHS of the equation. In this case it
is easy: x = e-x. Thus g(x) = e-x.

Step C. Set up a table like the following (you must do this in a test) and populate, using a starting guess
xi = 0 (because it is close enough to the root). Always choose a starting guess close to the actual root
– a good reason to graph the function.

Iteration xi g(xi)
1 0 1
2 1 0.368
3 0.368 0.692
4 0.692 0.5
5 0.5 0.607
6 0.607 0.545
7 0.545 0.58
8 0.58 0.56
9 0.56 0.571
10 0.571 0.565

We can stop after 10 iterations because the error looks small. In fact, Error = x 100% =
. .
.
X 100% = 1.06%. As mentioned earlier, the actual root is 0.567 and this is 0.35% different!

Problem 6.1 (from the Problems section at the end of the book chapter. These next three examples
are very similar to what you can expect in the tests)

Question: Locate the (non-zero) root of f(x) = 𝑆𝑖𝑛 √𝑥 − 𝑥 with an initial guess of 0.5

Answer:

Step A. Graph f(x) to visualise the function.

0.2

0.1

0.2 0.4 0.6 0.8 1.0

0.1

As you can see from this plot, there are two roots. We are looking for the non-zero root and we can
see that that root is near x = 0.8. The root is actually 0.768

Step B. Set f(x) = 0 and then rearrange, thus: x = 𝑆𝑖𝑛 √𝑥

Step C. Create the table…

Iteration xi g(xi)
1 0.5 0.65
2 0.65 0.722
3 0.722 0.751
4 0.751 0.762
5 0.762 0.766
6 0.766 0.768

We can stop after 6 iterations because the error looks small. In fact, Error = x 100% =
. .
.
X 100% = 0.26%

Problem 6.2 (from the Problems section at the end of the book chapter)

Question: Determine the highest real root of f(x) = 2x3 – 11.7x2 + 17.7x – 5 with a starting guess of 3
Answer:

Step A. Graph f(x) to visualise the function.

40

20

2 1 1 2 3 4 5

20

40

60

As you can see from this plot, there are three roots. We are looking for highest root and we can see
that that root is near x = 3.5. The root is actually 3.56

Step B. Set f(x) = 0 and then rearrange, thus: x = (5 - 2x3 + 11.7x2)

Step C. Create the table…

Iteration xi g(xi)
1 3 3.181
2 3.181 3.334
3 3.334 3.443
4 3.443 3.507
5 3.507 3.539
6 3.539 3.553
7 3.553 3.558

We can stop after 7 iterations because the error looks small. In fact, Error = x 100% =
. .
X 100% = 0.14%.
.

Problem 6.3 (from the Problems section at the end of the book chapter)

Question: Determine a root of f(x) = -0.9x2 + 1.7x + 2.5 using x0 = 5

Answer:

Step A. Graph f(x) to visualise the function.


2

2 1 1 2 3

As you can see from this plot, there are two roots. We are looking for the root closest to the initial
guess of x0 = 5 and we can see that that root is near x = 2.8. The root is actually 2.86

Step B. Set f(x) = 0 and then rearrange, thus: x = (0.9x2 – 2.5)

Step C. Create the table…

Iteration xi g(xi)
1 5 11.76
2 11.76 71.75
3 STOP: ANSWER
DIVERGING

As you can see the answer is diverging. When this happens, try an alternative arrangement of the
. .
original equation and start again. Let’s give x = .
…. a go!

Iteration xi g(xi)
1 5 3.496
2 3.496 3.063
3 3.063 2.926
4 2.926 2.882
5 2.882 2.867
6 2.867 2.862

We can stop after 6 iterations because the error looks small. In fact, Error = x 100% =
. .
.
X 100% = 0.17%.

6.2. The Newton-Raphson method

Please read the introduction to this method in the book.


( )
The single equation form of the Newton Raphson method is 𝑥 =𝑥 − ( )
where f’(xi) is the first
( )
derivative of f(xi). Note that 𝑥 =𝑥 − ( )
is known as the Newton-Raphson formula.

Example 6.3
Question: Locate the root of f(x) = e-x – x with a starting guess of xi = 0

Answer:

Step A. Graph the function:

1.0 0.5 0.5 1.0

As you can see from the plot, the root is near 0.5. The root is actually 0.567

Step B. Find the first derivative of f(x) with respect to x. Here, f’(xi) = - e-x – 1. Then, the NR formula
here becomes 𝑥 = xi – (e-xi – xi)/(-e-xi – 1)

C. Set up a table like the following (you must do this in a test) and populate

Iteration xi NR
1 0 0.5
2 0.5 0.566
3 0.566 0.567
4 0.567 0.567

We can stop after 4 iterations because the error looks small. You can see the convergence was rapid!

Problem 6.2 (from the Problems section at the end of the book chapter)

Question: Determine the highest real root of f(x) = 2x3 – 11.7x2 + 17.7x – 5 with a starting guess of 3

Answer:

Step A. We have seen this function before…

Graph the function (again):

40

20

2 1 1 2 3 4 5

20

40

60
As you can see from this plot, there are three roots. We are looking for highest root and we can see
that that root is near x = 3.5. The root is actually 3.56

Step B. Find the first derivative of f(x) with respect to x. Here, f’(x) = 6x 2 – 23.4x + 17.7. Then, the NR
formula here becomes NR = x – (2x3 – 11.7x2 + 17.7x – 5)/(6x2 – 23.4x + 17.7)

C. Set up a table like the following (you must do this in a test) and populate

Iteration xi NR
1 3 5.133
2 5.133 4.27
3 4.27 3.793
4 3.793 3.6
5 3.6 3.564
6 3.564 3.563

We can stop after 6 iterations because the error looks small.

Problem 6.3 (from the Problems section at the end of the book chapter)

Question: Determine a root of f(x) = -0.9x2 + 1.7x + 2.5 using x0 = 5

Answer:

Step A. Graph f(x) to visualise the function (again)

2 1 1 2 3

As you can see from this plot, there are two roots. We are looking for the root closest to the initial
guess of x0 = 5 and we can see that that root is near x = 2.8. The root is actually 2.86

Step B. Find the first derivative of f(x) with respect to x. Here, f’(x) =-1.8x + 1.7. Then, the NR formula
here becomes NR = x – (-0.9x2 + 1.7x + 2.5)/(-1.8x + 1.7).

Step C. Create the table…

Iteration xi NR
1 5 3.425
2 3.425 2.924
3 2.924 2.861
4 2.861 2.86
We can stop after 4 iterations because the error looks small.

Problem 6.4 (from the Problems section at the end of the book chapter)

Question: Determine the middle root of f(x) = -1 + 5.5x – 4x2 + 0.5x3

Answer:

Step A. Graph f(x) to visualise the function

10

2 4 6

10

As you can see from this plot, there are three roots. We are looking for the middle root and we can
see that that root is near x = 1.5. The root is actually 1.48

Step B. Find the first derivative of f(x) with respect to x. Here, f’(x) =1.5x 2 – 8x + 5.5. Then, the NR
formula here becomes NR = x – (-1 + 5.5x – 4x2 + 0.5x3)/( 1.5x2 – 8x + 5.5).

Step C. Create the table with starting guess close to the middle root – use a value of 1…

Iteration xi NR
1 1 2
2 2 1.556
3 1.556 1.483
4 1.483 1.48

We can stop after 4 iterations because the error looks small.

6.2. The Secant method

Please read the introduction to this method in the book.

In a nutshell, if it is tricky to find the first derivative of a function, using the NR method becomes
inconvenient. The Secant method is used to estimate the root by extrapolating a tangent of the
function to the x-axis (see Figure 6.7 below, taken from the text book). If you look at the caption you
will see a nice description of the difference between the NR method and Secant method
( )( )
The formula for the Secant method is: 𝑥 =𝑥 − ( ) ( )

( )( )
I find it easier to use a layman’s version: 𝑙𝑎𝑡𝑒𝑠𝑡 = 𝑛𝑒𝑤 − ( ) ( )

Example 6.6

Question: Use the Secant method to estimate the root of f(x) = e-x – x with starting estimates xi-1 = 0
and x0 = 1

Answer:

Step A. Graph the function (again):

1.0 0.5 0.5 1.0

As you can see from the plot, the root is near 0.5. The root is actually 0.567

Step B. Step C. Set up a table like the following (you must do this in a test) and populate (in a test you
do not need the “Comment” column). The guess that is lower in value is “old” and the larger guess is
“new”…

old f(old) new f(new) Secant formula = 𝑛𝑒𝑤 − Comment


( )( )
( ) ( )
0 1 1 -0.632 1−
. ( )
= 0.612
.
1 -0.632 0.612 -0.0697 0.612 −
. ( . )
= 0.564 We are getting close
. .
to root now. Maybe
one more iteration
0.612 -0.0697 0.564 0.00493 0.564 −
. ( . . )
=
. .
0.567

Example 6.7

Question: Use the Secant method to estimate the root of f(x) = ln(x) with starting estimates of 0.5 and
5

Answer:

Step A. Graph the function:


2

1 2 3 4 5 6

As you can see from the plot, the root is near 1. The root is actually 1

Step B. Step C. Set up a table and populate

old f(old) new f(new) Secant formula = 𝑛𝑒𝑤 − Comment


( )( )
( ) ( )
0.5 -0.693 5 1.609 5−
. ( . )
= 1.855
. .

5 1.609 1.855 0.618 1.855 −


. ( . )
= -0.106 Stop. The method is
. .
diverging. We cannot
find ln(-0.106)! When
the method does
converge, like in
Example 6.6, it is
about as efficient as
the NR method (see
Fig 6.9 in the book)
Problem 6.2 (from the Problems section at the end of the book chapter)

Question: Determine the highest real root of f(x) = 2x3 – 11.7x2 + 17.7x – 5 with a starting guess of 3
and 4

Answer:

Step A. Graph f(x) to visualise the function (again):

40

20

2 1 1 2 3 4 5

20

40

60

As you can know, there are three roots. We are looking for highest root and the root is actually 3.56

Step B. Step C. Set up a table and populate

old f(old) new f(new) Secant formula = 𝑛𝑒𝑤 − Comment


( )( )
( ) ( )
3 -3.2 4 6.6 4−
. ( )
= 3.327
. .

4 6.6 3.327 -1.966 3.327 −


. ( . )
= 3.48
. .

3.327 -1.966 3.48 -0.807 3.48 −


. ( . . )
= 3.58 The error between
. .
our latest estimate of
3.58 and actual root is
small.

Problem 6.6 (from the Problems section at the end of the book chapter)

Question: Determine the lowest real root of f(x) = -12 – 21x + 18x2 – 2.4x3

Answer:

Step A. Graph f(x) to visualise the function:


100

50

2 2 4 6

50

100

As you can know, there are three roots. We are looking for lowest root and that root is actually -
0.415

Step B. Step C. Set up a table and populate. Use guesses -0.5 and -0.6 (straddle the root):

old f(old) new f(new) Secant formula = 𝑛𝑒𝑤 − Comment


( )( )
( ) ( )
-0.5 3.3 -0.6 7.6 −0.6 −
. ( . . )
= -0.423
. .

-0.6 7.6 -0.423 0.285 −0.423 −


. ( . . )
=-
. .
0.416

-0.423 0.285 -0.416 0.0238 −0.416 −


. ( . . )
=-
. .
0.415

Problem 6.7b (from the Problems section at the end of the book chapter)

Question: Locate the second positive root of f(x) = Sin(x) + Cos(1 + x2) – 1 where x is in radians and
with guesses of 1.5 and 2.5 (actually the question asks for the first positive root but with these
guesses we will end up with the second positive root!)

Answer:

Step A. Graph f(x) to visualise the function:


0.5

1 1 2 3

0.5

1.0

1.5

2.0

As you can know see the highest root is near 2.5. The root is actually 2.53

Step B. Step C. Set up a table and populate:

old f(old) new f(new) Secant formula = 𝑛𝑒𝑤 − Comment


( )( )
( ) ( )
1.5 -0.997 2.5 0.166 2.5 −
. ( . . ))
=2.35
( . . )

2.5 0.166 2.35 0.683 2.35 −


. ( . . )
= 2.55
. .

2.35 0.683 2.55 -0.098 2.55 −


. ( . .
= 2.53
. .

You might also like