You are on page 1of 18

Chapter 2

Solution of Equations in One Variable

2.1 Introduction
In Applied Mathematics, the most frequent problem is to find the values of x to satisfy the
equation f ( x) = 0 . Such values are called the roots of the equation and also known as the
zeros of f (x) . Some equations are easy to solve. The linear equation such as 3 x − 2 = 0
can be solved easily. Quadratic equations can be solved by factorization or by the standard
formula. It is possible to solve polynomial equations of higher degree, if they are
factorisable, otherwise it is difficult to solve. Many equations involve sines, cosines,
exponential and other transcendental functions and it is difficult to solve them precisely. In
fact, majority of equations cannot be solved in any precise manner and so we have to solve
them by using iterative procedures. An iterative procedure is a repeative process that
produces a sequence of approximations to the equation. In this chapter, we shall consider
some of the important approximate methods in finding the roots of the equations in one
variable.

2.2 Roots and its Location


A polynomial in x of degree n is of the form
p ( x) = a0 + a1 x + a 2 x 2 + ⋅ ⋅ ⋅ + a n x n
where a’s are constants and n is a positive integer.
A polynomial equation p( x) = 0 of degree n has exactly n roots. Some of them are real
and others are complex. For a non polynomial equation f ( x) = 0 , there is no such rule of
finding the number of roots. Geometrically, if the graph of y = f (x) crosses the x-axis at
x = a , then x = a is a real root of f ( x) = 0 . Now we shall consider graphically to find the
the number of real roots and its location.

2.2.1 Number of Real Roots by Graphical Method

Rewrite the equation f ( x) = 0 as f1 ( x) = f 2 ( x) . At the point of intersection x = x1 (say)


of the graphs of
y = f1 ( x) and y = f 2 ( x)
we have
f1 ( x1 ) = f 2 ( x1 )

Thus the number of intersections of the two graphs will be the number of real roots of
f ( x) = 0 .
14 NUMERICAL METHODS WITH EXCEL

2.2.2 Location of Roots

To locate the roots of f ( x) = 0 first study the graph of y = f (x) as shown below. If we
can find two values of x, one for which f (x) is positive, and one for which f (x) is
negative, then the curve must have crossed the x-axis and so must have passed through a
root of the equation f ( x) = 0 .
y

+
+
x
O − −

In general, if f (x) is continuous in [a, b] and f (a ) and f (b) are opposite in signs i.e.
f (a ) f (b) < 0 , then there exists odd number of real roots (at least one root) of f ( x) = 0 in
( a, b) .

But the only exception where it does not work is where the graph looks like one of the
following:
y
y
x
O Q

x
O P
Graph 1 Graph 2

In Graph 1, there is a root of f ( x) = 0 at P but f ( x) > 0 to the left and to the right of P.
In Graph 2, f ( x) < 0 to both sides of the root at Q. In both the cases, the tangents at the
root are the x-axis and hence f ′( x) = 0 For this case, the existence of a root can be
determined by studying the signs of f ′(x) in the interval (a, b) containing the root and it
will satisfy the condition f ′(a) f ′(b) < 0 .

2.3 Method of Bisection


Let f (x) be continuous in [a, b] and f (a) f (b) < 0 , then there exists a real root of
f ( x) = 0 in [a, b] . In this method we assume the mid-point c = (a + b) / 2 is the
approximation to the root.
If f (c) = 0 , we conclude that c is a root of y
f ( x) = 0 . If f (c) ≠ 0 and
(i) if f (a) f (c) < 0 , the root is in (a, c) or
(ii) if f (c) f (b) < 0 , the root is in (c, b) . b c
O
a α x

To continue the process , relabel the new interval Fig. Bisection Method
[a, b] and repeat the process until the desired degree of accuracy is achieved.
The following notation is used to keep the tract in the process:
CHAPTER 2: Solutions of Equations in One Variable 15

a + b0
[a 0 , b0 ] is the starting interval and x 0 = 0 is the midpoint.
2
[a1 , b1 ] is the second interval which brackets the root and x1 is the midpoint.
At each step relabel the interval which brackets the root and find the midpoint by
using
a + bn
xn = n .
2

2.4 False Position Method


This method is also known as the Regula Falsi or Linear Approximation. The method is
very similar to Bisection method. In bisection method midpoint of the interval [a, b] is
used for the next iterate. In this method we replace the midpoint formula by the value of
the x-intercept of the line joining the points (a, f (a)) and (b, f (b)) .

The straight line through (a, f (a )) and (b, f (b)) is


