SemIV_Unit_VI_Numerical Methods_Notes
SemIV_Unit_VI_Numerical Methods_Notes
--------------------------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 1
Unit VI – Numerical Methods
----------------------------------------------------------------------------------------------------------------
1.3.1 Bisection Method
Steps:
1. Given 𝑓(𝑥) = 0, find, by trial and error, real numbers 𝑎 and 𝑏 such that 𝑓(𝑎)𝑓(𝑏) <
0, i.e., 𝑓(𝑎) and 𝑓(𝑏) should have opposite signs.
𝑎+𝑏
2. Evaluate 𝑐 = 2 and hence find 𝑓(𝑐)
3. Case 1: if 𝑓(𝑎)𝑓(𝑐) < 0 then the root lies between 𝑎 and 𝑐. Therefore, replace 𝑏 with
𝑐 and repeat step 2
Case 2: if 𝑓(𝑏)𝑓(𝑐) < 0 then the root lies between 𝑏 and 𝑐. Therefore, replace 𝑎
with 𝑐 and repeat step 2
4. Repeat step 3 till 𝑓(𝑐) is as close to zero as possible.
----------------------------------------------------------------------------------------------------------------
Example 1:
Find the approximate value of the root of the equation 𝑥 3 − 2𝑥 2 = 5 using Bisection
method. Take 4 iterations up to 4 digits after the decimal.
Solution:
Let 𝑓(𝑥) = 𝑥 3 − 2𝑥 2 − 5
𝑓(0) = −5 < 0,
𝑓(1) = −6 < 0,
𝑓(2) = −5 < 0,
𝑓(3) = 4 > 0,
Since 𝑓(2) and 𝑓(3) have opposite signs,
∴ 𝑓(2)𝑓(3) < 0, 𝑎 = 2, 𝑏=3
𝑎+𝑏
𝑖 𝑎 𝑓(𝑎) 𝑏 𝑓(𝑏) 𝑐= 𝑓(𝑐) = 𝑐 3 − 2𝑐 2 − 5
2
2+3
1 2 −5 3 4 𝑐= = 2.5 𝑓(2.5) = −1.875
2
2.5 + 3
2 2.5 −1.875 3 4 𝑐= = 2.75 𝑓(2.75) = 0.6719
2
2.5 + 2.75 𝑓(2.625)
3 2.5 −1.875 2.75 0.6719 𝑐 = = 2.625
2 = −0.6934
2.625 + 2.75
𝑓(2.6875)
4 2.625 −0.6934 2.75 0.6719 𝑐 = 2 = −0.0344
= 2.6875
After 4 iterations, using Bisection method, the approximate root of 𝑥 3 − 2𝑥 2 = 5 is
2.6875
----------------------------------------------------------------------------------------------------------------
Example 2:
Find the approximate value of the root of the equation 𝑥 2 − 2𝑥 − 1 = 0 using Bisection
method. Take 4 iterations up to 4 digits after the decimal.
Solution: Let 𝑓(𝑥) = 𝑥 2 − 2𝑥 − 1
𝑓(0) = −1 < 0,
𝑓(1) = −2 < 0,
𝑓(−1) = 2 > 0,
Since 𝑓(0) and 𝑓(−1) have opposite signs,
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 2
Unit VI – Numerical Methods
----------------------------------------------------------------------------------------------------------------
∴ 𝑓(0)𝑓(−1) < 0, 𝑎 = −1, 𝑏=0
𝑎+𝑏
𝑖 𝑎 𝑓(𝑎) 𝑏 𝑓(𝑏) 𝑐= 𝑓(𝑐) = 𝑐 2 − 2𝑐 − 1
2
−1 + 0
1 −1 2 0 −1 𝑐= = −0.5 𝑓(−0.5) = 0.25
2
−0.5 + 0 𝑓(−0.25)
2 −0.5 0.25 0 −1 𝑐= = −0.25
2 = −0.4375
−0.5 − 0.25
𝑓(−0.375)
3 −0.5 0.25 −0.25 −0.4375 𝑐 = 2 = −0.1094
= −0.375
−0.5 − 0.375
𝑐 = 𝑓(−0.4375)
4 −0.5 0.25 −0.375 −0.1094 2 = 0.0664
= −0.4375
After 4 iterations, using Bisection method, the approximate root of 𝑥 2 − 2𝑥 − 1 = 0 is
−0.4375.
Limitations of Bisection Method
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 3
Unit VI – Numerical Methods
--------------------------------------------------------------------------------------------------------------------------------------
𝑓(3) = 4 > 0,
Since 𝑓(2) and 𝑓(3) have opposite signs,
∴ 𝑓(2)𝑓(3) < 0, 𝑎 = 2, 𝑏=3
𝑖 𝑎 𝑓(𝑎) 𝑏 𝑓(𝑏) 𝑎 𝑓(𝑏) − 𝑏 𝑓(𝑎) 𝑓(𝑐)
𝑐=
𝑓(𝑏) − 𝑓(𝑎)
1 2 −5 3 4 2(4) − 3(−5) 𝑓(2.5556)
𝑐= = 2.5556 = −1.3717
4 − (−5)
2 2.5556 −1.3717 3 4 2.5556(4) − 3(−1.3717) 𝑓(2.6691)
𝑐= = −0.2335
4− (−1.3717)
= 2.6691
3 2.6691 −0.2335 3 4 2.6691(4) − 3(−0.2335) 𝑓(2.6874)
𝑐= = −0.0361
4 − (−0.2335)
= 2.6874
4 2.6874 −0.0361 3 4 2.6874(4) − 3(−0.0361) 𝑓(2.6902)
𝑐= = −0.0049
4 − (−0.0361)
= 2.6902
After 4 iterations, using False Position method, the approximate root of 𝑥 3 − 2𝑥 2 = 5
is 2.6902
----------------------------------------------------------------------------------------------------------------
Example 2:
Find the approximate value of the root of the equation 𝑥 2 − 2𝑥 − 1 = 0 using Bisection
method. Take 4 iterations up to 4 digits after the decimal.
Solution: Let 𝑓(𝑥) = 𝑥 2 − 2𝑥 − 1
𝑓(0) = −1 < 0,
𝑓(1) = −2 < 0,
𝑓(−1) = 2 > 0,
Since 𝑓(0) and 𝑓(−1) have opposite signs,
∴ 𝑓(0)𝑓(−1) < 0, 𝑎 = −1, 𝑏=0
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 4
Unit VI – Numerical Methods
--------------------------------------------------------------------------------------------------------------------------------------
After 4 iterations, using False Position method, the approximate root of
𝑥 2 − 2𝑥 − 1 = 0 is −0.4138.
----------------------------------------------------------------------------------------------------------------
Limitations of Regula Falsi Method:
Solution:
1
Let 𝑥 = 404 ∴ 𝑥 4 = 40 ∴ 𝑥 4 − 40 = 0
Let 𝑓(𝑥) = 𝑥 4 − 40, 𝑓 ′ (𝑥) = 4𝑥 3
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 5
Unit VI – Numerical Methods
--------------------------------------------------------------------------------------------------------------------------------------
Choose 𝑥0 = 2 (Try Yourself: choose 𝑥0 = 3 and see the difference, if any)
𝑛 𝑥𝑛 𝑓(𝑥𝑛 ) 𝑓′(𝑥𝑛 ) 𝑓(𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 − ′
𝑓 (𝑥𝑛 )
0 𝑥0 = 2 −24 32 (−24)
𝑥1 = 2 − = 2.75
32
1 𝑥1 = 2.75 17.1914 83.1875 17.1914
𝑥2 = 2.75 − = 2.5433
83.1875
2 𝑥2 1.8426 65.8072 1.8426
𝑥3 = 2.5433 − = 2.5153
= 2.5433 65.8072
3 𝑥3 0.0302 63.6576 0.0302
𝑥4 = 2.5153 − = 2.5148
= 2.5153 63.6576
4 𝑥4 8 × 10−6 63.6216 𝑥5 = 2.5148
= 2.5148
There are two methods to obtain the solution of system of linear equations:
• Direct method: These methods use elimination of variables. They transform the
system of equations to triangular form. Methods are Cramer’s method, Matrix
inversion method, Gauss elimination method.
• Iterative method: These methods use principles of successive approximation. The
iterations are repeated till the required accuracy is obtained. Methods are Jacobi’s
iteration method, Gauss Seidal method.
In this unit, the solution of three equations in three unknowns will be computed.
𝑎11 𝑥 + 𝑎12 𝑦 + 𝑎13 𝑧 = 𝑏1
𝑎21 𝑥 + 𝑎22 𝑦 + 𝑎23 𝑧 = 𝑏2
𝑎31 𝑥 + 𝑎32 𝑦 + 𝑎33 𝑧 = 𝑏3
Steps:
𝑎11 𝑎12 𝑎13 𝑏1
1. Construct the Augumented matrix [𝐴, 𝐵] = [𝑎21 𝑎22 𝑎23 |𝑏2 ]
𝑎31 𝑎32 𝑎33 𝑏3
2. Use row transformations to make 𝑎11 = 1.
3. Use 𝑅1 to make 𝑎21 = 0, 𝑎31 = 0.
4. Use 𝑅2 to make 𝑎32 = 0
----------------------------------------------------------------------------------------------------------------
Example 1:
Determine the solution using Gauss-Elimination Method:
3𝑥 − 2𝑦 + 2𝑧 = 9
𝑥 − 2𝑦 + 𝑧 = 5
2𝑥 − 𝑦 − 2𝑧 = −1
Solution:
3 −2 2 9
[𝐴, 𝐵] = [1 −2 1 | 5 ]
2 −1 −2 −1
𝑅1 ↔ 𝑅2
1 −2 1 5
[𝐴, 𝐵]~ [3 −2 2 | 9 ]
2 −1 −2 −1
𝑅2 → 𝑅2 − 3𝑅1 , 𝑅3 → 𝑅3 − 2𝑅1
1 −2 1 5
[𝐴, 𝐵]~ [0 4 −1 | −6 ]
0 3 −4 −11
3
𝑅3 → 𝑅3 − 𝑅2
4
1 −2 1 5
0 4 −1 −6
[𝐴, 𝐵]~ [ 13 | 13]
0 0 − −
4 2
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 7
Unit VI – Numerical Methods
--------------------------------------------------------------------------------------------------------------------------------------
13 13
𝑅3 gives, 0𝑥 + 0𝑦 − 𝑧=− ∴𝑧=2
4 2
𝑅2 gives 0𝑥 + 4𝑦 − 𝑧 = −6 ∴ 𝑦 = −1
𝑅1 gives 𝑥 − 2𝑦 + 𝑧 = 5 ∴𝑥=1
----------------------------------------------------------------------------------------------------------------
Example 2:
Determine the solution using Gauss-Elimination Method:
𝑥 + 2𝑦 − 𝑧 = 1
2𝑥 + 5𝑦 − 𝑧 = 3
𝑥 + 3𝑦 + 2𝑧 = 6
Solution:
1 2 −1 1
[𝐴, 𝐵] = [2 5 −1 |3]
1 3 2 6
𝑅2 → 𝑅2 − 2𝑅1 , 𝑅3 → 𝑅3 − 𝑅1
1 2 −1 1
[𝐴, 𝐵]~ [0 1 1 |1]
0 1 3 5
𝑅3 → 𝑅3 − 𝑅2
1 2 −1 1
[𝐴, 𝐵]~ [0 1 1 |1]
0 0 2 4
𝑅3 gives, 0𝑥 + 0𝑦 + 2𝑧 = 4 ∴𝑧=2
𝑅2 gives 0𝑥 + 𝑦 + 𝑧 = 1 ∴ 𝑦 = −1
𝑅1 gives 𝑥 + 2𝑦 − 𝑧 = 5 ∴𝑥=5
----------------------------------------------------------------------------------------------------------------
1.4.2 Gauss Jacobi Method
𝑎11 𝑥 + 𝑎12 𝑦 + 𝑎13 𝑧 = 𝑏1
𝑎21 𝑥 + 𝑎22 𝑦 + 𝑎23 𝑧 = 𝑏2
𝑎31 𝑥 + 𝑎32 𝑦 + 𝑎33 𝑧 = 𝑏3
The equations above are such that
|𝑎11 | ≥ |𝑎12 | + |𝑎13 |, |𝑎22 | ≥ |𝑎21 | + |𝑎23 |, |𝑎33 | ≥ |𝑎31 | + |𝑎32 |
Isolating 𝑥, 𝑦, 𝑧 from the equations,
1
𝑥𝑛+1 = (𝑏 − 𝑎12 𝑦𝑛 − 𝑎13 𝑧𝑛 )
𝑎11 1
1
𝑦𝑛+1 = (𝑏 − 𝑎21 𝑥𝑛 − 𝑎23 𝑧𝑛 )
𝑎22 2
1
𝑧𝑛+1 = (𝑏 − 𝑎31 𝑥𝑛 − 𝑎32 𝑦𝑛 )
𝑎33 3
Evaluate iterations taking 𝑥0 = 0, 𝑦0 = 0, 𝑧0 = 0
Example 1:
Determine the solution using Gauss Jacobi method
5𝑥 − 2𝑦 + 3𝑧 = −1
−3𝑥 + 9𝑦 + 𝑧 = 2
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 8
Unit VI – Numerical Methods
--------------------------------------------------------------------------------------------------------------------------------------
2𝑥 − 𝑦 − 7𝑧 = 3
Solution: Isolating 𝑥, 𝑦, 𝑧
1
𝑥𝑛+1 = (−1 + 2𝑦𝑛 − 3𝑧𝑛 )
5
1
𝑦𝑛+1 = (2 + 3𝑥𝑛 − 𝑧𝑛 )
9
1
𝑧𝑛+1 = (3 − 2𝑥𝑛 + 𝑦𝑛 )
−7
𝑛 𝑥𝑛 𝑦𝑛 𝑧𝑛
0 𝑥0 = 0 𝑦0 = 0 𝑧0 = 0
1 𝑥1 = −0.2 𝑦1 = 0.2222 𝑧1 = −0.4285
2 𝑥2 = 0.1460 𝑦2 = 0.2031 𝑧2 = −0.5174
3 𝑥3 = 0.1917 𝑦3 = 0.3283 𝑧3 = −0.4158
4 𝑥4 = 0.1808 𝑦4 = 0.3323 𝑧4 = −0.4207
After 4 iterations the approximate values are 𝑥 = 0.1808, 𝑦 = 0.3323, 𝑧 = −0.4207
----------------------------------------------------------------------------------------------------------------
Example 2:
Determine the solution using Gauss Jacobi method
9𝑥 + 2𝑦 + 4𝑧 = 20
𝑥 + 10𝑦 + 4𝑧 = 6
2𝑥 − 4𝑦 + 10𝑧 = −15
Solution:
Isolating 𝑥, 𝑦, 𝑧
1
𝑥𝑛+1 = (20 − 2𝑦𝑛 − 4𝑧𝑛 )
9
1
𝑦𝑛+1 = (6 − 𝑥𝑛 − 4𝑧𝑛 )
10
1
𝑧𝑛+1 = (−15 − 2𝑥𝑛 + 4𝑦𝑛 )
10
𝑛 𝑥𝑛 𝑦𝑛 𝑧𝑛
0 𝑥0 = 0 𝑦0 = 0 𝑧0 = 0
1 𝑥1 = 2.2222 𝑦1 = 0.6 𝑧1 = −1.5
2 𝑥2 = 2.7555 𝑦2 = 0.9777 𝑧2 = −1.7044
3 𝑥3 = 2.7624 𝑦3 = 1.0062 𝑧3 = −1.66
4 𝑥4 = 2.7363 𝑦4 = 0.9877 𝑧4 = −1.6500
After 4 iterations the approximate values are 𝑥 = 2.7363, 𝑦 = 0.9877, 𝑧 = −1.6500
1.4.3 Gauss Seidel Method
Consider the following system of equations:
𝑎11 𝑥 + 𝑎12 𝑦 + 𝑎13 𝑧 = 𝑏1
𝑎21 𝑥 + 𝑎22 𝑦 + 𝑎23 𝑧 = 𝑏2
𝑎31 𝑥 + 𝑎32 𝑦 + 𝑎33 𝑧 = 𝑏3
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 9
Unit VI – Numerical Methods
--------------------------------------------------------------------------------------------------------------------------------------
𝑛 𝑥𝑛 𝑦𝑛 𝑧𝑛
0 𝑥0 = 0 𝑦0 = 0 𝑧0 = 0
1 𝑥1 = −0.2 𝑦1 = 0.1555 𝑧1 = −0.5079
2 𝑥2 = 0.1669 𝑦2 = 0.3343 𝑧2 = −0.4286
3 𝑥3 = 0.1909 𝑦3 = 0.3334 𝑧3 = −0.4216
4 𝑥4 = 0.1863 𝑦4 = 0.3312 𝑧4 = −0.4226
After 4 iterations the approximate values are 𝑥 = 0.1863, 𝑦 = 0.3312, 𝑧 = −0.4226
----------------------------------------------------------------------------------------------------------------
Example 2:
Determine the solution using Gauss Jacobi method
9𝑥 + 2𝑦 + 4𝑧 = 20
𝑥 + 10𝑦 + 4𝑧 = 6
2𝑥 − 4𝑦 + 10𝑧 = −15
Solution:
Isolating 𝑥, 𝑦, 𝑧
1
𝑥𝑛+1 = (20 − 2𝑦𝑛 − 4𝑧𝑛 )
9
1
𝑦𝑛+1 = (6 − 𝑥𝑛+1 − 4𝑧𝑛 )
10
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 10
Unit VI – Numerical Methods
--------------------------------------------------------------------------------------------------------------------------------------
1
𝑧𝑛+1 = (−15 − 2𝑥𝑛+1 + 4𝑦𝑛+1 )
10
𝑛 𝑥𝑛 𝑦𝑛 𝑧𝑛
0 𝑥0 = 0 𝑦0 = 0 𝑧0 = 0
1 𝑥1 = 2.2222 𝑦1 = 0.3777 𝑧1 = −1.7933
2 𝑥2 = 2.9353 𝑦2 = 1.0238 𝑧2 = −1.6775
3 𝑥3 = 2.7402 𝑦3 = 0.9969 𝑧3 = −1.6492
4 𝑥4 = 2.7336 𝑦4 = 0.9863 𝑧4 = −1.6522
After 4 iterations the approximate values are 𝑥 = 2.7336, 𝑦 = 0.9863, 𝑧 = −1.6522
--------------------------------------------------------------------------------------------------------------------
B. Tech. Integrated (All branches) / 2nd Year Semester-IV / 2022-23 / Page 11