Gaussian Elimination With Partial Pivoting
Gaussian Elimination With Partial Pivoting
Partial pivoting is a strategy to minimize the effect of rounding errors is to arrange the
order of the equations so that each of the multiples in the algorithm satisfies the condition
| | 1 .In others words , partial pivoting places a coefficient of larger magnitude on the
diagonal by row interchanges. This will guarantee a nonzero divisor if there is a solution
to the set of equations and will have the added advantage of giving a more accurate
solution.
How does Gaussian elimination with partial pivoting differ from Nave
Gauss elimination?
The two methods are the same, except in the beginning of each step of
forward elimination, a row switching is done based on the following
criterion. If there are n equations, then there are 1 n forward elimination
steps. At the beginning of the
th
k step of forward elimination, one finds the
maximum of
kk
a ,
k k
a
, 1 +
, ,
nk
a
Then if the maximum of these values is
pk
a in the
th
p row, n p k s s , then
switch rows p and k .
The other steps of forward elimination are the same as the Nave Gauss
elimination method. The back substitution steps stay exactly the same as the
Nave Gauss elimination method.
Example 1
Consider the system of equations :
45 10 15 20
3 2 1
= + + x x x
751 . 1 7 249 . 2 3
3 2 1
= + x x x
9 3 5
3 2 1
= + + x x x
Find the solution using Gaussian elimination with partial pivoting using five
significant digits with chopping in your calculations.
Solution
(
(
(
3 1 5
7 249 . 2 3
10 15 20
(
(
(
3
2
1
x
x
x
=
(
(
(
9
751 . 1
45
Forward Elimination of Unknowns
Now for the first step of forward elimination, the absolute value of the first
column elements below Row 1 is
20 , 3 , 5
or
20, 3, 5
So the largest absolute value is in the Row 1. So as per Gaussian
elimination with partial pivoting, the switch is between Row 1 and Row 1 to
give
(
(
(
3 1 5
7 249 . 2 3
10 15 20
(
(
(
3
2
1
x
x
x
=
(
(
(
9
751 . 1
45
Divide Row 1 by 20 and then multiply it by 3, that is, multiply Row 1 by
15 . 0 20 / 3 = .
| | | | ( ) 15 . 0 45 10 15 20 gives Row 1 as
| | | | 75 . 6 5 . 1 25 . 2 3
Subtract the result from Row 2
| | | |
| | | |
501 . 8 5 . 8 001 . 0 0
75 . 6 5 . 1 25 . 2 3
751 . 1 7 249 . 2 3
to get the resulting equations as
(
(
(
3 1 5
5 . 8 001 . 0 0
10 15 20
(
(
(
3
2
1
x
x
x
=
(
(
(
9
501 . 8
45
Divide Row 1 by 20 and then multiply it by 5, that is, multiply Row 1 by
25 . 0 20 / 5 = .
| | | | ( ) 25 . 0 45 10 15 20 gives Row 1 as
| | | | 25 . 11 5 . 2 75 . 3 5
Subtract the result from Row 3
| | | |
| | | |
2.25 .5 0 75 . 2 0
25 . 11 5 . 2 75 . 3 5
9 3 1 5
to get the resulting equations as
(
(
(
5 . 0 75 . 2 0
5 . 8 001 . 0 0
10 15 20
(
(
(
3
2
1
x
x
x
=
(
(
(
25 . 2
501 . 8
45
This is the end of the first step of forward elimination.
Now for the second step of forward elimination, the absolute value of the
second column elements below Row 1 is
001 . 0 , 75 . 2
or
0.001, 2.75
So the largest absolute value is in Row 3. So Row 2 is switched with Row 3
to give
(
(
(
5 . 8 001 . 0 0
5 . 0 75 . 2 0
10 15 20
(
(
(
3
2
1
x
x
x
=
(
(
(
501 . 8
25 . 2
7
Divide Row 2 by 2.75 and then multiply it by 0.001, that is, multiply Row
2 by 00036363 . 0 75 . 2 / 001 . 0 = .
| | | | ( ) 00036363 . 0 25 . 2 5 . 0 75 . 2 0 gives Row 2 as
| | | | 00081816 . 0 00018182 . 0 00099998 . 0 0
Subtract the result from Row 3
| | | |
| | | |
.50018184 8 50018182 . 8 0 0
00081816 . 0 0.00018182 .00099998 0 0
501 . 8 .5 8 .001 0 0
Rewriting within 5 significant digits with chopping
| | | | 5001 . 8 5001 . 8 0 0
to get the resulting equations as
(
(
(
5001 . 8 0 0
5 . 0 75 . 2 0
10 15 20
(
(
(
3
2
1
x
x
x
=
(
(
(
5001 . 8
25 . 2
45
Back substitution
5001 . 8 5001 . 8
3
= x
5001 . 8
5001 . 8
3
= x
=1
Substituting the value of
3
x in Row 2
25 . 2 5 . 0 75 . 2
3 2
= + x x
75 . 2
5 . 0 25 . 2
2
2
=
x
x
75 . 2
1 5 . 0 25 . 2
=
75 . 2
5 . 0 25 . 2
=
75 . 2
75 . 2
=
1 =
Substituting the value of
3
x and
2
x in Row 1
45 10 15 20
3 2 1
= + + x x x
20
10 15 45
3 2
1
x x
x
=
20
1 10 1 15 45
=
20
10 30
20
10 15 45
=
=
20
20
=
1 =
So the solution is
| |
(
(
(
=
3
2
1
x
x
x
X
=
(
(
(
1
1
1
This, in fact, is the exact solution. By coincidence only, in this case, the
round-off error is fully removed.