f (b) − f (a )
y − f (a) = ( x − a)
b−a y
(b, f (b))
On the x-axis y = 0 and let x = x0 , then
f (b) − f (a )
− f (a) = ( x0 − a)
b−a a x0
α
Solving for x0 , O b x
(b − a) (a, f (a ))
x0 = a − f (a) .
f (b) − f (a ) Fig. False Position Method
(b − a)
Also note that x0 = b − f (b) .
f (b) − f (a )
If f ( x0 ) = 0 , then x0 is the root. Otherwise the root lies either between x0 and b or
between a and x0 depending on whether f (a) f ( x0 ) is positive or negative. By designating
the new interval of root as [a1 , b1 ] , we can then calculate the next iterate x1 by the formula
similar to above. Repeat the process until xn +1 − xn ≤ ε , where ε is the specified
accuracy.

2.5 Order of Convergence

Let ε n be the error in the nth iteration for a root α of f ( x) = 0 , then


ε n = xn − α
If
ε n +1
lim = const
n→∞ εnR
then the order of convergence of the sequence {x n } is R.
In special case,
If R = 1 , the convergence is called linear.
If R = 2 , the convergence is called quadratic.
If 1 < R < 2 , the convergence is superlinear.
16 NUMERICAL METHODS WITH EXCEL

2.6 The Secant Method


The Secant method is similar to that of the false position
method. In this method, to find a root of f ( x) = 0 with y
two points near the root is approximated by the x-intercept ( x0 , f ( x0 ))
of the secant line (chord) joining the two points.
Let x0 and x1 be the starting values of x , then the first
( x1 , f ( x1 ))
approximation x 2 of the root is given by
( x1 − x0 ) α x2 x1 x0 x
x2 = x1 − f ( x1 ) O
f ( x1 ) − f ( x0 )
Fig. The Secant Method
The estimated value will be closer to the root than
either of the two initial points. We continue the
process to get better approximation of the root by
using the last two computed points using the iteration formula
( xn − xn−1 )
xn+1 = xn − f ( xn ) , n ≥1
f ( xn ) − f ( xn−1 )
Here it is not necessary that the interval [ xn−1 , xn ] should contain the root i.e.
f ( xn−1 ) f ( xn ) < 0 .
In selecting, x0 and x1 care should be taken so that x1 is closer to the root than x0 in
order to get rapid convergence. This can be achieved by selecting x0 and x1 such that
f ( x1 ) < f ( x0 )
Secant method at a simple root, the error terms satisfy the relationship
R
ε n +1 = A ε n
where the order of convergence
R = (1 + R )1 / 2 ≈ 1.618 .
(The proof can be found in advanced texts on numerical analysis).

2.7 Newton-Raphson Method


The procedure known as Newton’s method is also called Newton-Raphson method. In
this method, the root of the equation f ( x) = 0 is approximated by the x-intercept of the
tangent line through a guess value x0 near the root.
The equation of the tangent through ( x0 , f ( x0 )) is y
( x0 , f ( x0 ))
y − f ( x0 ) = f ′( x0 ) ( x − x0 )
On the x-axis y = 0 and let x = x1 , then
− f ( x0 ) = f ′( x0 ) ( x1 − x0 )
O α x2 x1 x0 x
Solving for x1 ,
Fig. Newton-Raphson Method
f ( x0 )
x1 = x0 −
f ′( x0 )
The process can be repeated with the new estimate of x until we reach the required degree
of accuracy.
In general, the iterative formula for the process can be expressed as
f ( xn )
x n+1 = x n − , n = 0, 1, 2, 3, ⋅ ⋅ ⋅
f ′( x n )
CHAPTER 2: Solutions of Equations in One Variable 17

2.7.1 Order of Convergence of the Newton-Raphson process.

Let ε n be the error in the nth iteration, that is


ε n = xn − α
where α is a root of the equation f ( x) = 0 .
From the Newton-Raphson formula. we have
f ( xn )
x n +1 − α = x n − −α
f ′( x n )
f ( xn )
or ε n +1 =ε n− (1)
f ′( xn )
Taylor’s expansion of f (α ) = 0 about x n gives
f ( x n ) + (α − x n ) f ′( x n ) + 1 (α − xn ) 2 f ′′( x n ) + ⋅ ⋅ ⋅ = 0
2
From which we get
f ( xn ) f ′′( xn )
= ( xn − α ) − 1 ( xn − α ) 2 + ⋅⋅⋅
f ′( x n ) 2 f ′( x n )
f ′′( x n )
≈ ε n − 12 ε n 2
f ′( xn )
Substituting in (1), we have
f ′′( x n )
εn + 1 ≈ 1 εn2
2 f ′( x n )
i.e. ε n +1 ∝ ε n 2

