You are on page 1of 15

MAT307 Numerical Analysis Why Pivoting?

Gaussian Elimination with Partial Pivoting

MAT307 Numerical Analysis

Gaussian Elimination with Partial Pivoting

Dr. Mustafa Ağgül

mustafaaggul@hacettepe.edu.tr

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Definition
The use of an equation to eliminate an unknown from the others is called
a pivot and a rule to choose pivot is called a pivoting strategy.

Remark
Obtaining an echelon form of an augmented matrix may necessitate row
interchanges (pivoting).

Example
Consider the following augmented matrix
 
0 1 1
 .
1 1 2
Obtaining an echelon form of the given augmented matrix is impossible
without row interchanges while we can easily find the solution to the
system x1 = 1 ve x2 = 1.

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Example
Also consider the following augmented matrix for very small positive ,
 
− 1 1
 .
1 1 2
An equivalent system with Gaussian elimination without pivoting can be
found as
 
− 1 1
 .
0 1 + 1/ 2 + 1/
Using back substitution, solution can be find as
2 + 1/
x2 = ≈ 1,
1 + 1/
1 − x2
x1 = ≈ 0.


Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Example
On the other hand, interchanging rows before Gaussian elimination give
   
1 1 2 R2 +R1 1 1 2
 − −−−−→  .
− 1 1 0 1 +  1 + 2
Using back substitution, solution can be find as
1 + 2
x2 = ≈ 1,
1+
x1 = 2 − x2 ≈ 1.

Remark
Gaussian elimination without pivoting is not a stable method since small
perturbation in the equation may lead too much difference in the
solutions. Pivoting strategy seems to be a good candidate to resolve this
instability.

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Consider the following linear system:

0.02x1 + 0.01x2 = 0.02,


x1 + 2x2 + x3 = 1,
x2 + 2x3 + x4 = 4,
50x3 + 100x4 = 400.

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
We first write the system of linear equations as an augmented matrix
 
0.02 0.01 0 0 0.02
 
 
 1 2 1 0 1 
 
 
 0 1 2 1 4 
 
0 0 50 100 400

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Absolutely largest pivot element of the first column is on the second row.
 
0.02 0.01 0 0 0.02
 
 R ↔R2
1  −−1−−−→

 1 2 1 0
 
 
 0 1 2 1 4 
 
0 0 50 100 400

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Next, eliminate the entries below the pivot element on the first column.
 
1 2 1 0 1
 
 R −0.02R1
0 0.02  −−2−−−−−→

 0.02 0.01 0
 
 
 0 1 2 1 4 
 
0 0 50 100 400

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Absolutely largest pivot element of the second column is on the third row.
 
1 2 1 0 1
 
 R ↔R3
 0 −0.03 −0.02 0  −−2−−−→

0
 
 
 0 1 2 1 4 
 
0 0 50 100 400

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Next, eliminate the entries below the pivot element on the second
column.
 
1 2 1 0 1
 
 R +0.03R2
4  −−3−−−−−→

 0 1 2 1
 
 0 −0.03 −0.02
 
0 0 
 
0 0 50 100 400

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Absolutely largest pivot element of the third column is on the third row.
 
1 2 1 0 1
 
 R ↔R4
4  −−3−−−→

 0 1 2 1
 
 
 0 0 0.04 0.03 0.12 
 
0 0 50 100 400

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Next, eliminate the entries below the pivot element on the third column.
 
1 2 1 0 1
 
 R4 −0.0008R3
4  −−− −−−−−−→

 0 1 2 1
 
 
 0 0 50 100 400 
 
0 0 0.04 0.03 0.12

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
The augmented matrix is now in a row echelon form.
 
1 2 1 0 1
 
 
 0 1 2 1 4 
 
 
 0 0 50 100 400 
 
0 0 0 −0.05 −0.2

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Rewrite the equivalent linear system as

x1 + 2x2 + x3 = 1,
x2 + 2x3 + x4 = 4,
50x3 + 100x4 = 400,
−0.05x4 = −0.2.

Dr. Mustafa Ağgül Hacettepe University


MAT307 Numerical Analysis Why Pivoting?
Gaussian Elimination with Partial Pivoting

Partial Pivoting swaps rows only; hence does not require any changes in
the order of xi ’s.
I Swap the row having relatively small pivot element with one of the
rows below it. Choose this row to ensure that it has the absolutely
largest pivot element.
I Choose the row on the top if two or more rows possess the same
absolutely largest pivot element.

Example
Using back substitution, we can obtain the solution

x4 = 4,
x3 = 0,
x2 = 0,
x1 = 1.

Dr. Mustafa Ağgül Hacettepe University

You might also like