07 - Numerical Solution of Simultaneous Linear Equations
07 - Numerical Solution of Simultaneous Linear Equations
CEN-103
sanhita.das@ce.iitr.ac.in
https://civil.iitr.ac.in/CE?Uid=sanhita.das
What we have done so far
𝑓 𝑥 = 3𝑥 + 𝑠𝑖𝑛𝑥 − 𝑒 𝑥 = 0
Bracketing Method
❖ Regula-Falsi Method / Method of False Position
Open Methods
❖ Newton-Raphson’s Method
❖ Secant Method
09-02-2022 2
Linear algebraic Equations
09-02-2022 3
Let us consider an example!
Demand
Supply
DF1 200
400 6
Nagpur 20
DF2 150
Manufacturing units 12
Raipur
8
DF3 250
300
09-02-2022 4
Let us consider an example!
09-02-2022 5
Linear algebraic Equations
𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏1
𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑏2
.
.
.
.
𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛
❖ Gauss Elimination
❖ Gauss Jordan
❖ LU Decomposition
❖ Gauss-Seidel
09-02-2022 6
Matrices
Symmetric Matrix Diagonal Matrix Identity Matrix
𝑎𝑖𝑗 = 𝑎𝑗𝑖
𝑎11 𝑎12 𝑎13 12 𝟑 𝟓 𝑎11 0 0 1 0 0
𝑎21 𝑎22 𝑎23 𝐴 = 𝟑 17 𝟗 𝐴 = 0 𝑎22 0 𝐼 = 0 1 0
𝑎31 𝑎32 𝑎33 𝟓 𝟗 18 0 0 𝑎33 0 0 1
09-02-2022 7
Augmented Matrix
A matrix obtained by the addition of a column (or columns) to the original matrix
𝐴𝑋 = 𝐵
09-02-2022 8
Augmented Matrix
A matrix obtained by the addition of a column (or columns) to the original matrix
𝐴𝑋 = 𝐵
09-02-2022 9
Gauss Elimination
09-02-2022 10
Gauss Elimination-Example
6 3 2 6
6 3 2 𝑥 6 𝑅2 𝑅2 − 1𝑅1 0 1 1 −6
6 4 3 𝑦 = 0 20
16
𝑅3 0 5 −20
20 15 12 𝑧 0 𝑅3 − 𝑅1
6 3
6 3 2 6
6 4 3 0
6 3 2 6
20 15 12 0
0 1 1 −6
𝑅3 𝑅3 − 5𝑅2 1
0 0 10
3
09-02-2022 11
Gauss Elimination-Example
6𝑥 + 3𝑦 + 2𝑧 = 6
6𝑥 + 4𝑦 + 3𝑧 = 0
20𝑥 + 15𝑦 + 12𝑧 = 0
6 3 2 6 𝑧 = 30
0 1 1 −6 𝑦 = −36
1 𝑦 + 𝑧 = −6
0 0 10
3 6 − 3𝑦 − 2𝑧
6𝑥 + 3𝑦 + 2𝑧 = 6 𝑥=
6
6 − 3(−36) − 2(30)
𝑥= 𝑥=9
6
𝑥 = 9, 𝑦 = −36, 𝑧 = 30
09-02-2022 12
Gauss Elimination-Example
6𝑥 + 3𝑦 + 2𝑧 = 6
6𝑥 + 4𝑦 + 3𝑧 = 0
20𝑥 + 15𝑦 + 12𝑧 = 0
𝑥 = 9, 𝑦 = −36, 𝑧 = 30
Let us check!
6(9) + 3(−36) + 2(30)
6(9) + 4(−36) + 3(30)
20(9) + 15(−36) + 12(30)
09-02-2022 13
Gauss Jordan
09-02-2022 14
Gauss Jordan-Example
6𝑥 + 3𝑦 + 2𝑧 = 6
6𝑥 + 4𝑦 + 3𝑧 = 0
20𝑥 + 15𝑦 + 12𝑧 = 0
1 1
𝑅1 1 𝑥 1
6 3 2 𝑥 6 𝑅1 2 3 𝑦 = 0
6 4 3 𝑦 = 0 6 6 4 3 𝑧 0
20 15 12 𝑧 0 20 15 12
1 1 1 1
1 1
2 3 𝑥 1
𝑅2 𝑅2 − 6𝑅1 2 3 𝑥 1
𝑅3
0 1 1 𝑦 = −6 0 1 1 𝑦 = −6
𝑅3 − 5𝑅2
1 𝑧 10 𝑅3 𝑅3 − 20𝑅1 16 𝑧
0 0 −20
3 0 5
3
09-02-2022 15
Gauss Jordan-Example
6𝑥 + 3𝑦 + 2𝑧 = 6
6𝑥 + 4𝑦 + 3𝑧 = 0
20𝑥 + 15𝑦 + 12𝑧 = 0
1 1 1 1
1 1 𝑥 1
2 3 𝑥 1
2 3 𝑦 =
0 1 1 𝑦 = −6 𝑅3 3𝑅3 −6
0 1 1 𝑧 30
1 𝑧 10
0 0 0 0 1
3
09-02-2022 16
Gauss Jordan-Example
6𝑥 + 3𝑦 + 2𝑧 = 6
6𝑥 + 4𝑦 + 3𝑧 = 0
20𝑥 + 15𝑦 + 12𝑧 = 0
1 1 1
1 𝑥 1 𝑅2 𝑅2 − 𝑅3 1 0 𝑥 − 9
2 3 𝑦 = −6 2 𝑦 = −36
0 1 1 𝑧 30 𝑅3 0 1 0 𝑧
𝑅1 𝑅1 − 30
0 0 1 3 0 0 1
1 0 0 𝑥 9
0 1 0 𝑦 = −36
𝑅2
𝑅1 𝑅1 − 0 0 1 𝑧 30
2
𝑥 = 9, 𝑦 = −36, 𝑧 = 30
09-02-2022 17
LU Decomposition Method
𝐴𝑋 = 𝐵
𝐀 = 𝐋𝐔
Square matrix Upper triangular matrix
09-02-2022 18
LU Decomposition Method
𝐀 = 𝐋𝐔
𝑢11 𝑢12 𝑢13
1 0 0
𝐿 = 𝑙21 1 0 𝑈 = 0 𝑢22 𝑢23
0 0 𝑢33
𝑙31 𝑙32 1
09-02-2022 19
LU Decomposition Method
𝑎11 𝑎12 𝑎13 𝑢11 𝑢12 𝑢13
𝑎21 𝑎22 𝑎23 = 𝑙21 𝑢11 𝑙21 𝑢12 + 𝑢22 𝑙21 𝑢13 + 𝑢23
𝑎31 𝑎32 𝑎33 𝑙31 𝑢11 𝑙31 𝑢12 + 𝑙32 𝑢22 𝑙31 𝑢13 + 𝑙32 𝑢23 + 𝑢33
𝑎21
𝑙21 𝑢11 = 𝑎21 𝑙21 = 𝑙21 𝑢12 + 𝑢22 = 𝑎22 𝑙21 𝑢13 + 𝑢23 = 𝑎23
𝑢11
𝑢22 = 𝑢23 =
𝑎31
𝑙31 𝑢11 = 𝑎31 𝑙31 = 𝑙31 𝑢12 + 𝑙32 𝑢22 = 𝑎32 𝑙31 𝑢13 + 𝑙32 𝑢23 + 𝑢33 = 𝑎33
𝑢11
𝑙32 = 𝑢33 =
09-02-2022 20
LU Decomposition Method
𝐀 = 𝐋𝐔
𝑢11 𝑢12 𝑢13
1 0 0
𝐿 = 𝑙21 1 0 𝑈 = 0 𝑢22 𝑢23
0 0 𝑢33
𝑙31 𝑙32 1
𝐴𝑋 = 𝐵
𝐋𝐔𝐗 = 𝐁
𝑦1
Let 𝐔𝐗 = 𝐘 𝑌 = 𝑦2
𝑦3 𝐋𝐘 = 𝐁 1 0 0 𝑦1 𝑏1
𝑙21 1 0 𝑦2 = 𝑏2 Estimate 𝑦1 , 𝑦2 , 𝑦3
𝑙31 𝑙32 1 𝑦3 𝑏3
09-02-2022 21
LU Decomposition Method
𝐋𝐔𝐗 = 𝐁
1 0 0 𝑦1 𝑏1
𝐋𝐘 = 𝐁 𝑙21 1 0 𝑦2 = 𝑏2
𝑙31 𝑙32 1 𝑦3 𝑏3
09-02-2022 22
LU Decomposition Method
2𝑥 + 3𝑦 + 𝑧 = 9 1 0 0
1 2 3 1
𝑥 + 2𝑦 + 3𝑧 = 6 1 0 1 5
𝐿 = 2 𝑈 = 0
3𝑥 + 𝑦 + 2𝑧 = 8 3 2 2
−7 1 0 0 18
2
𝐋𝐘 = 𝐁 𝐔𝐗 = 𝐘
1 0 0 2 3 1
9
1 𝑦 9 9 1 5 𝑥
1 0 1 𝑌 = 3/2
0 𝑦 = 3/2
2 𝑦2 = 6 2 2 𝑧
𝑦3 5
3 8 5 0 0 18
−7 1
2
𝟑𝟓 𝟐𝟗 𝟓
𝐱= ,𝐲 = ,𝐳 =
𝟏𝟖 𝟏𝟖 𝟏𝟖
09-02-2022 23
Gauss-Seidel Method
𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3
𝑥1 𝑥1 =
𝑎11 𝑥1 + 𝑎12 𝑥2 + 𝑎13 𝑥3 = 𝑏1 𝑎11
𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3
𝑎21 𝑥1 + 𝑎22 𝑥2 + 𝑎23 𝑥3 = 𝑏2 𝑥2 𝑥2 =
𝑎22
𝑎31 𝑥1 + 𝑎32 𝑥2 + 𝑎33 𝑥3 = 𝑏3 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2
𝑥3 𝑥3 =
𝑎33
Calculate 𝑥1 considering 𝑥2 = 0, 𝑥3 = 0
Calculate 𝑥3 considering 𝑥1 , 𝑥2
First iteration
17 − 𝑦0 + 2𝑧0
𝑦 = 𝑦0 = 0, 𝑧 = 𝑧0 = 0 𝑥1 = = 0.8500
20
−18 − 3𝑥1 + 𝑧0
𝑦1 = = −1.0275
𝑥 = 𝑥1 , 𝑧 = 𝑧0 = 0 20
25 − 2𝑥1 + 3𝑦1
𝑥 = 𝑥1 , 𝑦 = 𝑦1 𝑧1 = = 1.0109
20
09-02-2022 25
Gauss-Seidel Method
17 − 𝑦 + 2𝑧
20𝑥 + 𝑦 − 2𝑧 = 17 𝑥 𝑥=
20
3𝑥 + 20𝑦 − 𝑧 = −18
−18 − 3𝑥 + 𝑧
𝑦 𝑦=
2𝑥 − 3𝑦 + 20𝑧 = 25 20
25 − 2𝑥 + 3𝑦
𝑧 𝑧=
20
Second iteration
17 − 𝑦1 + 2𝑧1
𝑦 = 𝑦1 , 𝑧 = 𝑧1 𝑥2 = = 1.0025
20
−18 − 3𝑥2 + 𝑧1
𝑦2 = = −0.9998
𝑥 = 𝑥2 , 𝑧 = 𝑧1 20
25 − 2𝑥2 + 3𝑦2
𝑥 = 𝑥2 , 𝑦 = 𝑦2 𝑧2 = = 0.9998
20
09-02-2022 26
Gauss-Seidel Method
17 − 𝑦 + 2𝑧
20𝑥 + 𝑦 − 2𝑧 = 17 𝑥 𝑥=
20
3𝑥 + 20𝑦 − 𝑧 = −18
−18 − 3𝑥 + 𝑧
𝑦 𝑦=
2𝑥 − 3𝑦 + 20𝑧 = 25 20
25 − 2𝑥 + 3𝑦
𝑧 𝑧=
20
Third iteration
17 − 𝑦2 + 2𝑧2
𝑦 = 𝑦2 , 𝑧 = 𝑧2 𝑥3 = = 1.0000
20
−18 − 3𝑥3 + 𝑧2
𝑦3 = = −1.0000
𝑥 = 𝑥3 , 𝑧 = 𝑧2 20
25 − 2𝑥3 + 3𝑦3
𝑥 = 𝑥3 , 𝑦 = 𝑦3 𝑧3 = = 1.0000
20
09-02-2022 27
Gauss-Seidel Method
10𝑥 + 2𝑦 + 𝑧 = 9
2𝑥 + 20𝑦 − 2𝑧 = −44
−2𝑥 + 3𝑦 + 10𝑧 = 22
09-02-2022 28