Thus for a simple root the convergence of the Newton-Raphson method is of order two.

2.7.2 Starting Value for Iteration


If the starting value is reasonably close to the root, the number of iterations needed will be
less and calculation time will be saved. Use specified starting value, if stated. Otherwise,
first find an interval in which a root lies and then choose as a starting value, x0 , either
(i) one of the end-points of the interval where the magnitudes of the value of the
function is small., or
(ii) guess an internal point of the interval closer to the root.

2.8 Multiple Roots


Equal (repeated) roots are known as the multiple roots. If the root α of f ( x) = 0 is a
repeated root, then we may write
f ( x) = ( x − α ) m g ( x) = 0
where g (x) is bounded and g (α ) ≠ 0 .
The root α is called a multiple root of multiplicity m. We obtain from the above equation
f (α ) = f ′(α ) = ⋅ ⋅ ⋅ = f ( m−1) (α ) = 0 , f ( m) (α ) ≠ 0
18 NUMERICAL METHODS WITH EXCEL

For a multiple root, the order of convergence is reduced, but the order may be increased by
modifying the methods discussed. If the multiplicity m of the root is known in advance,
then some of the methods can be modified so that they have the same rate of convergence
as that for simple roots.

2.8.1 Modified Newton-Raphson Method


For a multiple root the order of convergence of the Newton-Raphson formula is linear.
The order can be increased by the modified formula
f ( xn )
x n +1 = x n − m , n = 0, 1, 2, 3, ⋅ ⋅ ⋅
f ′( x n )
where m is the multiplicity of the root.
The order of convergence of the above is two as that of the simple root.
When the multiplicity of the root is not known in advance, we may proceed as follows;
The function
f ( x)
u ( x) =
f ′( x)
has a simple root α regardless of the multiplicity of the root of f ( x) = 0 .
When the Newton-Raphson method is applied to the simple root α of u ( x) = 0 , we have
u ( xn )
x n+1 = x n −
u ′( x n )
or
f ( x n ) f ′( x n )
x n+1 = x n − .
[ f ′( x n )]2 − f ( x n ) f ′′( x n )

2.9 Fixed Point Iteration Method


A fixed point of a function g (x) is a real number α such that α = g (α ) . This means α is
a root of the equation x = g (x) .
In order to find a root of the equation f ( x) = 0 by an iterative method, first rearrange the
equation into a form
x = g (x).
The function g (x) is called the iteration function. Note that there is no unique form
x = g (x) into which the equation can be rearranged.
An iteration formula is then
x n+1 = g ( x n ), n = 0, 1, 2, 3, ⋅ ⋅ ⋅

If x0 is an approximation close to a root of f ( x) = 0 and x n+1 = g ( x n ) is an iterative


formula used to find the root of the equation near x0, then
(i) if g ′( x0 ) < 1 , the sequence x1 , x 2 , x3 , ⋅ ⋅ ⋅ will converge to the root. In particular,
(a) if − 1 < g ′( x0 ) < 0 , the sequence will oscillates and converge to the root
(b) if 0 < g ′( x0 ) < 1 , the sequence will converge to the root without oscillating.
(ii) if g ′( x0 ) ≥ 1 , the sequence x1 , x 2 , x3 , ⋅ ⋅ ⋅ will diverge.
Without proof, the above possibilities are explained by an example.
CHAPTER 2: Solutions of Equations in One Variable 19

Example 2.1
The equation x 3 + 2 x − 5 = 0 has a root near x = 1.4. Using following iteration formulae,
perform few iterations and comment on the rerults.
2 xn 3 + 5
(b) xn +1 = (5 − 2 xn )1 / 3
1
(a) xn +1 = (5 − xn 3 ) (c) xn +1 =
2 3 xn 2 + 2
The equation can be rearranged as
2x = − x3 + 5
or 3x 3 + 2 x = 2 x 3 + 5
x(3 x 2 + 2) = 2 x 3 + 5
2x3 + 5
x=
3x 2 + 2
and this arrangement gives the iteration formula (c).
The calculation using the three iteration formulae are as follows:

n Formula Formula Formula


