Numerical Analysis –MTH603 VU
Regula-Falsi method (Method of false position)
Here we choose two points xn and xn −1 such that f ( xn ) and f ( xn −1 ) have opposite signs.
Intermediate value property suggests that the graph of the y=f(x) crosses the x-axis
between these two points and therefore, a root lies between these two points.
Thus to find the real root of f(x)=0 using Regula-Falsi method ,we replace the part of the
curve between the points A( xn , f ( xn )) and B( xn −1 , f ( xn −1 )) by a chord in the interval and
we take the point of intersection of this chord with x-axis as initial approximation.
Now, the equation of the chord joining the points A and B is,
y − f ( xn ) x − xn
=
f ( xn −1 ) − f ( xn ) xn −1 − xn
Setting y=0 in the above equation we get
xn − xn −1
x = xn − f ( xn )
f ( xn ) − f ( xn −1 )
Hence the first approximation to the root is given by
xn − xn −1
xn +1 = xn − f ( xn )
f ( xn ) − f ( xn −1 )
We observe that f ( xn −1 ) and f ( xn +1 ) are of opposite signs thus it is possible to apply the
above procedure, to determine the line through B and A1 and so on.
Hence for successive approximation to the root above formula is used.
Example
Use the Regula-Falsi method to compute a real root of the equation x3 – 9x + 1 = 0,
(i) if the root lies between 2 and 4
(ii) if the root lies between 2 and 3.
Comment on the results.
Solution
Let
f (x) = x3 - 9x + 1
f (2) = 23 - 9(2) + 1=8 − 18+1= − 9and f (4) = 43 - 9(4) + 1=64 − 36+1=29.
Since f (2) and f (4) are of opposite signs, the root of f (x) = 0 lies between 2 and 4.
Taking x1 = 2, x2 = 4 and using Regula-Falsi method, the first approximation is given by
x2 − x1 4−2 2(29)
x3 = x2 − f ( x2 ) = 4 − (29) = 4 −
f ( x2 ) − f ( x1 ) 29 − (−9) 38
58
= 4− = 4 − 1.5263 = 2.4736
38
© Copyright Virtual University of Pakistan 1
Numerical Analysis –MTH603 VU
Now
f (x3) = 2.47363 - 9(2.4736) + 1=15.13520-22.2624+1= -6.12644.
Since f (x2) and f (x3) are of opposite signs, the root lies between x2 and x3.
The second approximation to the root is given as
x3 − x2 2.4736 − 4
x4 = x3 − f ( x3 ) = 2.4736 − (−6.12644)
f ( x3 ) − f ( x2 ) −6.12644 − 29
−1.5264
= 2.4736 − (−6.12644) = 2.4736 − (0.04345)(−6.12644)
−35.12644
= 2.4736 + 0.26619 = 2.73989
Therefore
f (x4) = 2.739893 - 9(2.73989) + 1=20.5683-24.65901+1= =- 3. 090707.
Now, since f (x2) and f (x4) are of opposite signs, the third approximation is obtained
from
x4 − x2 2.73989 − 4
x5 = x4 − f ( x4 ) = 2.73989 − (−3.090707) = 2.86125
f ( x4 ) − f ( x2 ) −3.090707 − 29
−1.26011
= 2.73989 − (−3.090707) = 2.73989 + 0.039267(3.090707) = 2.73989 + 0.121363 = 2.86125
−32.090707
Now
f (x5) = 2.861253 - 9(2.86125) + 1=23.42434-25.75125+1= -1.326868.
(ii)
Here
f (x) = x3 - 9x + 1
f (2) = 23 - 9(2) + 1 = 8 − 18 +1=- 9 and f (3) = 33 - 9(3) + 1= 27 − 27+1= 1.
Since f (2) and f (3) are of opposite signs, the root of f (x) = 0 lies between 2 and 3.
Taking x1 = 2, x2 = 3 and using Regula-Falsi method, the first approximation is given by
x2 − x1 3− 2
x3 = x2 − f ( x2 ) = 3 − (1)
f ( x2 ) − f ( x1 ) 1+ 9
1
= 3− = 2.9
10
f (x 3 ) = 2.93 - 9(2.9) + 1 =24.389 − 26.1+1= − 0.711
Since f (x2) and f (x3) are of opposite signs, the root lies between x2 and x3.
The second approximation to the root is given as
2.9 − 3 −0.1 −0.1
x4 = 2.9 − (−0.711) = 2.9 − (−0.711) = 2.9 − (−0.711)
−0.711 − 1 −1.711 −1.711
= 2.9 − (0.05844)(−0.711) = 2.9 _ 0.04156 = 2.94156
f ( x4 ) = −0.0207
f (x 4 ) = 2.941563 - 9(2.94156) + 1 =25.45265 − 26.47404+1= − 0.0207
© Copyright Virtual University of Pakistan 2
Numerical Analysis –MTH603 VU
Now, we observe that f (x2) and f (x4) are of opposite signs; the third approximation is
obtained from
2.94156 − 3 −0.05844
x5 = 2.94156 − (−0.0207) = 2.94156 − (−0.0207)
−0.0207 − 1 −1.0207
= 2.94156 − (−0.05725)(−0.0207) = 2.94275
f (x 5 ) = 2.942753 - 9(2.94275) + 1 =25.48356 − 26.48475 +1= − 0.0011896
We observe that the value of the root as a third approximation is evidently different in
both the cases, while the value of x5, when the interval considered is (2, 3), is
closer to the root.
Important observation: The initial interval (x1, x2) in which the root of the equation
lies should be sufficiently small.
Example
Use Regula-Falsi method to find a real root of the equation lnx – cos x = 0
accurate to four decimal places after three successive approximations.
Note: here is a transcendental equation all the calculation should be done in the
radians mode
Sol:
f ( x) = ln x - cos x
we have
f(1)=ln1-cos(1)=0-0.540302=-0.540302<0
f(2)=ln2-cos(2)=0.69315-0.41615=1.109
As f(1)f(2)<0 so the root lies between 1and 2
the first approximation is obtained form
2 −1
x3 = 2 − (1.109)
1.109 + 0.540302
1.1093
= 2− = 1.3275
1.6496
f ( x3 ) = ln 1.3275 - cos 1.3275 = 02833 − 0.2409 = 0.0424
Now, since f (x1) and f (x3) are of opposite signs, the second approximation is obtained as
(.3275)(.0424)
x4 = 1.3275 −
0.0424 + 0.5403
= 1.3037
f ( x4 ) = ln 1.3037 - cos 1.3037 =1.24816 × 10−3
© Copyright Virtual University of Pakistan 3
Numerical Analysis –MTH603 VU
Similarly, we observe that f (x1) and f (x4) are of opposite signs, so, the third
approximation is given by
(0.3037)(0.001248)
x5 = 1.3037 −
0.001248 + 0.5403
= 1.3030
f ( x5 ) = 0.6245 × 10−4
The required real root is 1.3030
Example:
Use method of false position to solve e − x + 2− x + 2 cos x − 6 = 0 1≤ x ≤ 2
Solution:
f ( x) = e x + 2− x + 2 cos x − 6
x0 = 1 , x1 = 2
now
xn − xn −1
xn +1 = f ( xn )
f ( xn ) − f ( xn −1 )
f (1) = e1 + 2−1 + 2 cos1 − 6 = 2.7182 + 0.5 + 2(0.5403) − 6 = −1.7011
f (2) = e 2 + 2−2 + 2 cos 2 − 6 = 7.3886 + 0.25 + 2(−0.4161) − 6 = 0.8068
now for n = 1
x1 − x0 2 −1
x2 = x1 − f ( x1 ) = 2 − (0.8068)
f ( x1 ) − f ( x0 ) 0.8068 + 1.7011
1
x2 = 2 − (0.8068) = 1.6783
2.5079
f (1.6783) = e1.6783 + 2−1.6783 + 2 cos(1.6783) − 6 = −0.5457
now for n = 2
x2 − x1 1.6783 − 2
x3 = x2 − f ( x2 ) = 1.6783 − (−0.5457)
f ( x2 ) − f ( x1 ) (−0.5457) − 0.8068
(−0.3217)
x3 = 1.6783 − (−0.5457) = 1.6783 + 0.12979 = 1.8081
(−1.3525)
© Copyright Virtual University of Pakistan 4
Numerical Analysis –MTH603 VU
f (1.8081) = e1.6783 + 2−1.8081 + 2 cos(1.8081) − 6 = −0.8575
now for n = 3
x3 − x2 1.8081 − 1.6783
x4 = x3 − f ( x3 ) = 1.8081 − (−0.08575)
f ( x3 ) − f ( x2 ) (−0.08575) + 0.5457
0.1298
x3 = 1.8081 − (−0.08575) = 1.6783 + 0.12979 = 1.8323
0.45995
f (1.8323) = e1.8323 + 2−1.8323 + 2 cos(1.8323) − 6 = 0.1199
now for n = 4
x4 − x3 1.8323 − 1.8081
x5 = x4 − f ( x4 ) = 1.8323 − (0.01199)
f ( x4 ) − f ( x3 ) 0.01199 + 0.08575
0.0242
x5 = 1.8323 − (0.01199) = 1.8323 − 0.00296 = 1.8293
0.09774
f (1.8293) = e1.8293 + 2−1.8293 + 2 cos(1.8293) − 6 = −0.000343
now for n = 5
x5 − x4 1.8293 − 1.8323
x6 = x5 − f ( x5 ) = 1.8293 − (−0.000343)
f ( x5 ) − f ( x4 ) −0.000343 − 0.01199
(−0.003)
x6 = 1.8293 − (−0.000343) = 1.8293
−0.012333
Example:
Solve the equation 2 x cos 2 x − ( x − 2) 2 = 0 2 ≤ x ≤ 3 Perform only three iterations.
Solution
f ( x) = 2 x cos 2 x − ( x − 2) 2
here x0 = 2 and x1 = 3
so f (2) = 2(2) cos 4 − (2 − 2) 2 = 4 cos 4 = −2.6146
f (3) = 2(3) cos 2(3) − (3 − 2) 2 = 6 cos 6 − 1 = 4.7610
xn − xn −1
here xn +1 = xn − f ( xn )
f ( xn ) − f ( xn −1 )
for n = 1
x1 − x0 3− 2
x2 = x1 − f ( x1 ) = 3 − (4.7610)
f ( x1 ) − f ( x0 ) 4.7610 − 2.4146
© Copyright Virtual University of Pakistan 5
Numerical Analysis –MTH603 VU
1
= 3− (4.7610) = 3 − 0.6455 = 2.3545
7.3756
f (2.3545) = 2(2.3545) cos 2(2.3545) − (2.3545 − 2) 2 = 4.709 cos 4.709 − 0.1257 = −0.1416
for n = 2
x2 − x1 2.3545 − 3
x3 = x2 − f ( x2 ) = 2.3545 − (−0.1416)
f ( x2 ) − f ( x1 ) −0.1416 − 4.7610
= 2.3731
f (2.3713) = 2(2.3713) cos 2(2.3713) − (2.3713 − 2) 2 = 4.7462 cos 4.7462 − 0.1392 = −0.1392
for n = 3
x3 − x2 2.3731 − 2.3545
x4 = x3 − f ( x3 ) = 2.3713 − (0.0212)
f ( x3 ) − f ( x2 ) 0.0212 + 0.1416
= 2.3707
f (2.3707) = 2(2.3707) cos 2(2.3707) − (2.3707 − 2) 2 = 4.7414 cos 4.7412 − 0.1374 = 0.00013
for n = 4
x4 − x3 2.3707 − 2.3731
x5 = x4 − f ( x4 ) = 2.3707 − (0.00013)
f ( x4 ) − f ( x3 ) 0.00013 − 0.0212
= 2.3707
© Copyright Virtual University of Pakistan 6
Numerical Analysis –MTH603 VU
Example
Using Regula-Falsi method, find the real root of the following equation correct, to three
decimal places: x log 10 x =1.2
Solution:
Let f (x) = x log10 x − 1.2
f (2) = 2 log10 2 − 1.2 = − 0.5979,
f (3) = 3 log10 3 − 1.2 = 0.2314.
Since f (2) and f (3) are of opposite signs, the real root lies betweenx1 = 2, x2 = 3.
The first approximation is obtained from
x2 − x1 3− 2
x3 = x2 − f ( x2 ) = 3 − (0.2314)
f ( x2 ) − f ( x1 ) 0.2314 + 0.5979
0.2314
= 3− = 2.72097
0.8293
f ( x3 ) = Let f (x) = 2.72097log10 2.72097 − 1.2 = − 0.01713.
Since f (x2) and f (x3) are of opposite signs, the root of f (x) = 0 lies between x2 and
x3. Now, the second approximation is given by
x3 − x2 2.72097 − 3
x4 = x3 − f ( x3 ) = 2.72097 − (−0.1713) = 2.7402
f ( x3 ) − f ( x2 ) −0.1713 − 0.2314
f ( x4 ) = 2.7402 log10 2.7402 − 1.2 − 3.8905 ×10−4
Thus, the root of the given equation correct to three decimal places is 2.740
NOTE: Here if TOL is given then we can simply find the value of TOL by subtracting
both the consecutive roots and write it in the exponential notation if the required TOL is
obtained then we stop.
Method of Iteration
Method of iterations can be applied to find a real root of the equation f (x) = 0 by
rewriting the same in the form.
x = φ ( x)
Let x = x0 be the initial approximation to the actual root, say, α of the equation .then the
first approximation is x1 = φ ( x0 ) and the successive approximation are x2 = φ ( x1 )
x3 = φ ( x2 ), x4 = φ ( x3 ),..., xn = φ ( xn −1 ) if sequence of the approximate roots, x1 , x2 , x3 ,...xn
converges to α it is taken as the root of the equation f(x)=0.
For convergence purpose the initial approximation is to be done carefully.the choice
of the x0 is done according to the theorem.
© Copyright Virtual University of Pakistan 1
Numerical Analysis –MTH603 VU
Theorem
If α be a root of f(x) =0 which is equivalent to x = φ ( x) I be any interval containing the
point x= α and | φ '( x) |< 1 ∀ xε I , then the sequence of approximations x1 , x2 , x3 ,...xn will
converge to the root α provided that the initial approximation x0 is chosen in I
Example,
f (x) = cos x - 2x + 3 = 0.
It can be
1
Rewritten as x = (cos x + 3) = φ ( x)
2
1
φ ( x) = (cos x + 3)
2
f (x) = cos x - 2x + 3 = 0.
f(1)=cos 1 - 2(1) + 3 =1.54030>0
f(2)=cos 1 - 2(2) + 3 =-0.041614-4+3=-1.41614<0
so root lies between 1and 2
1
φ '( x) = − (sin x)
2
both φ '(1)andφ '(2) < 1 so the method of iterations can be applied
let x0 = 1.5
1 1
x1 = (cos x0 + 3) = (cos(1.5) + 3) = 1.999825
2 2
1 1
x2 = (cos x1 + 3) = (cos(1.999825) + 3) = 1.999695
2 2
1 1
x3 = (cos x2 + 3) = (cos(1.999625) + 3) = 1.999695
2 2
So this is the required root correct up to 5 places of decimal.
Example
Find the real root of the equation x3 + x 2 − 1 = 0 by method of iterations
Solution
let f ( x) = x 3 + x 2 − 1
now f (0) = 03 + 02 − 1 = −1 < 0
f (1) = 13 + 12 − 1 = 1 > 0
hence a real root lies between 0 and 1
© Copyright Virtual University of Pakistan 2
Numerical Analysis –MTH603 VU
here
x3 + x 2 − 1 = 0
x 2 ( x + 1) = 1
1 1
x2 = ⇒x= = φ ( x)
( x + 1) x +1
3
here φ '( x) = −1/ 2[1/( x + 1) 2 ]
5
φ '(0) = 1/ 2 < 1 and φ '(1) = 1/ 2 2 < 1
so φ '( x) < 1 for all the values in the int erval
let x0 = 0.65
1 1
x1 = φ ( x0 ) = = = 0.7784989
x0 + 1 1.65
1 1
x2 = φ ( x1 ) = = = 0.7498479
x1 + 1 1.7784989
1 1
x3 = φ ( x2 ) = = = 0.7559617
x2 + 1 1.7498479
1 1
x4 = φ ( x3 ) = = = 0.7546446
x3 + 1 1.7559617
1 1
x5 = φ ( x4 ) = = = 0.7549278
x4 + 1 1.7546446
1 1
x6 = φ ( x5 ) = = = 0.7548668
x5 + 1 1.7549278
1 1
x7 = φ ( x6 ) = = = 0.7548799
x6 + 1 1.7548668
1 1
x8 = φ ( x7 ) = = = 0.7548771
x7 + 1 1.7548799
1 1
x9 = φ ( x8 ) = = = 0.7548777
x8 + 1 1.7548771
1 1
x10 = φ ( x9 ) = = = 0.7548776
x9 + 1 1.7548777
1 1
x11 = φ ( x10 ) = = = 0.7548776
x10 + 1 1.7548776
hence root is 0.7548776
Note: In this question the accuracy up to 7 places is acquires or here the TOL is 10−7
© Copyright Virtual University of Pakistan 3
Numerical Analysis –MTH603 VU
Example
Find a real root of the equation cos x = 3 x − 1 correct to seven places of decimal.
Solution
Here it is a transcendental function and all the calculation must be done in the radians
mode and value of pi should be 3.14
f ( x) = cos x − 3 x + 1
f (0) = cos 0 − 3(0) + 1 = 1 > 0
f (π / 2) = cos(1.57) − 3(1.57) + 1 = 0.0007963 − 4.71 + 1 = −3.7092037 < 0
so a real root lies between 0 and π / 2
1
here φ ( x) = (cos x + 1)
3
1
we have φ '( x) = − sin x
3
it is clearly less than 1 as sin is a bounded function and it ' s values lies between − 1 and 1
hence iteration method can be applied
let x0 = 0.5 be the inital approximation then
1
x1 = φ ( x0 ) = [cos(0.5) + 1] = 0.6258608
3
1
x2 = φ ( x1 ) = [cos(0.6258608) + 1] = 0.6034863
3
1
x3 = φ ( x2 ) = [cos(0.6034863) + 1] = 0.6077873
3
1
x4 = φ ( x3 ) = [cos(0.6077873) + 1] = 0.6069711
3
1
x5 = φ ( x4 ) = [cos(0.6069711) + 1] = 0.6071264
3
1
x6 = φ ( x5 ) = [cos(0.6071264) + 1] = 0.6070969
3
© Copyright Virtual University of Pakistan 4
Numerical Analysis –MTH603 VU
1
x7 = φ ( x6 ) = [cos(0.6070969) + 1] = 0.6071025
3
1
x8 = φ ( x7 ) = [cos(0.6071025) + 1] = 0.6071014
3
1
x9 = φ ( x8 ) = [cos(0.6071014) + 1] = 0.6071016
3
1
x10 = φ ( x9 ) = [cos(0.6071016) + 1] = 0.6071016
3
© Copyright Virtual University of Pakistan 5