0% found this document useful (0 votes)
16 views28 pages

07 - Numerical Solution of Simultaneous Linear Equations

Uploaded by

SNEHA TITORIYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views28 pages

07 - Numerical Solution of Simultaneous Linear Equations

Uploaded by

SNEHA TITORIYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

INDIAN INSTITUTE OF TECHNOLOGY ROORKEE

CEN-103

Numerical Solution of Simultaneous Linear


Equations

sanhita.das@ce.iitr.ac.in
https://civil.iitr.ac.in/CE?Uid=sanhita.das
What we have done so far

𝑓 𝑥 = 3𝑥 + 𝑠𝑖𝑛𝑥 − 𝑒 𝑥 = 0

Determination of the value 𝑥 that satisfies the equation 𝑓(𝑥) = 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

𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏1


𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑏2
.
.
.
.
𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛

Determine the values 𝑥1 , 𝑥2 , . . , 𝑥𝑛 that simultaneously satisfy a set of 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

How many products to be shipped from each manufacturing unit to DFs?

09-02-2022 4
Let us consider an example!

𝑥𝑁1 + 𝑥𝑅1 = 200

𝑥𝑁2 + 𝑥𝑅2 = 150

𝑥𝑁3 + 𝑥𝑅3 = 250

𝑥𝑁1 + 𝑥𝑁2 + 𝑥𝑁3 = 400

𝑥𝑅1 + 𝑥𝑅2 + 𝑥𝑅3 = 300

𝑥𝑁1 , 𝑥𝑁2 , 𝑥𝑁3 6𝑥𝑁1 + 8𝑥𝑁2 + 15𝑥𝑁3 + 20𝑥𝑅1


No. of products to be shipped from Nagpur + 12𝑥𝑅2 + 8𝑥𝑅3 = 20000
𝑥𝑅1 , 𝑥𝑅2 , 𝑥𝑅3 No. of products to be shipped from Raipur

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

Upper triangular Matrix Lower triangular Matrix

𝑎11 𝑎12 𝑎13 𝑎11 0 0


𝐴 = 0 𝑎22 𝑎23 𝐴 = 𝑎21 𝑎22 0
0 0 𝑎33 𝑎31 𝑎32 𝑎33

09-02-2022 7
Augmented Matrix
A matrix obtained by the addition of a column (or columns) to the original matrix

𝐴𝑋 = 𝐵

𝑎11 𝑎12 𝑎13 𝑥1 𝑏1


𝑎21 𝑎22 𝑎23 𝑥2 = 𝑏2
𝑎31 𝑎32 𝑎33 𝑥3 𝑏3

𝑎11 𝑎12 𝑎13 𝑏1


𝐴 = 𝑎21 𝑎22 𝑎23 𝑏2
𝑎31 𝑎32 𝑎33 𝑏3
3 by 4-dimensional matrix
𝑎11 𝑎12 𝑎13 𝑏1
𝐴 = 𝑎21 𝑎22 𝑎23 𝑏2
𝑎31 𝑎32 𝑎33 𝑏3

09-02-2022 8
Augmented Matrix
A matrix obtained by the addition of a column (or columns) to the original matrix

𝐴𝑋 = 𝐵

𝑎11 𝑎12 𝑎13 𝑥1 𝑏1


𝑎21 𝑎22 𝑎23 𝑥2 = 𝑏2
𝑎31 𝑎32 𝑎33 𝑥3 𝑏3

𝑎11 𝑎12 𝑎13 𝑏1


𝐴 = 𝑎21 𝑎22 𝑎23 𝑏2
𝑎31 𝑎32 𝑎33 𝑏3
3 by 4-dimensional matrix
𝑎11 𝑎12 𝑎13 𝑏1
𝐴 = 𝑎21 𝑎22 𝑎23 𝑏2
𝑎31 𝑎32 𝑎33 𝑏3

09-02-2022 9
Gauss Elimination

𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏1 𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏1


′ ′
𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑏2 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑏2′
. .
. .
. .
. .
𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛 / /
𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛

𝑎11 𝑎12 𝑎13 𝑥1 𝑏1 𝑎11 𝑎12 𝑎13 𝑥1 𝑏1


′ ′
𝑎21 𝑎22 𝑎23 𝑥2 = 𝑏2 𝑎22 𝑎23 𝑥2 = 𝑏2′
𝑎31 𝑎32 𝑎33 𝑥3 𝑏3 ′
𝑎33 𝑥3 𝑏3′′