(a) (b) (c)
0 1.4 1.4 1.4
1 1.128 1.300591 1.330964
2 1.782375 1.338646 1.328273
3 -0.331181 1.324336 1.328269
4 2.518162 1.329753 1.328269
5 -5.484009 1.327708 1.328269
6 84.96401 1.328481 1.328269
7 -306670.2 1.328189 1.328269
8 1.44E+16 1.328299 1.328269
9 -1.5E+48 1.328257 1.328269
10 1.7E+144 1.328273 1.328269
The iteration function in (a) is
1 3
g a ( x) = (5 − x 3 ) and g a′ ( x) = − x 2
2 2
With x0 = 1.4 , g a′ (1.4) = −2.94 .
So g a′ (1.4) > 1 and the sequence will not converge to the root as shown in the above table.
The iteration function in (b) is
g b ( x) = (5 − 2 x )1 / 3 and
2 1
g b′ ( x) = −
3 (5 − 2 x) 2 / 3
With x0 = 1.4 , g b′ (1.4) = −0.394 .
Since g b′ (1.4) is negative and g b′ (1.4) < 1 , the sequence will converge to the root with
oscillation as shown in the above table.
The iteration function in (c) is
2x3 + 5 6 x( x 3 + 2 x − 5)
g c ( x) = and g c′ ( x) =
3x 2 + 2 (3 x 2 + 2) 2
With x0 = 1.4 , g c′ (1.4) = 0.0736 .
Since g c′ (1.4) is positive and g c′ (1.4) < 1 with small value, the sequence will converge
rapidly to the root without oscillation as shown in the above table.
20 NUMERICAL METHODS WITH EXCEL

2.10 A Test for Order of Convergence


Consider the convergence of the iteration formula x n+1 = g ( x n ) for the root α of the
equation f ( x) = 0 .
Let ε n be the error in the nth iteration, that is,
ε n+1 + α = g (α + ε n )
Expanding g (α + ε n ) in Taylor series about α, we get
εn εn2
g (α + ε n ) = g (α ) + g ′(α ) +
g ′′(α ) + ⋅ ⋅ ⋅
1! 2!
Since α is a root of the equation f ( x) = 0 , we have α = g (α ) , and hence
εn εn2
ε n+1 = g ′(α ) + g ′′(α ) + ⋅ ⋅ ⋅
1! 2!
If g ′(α ) ≠ 0 , then ε n+1 ∝ ε n and we have the first order convergence. If g ′(α ) = 0 and
g ′′(α ) ≠ 0 , then ε n+1 ∝ ε n 2 and we have the second order convergence and so on.
We summarize the results as follows:
The order of convergence is the order of the lowest non-zero derivative of the
iterative function g ( x) at the root α of f ( x) = 0

Example 1.1

Given that f ( x) = 2 cos 2 x + 2 − x .


(a) Find the number of real roots of the equation f ( x) = 0 .
(b) Show that the equation f ( x) = 0 has a root in (1,1.2) . Use the false position
(Regula Falsi) method to estimate this root correct to 4 decimal places,
(c) The equation f ( x) = 0 has a root in the interval (2.4, 2.6) . Use Newton-
Raphson formula to estimate this root correct to 5 decimal places with a suitable
starting value.
(d) An iterative formula x n +1 = (1 − k ) x n + 2k (1 + cos 2 xn ) can be used to estimate
the root of f ( x) = 0 . Find the range of values of k for which the iterative formula
will converge to the root near 3.6 .
Use this iterative formula with a suitable value of k to estimate the root correct to
3 d.p.

Solution

(a) The equation f ( x) = 0 i.e. 2 cos 2 x + 2 − x = 0 can be written as


2 cos 2 x = x − 2
The graphs of y = 2 cos 2 x and y = x − 2 are shown below.
CHAPTER 2: Solutions of Equations in One Variable 21

4
2

-2 2 4 6
-2
-4

The two curves intersect at three points and hence the number of real roots is 3.

(b) It can be seen that


f (1) = 0.16771
f (1.2) = −0.67479
Here f (1) f (1.2) < 0 . Thus a root lies in (1,1.2) .
Applying false position method on (1,1.2) , we have
1.2(0.16771) − 1(−0.67479)
x1 = = 1.03981 ≈ 1.0398
0.16771 − (−0.67479)
Now f (1.03981) = −0.01411
and f (1) = 0.16771 as the root lies in (1, 1.0367)
Using false position method again
1.03981(0.16771) − 1(−0.01411)
x2 = = 1.03672 ≈ 1.0367
0.16771 − (−0.01411)
Again f (1.03672) = −0.00021
f (1) = 0.16771
1.03672(0.16771) − 1(−0.00021)
and hence x3 = = 1.03667 ≈ 1.0367
0.16771 − (−0.00021)
Thus x2 and x3 are same to 4 d.p. Hence the root correct to 4 d.p. is 1.0367.
(c) When Newton-Raphson method applied to the equation, we have
f ( x) = 2 cos 2 x + 2 − x
f ′( x) = −4 sin 2 x − 1
Here f (2.4) = −0.225 and f (2.6) = 0.337 and we may take a starting value x0 = 2.5 .
Using Newton-Raphson formula we may proceed as follows:
x0 = 2.5
f ( x0 ) = f (2.5) = 0.067324
f ′( x0 ) = f ′(2.5) = 2.835697
f ( x0 ) 0.067324
x1 = x0 − = 2 .5 − = 2.476258 ≈ 2.47626
f ′( x0 ) 2.835697
f ( x1 ) − 0.000607
x 2 = x1 − = 2.476258 − = 2.476468 ≈ 2.47647

