Solving Nonlinear Equations
using Numerical Methods
(Bisection Method)
Numerical Methods
MATH160
Approximate Solutions to Polynomials
using Numerical Methods
Numerical methods represent alternatives that are also approximate
but employ systematic strategies to home in on the true root. There
are two ways in numerical methods in finding the roots of an
equation:
1. Bracketing Methods
2. Open Methods
Bracketing Methods
These methods start with guesses that bracket, or contain, the root
and then systematically reduce the width of the bracket. Two specific
methods are covered:
1. Bisection Method
2. False Position Method
Open Methods
These methods also involve systematic trial-and-error iterations but
do not require that the initial guesses bracket the root. These
methods are usually more computationally efficient than bracketing
methods but that they do not always work. We illustrate several
open methods including
1. Fixed-Point Iteration Method
2. Newton-Raphson Method
3. Secant Method
BRACKETING METHODS
Bisection Method
The bisection method is an incremental search method in which the
interval is always divided in half. If a function changes sign over an
interval, the function value at the midpoint is evaluated. The location
of the root is then determined as lying within the subinterval where
the sign change occurs. The subinterval then becomes the interval
for the next iteration. The process is repeated until the root is known
to the required precision.
Bisection Method
Bisection Method
Steps in Bisection Method:
1. Choose π₯π and π₯π’ as two guesses for the root such that
π π₯π’ π π₯π < 0. This ensures that π π₯ changes sign between π₯π and
π₯π’ . This indicates that somewhere between π₯π and π₯π’ there is a value
of π₯ where the function is equal to zero (root).
2. Estimate the root, π₯π , of the equation π π₯ = 0, as the midpoint
between π₯π and π₯π’ as
π₯π + π₯π’
π₯π =
2
Bisection Method
3. Now check the following:
a. If π π₯π π π₯π < 0, this indicates that there is a sign change
between π₯π and π₯π . Therefore the root lies between π₯π and π₯π ; so we
replace the old π₯π’ with the current π₯π .
b. If π π₯π π π₯π’ < 0, this indicates that there is a sign change
between π₯π’ and π₯π . Therefore the root lies between π₯π’ and π₯π ; so we
replace the old π₯π with the current π₯π .
c. If π π₯π = 0, then the root is π₯π ; Stop the algorithm if this is true.
Bisection Method
4. Find the new estimate of the root
π₯π + π₯π’
π₯π =
2
Find the approximate percent relative error as
%πππ =
π₯ππππ€−π₯ππππ
π₯ππππ€
× 100%
Bisection Method
5. Compare the approximate percent relative error %πππ to the prespecified relative error tolerance %ππ . If %πππ > %ππ , then repeat
step 3, else stop the algorithm.
Examples
1. Find the root of the function
π¦ = 39.24π₯ tanh 4
2.4525
π₯
− 36.
in between the interval [50,200] using Bisection method, given that
%ππ = 0.5%.
Solution
Iteration
ππ
ππ
ππ
0
50
200
125
π ππ
π ππ
π ππ
π ππ π ππ
π ππ π ππ
Solution (Iteration 0):
1. Enter the initial values of π₯π and π₯π’ given.
π₯ + π₯π’
2. Calculate the value of π₯π using, π₯π = π
2
3. Substitute the value of π₯π , π₯π’ and π₯π to the given equation:
π(π₯) = 39.24π₯ tanh 4
2.4525
π₯
− 36.
%πΊππ
%πΊππ <
%πΊπ
Solution
Iteration
ππ
ππ
ππ
π ππ
π ππ
π ππ
π ππ π ππ
π ππ π ππ
0
50
200
125
-4.57938708
0.8602906
-0.408601
1.8711443
-0.351516
Solution (Iteration 0):
π π₯π = π 50 =
2.4525
39.24(50) tanh 4
50
− 36 = −4.57938708
π π₯π’ = π 200 =
2.4525
39.24(200) tanh 4
200
− 36 = 0.8602906
π π₯π = π 125 =
2.4525
39.24(125) tanh 4
125
− 36 = −0.408601
4. Obtain the values of π ππ π ππ and π ππ π ππ .
5. We can’t calculate the value of %πΊππ because we only have one value of π₯π .
%πΊππ
%πΊππ <
%πΊπ ?
Solution
Iteration
ππ
ππ
ππ
0
50
200
125
1
125
200
162.5
π ππ
π ππ
-4.57938708 0.8602906
π ππ
π ππ π ππ
π ππ π ππ
-0.408601
1.8711443
-0.351516
%πΊππ
Solution (Iteration 1):
1. For the value of ππ :
If π π₯π π π₯π < 0 in the previous row, then copy the value of π₯π in the previous row.
If π π₯π π π₯π > 0 in the previous row, then copy the value of π₯π in the previous row.
2. For the value of ππ :
If π π₯π π π₯π’ < 0 in the previous row, then copy the value of π₯π’ in the previous row.
If π π₯π’ π π₯π > 0 in the previous row, then copy the value of π₯π in the previous row.
π₯π + π₯π’
3. Calculate the new value of π₯π using, π₯π =
2
%πΊππ <
%πΊπ ?
Solution
Iteration
ππ
ππ
ππ
0
50
200
125
1
125
200
162.5
π ππ
π ππ
π ππ
π ππ π ππ
π ππ π ππ
-4.57938708 0.8602906
-0.408601
1.8711443
-0.351516
-0.408601463
0.3594043
-0.1468531
0.309192107
0.8602906
Solution (Iteration 1):
4. Substitute the value of π₯π , π₯π’ and π₯π to the given equation:
π(π₯) = 39.24π₯ tanh 4
2.4525
π₯
− 36.
π π₯π = π 125 = −0.408601463
π π₯π’ = π 200 = 0.8602906
π π₯π = π 162.5 = 0.3594043
5. Obtain the values of π ππ π ππ and π ππ π ππ .
%πΊππ
%πΊππ <
%πΊπ ?
Solution
Iteration
ππ
ππ
ππ
0
50
200
125
1
125
200
162.5
π ππ
π ππ
π ππ
π ππ π ππ
π ππ π ππ
-4.57938708 0.8602906
-0.408601
1.8711443
-0.351516
-0.408601463
0.3594043
-0.1468531
0.309192107
0.8602906
%πΊππ
%πΊππ <
%πΊπ ?
23.07692
no
Solution (Iteration 1):
6. Calculate the value of %πππ using, %πππ =
π₯ππππ€ −π₯πππ
π
π₯ππππ€
× 100%
π₯ππππ€ − π₯ππππ
162.5 − 125
%πππ =
× 100% =
× 100% = 23.07692%
πππ€
π₯π
162.5
7. Check if %πΊππ < %πΊπ . Since %πΊππ = 23.07692% and %πΊπ = π. π%, therefore we
need to continue with our iteration.
Solution
Iteration
ππ
ππ
ππ
π ππ
π ππ
π ππ
π ππ π ππ
π ππ π ππ
0
50
200
125
-4.57938708
0.8602906
-0.408601
1.8711443
-0.351516
1
125
200
162.5
-0.408601463
0.8602906
0.3594043
-0.1468531
2
125
162.5
143.75
-0.408601463
0.3594043
0.0205771
3
125
143.75
134.375
-0.408601463
0.0205771
4
134.375
143.75
139.0625
-0.180600273
5
139.0625
143.75
141.40625
6
141.4063
143.75
7
142.5781
143.75
%πΊππ
%πΊππ <
%πΊπ ?
0.309192107
23.07692
no
-0.0084078
0.007395508
13.04348
no
-0.1806
0.0737935
-0.00371624
6.976744
no
0.0205771
-0.076963
0.0138996
-0.00158369
3.370787
no
-0.07696347
0.0205771
-0.027465
0.0021138
-0.00056516
1.657459
no
142.578125
-0.02746527
0.0205771
-0.003266
8.971E-05
-6.7208E-05
0.821918
no
143.1640625
-0.003266139
0.0205771
0.0086995
-2.841E-05
0.00017901
0.409277
yes
For the iteration 2 to 7, repeat the steps in iteration 1 until %πΊππ < %πΊπ .
At iteration 7, we see that %πΊππ < %πΊπ . We now have an estimate of the root between
the interval [50,200] which is equal to the value of the last π₯π
The root is approximately equal to π₯π = 143.1640625.
Examples
2. You are working for ‘DOWN THE TOILET COMPANY’ that makes
floats for ABC company. You are asked to find the depth to which
the ball is submerged when floating in water. The equation that
gives the depth x to which the ball is submerged under water is
given by
π¦ = π₯ 3 − 0.165π₯ 2 + 3.993 × 10−4
Solve this equation in the interval [-0.5, 0.5] using Bisection Method
given that the error tolerance is 0.2%.
Bisection Method
Advantages
1. The bisection method is always convergent. Since the method
brackets the root, the method is guaranteed to converge.
2. As iterations are conducted, the interval gets halved. So one can
guarantee that the error in the solution of the equation is reduced
as iterations go on.
Bisection Method
Disadvantages
1. The convergence of the bisection method is slow as it is simply
based on halving the interval.
2. If one of the initial guesses is closer to the root, it will take larger
number of iterations to reach the root.
3. If a function f(x) is such that it
just touches the x –axis, as
shown in the figure, it is unable
to find π₯π or π₯π’ .
Bisection Method
Disadvantages
4. For functions f(x) where there is a singularity and it reverses sign
at the singularity, the bisection method may converge on the
singularity. However, the function is not continuous and the theorem
that a root exists is also not applicable. An example of this is the
function,
π π₯
1
=
π₯
END