Linear Systems Gaussian Elimination

Linear Systems
Pivoting in Gaussian Elim.
CSE 541
Roger Crawfis
Limitations of Gaussian
Elimation

The naïve implementation of Gaussian
Elimination is not robust and can suffer
from severe round-off errors due to:
Dividing by zero
 Dividing by small numbers and adding.


Both can be solved with pivoting
Partial Pivoting


What if at step i, Aii = 0?

Simple Fix:

If A = 0
Find A  0 j > i 
Swap Row j with i 

ii
ji
Factored Portion
Aii
A ji




Row i
Row j
Example – Partial Pivoting
1.25 104 1.25  x1  6.25

   

x
75
12
.
5
12
.
5


 2  
Forward Elimination
6.25
1.25 104
  x1  
1.25




5
5 
x
75

6
.
25

10
0
12
.
5

1
.
25

10


 2  
 x1 
1.0001 

x 

4
.
9999

 2  5 digits 
Example – Partial Pivoting
1.25 104 1.25  x1  6.25

   

x
75
12
.
5
12
.
5


 2  
Forward Elimination
 x1 
1.0001 

x 

4
.
9999

 2  5 digits 
6.25
1.25 104
  x1  
1.25


  75  6.25 105 
5 
x
0
12.5  1.25 10   2  


Rounded to 3 digits
1.25 104

0

  x1   6.25 


5
5 
 1.25 10   x2   6.25 10 
1.25
 x1 
0 
 
x 
 2  3digits 5
Better Pivoting

Partial Pivoting to mitigate round-off error
If | Aii | < max | Aji |
j i
Swap row i with arg (max | Aij |)
j i
Avoids Small
Multipliers

Adds an O(n) search.
Partial Pivoting
swap
1.25 104 1.25  x1  6.25

   

12.5  x2   75 
 12.5
12.5  x1   75 
 12.5
1.25 104 1.25  x   6.25

 2  

Forward Elimination
12.5
75
12.5
  x1  


 0 1.25  12.5 105   x  6.25  75 105 

 2  

Rounded to 3 digits
12.5 12.5  x1   75 
 0 1.25  x   6.25

 2  

 x1 
1
 
x 
 2  3digits 5
Pivoting strategies
k

Partial Pivoting:


Complete (Full) Pivoting


Only row interchange
k
Threshold Pivoting

k
Row and Column interchange
k
Only if prospective pivot is found
to be smaller than a certain
threshold
Pivoting With Permutations

Adding permutation matrices in the mix:
M n1Pn1M n2 Pn2  M1P1 Ax  M n1Pn1M n2 Pn2  M1P1b

However, in Gaussian Elimination we will
only swap rows or columns below the
current pivot point. This implies a global
reordering of the equations will work:
MPAx  MPb
MAx  b
Pivoting
Again, the pivoting is strictly a function of
the matrix A, so once we determine P it
is trivial to apply it to many problems bk.
 For LU factorization we have:

LU = PA
 Ly = Pb
 Ux = y