f ( x1 ) 2.885231
f ( x2 ) − 1.36 × 10 −7
x3 = x 2 − = 2.476468 − = 2.476468 ≈ 2.47647
f ′( x 2 ) 2.884831
The root correct to 5 d.p. is 2.47647.

(d) In this case the iterative function g (x) is given by


g ( x) = (1 − k ) x + 2k (1 + cos 2 x)
22 NUMERICAL METHODS WITH EXCEL

g ′( x) = 1 − k − 4k sin 2 x
and g ′(3.6) = 1 − 4.175k
The iterative formula will converge to the root near 3.6 if
g ′(3.6) < 1 or 1 − 4.175k < 1
− 1 < 1 − 4.175k < 1
− 2 < −4.175k < 0 (adding − 1 to each expression)
2 > 4.175k > 0 (multiplying by − 1 )
0.4896 > k > 0 (dividing by 4.175)
which gives the range of values of k.
A suitable choice of k is
1
1 − 4.175k ≈ 0 which gives k = = 0.2395 ≈ 0.24 .
4.175
With k = 0.24 , the iteration formula becomes
x n +1 = 1 − 0.24) xn + 2(0.24)(1 + cos 2 x n ) = 0.76 x n + 0.48(1 + cos 2 x n )
With x0 = 3.6 , the successive iterates are given below:
n xn xn (to 4 d.p.)
0 3.6 3.6000
1 3.50801 3.5080
2 3.50286 3.5029
3 3.50224 3.5022
4 3.50216 3.5022

The root correct to 4 d.p. is 3.5022.

Example 1.2

. Equation x tan x = 4 has infinite number of roots. To find the root near x = 1.3, we
may use an iteration formula xn+1 = arctan (4/xn). Show that the process is linearly
convergent.
Starting with x0 = 1.3, estimate x 4 rounded to 3 decimal places.
Show that x 4 is correct to 3 decimal places.

Solution
In this case the iterative function g(x) is
(x )
g ( x) = tan −1 4
1 ⎛ 4 ⎞ 4
Differentiating g ′( x) = ⎜⎜ − ⎟⎟ = −
1 + (4 / x) 2 ⎝ x 2 ⎠ x 2 + 16
Therefore g ′( x) ≠ 0 for all real values of x and hence it is linearly convergent.

Starting with x0 = 1.3 we have the successive iterated values as follows:


x1 = 1.2566 , x 2 = 1.2663 , x3 = 1.2642 , x 4 = 1.2647 ≈ 1.265
Comparing x 4 with x3 we cannot conclude that x 4 is correct to 3 d.p, Next iteration
gives
x5 = 1.2646 ≈ 1.265
Comparison of x 4 and x5 shows that x 4 is correct to 3 d.p.
CHAPTER 2: Solutions of Equations in One Variable 23

Alternatively, if x 4 is correct to 3 d.p. the root α must satisfy the condition


1.265 − 1 × 10 − 3 < α < 1.265 + 1 × 10 − 3 i.e. 1.2645 < α < 1.2655
2 2
Using f ( x) = x tan x − 4 . we find
f (1.2645) = −0.0016 and f (1.2655) = 0.0156
This shows that x 4 is correct to 3 d.p.
24 NUMERICAL METHODS WITH EXCEL

2.11 Solution Using MS Excel


2.11.1 Number of Real Roots by Graphical Method
For example, consider the number of real roots of the equation
7 cos x − 1 + 2 x = 0
The equation can be written as 7 cos x = 1 − 2 x .
Now consider the graphs of f1 ( x) = 7 cos x and f 2 ( x) = 1 − 2 x .

Excel Worksheet Entry for data values Creating Chart (Graph)