09-02-2022 10
Gauss Elimination-Example

6𝑥 + 3𝑦 + 2𝑧 = 6 𝑎11 𝑎12 𝑎13 𝑏1 𝑎11 𝑎12 𝑎13 𝑏1


6𝑥 + 4𝑦 + 3𝑧 = 0 𝑎21 𝑎22 𝑎23 𝑏2 ′ ′
0 𝑎22 𝑎23 𝑏2′
20𝑥 + 15𝑦 + 12𝑧 = 0 𝑎31 𝑎32 𝑎33 𝑏3 ′
0 0 𝑎33 𝑏3′′

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

𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏1 𝑎11 𝑥1 = 𝑏1



𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑏2 𝑎22 𝑥2 = 𝑏2′
. .
. .
. .
. .
𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛 / /
𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛

𝑎11 𝑎12 𝑎13 𝑥1 𝑏1 𝑎11 0 0 𝑥1 𝑏1



𝑎21 𝑎22 𝑎23 𝑥2 = 𝑏2 0 𝑎22 0 𝑥2 = 𝑏2′
𝑎31 𝑎32 𝑎33 𝑥3 𝑏3 0 0 ′
𝑎33 𝑥3 𝑏3′′

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

Unit lower triangular matrix

𝑎11 𝑥1 + 𝑎12 𝑥2 + 𝑎13 𝑥3 = 𝑏1 𝑎11 𝑎12 𝑎13 𝑥1 𝑏1


𝑎21 𝑥1 + 𝑎22 𝑥2 + 𝑎23 𝑥3 = 𝑏2 𝐴𝑋 = 𝐵 𝑎21 𝑎22 𝑎23 𝑥2 = 𝑏2
𝑎31 𝑥1 + 𝑎32 𝑥2 + 𝑎33 𝑥3 = 𝑏3 𝑎31 𝑎32 𝑎33 𝑥3 𝑏3

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

𝑎11 𝑎12 𝑎13 1 0 0 𝑢11 𝑢12 𝑢13


𝑎21 𝑎22 𝑎23 = 𝑙21 1 0 0 𝑢22 𝑢23
𝑎31 𝑎32 𝑎33 𝑙31 𝑙32 1 0 0 𝑢33

𝑎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

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

Comparing the two matrices, we get

𝑢11 = 𝑎11 𝑢12 = 𝑎12 𝑢13 = 𝑎13

𝑎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

𝐔𝐗 = 𝐘 𝑢11 𝑢12 𝑢13 𝑥1 𝑦1


0 𝑢22 𝑢23 𝑥2 = 𝑦2 Calculate 𝑥1 , 𝑥2 , 𝑥3
0 0 𝑢33 𝑥3 𝑦3

09-02-2022 21
LU Decomposition Method

𝐴𝑋 = 𝐵 𝑎11 𝑎12 𝑎13 𝑥1 𝑏1


𝑎21 𝑎22 𝑎23 𝑥2 = 𝑏2
𝑎31 𝑎32 𝑎33 𝑥3 𝑏3

1 0 0 𝑢11 𝑢12 𝑢13


𝐋𝐔 𝑈 = 0 𝑢22 𝑢23
𝐿 = 𝑙21 1 0
𝑙31 𝑙32 1 0 0 𝑢33

𝐋𝐔𝐗 = 𝐁

𝑢11 𝑢12 𝑢13 𝑥1 𝑦1


𝐔𝐗 = 𝐘 0 𝑢22 𝑢23 𝑥2 = 𝑦2
0 0 𝑢33 𝑥3 𝑦3

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 𝑥2 considering 𝑥3 = 0 and 𝑥1

Calculate 𝑥3 considering 𝑥1 , 𝑥2

Process is repeated till we get desired degree of accuracy


09-02-2022 24
Gauss-Seidel Method
17 − 𝑦 + 2𝑧
20𝑥 + 𝑦 − 2𝑧 = 17 𝑥 𝑥=
20
3𝑥 + 20𝑦 − 𝑧 = −18
−18 − 3𝑥 + 𝑧
𝑦 𝑦=
2𝑥 − 3𝑦 + 20𝑧 = 25 20
25 − 2𝑥 + 3𝑦
𝑧 𝑧=
20

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy