Roots of Equations
Roots of Equations
ROOTS OF EQUATIONS
−𝑏 ± √𝑏 2 − 4𝑎𝑐
𝑥=
2𝑎
to solve
𝑓(𝑥) = 𝑎 𝑥 2 + 𝑏 𝑥 + 𝑐 = 0
The values calculated are called roots of the equation. They represent the values of x that make 𝑓(𝑥) = 0.
For this reason, roots are sometimes called the zeros of the equation. Although the quadratic formula is
handy for solving quadratic equation, there are many other functions for which roots cannot be determined
so easily. For these cases, the numerical methods described in this chapter provide efficient means to obtain
the answer.
Graphical Method:
Graphical techniques are useful for visualizing the properties of the function and the behavior of the various
numerical methods. A simple method for obtaining an estimate of the root of the equation 𝑓(𝑥) = 0 is to
make a plot of the equation and observe where it crosses the x axis. This which represents the x value for
EX: use the graphical method to determine the roots for the equation
𝑓(𝑥) = 𝑒 𝑥 − 𝑥 − 2
Solution:
First
we X 0 1 2 3 4
From the graph the root is approximately 1.2. Graphical techniques are of limited practical value because
they are not precise. However, graphical methods can be utilized to obtain rough estimations of roots. These
Page 1 of 10 2025-03-17
Roots of Equations
Numerical method for finding a root of an equation can be classified to two classes of methods which are
BRACKETING METHOD
Bisection Method:
When applying graphical technique, you have observed that 𝑓(𝑥) changed sign on opposite sides of the
root. In general, if f(x) is real and continuous in the interval from 𝑓(𝑥𝑙 ) and 𝑓(𝑥𝑢 ) have opposite signs that is
𝑓(𝑥𝑙 )𝑓(𝑥𝑢 ) < 0 then there is at least one real root between 𝑥𝑙 and 𝑥𝑢 .
The bisection method is one type of incremental search method in which the interval is always divided in
half. If the location of the root is then determine as lying at the midpoint of the subinterval within which the
sign change occurs. The process repeated to obtain refined estimates. A simple algorithm for the bisection
Step1: choose lower 𝑥𝑙 and upper 𝑥𝑢 guesses for the root such that function changes sign over the interval.
xl xu
Step 2: an estimate of the root xf is determined by x f
2
Step 3: make following evaluation to determine in which subinterval the root leis:
a- if 𝑓(𝑥𝑙 )𝑓(𝑥𝑓 ) < 0, the root leis in the lower subinterval. Therefore, set 𝑥𝑢 = 𝑥𝑓 , and return to step 2
b- if 𝑓(𝑥𝑙 )𝑓(𝑥𝑓 ) > 0, the root leis in the `upper subinterval. Therefore, set 𝑥𝑙 = 𝑥𝑓 , and return to step 2
EX: use the bisection method to find the root of the equation
𝑓(𝑥) = cos(𝑥) – 𝑥 = 0
Solution: first we have to make sure that that f(0.5) and f(1.5) are different in sign. That is true f(0.5)=0.38
and f(1.5)= -1.43. Because there is a sign change in this interval, there will be root in this interval.
Now we need to know the sign of 𝑓(𝑥𝑓 ) = 𝑓(1) = −0.46. The sign is negative which means that the root
is interval [0.5,1]. The sign of f(x) changes from positive at x=0.5 to negative at x=1.
Page 2 of 10 2025-03-17
Roots of Equations
0.5 + 1.5
𝑥𝑓 = =1
2
0.5 + 1
𝑥𝑓 = = 0.75
2
0.5 + 0.75
𝑥𝑓 = = 0.625
2
and 𝑓(0.625) = 0.186 which is positive that mean the root is in the interval [0.625,0.75]. We continue to
An initial suggestion might be to end the calculation when the true error falls below some prespecified level.
We might decide that we should terminate when the error drops below say 0.1 percent. An estimated percent
𝑥𝑓𝑛𝑒𝑤 − 𝑥𝑓𝑜𝑙𝑑
𝜀𝑎 = | |
𝑥𝑓𝑛𝑒𝑤
Where 𝑥𝑓𝑛𝑒𝑤 is the root for the present iteration and 𝑥𝑓𝑜𝑙𝑑 is the root of previous iteration. The absolute value
is used because we are usually concerned with the magnitude of a rather than with its sign.
Page 3 of 10 2025-03-17
Roots of Equations
EX: continue the previous example until the approximate error falls below a a =0.5%.
Solution: the results of the iterations for previous example are listed below:
Iteration Xl Xu Xf a (%)
1 0.5 1.5 1
Although the bisection is a perfectly valid technique for determining roots, it is relatively inefficient. False
position is an alternative based on a graphical insight. A shortcoming of the bisection method is that in
dividing the interval from 𝑥𝑙 to 𝑥𝑢 into equal halves, no account is taken of the magnitudes of 𝑓(𝑥𝑙 ) and
𝑓(𝑥𝑢 ). For example, if 𝑓(𝑥𝑙 ) is much closer to zero than 𝑓(𝑥𝑢 ), it is likely that the root is closer to 𝑥𝑙 than to
𝑓(𝑥𝑙 ) and 𝑓(𝑥𝑢 ) by a straight line. The intersection of this line with
f(xu)
the 𝑥 axis represents an improved estimate of the root. The fact that
replacement the curve by a straight line gives a false position of the root xf
xl
is the origin of the name. It is also called the linear interpolation
xu x
method. The intersection of the line with the x axis f(xl)
This is the false position formula. The algorithm is identical to the one for bisection with the exception that
EX: continue the previous example until the approximate error falls below a a =0.5%.
Page 4 of 10 2025-03-17
Roots of Equations
Solution: the results of the iterations for previous example are listed below:
5 0.739 0.00014
OPEN METHODS
For the bracketing methods in the previous section, the root is located within an interval prescribed by a
lower and an upper bound. Repeated application of these methods always results in closer estimates of the
true value of the root. Such methods are said to be convergent because they move closer to the truth as
computation progress.
In contrast, the open methods described in this section are based on formulas that require only a single
starting value of x or two starting values that do not necessary bracket the root. As such they sometimes
diverge or move away from the true root as the computation progresses. However, when open methods
converge, they usually do so much more quickly than the bracketing methods.
As mentioned above, open methods employ a formula to predict the root. Such a formula can be developed
𝑓(𝑥) = 0
𝑥 = 𝑔(𝑥)
This transformation can be accomplished either by algebraic manipulation or by simply adding 𝑥 to both
x2 3
2
For example, x -2x +3=0 can be simply manipulated to yield x .
2
Page 5 of 10 2025-03-17
Roots of Equations
x2 3
So g ( x) . Whereas sin x=0 could be put into the form by adding x to both sides to yield
2
𝑥 = 𝑠𝑖𝑛 𝑥 + 𝑥 . so g(x) = sin x + x. Given an initial guess at the root 𝑥𝑖 , a new estimate xi+1 can be computed
Solution: the function can be separated directly and expressed in the form: 𝑥 = 𝑒 −𝑥 . So the iterative formula
𝑥𝑖+1 = 𝑒 −𝑥𝑖 Starting with an initial guess of 𝑥0 = 0 this iterative equation can be applied to compute the
table.
error
i xi a% t % *100 xi+1
true
0 0 100 1 f(x)
f(x)=e-x-x
1 1 100 76.3 0.367879 Root
Root
6 0.545396 11.2 3.83 0.579612
x
7 0.579612 5.9 2.2 0.560115
Thus, each iteration bring the estimate closer to the true value of the root: 0.56714329
Convergence:
Notice that the true percent relative error for each iteration of previous example is roughly proportional (by
factor of 0.5 to 0.6) to the error from previous iteration. This property called linear convergence. It is
graphically. The solution is Convergent when the estimates of x move closer to the root with each iteration
Page 6 of 10 2025-03-17
Roots of Equations
and the solution is divergent when the estimates of x move away from the root with each iteration. Notice
the convergence seems to occur only when the absolute value of the slope f(x)=g(x) is less than 1 that means
g ' ( x) 1 .
Newton-Raphson equation. If the initial guess at the root is 𝑥𝑖 , a f(x) Slope = f’(xi)
tangent can be extended from the point [𝑥𝑖 , 𝑓(𝑥𝑖 )]. The point f(xi)
where this tangent crosses the x axis usually represented an f(xi )-0
f x i 0
f ' x i
x i x i 1
EX: use Newton-Raphson method to estimate the root of 𝑓(𝑥) = 𝑒 −𝑥 − 𝑥 employing an initial guess of
𝑥0 = 0.
Solution: the first derivative of the function can be evaluated as f'(x) = - e-x-1
e xi x i
Which can be substituted with the original function give x i 1 x i
e xi 1
4 0.567143290 <10-8
Page 7 of 10 2025-03-17
Roots of Equations
Although, the Newton_Raphson method is often very efficient, there are situations where it is perform
This can be used to compute the table. Thus, after the first predication, the .
technique is converging on the true root of 1, but at a very slow rate. ∞ 1.00000000
Aside of slow convergence due to the nature of the function, other difficulties can arise, as illustrated in
a) Depicts the case where an inflection point [that is, f''(x) = 0 ] occurs in the vicinity of a root. Notice that
b) Illustrates the tendency of the Newton-Raphson technique to oscillate around a local maximum of
x2 x 1 x0 x1 x
move away from area of interest. That x0
x
encountered.
Page 8 of 10 2025-03-17
Roots of Equations
d) Obviously a zero slope truly a disaster because in causes division by zero in the Newton-Raphson
formula. Graphically, it means that the solution shoots off horizontally and never hits the x axis.
for polynomials and may other functions, there are certain functions
f x i 1 f x i
f ' x i .
x i 1 x i
f ( xi )
This approximation can be substituted into x i 1 x i
f ' x i
f ( x i )x i 1 x i
to yield the following iterative equation x i 1 x i .
f x i 1 f x i
This equation is the formula of the secant method. Notice that the approach requires two initial estimates of
x.
EX: use secant method to estimates the root of f(x) = e-x – x. start with initial estimates of xi-1 = 0 and x0 =
1.
First iteration
xi-1 = 0 f(xi-1) = 1
x0 = 1 f(x0) = -0.63212
0.632120 1
x1 1 0.6127 t 8.0%
1 0.63212
Second iteration
x0 = 1 f(x0) = -0.63212
Page 9 of 10 2025-03-17
Roots of Equations
Note that both estimates are now on the same side of the root.
0.07081 1 0.61270
x2 1 0.56384 t 0.58%
0.63212 0.07081
Third iteration:
Page 10 of 10 2025-03-17