A B C 1 Tabulate the data values.
1 x f1(x) f2(x) 2 Select data range (cells A2:C14)
2 -6 =7*cos(A2) =1-2*A2 3 In the Insert menu, select Chart
3 -5 4 In the Chart Wizard, select Char type:
4 XY (Scatter) and in Chart sub-type :
5 Select Finish to complete the diagram.
Excel Results 6 Change the size of the diagram by dragging
A B C and change the background color (optional)
1 x f1(x) f2(x) 7 Place the diagram in the desired location
2 -6 6.721192 13 by dragging.
3 -5 1.985635 11
4 -4 -4.575505 9 15

5 -3 -6.929947 7 10

6 -2 -2.913028 5 5

7 -1 3.782116 3 0
-8 -6 -4 -2 0 2 4 6 8
8 0 7 1 -5

9 1 3.782116 -1 -10

10 2 -2.913028 -3 -15

11 3 -6.929947 -5
12 4 -4.575505 -7
13 5 1.985635 -9 There are three intersections and hence
14 6 6.721192 -11 the number of real roots is three.

Intervals of roots of width 0.5 for f ( x) = 7 cos x − 1 + 2 x = 0 .


A B
1 x f(x) 1 Enter the range of values of the variable x
2 -2 -7.913028 in column A.
3 -1.5 -3.50484 2 In cell B2 enter the formula
4 -1 0.782116 =7*cos(a2)-1+2*a2
5 0 6 and drag down the column.
6 1 4.782116
7 2 0.086972 From the table
8 2.5 -1.608005 (i) f(-1.5) f(-1) < 0 A root is in ( -1.5, -1).
9 3 -1.929947 (ii) f(2) f(2.5) < 0 A root is in ( 2, 2.5).
10 3.5 -0.555197 (i) f(3.5) f(4) < 0 A root is in ( 3.5, 4).
11 4 2.424495
CHAPTER 2: Solutions of Equations in One Variable 25

2.11.2 Solution by Bisection Method


To determine a root of f ( x) = 0 in (a, b) such that f (a) f (b) < 0 , set
a 0 = a and b0 = b .
The approximation to the root is obtained by
a + bn
xn = n n = 0,1,2, L
2
Now if f (a n ) f ( x n ) < 0 , then set
a n +1 = a n and bn +1 = x n
else set
a n +1 = x n and bn +1 = bn .

A B C D E F G
1 Solution of f(x) = 7 cos(x) - 1 + 2x = 0 by Bisection Method
2 n an xn bn f(an) f(xn) f(bn)
3 0 -1.5 -1.25 -1 -3.5048396
4 1 -1.25 -1.25
5 2
= (B3 + D3)/2 = 7 * cos(B3)− 1 + 2 * B3
6
7 = IF(F3 * E3 < 0, B3,C3) = IF(F3 * G3 < 0, D3, C3)
8

A B C D E F G
1 Solution of f(x) = 7 cos(x) - 1 + 2x = 0 by Bisection Method
2 n an xn bn f(an) f(xn) f(bn)
3 0 -1.5 -1.25 -1 -3.5048396 -1.292743 0.782116
4 1 -1.25 -1.125 -1 -1.2927435 -0.231764 0.782116
5 2 -1.125 -1.0625 -1 -0.2317644 0.281828 0.782116
6 3 -1.125 -1.09375 -1.0625 -0.2317644 0.026601 0.281828
7 4 -1.125 -1.109375 -1.09375 -0.2317644 -0.102201 0.026601
8 5 -1.109375 -1.101563 -1.09375 -0.1022013 -0.037704 0.026601
9 6 -1.101563 -1.097656 -1.09375 -0.0377036 -0.005527 0.026601
10 7 -1.097656 -1.095703 -1.09375 -0.005527 0.010543 0.026601
11 8 -1.097656 -1.09668 -1.095703 -0.005527 0.00251 0.010543
12 9 -1.097656 -1.097168 -1.09668 -0.005527 -0.001508 0.00251
13 10 -1.097168 -1.096924 -1.09668 -0.0015084 0.000501 0.00251
26 NUMERICAL METHODS WITH EXCEL

2.11.3 Solution by False Position (Regula Falsi) Method


The False Position method is very similar to Bisection method. Here replace the iterative
formula by
a n − bn
xn = an − f (a n ) .
f (a n ) − f (bn )

Replace the formula of cell C3 in Bisection method by


=B3-(D3-B3)*E3/(G3-E3)

