Unit 2 (Locating Roots of Algebraic Equations)
Unit 2 (Locating Roots of Algebraic Equations)
Unit-2
(Locating Roots of Algebraic Equations)
Dr. Muhammad Majid Gulzar (CIE-KFUPM)
Contents (Unit-2):
1) Graphical Method (Sec 5.1)
Analyticalsolution of a x 2 + b x + c = 0
− b ± b 2 − 4ac
roots =
2a
No analytical solution is available for x − e− x = 0
Bracketing Method
Open Method
Bisection Method
This point, which represents the 𝑥𝑥 value for which 𝑓𝑓 𝑥𝑥 = 0 , provides a rough
e− x
approximation of the root.
𝑥𝑥 = 𝑒𝑒 −𝑥𝑥
2 Root
x
1
1 2
668.06
𝑓𝑓 14.75 = 1 − e−0.146843(14.75) − 40 = 0.100 ≅ 0
14.75
9.8 68.1 −
14.75
𝑣𝑣 = 1−e 68.1 10 = 40.100 ≅ 40
14.75
𝑓𝑓 𝑥𝑥 = 𝑠𝑠𝑠𝑠𝑠𝑠 10𝑥𝑥 + cos(3𝑥𝑥) Seems double root at about Infact distinct roots at about
𝑥𝑥 = 4.2 𝑥𝑥 = 4.23 & 4.26
In graphical method, it is observed that 𝑓𝑓(𝑥𝑥) changes sign on opposite sides of the root.
In general, if 𝑓𝑓(𝑥𝑥) is real and continuous in the interval from 𝑥𝑥𝑙𝑙 𝑡𝑡𝑡𝑡 𝑥𝑥𝑢𝑢 and 𝑓𝑓(𝑥𝑥𝑙𝑙 ) and
𝑓𝑓(𝑥𝑥𝑢𝑢 ) have opposite signs (𝑓𝑓(𝑥𝑥𝑙𝑙 )𝑓𝑓 𝑥𝑥𝑢𝑢 < 0), then there is at least one real root between
𝑥𝑥𝑙𝑙 and 𝑥𝑥𝑢𝑢 .
The bisection method, which is alternatively called binary chopping, interval halving or
Bolzano’s method, in which the interval is always divided in half.
The location of the root is then determined as lying at the midpoint of the subinterval
within which the sign change occurs.
+ - -
+ + -
Step 2:
An estimate of the root 𝑥𝑥𝑟𝑟 is determined by
𝑥𝑥𝑙𝑙 + 𝑥𝑥𝑢𝑢
𝑥𝑥𝑟𝑟 =
2
If 𝑓𝑓 𝑥𝑥𝑙𝑙 𝑓𝑓 𝑥𝑥𝑟𝑟 > 0, the root lies in the upper subinterval. Thus, set 𝑥𝑥𝑙𝑙 = 𝑥𝑥𝑟𝑟 and return to step 2.
If 𝑓𝑓 𝑥𝑥𝑙𝑙 𝑓𝑓 𝑥𝑥𝑟𝑟 = 0, the root equals 𝑥𝑥𝑟𝑟 . Thus, terminate the computation.
As 9.850 is greater than zero, thus no sign change occurs between the lower bound and the
midpoint. Consequently, the root must be located between 14 and 16.
Disadvantage:
Slow to converge
Good intermediate approximations may be discarded
𝑓𝑓(𝑥𝑥0 ) 33
Iteration 1: 𝑥𝑥1 = 𝑥𝑥0 − =4− =3
𝑓𝑓′(𝑥𝑥0 ) 33
𝑓𝑓(𝑥𝑥1 ) 9
Iteration 2: 𝑥𝑥2 = 𝑥𝑥1 − =3− = 2.4375
𝑓𝑓′(𝑥𝑥1 ) 16
𝑓𝑓(𝑥𝑥2 ) 2.0369
Iteration 3: 𝑥𝑥3 = 𝑥𝑥2 − = 2.4375 − = 2.2130
𝑓𝑓′(𝑥𝑥2 ) 9.0742
Dr. Muhammad Majid Gulzar (CIE-KFUPM)
Newton-Raphson Method (Class Activity):
Use the Newton-Raphson method to estimate the root of 𝑓𝑓 𝑥𝑥 = 𝑥𝑥 3 − 2𝑥𝑥 2 + 𝑥𝑥 − 3,
employing an initial guess of 𝑥𝑥0 = 4.
x1=x3=x5
x0=x2=x4
Disadvantage:
Must find the derivative
May encounter a zero derivative
1st Iteration:
2nd Iteration:
3rd Iteration:
40
-1.0000 1.0000 30
20
0
-1.1062 0.0102 -1.1052 0.0009 -10
-30
-40
Dr. Muhammad Majid Gulzar (CIE-KFUPM) -2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Modified Secant Method:
Rather than using two arbitrary values to estimate the derivative, an alternative approach
involves a fractional perturbation of the independent variable to estimate 𝑓𝑓 ′ (𝑥𝑥).
If 𝛿𝛿 is too big, the technique can become inefficient and even divergent.
However, if chosen correctly, it provides a nice alternative for cases where evaluating
the derivative is difficult and developing two initial guesses is inconvenient.
1st Iteration:
2nd Iteration:
3rd Iteration:
𝑓𝑓 𝑥𝑥 = 𝑒𝑒 −𝑥𝑥 − 𝑥𝑥
In general, odd multiple roots cross the axis, whereas even ones do not.
𝑓𝑓 ′ 𝑥𝑥 also goes to zero in addition to 𝑓𝑓 𝑥𝑥 at the root when using Newton-Raphson and
Secant Methods. This results in division by zero when solution converges very close to the
root.
Solution: This can be check in the program and computation can be terminated.
Thus, both methods converge quickly, with the standard method being somewhat more efficient.
Although it is preferable for multiple roots, it is somewhat less efficient and requires more
computational effort than the standard method for simple roots.