Professional Documents
Culture Documents
NonLinear Equations
NonLinear Equations
Example 1
Derive the solution to ax 2 + bx + c = 0 .
Solution
ax 2 + bx + c = 0
Dividing both sides by a , (a ≠ 0), we get
b c
x2 + x + = 0
a a
Note if a = 0 , the solution to
ax 2 + bx + c = 0
is
c
x=−
b
Rewrite
b c
x2 + x + = 0
a a
as
2
⎛ b ⎞ b2 c
⎜x+ ⎟ − 2 + =0
⎝ 2a ⎠ 4a a
2
⎛ b ⎞ b2 c
⎜x + ⎟ = 2 −
⎝ 2a ⎠ 4a a
b 2 − 4ac
=
4a 2
b b 2 − 4ac
x+ =±
2a 4a 2
b 2 − 4ac
=±
2a
2
b b − 4ac
x=− ±
2a 2a
2
− b ± b − 4ac
=
2a
Example 2
A ball is thrown down at 50 mph from the top of a building. The building is 420 feet tall.
Derive the equation that would let you find the time the ball takes to reach the ground.
Solution
The distance s covered by the ball is given by
1
s = ut + gt 2
2
where
u = initial velocity (ft/s)
g = acceleration due to gravity ( ft/s 2 )
t = time (s )
Given
miles 1 hour 5280 ft
u = 50 × ×
hour 3600 s 1 mile
ft
= 73.33
s
ft
g = 32.2 2
s
s = 420 ft
we have
1
420 = 73.33t + (32.2) t 2
2
2
16.1t + 73.33t − 420 = 0
The above equation is a quadratic equation, the solution of which would give the time it
would take the ball to reach the ground. The solution of the quadratic equation is
− 73.33 ± 73.33 2 − 4 × 16.1 × (−420)
t=
2(16.1)
= 3.315,−7.870
Since t > 0, the valid value of time t is 3.315 s .
Solution of Cubic Equations
How to Find the Exact Solution of a General Cubic Equation
In this section, we are going to find the exact solution of a general cubic equation
ax 3 + bx 2 + cx + d = 0 (1)
( ) 2
To find the roots of Equation (1), we first get rid of the quadratic term x by making the
substitution
b
x= y− (2)
3a
to obtain
3 2
⎛ b ⎞ ⎛ b ⎞ ⎛ b ⎞
a⎜ y − ⎟ + b⎜ y − ⎟ + c⎜ y − ⎟ + d = 0 (3)
⎝ 3a ⎠ ⎝ 3a ⎠ ⎝ 3a ⎠
Expanding Equation (3) and simplifying, we obtain the following equation
⎛ b2 ⎞ ⎛ 2b 3 bc ⎞
ay 3 + ⎜⎜ c − ⎟⎟ y + ⎜⎜ d + − ⎟=0 (4)
⎝ 3a ⎠ ⎝ 27 a 2 3a ⎟⎠
Equation (4) is called the depressed cubic since the quadratic term is absent. Having the
equation in this form makes it easier to solve for the roots of the cubic equation.
First, convert the depressed cubic Equation (4) into the form
1⎛ b2 ⎞ 1⎛ 2b 3 bc ⎞
y 3 + ⎜⎜ c − ⎟⎟ y + ⎜⎜ d + − ⎟=0
a⎝ 3a ⎠ a⎝ 27 a 2 3a ⎟⎠
y 3 + ey + f = 0 (5)
where
1⎛ b2 ⎞
e = ⎜⎜ c − ⎟⎟
a⎝ 3a ⎠
1⎛ 2b 3 bc ⎞
f = ⎜⎜ d + − ⎟
a⎝ 27 a 2 3a ⎟⎠
Now, reduce the above equation using Vieta’s substitution
s
y= z+ (6)
z
For the time being, the constant s is undefined. Substituting into the depressed cubic
Equation (5), we get
3
⎛ s⎞ ⎛ s⎞
⎜ z + ⎟ + e⎜ z + ⎟ + f = 0 (7)
⎝ z⎠ ⎝ z⎠
Expanding out and multiplying both sides by z 3 , we get
z 6 + (3s + e)z 4 + fz 3 + s(3s + e)z 2 + s 3 = 0 (8)
e
Now, let s = − ( s is no longer undefined) to simplify the equation into a tri-quadratic
3
equation.
e3
z 6 + fz 3 − =0 (9)
27
By making one more substitution, w = z 3 , we now have a general quadratic equation which
can be solved using the quadratic formula.
2 e3
w + fw − =0 (10)
27
Once you obtain the solution to this quadratic equation, back substitute using the previous
substitutions to obtain the roots to the general cubic equation.
w→ z→ y→ x
where we assumed
w = z3 (11)
s
y= z+
z
e
s=− (12)
3
b
x= y−
3a
Note: You will get two roots for w as Equation (10) is a quadratic equation. Using
Equation (11) would then give you three roots for each of the two roots of w , hence giving
you six root values for z . But the six root values of z would give you six values of y
( Equation (6) ); but three values of y will be identical to the other three. So one gets only
three values of y , and hence three values of x . (Equation (2))
Example 1
Find the roots of the following cubic equation.
x 3 − 9 x 2 + 36 x − 80 = 0
Solution
For the general form given by Equation (1)
ax 3 + bx 2 + cx + d = 0
we have
a = 1 , b = −9 , c = 36 , d = −80
in
x 3 − 9 x 2 + 36 x − 80 = 0 (E1-1)
Equation (E1-1) is reduced to
y 3 + ey + f = 0
where
1⎛ b2 ⎞
e = ⎜⎜ c − ⎟⎟
a⎝ 3a ⎠
2
1⎛
= ⎜⎜ 36 −
(− 9) ⎞
⎟
1⎝ 3(1) ⎟
⎠
=9
and
1⎛ 2b 3 bc ⎞
f = ⎜⎜ d + − ⎟
a⎝ 27 a 2 3a ⎟⎠
3
1⎛ 2(− 9) (− 9)(36 ) ⎞
= ⎜⎜ − 80 + − ⎟
1⎝ 27(1)
2
3(1) ⎟⎠
= −26
giving
y 3 + 9 y − 26 = 0 (E1-2)
For the general form given by Equation (5)
y 3 + ey + f = 0
we have
e = 9 , f = −26
in Equation (E1-2).
From Equation (12)
e
s=−
3
9
=−
3
= −3
From Equation (10)
2 e3
w + fw − =0
27
93
w 2 − 26 w − =0
27
w 2 − 26 w − 27 = 0
where
w = z3
and
s
y= z+
z
3
= z−
z
− (− 26 ) ± (− 26 )2 − 4(1)(− 27 )
w=
2(1)
= 27,−1
The solution is
w1 = 27
w2 = −1
Since
w = z3
z3 = w
For w = w1
z 3 = w1
= 27
= 27 e i 0
Since
w = z3
3
( )
re iθ = ue iα = u 3e 3iα
r (cosθ + i sin θ ) = u 3 (cos 3α + i sin 3α )
resulting in
r = u3
cos θ = cos 3α
sin θ = sin 3α
Since sin θ and cos θ are periodic of 2π ,
3α = θ + 2πk
θ + 2πk
α=
3
k will take the value of 0, 1 and 2 before repeating the same values of α .
So,
θ + 2πk
α= , k = 0, 1, 2
3
θ
α1 =
3
α2 =
(θ + 2π )
3
α3 =
(θ + 4π )
3
So roots of w = z 3 are
1
⎛ θ θ⎞
z1 = r 3 ⎜ cos + i sin ⎟
⎝ 3 3⎠
1
⎛ θ + 2π θ + 2π ⎞
z 2 = r 3 ⎜ cos + i sin ⎟
⎝ 3 3 ⎠
1
⎛ θ + 4π θ + 4π ⎞
z 3 = r 3 ⎜ cos + i sin ⎟
⎝ 3 3 ⎠
gives
1/ 3 ⎛ 0 0⎞
z1 = (27 ) ⎜ cos + i sin ⎟
⎝ 3 3⎠
=3
1/ 3 ⎛ 0 + 2π 0 + 2π ⎞
z 2 = (27 ) ⎜ cos + i sin ⎟
⎝ 3 3 ⎠
⎛ 2π 2π ⎞
= 3⎜ cos + i sin ⎟
⎝ 3 3 ⎠
⎛ 1 3⎞
= 3⎜⎜ − + i ⎟
⎟
⎝ 2 2 ⎠
3 3 3
= − +i
2 2
1/ 3 ⎛ 0 + 4π 0 + 4π ⎞
z 3 = (27 ) ⎜ cos + i sin ⎟
⎝ 3 3 ⎠
⎛ 4π 4π ⎞
= 3⎜ cos + i sin ⎟
⎝ 3 3 ⎠
⎛ 1 3⎞
= 3⎜⎜ − − i ⎟
⎝ 2 2 ⎟⎠
3 3 3
= − −i
2 2
Since
3
y=z−
z
3
y1 = z1 −
z1
3
= 3−
3
=2
3
y2 = z2 −
z2
⎛ 3 3 3⎞ 3
= ⎜⎜ − + i ⎟−
⎟
⎝ 2 2 ⎠ ⎛ 3 3 3⎞
⎜− + i ⎟
⎜ 2 2 ⎟
⎝ ⎠
5 + 3i 3
=−
−1 + i 3
5 + 3i 3 − 1 − i 3
=− ×
−1 + i 3 −1 − i 3
= −1 + i 2 3
3
y3 = z 3 −
z3
⎛ 3 3 3⎞ 3
= ⎜⎜ − − i ⎟−
⎝ 2 2 ⎟⎠ ⎛ 3 3 3 ⎞
⎜− − i ⎟
⎜ 2 2 ⎟
⎝ ⎠
5 − i3 3
=
1+ i 3
5 − i3 3 1 − i 3
= ×
1+ i 3 1− i 3
= −1 − i 2 3
Since
x = y+3
x1 = y1 + 3
= 2+3
=5
x2 = y2 + 3
( )
= − 1 + i2 3 + 3
= 2 + i2 3
x3 = y 3 + 3
( )
= − 1 − i2 3 + 3
= 2 − i2 3
Example 2
Find the roots of the following cubic equation
x 3 − 0.03 x 2 + 2.4 × 10 −6 = 0
Solution
For the general form
ax 3 + bx 2 + cx + d = 0
a = 1, b = −0.03, c = 0, d = 2.4 ×10 −6
Depress the cubic equation by letting (Equation (2))
b
x= y−
3a
= y−
(− 0.03)
3(1)
= y + 0.01
Substituting the above equation into the cubic equation and simplifying, we get
( ) (
y 3 − 3 × 10 −4 y + 4 × 10 −7 = 0)
That gives e = −3 × 10 −4 and f = 4 ×10 −7 for Equation (5), that is, y 3 + ey + f = 0 .
Now, solve the depressed cubic equation by using Vieta’s substitution as
s
y= z+
z
to obtain
( ) ( ) ( )
z 6 + 3s − 3 ×10 −4 z 4 + 4 ×10 −7 z 3 + s 3s − 3 ×10 −4 z 2 + s 3 = 0
Letting
e − 3 × 10 −4
s=− =− = 10 −4
3 3
we get the following tri-quadratic equation
( )
z 6 + 4 ×10 −7 z 3 + 1×10 −12 = 0
Using the following conversion, w = z 3 , we get a general quadratic equation
( ) (
w 2 + 4 ×10 −7 w + 1×10 −12 = 0 )
Using the quadratic equation, the solutions for w are
−7 2
w=
− 4 ×10 −7 ± (4 ×10 ) (
− 4(1) 1× 10 −12 )
2(1)
giving
(
w1 = −2 × 10 −7 + i 9.79795897113 × 10 −7 )
(
w2 = −2 × 10 −7 − i 9.79795897113 × 10 −7 )
Each solution of w = z 3 yields three values of z . The three values of z from w1 are in
rectangular form.
Since
w = z3
Then
1
z=w 3
Let
w = r (cosθ + i sin θ ) = reiθ
then
z = u(cos α + i sin α ) = ue iα
This gives
w = z3
3
( )
re iθ = ue iα = u 3e 3iα
r (cosθ + i sin θ ) = u 3 (cos 3α + i sin 3α )
resulting in
r = u3
cos θ = cos 3α
sin θ = sin 3α
Since sin θ and cos θ are periodic of 2π ,
3α = θ + 2πk
θ + 2πk
α=
3
k will take the value of 0, 1 and 2 before repeating the same values of α .
So,
θ + 2πk
α= , k = 0, 1, 2
3
θ
α1 =
3
α2 =
(θ + 2π )
3
α3 =
(θ + 4π )
3
So the roots of w = z 3 are
1
⎛ θ θ⎞
z1 = r 3 ⎜ cos + i sin ⎟
⎝ 3 3⎠
1
⎛ θ + 2π θ + 2π ⎞
z 2 = r 3 ⎜ cos + i sin ⎟
⎝ 3 3 ⎠
1
⎛ θ + 4π θ + 4π ⎞
z 3 = r 3 ⎜ cos + i sin ⎟
⎝ 3 3 ⎠
So for
(
w1 = −2 × 10 −7 + i 9.79795897113 × 10 −7 )
−7 2 −7 2
r= (− 2 × 10 ) + (9.7979589711 3 × 10 )
= 1 × 10 −6
9.79795897113 × 10 −7
θ = tan −1
− 2 × 10 −7
= 1.772154248 (2nd quadrant because y (the numerator) is positive and x (the
denominator) is negative)
1
⎛ 1.772154248 1.772154248 ⎞
z1 = (1 × 10 −6 )3 ⎜ cos + i sin ⎟
⎝ 3 3 ⎠
= 0.008305409517 + i 0.005569575635
1
⎛ 1.772154248 + 2π 1.772154248 + 2π ⎞
( )
z 2 = 1 × 10 −6 3 ⎜ cos
3
+ i sin
3
⎟
⎝ ⎠
= −0.008976098746 + i 0.004407907815
1
−6 3 ⎛ 1.772154248 + 4π 1.772154248 + 4π ⎞
(
z 3 = 1 × 10 ) ⎜ cos
3
+ i sin
3
⎟
⎝ ⎠
= 0.0006706892313 − i 0.009977483448
Compiling
z1 = 0.008305409518 + i0.005569575634
z 2 = −0.008976098746 + i0.004407907814
z 3 = 6.7068922852 5 × 10 −4 − i0.0099774834 48
Similarly, the three values of z from w2 in rectangular form are
z 4 = 0.008305409518 − i0.005569575634
z 5 = −0.008976098746 − i0.004407907814
z 6 = 6.7068922852 5 × 10 −4 + i0.0099774834 48
Using Vieta’s substitution (Equation (6)),
s
y= z+
z
y = z+
(
1×10 −4 )
z
we back substitute to find three values for y .
For example, choosing
z1 = 0.008305409518 + i0.005569575634
gives
1 × 10 −4
y1 = 0.008305409518 + i0.005569575634 +
0.008305409518 + i0.005569575634
= 0.0083054095 18 + i 0.0055695756 34
1 × 10 − 4 0.0083054095 18 − i 0.0055695763 4
+ ×
0.0083054090 78 + i 0.0055695763 4 0.0083054095 18 − i 0.0055695763 4
= 0.0083054095 18 + i 0.0055695756 34
1 × 10 − 4
+ (0.0083054095 18 − i0.0055695763 4)
1 × 10 − 4
= 0.016610819036
The values of z1 , z 2 and z 3 give
y1 = 0.016610819036
y2 = −0.01795219749
y3 = 0.001341378457
respectively. The three other z values of z 4 , z 5 and z 6 give the same values as y1 , y 2 and
y 3 , respectively.
Now, using the substitution of
x = y + 0.01
the three roots of the given cubic equation are
x1 = 0.016610819036 + 0.01
= 0.026610819036
x2 = −0.01795219749 + 0.01
= −0.00795219749
x3 = 0.001341378457 + 0.01
= 0.011341378457
Bisection Method of Solving a Nonlinear Equation
What is the bisection method and what is it based on?
One of the first numerical methods developed to find the root of a nonlinear equation
f ( x) = 0 was the bisection method (also called binary-search method). The method is based
on the following theorem.
Theorem
An equation f ( x) = 0 , where f (x) is a real continuous function, has at least one root
between xℓ and xu if f ( xℓ ) f ( xu ) < 0 (See Figure 1).
Note that if f ( xℓ ) f ( xu ) > 0 , there may or may not be any root between xℓ and xu
(Figures 2 and 3). If f ( xℓ ) f ( xu ) < 0 , then there may be more than one root between xℓ and
xu (Figure 4). So the theorem only guarantees one root between xℓ and xu .
Bisection method
Since the method is based on finding the root between two points, the method falls
under the category of bracketing methods.
Since the root is bracketed between two points, xℓ and xu , one can find the mid-
point, x m between xℓ and xu . This gives us two new intervals
1. xℓ and x m , and
2. x m and xu .
f (x)
xℓ
x
xu
Figure 1 At least one root exists between the two points if the function is real, continuous,
and changes sign.
f (x)
x
xℓ xu
Figure 2 If the function f (x) does not change sign between the two points, roots of the
equation f ( x) = 0 may still exist between the two points.
f (x) f (x)
xℓ xu
x x
xℓ xu
Figure 3 If the function f (x) does not change sign between two points, there may not be
any roots for the equation f ( x) = 0 between the two points.
f (x)
xu
xℓ x
Figure 4 If the function f (x) changes sign between the two points, more than one root for
the equation f ( x) = 0 may exist between the two points.
Is the root now between xℓ and x m or between x m and xu ? Well, one can find the sign of
f ( xℓ ) f ( xm ) , and if f ( xℓ ) f ( xm ) < 0 then the new bracket is between xℓ and x m , otherwise,
it is between x m and xu . So, you can see that you are literally halving the interval. As one
repeats this process, the width of the interval [xℓ , xu ] becomes smaller and smaller, and you
can zero in to the root of the equation f ( x) = 0 . The algorithm for the bisection method is
given as follows.
Example 1
You are working for ‘DOWN THE TOILET COMPANY’ that makes floats for ABC
commodes. The floating ball has a specific gravity of 0.6 and has a radius of 5.5 cm. 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
x 3 − 0.165x 2 + 3.993 × 10 −4 = 0
Use the bisection method of finding roots of equations to find the depth x to which the ball
is submerged under water. Conduct three iterations to estimate the root of the above
equation. Find the absolute relative approximate error at the end of each iteration, and the
number of significant digits at least correct at the end of each iteration.
Solution
From the physics of the problem, the ball would be submerged between x = 0 and x = 2 R ,
where
R = radius of the ball,
that is
0 ≤ x ≤ 2R
0 ≤ x ≤ 2(0.055)
0 ≤ x ≤ 0.11
Lets us assume
xℓ = 0, xu = 0.11
Check if the function changes sign between xℓ and xu .
f ( xℓ ) = f (0) = (0) 3 − 0.165(0) 2 + 3.993 × 10 −4 = 3.993 × 10 −4
f ( xu ) = f (0.11) = (0.11) 3 − 0.165(0.11) 2 + 3.993 × 10 −4 = −2.662 × 10 −4
Hence
f ( xℓ ) f ( xu ) = f (0) f (0.11) = (3.993 × 10 −4 )( −2.662 × 10 −4 ) < 0
So there is at least one root between xℓ and xu , that is between 0 and 0.11.
Iteration 1
The estimate of the root is
x + xu
xm = ℓ
2
0 + 0.11
=
2
= 0.055
3 2
f (xm ) = f (0.055) = (0.055) − 0.165(0.055) + 3.993 × 10 −4 = 6.655 × 10 −5
( )( )
f ( xℓ ) f ( xm ) = f (0) f (0.055) = 3.993 × 10 −4 6.655 × 10 −4 > 0
Hence the root is bracketed between x m and xu , that is, between 0.055 and 0.11. So, the
lower and upper limit of the new bracket is
xℓ = 0.055, xu = 0.11
At this point, the absolute relative approximate error ∈a cannot be calculated as we do not
have a previous approximation.
Iteration 2
The estimate of the root is
x + xu
xm = ℓ
2
0.055 + 0.11
=
2
= 0.0825
f ( xm ) = f (0.0825) = (0.0825) 3 − 0.165(0.0825) 2 + 3.993 × 10 −4 = −1.622 × 10 −4
( ) ( )
f (xℓ ) f (x m ) = f (0.055 ) f (0.0825) = 6.655 × 10 −5 × − 1.622 × 10 −4 < 0
Hence, the root is bracketed between xℓ and x m , that is, between 0.055 and 0.0825. So the
lower and upper limit of the new bracket is
xℓ = 0.055, xu = 0.0825
The absolute relative approximate error ∈a at the end of Iteration 2 is
xmnew − xmold
∈a = × 100
xmnew
0.0825 − 0.055
= × 100
0.0825
= 33.33%
None of the significant digits are at least correct in the estimated root of xm = 0.0825
because the absolute relative approximate error is greater than 5%.
Iteration 3
x + xu
xm = ℓ
2
0.055 + 0.0825
=
2
= 0.06875
f ( xm ) = f (0.06875) = (0.06875) 3 − 0.165(0.06875) 2 + 3.993 × 10 −4 = −5.563 × 10 −5
f ( xℓ ) f ( xm ) = f (0.055) f (0.06875) = (6.655 × 10 5 ) × (−5.563 × 10 −5 ) < 0
Hence, the root is bracketed between xℓ and x m , that is, between 0.055 and 0.06875. So the
lower and upper limit of the new bracket is
xℓ = 0.055, xu = 0.06875
The absolute relative approximate error ∈a at the ends of Iteration 3 is
xmnew − xmold
∈a = × 100
xmnew
0.06875 − 0.0825
= × 100
0.06875
= 20%
Still none of the significant digits are at least correct in the estimated root of the equation as
the absolute relative approximate error is greater than 5%.
Seven more iterations were conducted and these iterations are shown in Table 1.
f (x)
1
A singularity in a function is defined as a point where the function becomes infinite. For example, for a function
such as 1 / x , the point of singularity is x = 0 as it becomes infinite.
f (x)
1
Figure 7 The equation f (x ) = = 0 has no root but changes sign.
x
Newton-Raphson Method of Solving a Nonlinear
Equation
Introduction
Methods such as the bisection method and the false position method of finding roots of a
nonlinear equation f ( x) = 0 require bracketing of the root by two guesses. Such methods
are called bracketing methods. These methods are always convergent since they are based on
reducing the interval between the two guesses so as to zero in on the root of the equation.
In the Newton-Raphson method, the root is not bracketed. In fact, only one initial
guess of the root is needed to get the iterative process started to find the root of an equation.
The method hence falls in the category of open methods. Convergence in open methods is
not guaranteed but if the method does converge, it does so much faster than the bracketing
methods.
Derivation
The Newton-Raphson method is based on the principle that if the initial guess of the root of
f ( x) = 0 is at xi , then if one draws the tangent to the curve at f ( xi ) , the point xi +1 where
the tangent crosses the x -axis is an improved estimate of the root (Figure 1).
Using the definition of the slope of a function, at x = xi
f ʹ(xi ) = tan θ
f (xi ) − 0
= ,
xi − xi +1
which gives
f (xi )
xi +1 = xi − (1)
f ʹ(xi )
Equation (1) is called the Newton-Raphson formula for solving nonlinear equations of the
form f (x) = 0 . So starting with an initial guess, xi , one can find the next guess, xi +1 , by
using Equation (1). One can repeat this process until one finds the root within a desirable
tolerance.
Algorithm
The steps of the Newton-Raphson method to find the root of an equation f (x) = 0 are
1. Evaluate f ʹ(x ) symbolically
2. Use an initial guess of the root, xi , to estimate the new value of the root, xi +1 , as
f (xi )
xi +1 = xi −
f ʹ(xi )
3. Find the absolute relative approximate error ∈a as
xi +1 − xi
∈a = × 100
xi +1
4. Compare the absolute relative approximate error with the pre-specified relative
error tolerance, ∈s . If ∈a > ∈s , then go to Step 2, else stop the algorithm. Also,
check if the number of iterations has exceeded the maximum number of iterations
allowed. If so, one needs to terminate the algorithm and notify the user.
f (x)
f (xi)
[xi, f (xi)]
f (xi+1)
θ
x
xi+2 xi+1 xi
Example 1
You are working for ‘DOWN THE TOILET COMPANY’ that makes floats for ABC
commodes. The floating ball has a specific gravity of 0.6 and has a radius of 5.5 cm. You
are asked to find the depth to which the ball is submerged when floating in water.
The equation that gives the depth x in meters to which the ball is submerged under water is
given by
x 3 − 0.165x 2 + 3.993 × 10 −4 = 0
Use the Newton-Raphson method of finding roots of equations to find
a) the depth x to which the ball is submerged under water. Conduct three iterations
to estimate the root of the above equation.
b) the absolute relative approximate error at the end of each iteration, and
c) the number of significant digits at least correct at the end of each iteration.
Solution
f (x ) = x 3 − 0.165x 2 + 3.993 × 10 −4
f ʹ(x ) = 3x 2 − 0.33 x
Let us assume the initial guess of the root of f (x) = 0 is x0 = 0.05 m. This is a reasonable
guess (discuss why x = 0 and x = 0.11 m are not good choices) as the extreme values of the
depth x would be 0 and the diameter (0.11 m) of the ball.
Iteration 1
The estimate of the root is
f (x 0 )
x1 = x0 −
f ʹ(x0 )
= 0.05 −
(0.05)3 − 0.165(0.05)2 + 3.993 × 10 −4
2
3(0.05 ) − 0.33(0.05 )
1.118 × 10 −4
= 0.05 −
− 9 × 10 −3
= 0.05 − (− 0.01242)
= 0.06242
The absolute relative approximate error ∈a at the end of Iteration 1 is
x1 − x0
∈a = × 100
x1
0.06242 − 0.05
= × 100
0.06242
= 19.90%
The number of significant digits at least correct is 0, as you need an absolute relative
approximate error of 5% or less for at least one significant digit to be correct in your result.
Iteration 2
The estimate of the root is
f (x1 )
x 2 = x1 −
f ʹ(x1 )
3 2
(0.06242 ) − 0.165(0.06242 ) + 3.993 × 10 −4
= 0.06242 − 2
3(0.06242 ) − 0.33(0.06242 )
− 3.97781× 10 −7
= 0.06242 −
− 8.90973 × 10 −3
(
= 0.06242 − 4.4646 × 10 −5 )
= 0.06238
The absolute relative approximate error ∈a at the end of Iteration 2 is
x2 − x1
∈a = ×100
x2
0.06238 − 0.06242
= × 100
0.06238
= 0.0716%
The maximum value of m for which ∈a ≤ 0.5 ×102 − m is 2.844. Hence, the number of
significant digits at least correct in the answer is 2.
Iteration 3
The estimate of the root is
f (x 2 )
x3 = x 2 −
f ʹ(x 2 )
3 2
(0.06238 ) − 0.165(0.06238 ) + 3.993 × 10 −4
= 0.06238 − 2
3(0.06238 ) − 0.33(0.06238 )
4.44 × 10 −11
= 0.06238 −
− 8.91171× 10 −3
(
= 0.06238 − − 4.9822 ×10 −9 )
= 0.06238
The absolute relative approximate error ∈a at the end of Iteration 3 is
0.06238 − 0.06238
∈a = × 100
0.06238
=0
The number of significant digits at least correct is 4, as only 4 significant digits are carried
through in all the calculations.
2. Division by zero
For the equation
f (x ) = x 3 − 0.03x 2 + 2.4 × 10 −6 = 0
the Newton-Raphson method reduces to
3 2
xi − 0.03 xi + 2.4 ×10 −6
xi +1 = xi − 2
3xi − 0.06 xi
For x0 = 0 or x0 = 0.02 , division by zero occurs (Figure 4). For an initial guess close to
0.02 such as x0 = 0.01999 , one may avoid division by zero, but then the denominator in the
formula is a small number. For this case, as given in Table 2, even after 9 iterations, the
Newton-Raphson method does not converge.
4. Root jumping
In some case where the function f (x) is oscillating and has a number of roots, one may
choose an initial guess close to a root. However, the guesses may jump and converge to
some other root. For example for solving the equation sin x = 0 if you choose
x0 = 2.4π = (7.539822) as an initial guess, it converges to the root of x = 0 as shown in
Table 4 and Figure 6. However, one may have chosen this as an initial guess to converge to
x = 2π = 6.2831853 .
Table 4 Root jumping in Newton-Raphson method.
Iteration xi f ( xi ) ∈a %
Number
0 7.539822 0.951
1 4.462 –0.969 68.973
2 0.5499 0.5226 711.44
3 –0.06307 –0.06303 971.91
4 8.376 ×10 −4
8.375 ×10 −5
7.54 ×10 4
5 − 1.95861×10 −13
− 1.95861×10 −13
4.28 ×1010
Figure 6 Root jumping from intended location of root for f (x) = sin x = 0 .
The secant method can also be derived from geometry, as shown in Figure 1. Taking two
initial guesses, xi −1 and xi , one draws a straight line between f ( xi ) and f ( xi −1 ) passing
through the x -axis at xi +1 . ABE and DCE are similar triangles.
Hence
AB DC
=
AE DE
f ( xi ) f ( xi −1 )
=
xi − xi +1 xi −1 − xi +1
On rearranging, the secant method is given as
f ( xi )( xi − xi −1 )
xi +1 = xi −
f ( xi ) − f ( xi −1 )
f (x)
f (xi) B
f (xi–1) C
E D A
x
xi+1 xi–1 xi
Example 1
You are working for ‘DOWN THE TOILET COMPANY’ that makes floats (Figure 2) for
ABC commodes. The floating ball has a specific gravity of 0.6 and a radius of 5.5 cm. 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
x 3 − 0.165x 2 + 3.993 × 10 −4 = 0
Use the secant method of finding roots of equations to find the depth x to which the ball is
submerged under water. Conduct three iterations to estimate the root of the above equation.
Find the absolute relative approximate error and the number of significant digits at least
correct at the end of each iteration.
Solution
f (x ) = x 3 − 0.165x 2 + 3.993 × 10 −4
Let us assume the initial guesses of the root of f (x) = 0 as x−1 = 0.02 and x0 = 0.05 .
= x0 −
(x3
0 − 0.165x02 + 3.993×10 −4 × (x0 − x−1 ) )
(x3
0
2
− 0.165x + 3.993×10
0
−4
) − (x 3
−1 − 0.165x−21 + 3.993×10 − 4 )
= 0.05 −
[0.05 3 2
− 0.165(0.05) + 3.993 ×10 −4
]× [0.05 − 0.02]
[0.05 3 2
] [
− 0.165(0.05) + 3.993 ×10 − 4 − 0.02 3 − 0.165(0.02 ) + 3.993 ×10 − 4
2
]
= 0.06461
Iteration 2
f (x1 )(x1 − x0 )
x2 = x1 −
f (x1 ) − f (x0 )
= x1 −
(x13 − 0.165x12 + 3.993×10 −4 )× (x1 − x0 )
(x 3
1 ) (
− 0.165x12 + 3.993×10 − 4 − x03 − 0.165x02 + 3.993×10 − 4 )
= 0.06461 −
[0.06461 − 0.165(0.06461) + 3.993×10 ]× (0.06461 − 0.05)
3 2 −4
= 0.06241
The absolute relative approximate error ∈a at the end of Iteration 2 is
x2 − x1
∈a = × 100
x2
0.06241 − 0.06461
= × 100
0.06241
= 3.525%
The number of significant digits at least correct is 1, as you need an absolute relative
approximate error of 5% or less.
Iteration 3
f (x2 )(x2 − x1 )
x3 = x2 −
f (x2 ) − f (x1 )
= x2 −
(x 3
2 )
− 0.165x22 + 3.993×10 −4 × (x2 − x1 )
(x 3
2 ) (
− 0.165x22 + 3.993×10 − 4 − x13 − 0.165x12 + 3.993 ×10 − 4 )
= 0.06241 −
[0.06241 − 0.165(0.06241) + 3.993×10 ]× (0.06241 − 0.06461)
3 2 −4
f (xU )
Exact root
xL
O xr xU x
f (xL )
Figure 1 False-Position Method
The above nonlinear equation can be stated as finding the value of x such that Equation (1) is
satisfied.
In the bisection method, we identify proper values of x L (lower bound value) and xU (upper
bound value) for the current bracket, such that
f ( x L ) f ( xU ) < 0 . (2)
The next predicted/improved root x r can be computed as the midpoint between x L and xU
as
x + xU
xr = L (3)
2
The new upper and lower bounds are then established, and the procedure is repeated until the
convergence is achieved (such that the new lower and upper bounds are sufficiently close to
each other).
However, in the example shown in Figure 1, the bisection method may not be efficient
because it does not take into consideration that f ( x L ) is much closer to the zero of the
function f (x) as compared to f ( xU ) . In other words, the next predicted root xr would be
closer to x L (in the example as shown in Figure 1), than the mid-point between x L and xU .
The false-position method takes advantage of this observation mathematically by drawing a
secant from the function value at x L to the function value at xU , and estimates the root as
where it crosses the x-axis.
False-Position Method
Based on two similar triangles, shown in Figure 1, one gets
0 − f ( x L ) 0 − f ( xU )
= (4)
xr − x L xr − xU
From Equation (4), one obtains
(xr − xL ) f (xU ) = (xr − xU ) f (xL )
xU f (x L ) − x L f (xU ) = xr { f (x L ) − f (xU )}
The above equation can be solved to obtain the next predicted root x m as
xU f (x L ) − x L f (xU )
xr = (5)
f (x L ) − f (xU )
The above equation, through simple algebraic manipulations, can also be expressed as
f (xU )
x r = xU − (6)
⎧ f (x L ) − f (xU )⎫
⎨ ⎬
⎩ x L − xU ⎭
or
f (x L )
xr = x L − (7)
⎧ f (xU ) − f (x L )⎫
⎨ ⎬
⎩ xU − x L ⎭
Observe the resemblance of Equations (6) and (7) to the secant method.
False-Position Algorithm
The steps to apply the false-position method to find the root of the equation f (x) = 0 are as
follows.
1. Choose x L and xU as two guesses for the root such that f (x L ) f (xU ) < 0, or in other words,
f (x ) changes sign between x L and xU .
2. Estimate the root, x r of the equation f (x) = 0 as
x f (x L ) − x L f (xU )
xr = U
f (x L ) − f (xU )
3. Now check the following
If f (xL ) f (xr ) < 0 , then the root lies between x L and xr ; then x L = x L and xU = x r .
If f (xL ) f (xr ) > 0 , then the root lies between xr and xU ; then xL = xr and xU = xU .
If f (xL ) f (xr ) = 0 , then the root is x r . Stop the algorithm.
4. Find the new estimate of the root
xU f (x L ) − x L f (xU )
xr =
f (x L ) − f (xU )
Find the absolute relative approximate error as
x new − x old
∈a = r new r × 100
xr
where
x rnew = estimated root from present iteration
xrold = estimated root from previous iteration
5. Compare the absolute relative approximate error ∈a with the pre-specified relative error
tolerance ∈s . If ∈a >∈s , then go to step 3, else stop the algorithm. Note one should also
check whether the number of iterations is more than the maximum number of iterations
allowed. If so, one needs to terminate the algorithm and notify the user about it.
Note that the false-position and bisection algorithms are quite similar. The only difference is
the formula used to calculate the new estimate of the root x r as shown in steps #2 and #4!
Example 1
You are working for “DOWN THE TOILET COMPANY” that makes floats for ABC
commodes. The floating ball has a specific gravity of 0.6 and has a radius of 5.5cm. 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
x 3 − 0.165x 2 + 3.993 × 10 −4 = 0
Use the false-position method of finding roots of equations to find the depth x to which the
ball is submerged under water. Conduct three iterations to estimate the root of the above
equation. Find the absolute relative approximate error at the end of each iteration, and the
number of significant digits at least correct at the end of third iteration.
Solution
From the physics of the problem, the ball would be submerged between x = 0 and x = 2 R ,
where
R = radius of the ball,
that is
0 ≤ x ≤ 2R
0 ≤ x ≤ 2(0.055)
0 ≤ x ≤ 0.11
Let us assume
x L = 0, xU = 0.11
Check if the function changes sign between x L and xU
3 2
f (x L ) = f (0) = (0) − 0.165(0) + 3.993 × 10 −4 = 3.993 × 10 −4
3 2
f (xU ) = f (0.11) = (0.11) − 0.165(0.11) + 3.993 × 10 −4 = −2.662 × 10 −4
Hence
f (x L ) f (xU ) = f (0) f (0.11) = (3.993 × 10 −4 )(− 2.662 × 10 −4 ) < 0
Therefore, there is at least one root between x L and xU , that is between 0 and 0.11.
Iteration 1
The estimate of the root is
x f (x L ) − x L f (xU )
xr = U
f (x L ) − f (xU )
=
(
0.11 × 3.993 × 10 − 4 − 0 × − 2.662 × 10 − 4 )
(
3.993 × 10 −4 − − 2.662 × 10 − 4 )
= 0.0660
f (x r ) = f (0.0660 )
3 2
(
= (0.0660 ) − 0.165(0.0660) + 3.993 × 10 − 4 )
= −3.1944 × 10 −5
f (xL ) f (xr ) = f (0) f (0.0660) = (+)(−) < 0
Hence, the root is bracketed between x L and x r , that is, between 0 and 0.0660. So, the lower
and upper limits of the new bracket are x L = 0, xU = 0.0660 , respectively.
Iteration 2
The estimate of the root is
x f (x L ) − x L f (xU )
xr = U
f (x L ) − f (xU )
(
0.0660 × 3.993 × 10 −4 − 0 × − 3.1944 × 10 −5
=
)
(
3.993 × 10 − 4 − − 3.1944 × 10 −5 )
= 0.0611
The absolute relative approximate error for this iteration is
0.0611 − 0.0660
∈a = × 100 ≅ 8%
0.0611
f (x r ) = f (0.0611)
3 2
(
= (0.0611) − 0.165(0.0611) + 3.993 × 10 − 4 )
−5
= 1.1320 × 10
f (xL ) f (xr ) = f (0) f (0.0611) = (+)(+) > 0
Hence, the lower and upper limits of the new bracket are x L = 0.0611, xU = 0.0660,
respectively.
Iteration 3
The estimate of the root is
x f (x L ) − x L f (xU )
xr = U
f (x L ) − f (xU )
=
(
0.0660 × 1.132 × 10 −5 − 0.0611 × − 3.1944 × 10 −5 )
(
1.132 × 10 −5 − − 3.1944 × 10 −5 )
= 0.0624
The absolute relative approximate error for this iteration is
0.0624 − 0.0611
∈a = × 100 ≅ 2.05%
0.0624
f (xr ) = −1.1313 × 10 −7
f (xL ) f (xr ) = f (0.0611) f (0.0624) = (+)(−) < 0
Hence, the lower and upper limits of the new bracket are x L = 0.0611, xU = 0.0624
All iterations results are summarized in Table 1. To find how many significant digits are at
least correct in the last iterative value
∈a ≤ 0.5 × 10 2−m
2.05 ≤ 0.5 × 10 2−m
m ≤ 1.387
The number of significant digits at least correct in the estimated root of 0.0624 at the end of
3rd iteration is 1.
Example 2
Find the root of f (x ) = (x − 4)2 (x + 2) = 0 , using the initial guesses of xL = −2.5 and
xU = −1.0, and a pre-specified tolerance of ∈s = 0.1% .
Solution
The individual iterations are not shown for this example, but the results are summarized in
Table 2. It takes five iterations to meet the pre-specified tolerance.
Table 2 Root of f (x ) = (x − 4)2 (x + 2) = 0 for false-position method.
Iteration x L xU f (xL ) f (xU ) x r ∈a % f (x m )
1 -2.5 -1 -21.13 25.00 -1.813 N/A 6.319
2 -2.5 -1.813 -21.13 6.319 -1.971 8.024 1.028
3 -2.5 -1.971 -21.13 1.028 -1.996 1.229 0.1542
4 -2.5 -1.996 -21.13 0.1542 -1.999 0.1828 0.02286
5 -2.5 -1.999 -21.13 0.02286 -2.000 0.02706 0.003383
To find how many significant digits are at least correct in the last iterative answer,
∈a ≤ 0.5 × 10 2−m
0.02706 ≤ 0.5 × 10 2−m
m ≤ 3.2666
Hence, at least 3 significant digits can be trusted to be accurate at the end of the fifth
iteration.
Reference:
http://nm.mathforcollege.com