Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Numerical

Methods
Lecture-8
[MA-200]
ARISHA ALI
Pivoting Strategies

Why we need pivoting if we have Gauss


Elimination Method
ARISHA ALI 2
Example
The Linear system
0.003000𝑥1 + 59.14𝑥2 = 59.17
5.291𝑥1 − 6.130𝑥2 = 46.78
Has the exact solution 𝑥1 = 10.00 𝑎𝑛𝑑 𝑥2 = 1.000
Applying Gauss Elimination Method
0.003000 59.14 59.17
0 −104300 −104400
𝑥1 = −10.00 𝑎𝑛𝑑 𝑥2 = 1.001

ARISHA ALI 3
Graphical Representation

ARISHA ALI 4
Partial Pivoting Illustration
0.003000𝑥1 + 59.14𝑥2 = 59.17 5.291 −6.130 46.78
0 59.14 59.14
5.291𝑥1 − 6.130𝑥2 = 46.78
𝑥1 = 10.00 𝑎𝑛𝑑 𝑥2 = 1.000
0.003000 59.14 59.17
5.291 −6.130 46.78
𝑅1 ↔ 𝑅2
5.291 −6.130 46.78
0.003000 59.14 59.17
Applying Gauss Elimination Method

ARISHA ALI 5
Example
The Linear system
30.00𝑥1 + 591400𝑥2 = 591700
5.291𝑥1 − 6.130𝑥2 = 46.78
Has the exact solution 𝑥1 = 10.00 𝑎𝑛𝑑 𝑥2 = 1.000
Applying Gauss Elimination Method with Partial Pivoting
30.00 591400 591700
0 −104300 −104400
𝑥1 = −10.00 𝑎𝑛𝑑 𝑥2 = 1.001

ARISHA ALI 6
Scaled Partial Pivoting Illustration
30 −5 5.291
30.00𝑥1 + 591400𝑥2 = 591700 = 5.0 ∗ 10 , = 0.8631
591400 6.130
5.291𝑥1 − 6.130𝑥2 = 46.78 5.291 −6.130 46.78
30.00 591400 591700
𝑆𝑖 = max 𝑎𝑖,𝑗
1≤𝑗≤𝑛 𝑥1 = 10.00 𝑎𝑛𝑑 𝑥2 = 1.000
𝑠1 = 591400
𝑠2 = 6.130
𝑎𝑝1 𝑎𝑘1
= max
𝑆𝑝 1≤𝑗≤𝑛 𝑆𝑘

ARISHA ALI 7
Example of Partial Pivoting
Solve the system of equations by Gauss Elimination Method by partial pivoting
0.02𝑥1 + 0.01𝑥2 = 0.02
𝑥1 + 2𝑥2 + 𝑥3 = 1
𝑥2 + 2𝑥3 + 𝑥4 = 4
100𝑥3 + 200𝑥4 = 800
Solution:

0.02 0.01 0 0 𝑥1 0.02


1 2 1 0 𝑥2 1
𝑥3 =
0 1 2 1 4
0 0 100 200 𝑥4 800
ARISHA ALI 8
Example of Partial Pivoting
The augmented matrix of given system is 𝑅2 → 𝑅2 − 0.02𝑅1

0.02 0.01 0 0 0.02 1 2 1 0 1


1 2 1 0 1 0 −0.03 −0.02 0 0
0 1 2 1 4 0 1 2 1 4
0 0 100 200 800 0 0 100 200 800
𝑅1 ↔ 𝑅2 𝑅3 ↔ 𝑅2

1 2 1 0 1 1 2 1 0 1
0.02 0.01 0 0 0.02 0 1 2 1 4
0 1 2 1 4 0 −0.03 −0.02 0 0
0 0 100 200 800 0 0 100 200 800
ARISHA ALI 9
Cont…
𝑅3 → 𝑅3 + 0.03𝑅2 𝑅4 → 100𝑅4 − 0.04𝑅3

1 2 1 0 1 1 2 1 0 1
0 1 2 1 4 0 1 2 1 4
0 0 0.04 0.03 0.12 0 0 100 200 800
0 0 100 200 800 0 0 0 −5 −20
𝑅3 ↔ 𝑅4 −5𝑥4 = −20 ⟹ 𝑥4 = 4

1 2 1 0 1 100𝑥3 + 200𝑥4 = 800 ⇒ 𝑥3 = 0


0 1 2 1 4 𝑥2 + 2𝑥3 + 𝑥4 = 4 ⇒ 𝑥2 = 0
0 0 100 200 800
0 0 0.04 0.03 0.12 𝑥1 + 2𝑥2 + 𝑥3 = 1 ⇒ 𝑥1 = 1
ARISHA ALI 10
Example of Scaled Partial Pivoting
Solve the system of equations by Gauss Elimination Method by scaled partial
pivoting
2.11𝑥1 − 4.21𝑥2 + 0.921𝑥3 = 2.01
4.01𝑥1 + 10.2𝑥2 − 1.12𝑥3 = −3.09
1.09𝑥1 + 0.987𝑥2 + 0.832𝑥3 = 4.21
Solution:

2.11 −4.21 0.921 𝑥1 2.01


4.01 10.2 −1.12 𝑥2 = −3.09
1.09 0.987 0.832 𝑥3 4.21

ARISHA ALI 11
Cont…
The augmented matrix of given system is 𝑅3 ↔ 𝑅1
2.11 −4.21 0.921 2.01 1.09 0.987 0.832 4.21
4.01 10.2 −1.12 −3.09 4.01 10.2 −1.12 −3.09
1.09 0.987 0.832 4.21
2.11 −4.21 0.921 2.01
𝑆1 = 4.21, 𝑆2 = 10.2, 𝑆3 = 1.09 4.01 2.11
𝑅2 → 𝑅2 − 𝑅 ,𝑅 → 𝑅3 − 𝑅
𝑎11 2.11 1.09 1 3 1.09 1
= = 0.501
𝑆1 4.21
1.09 0.987 0.832 4.21
𝑎21
=
4.01
= 0.393 0 6.57 −4.18 −18.6
𝑆2 10.2
0 −6.12 −0.689 −6.16
𝑎31 1.09
= =1 𝑆2 = 10.2, 𝑆3 = 1.09
𝑆3 1.09

ARISHA ALI 12
Cont…
𝑎12 6.57 𝑎32 6.12
= = 0.644, = = 5.61 −4.92𝑥3 = −25.2 ⇒ 𝑥3 = 5.12
𝑆2 10.2 𝑆3 1.09

𝑅3 ↔ 𝑅2 −6.12𝑥2 − 0.689𝑥3 = −6.16 ⇒ 𝑥2 = 0.430

1.09 0.987 0.832 4.21 1.09𝑥1 + 0.987𝑥2 + 0.832𝑥3 = 4.21


0 −6.12 −0.689 −6.16
0 6.57 −4.18 −18.6 𝑥1 = −0.431
6.57
𝑅3 → 𝑅3 − 𝑅
(−6.12) 2

1.09 0.987 0.832 4.21


0 −6.12 −0.689 −6.16
0 0 −4.92 −25.2
ARISHA ALI 13
Practice Problems
Exercise 6.1:
Q1 – Q6 (Both with Gauss elimination and Gauss Jordan method)
Exercise 6.2:
Q3 - Q6 and Q13 - Q20

ARISHA ALI 14

You might also like