Linear Systems Linear Systems
Pivoting in Gaussian Elim.
CSE 541 Roger Crawfis
Limitations of Gaussian Elimation
The naïve implementation of Gaussian
Elimation
The naïve implementation of Gaussian
Elimination is not robust and can suffer from severe round-off errors due to: from severe round off errors due to:
Dividing by zero Dividing by small numbers and adding Dividing by small numbers and adding.
Both can be solved with pivoting
Partial Pivoting
- What if at step i
Aii = 0?
g
- What if at step i, Aii = 0?
Si l Fi
⎡ ⎤ ⎢ ⎥
Factored Portion
- Simple Fix:
If Aii = 0 Fi d A 0 j i
⎢ ⎥ ⎢ ⎥
Factored Portion
ii
A
Row i
Find Aji ≠ 0 j > i Swap Row j with i
⎢ ⎥ ⎢ ⎥ ⎣ ⎦
ji
A
Row j
Example – Partial Pivoting
⎤ ⎡ ⎤ ⎡ ⎥ ⎤ ⎢ ⎡ ⋅
−
25 . 6 25 . 1 10 25 . 1
1 4
x
p g
⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ 75 5 . 12 5 . 12 5 . 5 .
2 1
x Forward Elimination ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ ⋅ − = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ ⋅ − ⋅
− 5 2 1 5 4
10 25 . 6 75 25 . 6 10 25 . 1 5 . 12 25 . 1 10 25 . 1 x x ⎦ ⎣ ⎦ ⎣ ⎦ ⎣
2
10 25 . 6 75 10 25 . 1 5 . 12 x ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ = ⎥ ⎦ ⎤ ⎢ ⎣ ⎡ 9999 . 4 0001 . 1
5 2 1 digits