A B C D E F G
1 Solution of f(x) = 7 cos(x) - 1 + 2x = 0 by False Position Method
2 n an xn bn f(an) f(xn) f(bn)
3 0 -1.5 -1.09122 -1 -3.5048396 0.04738 0.782116
4 1 -1.5 -1.096673 -1.09122 -3.5048396 0.002566 0.04738
5 2 -1.5 -1.096968 -1.096673 -3.5048396 0.000138 0.002566
6 3 -1.5 -1.096984 -1.096968 -3.5048396 7.43E-06 0.000138
7 4 -1.5 -1.096985 -1.096984 -3.5048396 3.99E-07 7.43E-06
8 5 -1.5 -1.096985 -1.096985 -3.5048396 2.15E-08 3.99E-07

2.11.4 Solution by Secant Method


To determine a root of f ( x) = 0 given two values x0 , x1 that are near the root, proceed as
follows:
If f ( x0 ) < f ( x1 ) , swap x0 and x1 and contitnue the process by using the iterative
formula
x n − x n −1
x n +1 = x n − f ( xn ) .
f ( x n ) − f ( n −1 )

Initialization of data:
x f(x) Here ⏐f(-1.5)⏐ > ⏐f(-1)⏐ and thus use
-1.5 -3.50484 x0 = -1.5
-1 0.782116 x1 = -1

A B C D E F G
1 Solution of f(x) = 7 cos(x) - 1 + 2x = 0 by Secant Method
2 n xn f(xn)
3 0 -1.5 -3.50484 In cell C3 enter the formula
4 1 -1 0.782116 =7*cos(B3) - 1 +2*B3
5 2 -1.09122 0.04738 and copy down the column.
6 3 -1.097103 -0.000972
7 4 -1.096985 1.09E-06 In cell B5 enter the formula
8 5 -1.096985 2.51E-11 =B4 - (B4 - B3)*C4/(C4 -C3)
9 6 -1.096985 0 and copy down the column.
CHAPTER 2: Solutions of Equations in One Variable 27

2.11.5 Solution by Newton (Newton-Raphson) Method


In Newton-Raphson method, the iterative formula is expressed as
f ( xn )
x n+1 = x n − , n = 0, 1, 2, 3, ⋅ ⋅ ⋅
f ′( x n )
For example,

Solution of 7 cos(x) - 1 + 2x = 0 by Newton-Raphson Method


Here f(x) = 7 cos x - 1 + 2x
f'(x) = - 7 sin x +2

Estimation of starting value


x f(x)
-1.5 -3.50484 Root is closer to x = -1.
-1 0.782116 Comparing the magnitudes, assume xo = - 1.1.

A B C D
1 Solution by Newton-Raphson Method
2 n xn f(xn) f'(xn)
3 0 -1.1 = −7 * sin(B3)+ 2
4 1 =B3-C3/D3
5 2 = 7 * cos(B3)− 1 + 2 * B3

A B C D
1 Solution by Newton-Raphson Method
2 n xn f(xn) f'(xn)
3 0 -1.1 -0.024827 8.238452
4 1 -1.096986 -1.44E-05 8.228855
5 2 -1.096985 -4.92E-12 8.228849
6 3 -1.096985 0 8.228849
7 4 -1.096985 0 8.228849
8 5 -1.096985 0 8.228849
28 NUMERICAL METHODS WITH EXCEL

Exercise 2

1. Given the following equations:


(i) x 3 + 4 x − 3 = 0 (ii) x 4 + 2 x 2 − 7 = 0 (iii) 2e x − x 2 − 7 = 0
(iv) e 2 x (5 − 3x) = 1 (v) 7 cos x − 1 + 2 x = 0 (vi) 2 sin 2 x + 4 − x 2 = 0
(vii) ln(2 x) − 5 + 2 x = 0 (viii) sin x − x + 1 = 0 (ix) x ln x − 1.2 = 0
(x) 3x − 1 − cos x = 0 (xi) 4 x 2 − tan x − 1 = 0 in (−π / 2, π / 2)

(a) Find the number of real roots and in each case find an interval where the root lies.
(b) Use Bisection method to find a root of the equation correct to 1 decimal place.
(c) Use the false position method (Regula Falsi) method to find a root, correct to 2
decimal places.
(d) Use Secant method to find a root of the equation correct to 2 decimal places.
(e) Use Newton-Raphson method to find a root of the equation correct to 3 decimal
places.

2. Given that f ( x) = e 2 x − e x − 10 = 0 .
(a) Find the number of real roots of the equation f ( x) = 0 and locate them with an
interval of width 1.
(b) Use the Bisection method thrice to find the new interval where the roots lie.
(c) Use the Secant method on the interval obtained in (b) to estimate the roots
correct to 3 decimal places.

3. Show that the equation f ( x) = 3x + cos 3x − 4 = 0 has a root in [1, 2].


