Roots of Equations
Roots of Equations
−𝑏 ± √𝑏 2 − 4𝑎𝑐
𝑥=
2𝑎
To solve
𝑓(𝑥) = 𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0
Numerical methods are used to solve for the roots that are not easily determined.
Example: Newton’s second law of motion used to solve for velocity of falling body.
𝑔𝑚 𝑐
𝑣= (1 − 𝑒 −(𝑚)𝑡 )
𝑐
where the velocity is 𝑣, the dependent variable, time is 𝑡, the independent variable, the gravity
constant is 𝑔, the forcing function, and the drag coefficient 𝑐 and the mass 𝑚, are the parameters
are known. The mentioned equation is used to predict the velocity as function of time.
However, suppose we had to determine the drag coefficient for a given mass to attain a
prescribed velocity in a set time period. The equation cannot be solved for the drag coefficient c
explicitly. In such case, 𝑐 is said to be implicit.
The solution is provided by numerical methods for roots of equations. This is done by
subtracting the dependent variable 𝑣 from both sides of the equation to give
𝑔𝑚 𝑐
𝑓(𝑐) = (1 − 𝑒 −(𝑚)𝑡 − 𝑣
𝑐
The value of 𝑐 that makes 𝑓(𝑐) = 0 is, therefore, the root of the equation. This value also
represents the drag coefficient that solve the design problem.
Bracketing Methods
This section on roots of equations that changes sign in the vicinity of the root. These
techniques are called bracketing methods because two initial guesses for the root are required.
Graphical Methods
Simply, make a plot of the function and observe where it crosses the 𝑥 − 𝑎𝑥𝑖𝑠, and that would
give a rough approximation of the root.
Example 5.1:
Bisection Method
As noticed in using the graphical method that 𝑓(𝑥) has changed sign on opposite sides of the
root. In general, if 𝑓(𝑥) is real and continuous in the interval from 𝑥𝑙 to 𝑥𝑢 and 𝑓(𝑥𝑙 ) and 𝑓(𝑥𝑢 )
have opposite signs, that is
The bisection method which is also called the interval halving because the interval is
always divided in half.
Solution procedure:
Step1: choose a lower xl and upper xu guesses for the root such that the function changes sign
over the interval. This can be checked by ensuring that f(xl)f(xu)<0.
a) If f(xl)f(xr)<0, the root lies in the lower subinterval. Therefore, set xu=xr, and return to
step 2.
b) If f(xl)f(xr)>0, the root lies in the upper subinterval. Therefore, set xl=xr and return to
step 2.
c) If f(xl)f(xr)=0, the root equals to xr; terminate computation.
Example 5.3: use bisection method to solve the same problem graphically in Example 5.1.
𝜀𝑎 < 𝜀𝑠
𝑥𝑟𝑛𝑒𝑤 −𝑥𝑟𝑜𝑙𝑑
where 𝜀𝑎 = | | × 100%
𝑥𝑟𝑛𝑒𝑤
Example 5.4:
Another feature of the bisection method is that you can calculate the number of iterations a priori
∆𝑥 0
𝑛 = 𝑙𝑜𝑔2 ( )
𝐸𝑎,𝑑
𝑓(𝑥𝑙 ) 𝑓(𝑥𝑢 )
=
𝑥𝑟 − 𝑥𝑙 𝑥𝑟 − 𝑥𝑢
The algorithm is similar to Bisection Method accept Eq (5.7) is substituted for step 2.
Example 5.5:
False position method converges quicker than the bisection method. See figure 5.13.
Always check the result and check and substitute the obtained root to see if the function
is zero.
If the function has acute curvature the false position method could give poor result.
Open Methods:
𝑥 = 𝑔(𝑥)
For example;
𝑥 2 − 2𝑥 + 3 = 0
𝑥2 + 3
𝑥=
2
𝑥 = 𝑠𝑖𝑛𝑥 + 𝑥
The utility of Eq (6.1) is that it provides a formula to predict a new value of x as a function of an
old value of x. Thus, given an initial guess at the root xi, Eq (6.1) can be used to compute a new
estimate of xi+1 as expressed by the iterative formula
𝑥𝑖+1 = 𝑔(𝑥𝑖 )
The approximation error for this formula can be evaluated using the error estimator
𝑥𝑖+1 − 𝑥𝑖
𝜀𝑎 = | | 100%
𝑥𝑖+1
Example 6.1: Use simple fixed-point iteration to locate the root of 𝑓(𝑥) = 𝑒 −𝑥 − 𝑥.
The most widely used of all root-locating formulas. If the initial value of the root is xi, a tangent
can be extended from the point [xi,f(xi)]. The point where this tangent crosses the x-axis usually
represents an improved estimate of the root.
𝑓(𝑥𝑖 ) − 0
𝑓 ′ (𝑥) =
𝑥𝑖 − 𝑥𝑖+1
𝑓(𝑥𝑖 )
𝑥𝑖+1 = 𝑥𝑖 −
𝑓 ′ (𝑥𝑖 )
A tangent of to the function of xi [that is, f’(xi)] is extrapolated down to the x-axis to provide an
estimate of the root of xi
Example 6.3: Use the Newton Raphson method to estimate the root of 𝑓(𝑥) = 𝑒 −𝑥 − 𝑥, use
initial guess of x0=0.
A potential problem in implementing the Newton Raphson method is the evaluation of the
derivative. Although this is not inconvenient for polynomials and many other functions, there
some functions whose derivatives may be extremely difficult or inconvenient to evaluate. For
these cases, the derivative can be approximated by a back ward finite divided difference, as in
the figure below.
This technique is similar to the Newton Raphson technique. In the sense that an estimate of the
root is predicted by extrapolating a tangent of the function to the x-axis. However, the secant
uses difference rather than derivative to estimate the slope.
𝑓(𝑥𝑖+1 ) − 𝑓(𝑥𝑖 )
𝑓 ′ (𝑥) ≅
𝑥𝑖+1 − 𝑥𝑖
This approximation can be substituted into the Newton Raphson formula to yield:
𝑓(𝑥𝑖 )(𝑥𝑖−1 − 𝑥𝑖 )
𝑥𝑖+1 = 𝑥𝑖 −
𝑓(𝑥𝑖−1 ) − 𝑓(𝑥𝑖 )
Note Secant method require two initial estimates but f(xi) need not change sign.
Modified Secant Method:
𝛿𝑥𝑖 𝑓(𝑥𝑖 )
𝑥𝑖+1 = 𝑥𝑖 −
𝑓(𝑥𝑖 + 𝛿𝑥𝑖 ) − 𝑓(𝑥𝑖 )
Example 6.8: Use modified secant method to estimate the root of 𝑓(𝑥) = 𝑒 −𝑥 − 𝑥. Use a value
of 0.01 for 𝛿 and start with 𝑥0 = 1.0. Recall that the true root is 0.56714329….
8.3, 8.19