NM Chapter 2
NM Chapter 2
ROOTS OF EQUATIONS
2.1 Introduction
The roots or zeros of equations can be simply defined as the value(s) of x that makes f(x) = 0. There are
many ways to solve for roots of equations. For some cases, the roots can be found easily by solving the
equation directly (Analytical Method). However, there are also other cases where solving the equation
directly or analytically is not so possible. In such instances, the only alternatives will be approximate
solution techniques. There are several techniques of such type. One alternative is to use Numerical
method. There are various techniques under this method. Some of them are; Bisection method, False-
Position method, Fixed point iteration method, Newton-Raphson method and Secant method. Another
alternative to obtain an approximate solution is to plot the function and determine where it crosses the
x-axis. This point, which represents the x-value for which f(x) = 0 is the root. When a solution (a root)
is obtained using this technique, it is called Graphical method. Graphical techniques are of limited
practical value because they are not precise. However, graphical methods can be utilized to obtain
rough estimates of the roots. These estimates can be employed as starting guesses for numerical
methods which will be discussed in the next section.
If a function f is real and continuous in an interval from xl to xu and f ( xl ) and f ( xu ) have opposite
signs then there exists at least one real root xr between xl and xu such that f ( x) 0 .
interval. This can be done by evaluating the function at xl and xu or by plotting the graph of the
function………………………(i)
xl xu
Estimate the root xr from; xr …………………………(ii)
2
Make the following evaluations to determine the interval in which the root lies
If f ( xl ) f ( xr ) 0 , the root lies in the lower subinterval. Therefore, set xu xr and
return to step ii
If f ( xr ) f ( xu ) 0 , the root lies in the upper subinterval. Therefore, set xl xr and
return to step ii
If f ( xr ) 0 , the root equals xr ; then terminate the computation.
2.2.1 Termination criteria and Error Estimate
We must now develop an objective criterion for deciding when to terminate the method. An initial
suggestion might be to end the calculation when the errors falls below some pre-specified level, s .
Therefore, we require an approximate relative error, a , given by the following equation, to be less than
or equal to s .
xr new xr old
a *100%
xr new
E.g. 2.1 Using Bisection Method, find the root of the function f x 5x3 5x 2 6 x 2 in the interval
0,1 . Calculate the percentage error at the end of each iteration. Use 5 iterations.
Solution:
f 0 5(0)3 5(0)2 6(0) 2 2
f 0.25 * f 0.5 0 at least one root exists b/n 0.25 and 0.5.
0.25 0.5
a *100% 100%
0.25
3rd Iteration;
0.25 0.5
xr 0.375
2
f 0.375 5(0.375)3 5(0.375)2 6(0.375) 2 0.1895
f 0.375 * f 0.5 0 at least one root exists b/n 0.375 and 0.5.
0.375 0.25
a *100% 33.33%
0.375
4th Iteration;
0.375 0.5
xr 0.4375
2
f 0.4375 5(0.4375)3 5(0.4375)2 6(0.4375) 2 0.0867
f 0.375 * f 0.4375 0 at least one root exists b/n 0.375 and 0.4375.
0.4375 0.375
a *100% 14.29%
0.4375
5th Iteration;
0.375 0.4375
xr 0.4063
2
f 0.4063 5(0.4063)3 5(0.4063)2 6(0.4063) 2 0.0525
f 0.4063 * f 0.4375 0 at least one root exists b/n 0.4063 and 0.4375.
0.4063 0.4375
a *100% 7.69%
0.4063
Since, only 5-iterations are required, the root is x = 0.4063.
E.g. 2.2 Use the Bisection method to estimate x . Take an initial guess of [2.2, 4.7] and compute the
absolute relative percentage error at the end of each iteration. The pre-specified error tolerance is,
s 2% . x4 – 5x3 + 5 x2 +5x -6 = 0
A shortcoming of the bisection method is that, in dividing the interval from xl to xu into equal halves,
no account is taken of the magnitude of f ( xl ) and f ( xu ) . For example, if f ( xl ) is much closer to zero
than f ( xu ) , it is likely that the root is closer to xl than to xu . An alternative method that exploits this
graphical insight is to join f ( xl ) and f ( xu ) by a straight line. The intersection of this line with the x
axis represents an improved estimate of the root. The fact that the replacement of the curve by a straight
line gives a “false position” of the root is the origin of the name, method of false position, or in Latin,
regula falsi. It is also called the linear interpolation method.
Using similar triangles (Fig. 2.1), the intersection of the straight line with the x axis, can be estimated as
f ( xl ) f ( xu )
xr xl xr xu
which can besolved for
f ( xu )( xl xu )
xr xu
f ( xl ) f ( xu )
Solution:
Let x 29 x 2 29 x 2 29 0 f x x 2 29
f xu xl xu
xr xu
f xl f xu
1st Iteration;
xl 5, xu 6 f xl 52 29 4, f xu 62 29 7
7 5 6
xr 6 5.3636
4 7
2nd Iteration;
xl 5.3636, xu 6
7 5.3636 6
xr 6 5.3840
0.2318 7
5.3840 5.3636
a *100% 0.38%
5.3840
3rd Iteration;
xl 5.3840, xu 6
7 5.3840 6
xr 6 5.3851
0.0125 7
5.3851 5.3840
a *100% 0.02% s 0.1%
5.3851
E.g. 2.4 Using the False-Position method, find the root or solution of the expression e x 3x 2 in the
interval [0.5, 1]. The pre-specified error tolerance is 0.002%.
Solution: - Solving by using a table;
n xl xu f ( xl ) f ( xu ) xr f ( xr ) %a
Since a 0.0011% s 0.002% stop the iteration. Thus the root of the given expression is xr 0.91001
E.g. 2.5 Use the False-Position method to estimate x correct to 3 decimal places. Take an initial guess
of [1, 3.2] and compute the absolute relative percentage error at the end of each iteration.
x3 7 x2 14 x 6 0
Solution: - First Iteration
xl 1 f ( xl ) 2
xu 3.2 f ( xu ) 0.11200
f ( xu )( xl xu ) (0.11200)(1 3.2)
xr xu 3.2 3.08333
f ( xl ) f ( xu ) 2 (0.112)
Second Iteration
f ( xr ) f (3.0833) 0.06886
f ( xl ) f ( xr ) 0, then xu xr 3.08333
f ( xu )( xl xu ) (0.06886)(1 3.08333)
xr xu 3.08333 3.01399
f ( xl ) f ( xu ) 2 (0.06886)
3.01399 3.08333
a *100 2.30%
3.01399
Third Iteration
f ( xr ) f (3.01399) 0.01360
f ( xl ) f ( xr ) 0, then xu xr 3.01399
f ( xu )( xl xu ) (0.01360)(1 3.01399)
xr xu 3.01399 3.00039
f ( xl ) f ( xu ) 2 (0.01360)
3.00039 3.01399
a *100 0.45%
3.00039
Forth Iteration
f ( xr ) f (3.00039) 0.00039
f ( xl ) f ( xr ) 0, then xu xr 3.00039
f ( xu )( xl xu ) (0.00039)(1 3.00039)
xr xu 3.00039 3.00000
f ( xl ) f ( xu ) 2 (0.00039)
3.00000 3.00039
a *100 0.013%
3.00000
Therefore the solution is xr 3.000 correct to 3 decimal places.
2.4 Fixed Point Iteration
Iterative techniques are used to find roots of equations, solutions of linear and nonlinear systems of
equations and solutions of differential equations. A rule or function g(x) for computing successive
terms is needed and it can be found by rearranging the function f(x) = 0 so that x is on the left side of
the equation. x = g(x). This transformation can be accomplished either by algebraic manipulation or by
simply adding x to both sides of the original equation. For example,
x2 2 x 3 0 can be simply manipulated to yield
x2 3
x
2
Whereas sin x = 0 could be put by adding x to both sides to yield
x sin x x
Thus, given an initial guess of the root xi, the above equation can be used to compute a new estimate
xi 1 as expressed by the iterative formula xi1 g ( xi )
The approximate error for this equation can be determined using the error estimator
xi1 xi
a *100%
xi1
E.g. 2.6 Find a real root of cos x 3x 5 0 correct to 4 decimal places. Take an initial guess of x0 0 .
Use the fixed-point iteration method.
1
x1 g ( x0 ) (5 cos 0) 2
3
1
x2 g ( x1 ) (5 cos 2) 1.52795
3
1
x3 g ( x2 ) (5 cos1.52795) 1.68094
3
1
x4 g ( x3 ) (5 cos1.68094) 1.63002
3
1
x5 g ( x4 ) (5 cos1.63002) 1.64694
3
1
x6 g ( x5 ) (5 cos1.64694) 1.64131
3
1
x7 g ( x6 ) (5 cos1.64131) 1.64318
3
1
x7 g ( x6 ) (5 cos1.64318) 1.64256
3
1
x8 g ( x7 ) (5 cos1.64256) 1.64277
3
1
x9 g ( x8 ) (5 cos1.64277) 1.64270
3
Solution: - the function can be separated directly and expressed in the form of x g ( x)
1st option
12 18 x 2 2.4 x3
Use x use initial guess of x0 0
21
12 18 x0 2 2.4 x03 12 18(0)2 2.4(0)3
1st iteration x1 0.57143
21 21
12 18 x12 2.4 x13 12 18(0.57143)2 2.4(0.57143)3
2nd iteration x2 0.27022
21 21
12 18 x2 2 2.4 x23 12 18(0.27022)2 2.4(0.27022)3
3 iteration x3
rd
0.50659
21 21
12 18 x32 2.4 x33 12 18(0.50659)2 2.4(0.50659)3
4th iteration x4 0.336603
21 21
.
.
12 18 x77 2 2.4 x773 12 18(0.41536)2 2.4(0.41536)3
78th iteration x78 0.41536
21 21
Therefore xr 0.41536
2nd option
12 21x 2.4 x3
Use x use initial guess of x0 0
18
12 21x0 2.4 x03 12 21(0)2 2.4(0)3
1st iteration x1 0.816497
18 18
12 21x1 2.4 x13 12 21(0.816497)2 2.4(0.816497)3
2 iteration x2
nd
1.300701
18 18
12 21x2 2.4 x23 12 21(1.300701)2 2.4(1.300701)3
3rd iteration x3 1.57403
18 18
12 21x3 2.4 x33 12 21(1.300701)2 2.4(1.300701)3
4 iteration x3
th
1.57403
18 18
.
.
12 21x37 2.4 x373 12 21(2.053604)2 2.4(2.053604)3
38th iteration x3 2.053604
18 18
Therefore xr 2.053604
3rd option
12 21x 18 x 2
Use x 3 use initial guess of x0 0
2.4
12 21x0 18 x0 2 3 12 21(0) 18(0)2
1st iteration x1 3 1.70998
2.4 2.4
12 21x1 18 x12 3 12 21(1.70998) 18(1.70998)2
2 iteration x2
nd 3 3.17124
2.4 2.4
12 21x2 18 x2 2 3 12 21(3.17124) 18(3.17124)2
3rd iteration x3 3 3.49461
2.4 2.4
12 21x3 18 x32 3 12 21(3.49461) 18(3.49461)2
4th iteration x4 3 3.82619
2.4 2.4
.
.
12 21x60 18 x60 2 3 12 21(5.861755) 18(5.861755)2
61st iteration x61 3 5.86176
2.4 2.4
Therefore xr 5.86176
2.5 Newton-Raphson Method
The Newton-Raphson (or simply Newton's) method is one of the most useful and best-known
algorithms that relies on the continuity of f(x) and f ’(x). The method is attributed to Sir Isaac Newton
(1643-1727) and Joseph Raphson (1648-1715).
If the initial guess of the root is xi , a tangent can be extended from the point xi , f ( xi ) . The point where
this tangent cross the x-axis usually represents an improved estimate of the root and the Newton-
Raphson method can be derived based on the basis of this geometrical interpretation and is expressed
by the iteration
The approximate error for this equation can be determined using the error estimator
xi1 xi
a *100%
xi1
E.g. 2.8 Use the Newton-Raphson method to estimate the real root near 2 of the
equation x4 11x 8 0 accurate to 4-decimal places.
Solution:
f xi
xi 1 xi i 0,1, 2......
f ' xi
x0 2 , f x0 f 2 24 11 2 8 2
f ' x 4 x3 11 , f ' x0 f ' 2 4 2 11 21
3
1st Iteration ( i 0 );
f x0 2
x1 x0 2 1.9048
f ' x0 21
f x1 f 1.9048 (1.9048)4 111.9048 8 0.2108
f ' x1 f ' 1.9048 4 1.9048 11 16.6427
3
2nd Iteration ( i 1 );
f x1 0.2108
x2 x1 1.9048 1.8921
f ' x1 16.6427
f x2 f 1.8921 (1.8921)4 111.8921 8 0.0034
f ' x2 f ' 1.8921 4 1.8921 11 16.0948
3
3rd Iteration ( i 2 );
f x2 0.0034
x3 x2 1.8921 1.8919
f ' x2 16.0948
f x3 f 1.8919 (1.8919)4 111.8919 8 0.0001
f ' x3 f ' 1.8919 4 1.8919 11 16.0857
3
4th Iteration ( i 3 );
f x3 0.0001
x4 x3 1.8919 1.8919
f ' x3 16.0857
x3 x4 1.8919 The root is x=1.8919 correct to 4-decimal places.
E.g. 2.9 Determine the roots of f(x) = -2 + 6.2x – 4 x2 + 0.7 x3 using Newton-Raphson method with
initial guess of X0 = 1 with in Ɛs = 1%.
Solution: - first determine the derivatives of the function
f ' ( x) 6.2 8x 2.1x 2
Then evaluate the function and its derivatives with initial guess which can be substituted into
equation
f ( xi )
xi 1 xi
f ' ( xi )
1st iteration (i=0) x0 1
f ( x0 ) f (1) 2 6.2(1) 4(1) 2 0.7(1) 3 0.9
x1 x0
f ' ( x0 ) f ' (1) 6.2 8(1) 2.1(1) 2 0.3
0.9 2 1
x1 1 2 a *100 150% s 1%
0.3 2
36 0.8235 (2)
x2 2 0.8235 a *100 142.86% s 1%
30.6 0.8235
Answer xr 0.435732
The Newton-Raphson algorithm requires two functions evaluations per iteration, f(x) and f’(x).
However, many functions have derivatives which may be extremely difficult or inconvenient to
evaluate. Hence, it is desirable to have a method for finding a root that does not depend on the
computation of a derivative. The secant method does not need a formula for the derivative and it can be
coded so that only one new function evaluation is required per iteration. For these cases, the derivative
can be approximated by a backward finite divided difference, as in fig. 2.3.
f ( xi1 ) f ( xi )
f '( xi )
xi1 xi
This approximation can be substituted into the
above equation to yield the following iterative
equation
f ( xi )( xi1 xi )
xi1 xi
f xi1 f xi
The approximate error for this equation can be determined using the error estimator
xi1 xi
a *100%
xi1
E.g. 2.10 Evaluate zero of the expression 2 x 9 log x , Accurate to 5 significant digits with an initial
guesses of x-1 = 4 and x0 = 5. Use Secant method.
f ( xi ) xi1 xi
xi1 xi
f ( xi1 ) f ( xi )
1st iteration (i=0) x1 4 and x0 5
f ( x0 ) x1 x0 f ( x1 ) 2(4) log 4 9 1.60206
x1 x0 ;
f ( x1 ) f ( x0 ) f ( x0 ) 2(5) log 5 9 0.30103
0.30103(4 5)
x1 5 4.84182
0.30103 (0.60206)
2nd iteration (i=1) x0 5 and x1 4.84182
f ( x1 ) x0 x1
x2 x1 ; f ( x1 ) 2(4.84182) log 4.84182 9 0.00137
f ( x0 ) f ( x1 )
0.00137(4.84182 5)
x2 4.84182 4.84253
0.00137 0.30103
3rd iteration (i=2) x1 4.84182 and x2 4.84253
f ( x2 ) x1 x2
x3 x2 ; f ( x2 ) 2(4.84253) log 4.84253 9 1.23199(105 )
f ( x1 ) f ( x2 )
1.21399(105 )(4.84253 4.84182)
x3 4.84253 4.84256
1.21399(105 ) (0.00137)
Thus, x 4.8425 is the root accurate to 5 significant digits.
E.g. 2.5 Determine x by using Secant method with an initial guess of x-1 = 1 and x0 = 1.5. Perform the
computation until Ɛa is less than Ɛs=1%
x3 0.795973 x2 0.039023 0
Solution: -
f ( xi ) xi1 xi
xi1 xi
f ( xi1 ) f ( xi )
0.1355(1.5 0.91194)
x2 0.91194 0.858375
1.62308375 0.1355
0.858375 0.91194
a *100 6.24% s 1%
0.858375