Find the root correct to 3 significant figures using
(i) Bisection method
(ii) False position method
(iii) Secant method and
(iv) Newton-Raphson method.
Compare the number of iterations required and the computational effort in each case.

4. The equation f(x) = 0 has a real root α, and x1 is an approximation to α, where α =


x1 - ε and ε is small. Write down the first two terms of Taylor’s series, in powers of
ε, for f ( x1 − ε ) . Hence obtain the Newton-Raphson approximation to α.
Solve the equation 3x – cos x – 1 = 0 by Newton-Raphson method.

5. Given that f ( x) = x sin x + cos x .


(a) Show that the equation f ( x) = 0 has a real root α in the interval [2, 3] .
(b) Use the Secant method twice on the above interval to obtain an approximation to
α rounded to 2 decimal places.
(c) Use Newton-Raphson method twice starting with the estimated value obtained
in (b) to find a second approximation x 2 to α, giving your answer to 5 decimal
places.
(d) Show that x 2 is correct to 5 decimal places.
CHAPTER 2: Solutions of Equations in One Variable 29

6. The equation 49 x 3 + 70 x 2 − 423x + 324 = 0 has a double root near x = 1. Use


modified Newton-Raphson method to find the root correct to 3 decimal places.

7. The equation x 6 − 3x 4 + 4 = 0 has two double roots. One near x = −1.5 and another
near x = 1.5 . Find the roots correct to 5 decimal places using the Newton-Raphson
method.

8. The equation 27 x 4 − 450 x 2 + 1000 x − 625 = 0 has a multiple root of multiplicity three
near x = 2. Use Newton-Raphson method to find the root correct to 5 decimal
places.

9. Consider the solution of x 3 + 5 x 2 − 9 = 0 in [1, 2] based on the following iterative


formulae
1/ 2
⎛ 9 − xn 3 ⎞
1/ 2
9 ⎛ 9 ⎞
(a) x n +1 = 2 − 5 (b) x n +1 = ⎜ ⎟ (c) x n +1 = ⎜⎜ ⎟⎟
⎜ 5 ⎟ ⎝ xn + 5 ⎠
xn ⎝ ⎠
Perform few iterations and comment on the different iterative formulas.

10. The equation 2 cos x – x = 0 has a root near x = 1.1. Among others, the following
iteration formulae are suggested to estimate the root.
1 2
(i) x n +1 = 2 cos x n (ii) x n +1 = cos x n + xn (iii) x n +1 = (cos x n + x n )
2 3
Apply an appropriate test to determine, for each rearrangement, whether or not the
corresponding iteration converges to the root.
Using whichever of these iteration formulae you consider most appropriate, find the
root correct to 4 significant figures.

11. The equation x 3 − 5 x 2 + 4 x − 3 = 0 has a root near x = 4 , which is to be computed


by the iteration
3 + (k − 4) xn + 5 x n2 − xn3
x n +1 = and x0 = 4
k
(i) Determine which value of k will give the fastest convergence.
(ii) Using this value of k, iterate three times and estimate the error in x3 .

12. Given that f ( x) = xe x + x 2 − 2 .


(a) Show that the equation f ( x) = 0 has only two real roots.
(b) Use the false position method twice in [0, 1] to find the root of f ( x) = 0 to 2
decimal places.
(c) Use Newton-Raphson method thrice to find the root in [−2,−1] of the equation
f ( x) = 0 giving your answer to 3 decimal places. Asses the accuracy of the root
without further calculation.
(d) An iterative formula x n +1 = x n + k ( x n e xn + x n 2 − 2) , k ≠ 0, can be used to
estimate the roots of f(x) = 0. Find the range of values of k for which the
iterative formula will converge to the root near 0.7.
Use this iterative formula with a suitable value of k to estimate the root correct to
3 d.p.
30 NUMERICAL METHODS WITH EXCEL

13. The following iterative formulae can be used to estimate the value of √ a . In each
case find the order of convergence of the sequence.
x n2 1 3a x n2
(i) x n +1 = 1 xn (1 + a2 ) (ii) x n+1 = 13 x n (4 − ) (iii) x n +1 = x n [6 + − ]
2 xn a 8 x n2 a
With an iterative formula above, estimate the value of 11 correct to 5 decimal
places.

14. Equation f(x) = 0 has a root x = α . Show that rewriting the equation as x = x + λ
f(x), where λ is a constant, yields a convergent iteration for α if λ = -1/f′ (x0) and x0
is sufficiently close to α.
Use this method to derive an iteration formula for the root of the equation
xe x = cos x .
Hence estimate the root near x = −1.8 correct to 2 decimal places.

You might also like