EEPC102 Module II
EEPC102 Module II
INTRODUCTION
Module II
2
MODULE II
ROOTS OF EQUATIONS
INTRODUCTION
This chapter on roots of equations deals with methods that exploit the
fact that a function typically changes sign in the vicinity of a root. These
techniques are called bracketing methods because two initial guesses for the
root are required. As the name implies, these guesses must “bracket,” or be
on either side of, the root.
In contrast, the open methods described in this chapter are based on
formulas that require only a single starting value of x or two starting values
that do not necessarily bracket the root. As such, they sometimes diverge or
move away from the true root as the computation progresses. They usually
do so much more quickly than the bracketing methods.
OBJECTIVES
1. Solve for the roots/”zeros’ of equations that will equate to zero when
substituted.
2. Discuss, Explain and Demonstrate the different Methods used in Solving
Roots of Equations.
3. Solve for several values of x that when substituted will satisfy
equations simultaneously.
4. Implement numerical methods with the use of Microsoft Excel.
There are three lessons in the module. Read each lesson carefully then
answer the exercises/activities to find out how much you have benefited from
EEPC102 Module II
3
it. Work on these exercises carefully and submit your output to your
instructor.
In case you encounter difficulty, discuss this with your instructor during
the face-to-face meeting.
EEPC102 Module II
4
Lesson 1
A. Graphical Methods
EEPC102 Module II
5
These points are plotted in Figure below. The resulting curve crosses
the c axis between 12 and 16. Visual inspection of the plot provides a rough
estimate of the root of 14.75. The validity of the graphical estimate can be
checked by substituting it into equation above to yield
9.81(68.1) 14.75
𝑓𝑓 (14.75) = �1 − 𝑒𝑒 −� 68.1 �10 � − 40 = 0.09983
14.75
Which is very close to zero.
EEPC102 Module II
6
EEPC102 Module II
7
If 𝑓𝑓(𝑥𝑥𝑥𝑥) ∙ 𝑓𝑓(𝑥𝑥𝑥𝑥) > 0, then the root lies in the upper subinterval. Therefore
set 𝑥𝑥𝑥𝑥 = 𝑥𝑥𝑥𝑥 and repeat Step 2.
If 𝑓𝑓(𝑥𝑥𝑥𝑥) ∙ 𝑓𝑓(𝑥𝑥𝑥𝑥) = 0, then the root is equal to 𝑥𝑥𝑥𝑥. Terminate the
computation.
• Step 4: Calculate the approximate percent relative error,
𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝
𝜀𝜀𝑎𝑎 = � 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 � 𝑥𝑥 100%
𝑥𝑥𝑟𝑟
• Step 5: Compare with. If 𝜀𝜀𝜀𝜀 < 𝜀𝜀𝜀𝜀, then stop the computation. Otherwise go to
Step 2 and repeat the process by using the new interval.
Figure B.2 A graphical depiction of the bisection method. This plot conforms
to the first three iterations from Example 1.
Using excel,
EEPC102 Module II
8
*for 𝑥𝑥𝑟𝑟
𝑥𝑥𝑙𝑙 + 𝑥𝑥𝑢𝑢
𝑥𝑥𝑟𝑟 =
2
Using step 3, you can evaluate the new intervals and continue to next
iterations.
*for 𝜀𝜀𝑎𝑎
𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝
𝜀𝜀𝑎𝑎 = � 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 � 𝑥𝑥 100%
𝑥𝑥𝑟𝑟
*for 𝜀𝜀𝑡𝑡
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣 − 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴
𝜀𝜀𝑡𝑡 = � � 𝑥𝑥 100%
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇 𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉
EEPC102 Module II
9
method of false position, or in Latin, regula falsi. It is also called the linear
interpolation method.
Using similar triangles (Fig. C.1), the intersection of the straight line with the
x axis can be estimated as
𝑓𝑓(𝑥𝑥𝑙𝑙 ) 𝑓𝑓(𝑥𝑥𝑢𝑢 )
=
𝑥𝑥𝑟𝑟 − 𝑥𝑥𝑙𝑙 𝑥𝑥𝑟𝑟 − 𝑥𝑥𝑢𝑢
By manipulating we will derived to
𝑓𝑓 (𝑥𝑥𝑢𝑢 )(𝑥𝑥𝑙𝑙 − 𝑥𝑥𝑢𝑢 )
𝑥𝑥𝑟𝑟 = 𝑥𝑥𝑢𝑢 −
𝑓𝑓 (𝑥𝑥𝑙𝑙 ) − 𝑓𝑓(𝑥𝑥𝑢𝑢 )
This is the false-position formula.
EEPC102 Module II
10
If 𝑓𝑓(𝑥𝑥𝑥𝑥) ∙ 𝑓𝑓(𝑥𝑥𝑥𝑥) > 0, then the root lies in the upper subinterval. Therefore
set 𝑥𝑥𝑥𝑥 = 𝑥𝑥𝑥𝑥 and repeat Step 2.
If 𝑓𝑓(𝑥𝑥𝑥𝑥) ∙ 𝑓𝑓(𝑥𝑥𝑥𝑥) = 0, then the root is equal to 𝑥𝑥𝑥𝑥. Terminate the
computation.
• Step 4: Calculate the approximate percent relative error,
𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝
𝜀𝜀𝑎𝑎 = � 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 � 𝑥𝑥 100%
𝑥𝑥𝑟𝑟
• Step 5: Compare with. If 𝜀𝜀𝜀𝜀 < 𝜀𝜀𝜀𝜀, then stop the computation. Otherwise go to
Step 2 and repeat the process by using the new interval.
Example 3. Use the false-position method to determine the root of the same
equation investigated in Example 1.
Solution:
As in Example 2, initiate the computation with guesses of 𝑥𝑥𝑙𝑙 = 12 and 𝑥𝑥𝑢𝑢 =16.
Using excel,
*for 𝑥𝑥𝑟𝑟
𝑓𝑓 (𝑥𝑥𝑢𝑢 )(𝑥𝑥𝑙𝑙 − 𝑥𝑥𝑢𝑢 )
𝑥𝑥𝑟𝑟 = 𝑥𝑥𝑢𝑢 −
𝑓𝑓 (𝑥𝑥𝑙𝑙 ) − 𝑓𝑓(𝑥𝑥𝑢𝑢 )
Using step 3, you can evaluate the new intervals and continue to next
iterations.
*for 𝜀𝜀𝑎𝑎
𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑟𝑟𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝
𝜀𝜀𝑎𝑎 = � 𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 � 𝑥𝑥 100%
𝑥𝑥𝑟𝑟
*for 𝜀𝜀𝑡𝑡
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣 − 𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴𝐴
𝜀𝜀𝑡𝑡 = � � 𝑥𝑥 100%
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇 𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉
EEPC102 Module II
11
FIGURE D Cases where roots could be missed because the increment length
of the search procedure is too large. Note that the last root on the right is
multiple and would be missed regardless of increment length.
EEPC102 Module II
12
Learning Activity
2. Determine the real root of 𝑓𝑓(𝑥𝑥 ) = −25 + 82𝑥𝑥 − 90𝑥𝑥 2 + 44𝑥𝑥 3 − 8𝑥𝑥 4 +
0.7𝑥𝑥 5
a. Graphically
b. Using bisection to determine the root to 𝜀𝜀𝑠𝑠 = 10%. Employ initial guesses
of 𝑥𝑥𝑙𝑙 = 0.5 and 𝑥𝑥𝑢𝑢 =1.0.
c. Perform the same computation as in (b) but use the false-position
method and 𝜀𝜀𝑠𝑠 = 0.2%.
EEPC102 Module II
13
Lesson 2
Iterative Non-Bracketing/Open
Methods
whereas 𝑠𝑠𝑠𝑠𝑠𝑠 𝑥𝑥 = 0 could be put into the form of Eq. (A.1) by adding 𝑥𝑥 to
both sides to yield
𝑥𝑥 = 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠 + 𝑥𝑥
The utility of Eq. (A.1) is that it provides a formula to predict a new value of
𝑥𝑥 as a function of an old value of 𝑥𝑥. Thus, given an initial guess at the root
𝑥𝑥𝑖𝑖 , Eq. (A.1) can be used to compute a new estimate 𝑥𝑥𝑖𝑖+1 as expressed by the
iterative formula
𝒙𝒙𝒊𝒊+𝟏𝟏 = 𝒈𝒈(𝒙𝒙𝒊𝒊 ) (A.2)
As with other iterative formulas, the approximate error for this equation
can be determined using the error estimator
𝒙𝒙𝒊𝒊+𝟏𝟏 − 𝒙𝒙𝒊𝒊
𝜺𝜺𝒂𝒂 = � � ∗ 𝟏𝟏𝟏𝟏𝟏𝟏%
𝒙𝒙𝒊𝒊+𝟏𝟏
EEPC102 Module II
14
Solution:
The function can be separated directly and expressed in the form of Eq. (A.2)
as 𝑥𝑥𝑖𝑖+1 = 𝑒𝑒 −𝑥𝑥𝑖𝑖
Starting with an initial guess of 𝑥𝑥0 = 0, this iterative equation can be applied
to compute
Thus, each iteration brings the estimate closer to the true value of the root:
0.56714329.
EEPC102 Module II
15
Starting with an initial guess of𝑥𝑥0 = 0, this iterative equation can be applied
to compute
Thus, the approach rapidly converges on the true root. Notice that the true
percent relative error at each iteration decreases much faster than it does
in simple fixed-point iteration (compare with Example 4).
EEPC102 Module II
16
EEPC102 Module II
17
Example 6. Use the secant method to estimate the root of 𝑓𝑓 (𝑥𝑥 ) = 𝑒𝑒 −𝑥𝑥 − 𝑥𝑥.
Start with initial estimates of 𝑥𝑥−1 = 0 and 𝑥𝑥0 =1.0.
Solution: Recall that the true root is 0.56714329. . . .
For 6 iterations we have arrived to the exact root of the equation which is
0.56714329.
Multiple roots pose some difficulties for many of the numerical methods such
as:
1. The fact that the function does not change sign at even multiple roots
precludes the use of the reliable bracketing methods that were discussed in
this module.
2. Another possible problem is related to the fact that not only 𝑓𝑓(𝑥𝑥) but also
𝑓𝑓′(𝑥𝑥) goes to zero at the root. This poses problems for both the Newton-
Raphson and secant methods, which both contain the derivative (or its
estimate) in the denominator of their respective formulas. This could result
in division by zero when the solution converges very close to the root. A simple
way to circumvent these problems is based on the fact that it can be
demonstrated theoretically (Ralston and Rabinowitz, 1978) that 𝑓𝑓(𝑥𝑥 ) will
always reach zero before 𝑓𝑓′(𝑥𝑥) . Therefore, if a zero check for 𝑓𝑓(𝑥𝑥) is
EEPC102 Module II
18
where 𝑚𝑚 is the multiplicity of the root (that is, m= 2 for a double root, m= 3
for a triple root, etc.). Of course, this may be an unsatisfactory alternative
because it hinges on fore knowledge of the multiplicity of the root.
Another alternative, also suggested by Ralston and Rabinowitz (1978), is to
define a new function 𝑢𝑢(𝑥𝑥), that is, the ratio of the function to its derivative,
as in
𝑓𝑓(𝑥𝑥)
𝑢𝑢(𝑥𝑥) = 𝑓𝑓′(𝑥𝑥)
D.3
It can be shown that this function has roots at all the same locations as the
original function. Therefore, Eq. (D.3) can be substituted into Eq. (B.2) to
develop an alternative form of the Newton-Raphson method:
𝑢𝑢(𝑥𝑥 )
𝑥𝑥𝑖𝑖+1 = 𝑥𝑥𝑖𝑖 − 𝑢𝑢′(𝑥𝑥𝑖𝑖 ) D.4
𝑖𝑖
Equations (D.3) and (D.15) can be substituted into Eq. (D.4) and the result
simplified to yield
𝑓𝑓(𝑥𝑥𝑖𝑖 )𝑓𝑓′(𝑥𝑥𝑖𝑖 )
𝑥𝑥𝑖𝑖+1 = 𝑥𝑥𝑖𝑖 − [𝑓𝑓′( D.6
𝑥𝑥𝑖𝑖 )]2 −𝑓𝑓(𝑥𝑥𝑖𝑖 )𝑓𝑓"(𝑥𝑥𝑖𝑖 )
Solution:
The first derivative of the equation is 3𝑥𝑥 2 − 10𝑥𝑥 + 7
The second derivative of the equation is 6𝑥𝑥 − 10
Substituting values to eqn. 6
EEPC102 Module II
19
Thus, the modified formula is quadratically convergent. We can also use the
method to search for the single root at x = 3. Using an initial guess of 𝑥𝑥0 = 4
gives the following results:
Learning Activity
1. Determine the highest real root of 𝑓𝑓 (𝑥𝑥 ) = 2𝑥𝑥 3 − 11𝑥𝑥 2 + 17.7𝑥𝑥 − 5 .
Compute the approximate percent relative error, 𝜀𝜀𝑎𝑎 and true percent
relative error, 𝜀𝜀𝑡𝑡 after each iteration.
a. Fixed-point iteration method (three iterations, 𝑥𝑥0 = 3)
b. Newton-Raphson method (three iterations, 𝑥𝑥0 = 3).
c. Secant method (three iterations, 𝑥𝑥−𝑖𝑖 = 3 𝑥𝑥0 = 4).
2. Locate the first positive root of 𝑓𝑓 (𝑥𝑥 ) = sin 𝑥𝑥 + cos (1 + 𝑥𝑥 2 -1)
where x is in radians. Compute the approximate percent relative
error, 𝜀𝜀𝑎𝑎 and true percent relative error, 𝜀𝜀𝑡𝑡 after each iteration. Use
four iterations of the secant method with initial guesses of
a. 𝑥𝑥𝑖𝑖−1 = 1 𝑥𝑥0 = 3.0
b. 𝑥𝑥𝑖𝑖−1 = 1.5 𝑥𝑥0 = 2.5
EEPC102 Module II
20
3. The function 𝑥𝑥 3 − 2𝑥𝑥 2 − 4𝑥𝑥 + 8 has a double root at 𝑥𝑥 = 2. Use (a) the
standard Newton-Raphson, (b) the modified Newton-Raphson [to solve
for the root at 𝑥𝑥 = 2. Compare and discuss the rate of convergence
using an initial guess of 𝑥𝑥0 = 1.2.
4. You are designing a spherical tank (Figure below) to hold water for a small
village in a developing country. The volume of liquid it can hold can be
computed as
[3𝑅𝑅 − ℎ]
𝑉𝑉 = 𝜋𝜋ℎ2
3
where V = volume (m3), h = depth of water in tank (m), and R = the
tank radius (m). If R = 3 m, what depth must the tank be filled to so
that it holds 30 m3? Use three iterations of the Newton-Raphson method
to determine your answer. Determine the approximate relative error
after each iteration. Note that an initial guess of R will always
converge.
EEPC102 Module II
21
Lesson 3
Roots of Polynomials
Mullers Method
Recall that the secant method obtains a root estimate by projecting a
straight line to the x axis through two function values (Fig. 3a). Muller’s
method takes a similar approach, but projects a parabola through three points
(Fig. 3b).
The method consists of deriving the coefficients of the parabola that
goes through the three points. These coefficients can then be substituted into
the quadratic formula to obtain the point where the parabola intercepts the
𝑥𝑥 axis—that is, the root estimate. The approach is facilitated by writing the
parabolic equation in a convenient form,
𝑓𝑓2 (𝑥𝑥 ) = 𝑎𝑎(𝑥𝑥 − 𝑥𝑥2 )2 + 𝑏𝑏(𝑥𝑥 − 𝑥𝑥2 ) + 𝑐𝑐 3.1
We want this parabola to intersect the three points [𝑥𝑥0 , 𝑓𝑓(𝑥𝑥0 )], [𝑥𝑥1 , 𝑓𝑓(𝑥𝑥1 )],
and [𝑥𝑥2 , 𝑓𝑓(𝑥𝑥2 )]. The coefficients of Eq. (3.1) can be evaluated by
substituting each of the three points to give
FIGURE 3 A comparison of two related approaches for locating roots: (a) the
secant method and (b) Müller’s method
EEPC102 Module II
22
Note that we have dropped the subscript “2” from the function for
conciseness. Because we have three equations, we can solve for the three
unknown coefficients, 𝑎𝑎, 𝑏𝑏, and 𝑐𝑐. Because two of the terms in Eq. (3.4) are
zero, it can be immediately solved for 𝑐𝑐 = 𝑓𝑓(𝑥𝑥2 ). Thus, the coeffi cient 𝑐𝑐 is
merely equal to the function value evaluated at the third guess, 𝑥𝑥2 . This
result can then be substituted into Eqs. (3.2) and (3.3) to yield two equations
with two unknowns:
which can be solved for 𝑎𝑎 and 𝑏𝑏. The results can be summarized as
𝛿𝛿1 −𝛿𝛿0
𝑎𝑎 = 3.8
ℎ1 +ℎ0
𝑏𝑏 = 𝑎𝑎ℎ1 + 𝛿𝛿1 3.9
𝑐𝑐 = 𝑓𝑓(𝑥𝑥2 ) 3.10
To find the root, we apply the quadratic formula to Eq. (3.1). However,
because of potential round-off error, rather than using the conventional form,
we use the alternative formulation to yield
−2𝑐𝑐
𝑥𝑥3 − 𝑥𝑥2 = 3.11a
𝑏𝑏 ±√𝑏𝑏2 −4𝑎𝑎𝑎𝑎
or isolating the unknown 𝑥𝑥3 on the left side of the equal sign,
−2𝑐𝑐
𝑥𝑥3 = 𝑥𝑥2 + 3.11b
𝑏𝑏 ±√𝑏𝑏2 −4𝑎𝑎𝑎𝑎
Note that the use of the quadratic formula means that both real and complex
roots can be located. This is a major benefi t of the method.
In addition, Eq. (3.11a) provides a neat means to determine the
approximate error. Because the left side represents the difference between
the present (𝑥𝑥3 ) and the previous (𝑥𝑥2 ) root estimate, the error can be
calculated as
EEPC102 Module II
23
𝑥𝑥3 − 𝑥𝑥2
𝜀𝜀𝑎𝑎 = � � ∗ 100%
𝑥𝑥3
Example 8. Use Müller’s method with guesses of 𝑥𝑥0 , 𝑥𝑥1 , and 𝑥𝑥2 = 4.5, 5.5,
and 5, respectively, to determine a root of the equation
𝑓𝑓 (𝑥𝑥 ) = 𝑥𝑥 3 − 13𝑥𝑥 − 12
Note that the roots of this equation are -3, -1, and 4.
EEPC102 Module II
24
For,
ℎ𝑖𝑖 = 𝑥𝑥𝑖𝑖+1 − 𝑥𝑥𝑖𝑖 = 5.5 − 4.5 = 1 ℎ𝑖𝑖+1 = 𝑥𝑥𝑖𝑖+2 − 𝑥𝑥𝑖𝑖+1 = 5 − 5.5 = −0.5
Learning Activity
Summative Test
EEPC102 Module II
25
2. Given
𝑓𝑓 (𝑥𝑥 ) = −2𝑥𝑥 6 − 1.5𝑥𝑥 4 + 10𝑥𝑥 + 2
Use a root location technique to determine the maximum of this
function. Perform iterations until the approximate relative error falls
below 5%. If you use a bracketing method, use initial guesses of 𝑥𝑥𝑙𝑙 = 0
and 𝑥𝑥𝑢𝑢 = 1. If you use the Newton-Raphson , use an initial guess of 𝑥𝑥𝑖𝑖 =
1. If you use the secant method, use initial guesses of 𝑥𝑥𝑖𝑖−1 = 0 and 𝑥𝑥𝑖𝑖 =
1. Assuming that convergence is not an issue, choose the technique
that is best suited to this problem. Justify your choice.
MODULE SUMMARY
In module II, you have learned the Roots of Equations through the use
of Bracketing and Open Methods.
EEPC102 Module II