AMTH247 Lecture 9
Linear Equations III
Reading: Heath §2.4.5
At each stage of the process of LU factorization we have
a partially reduced matrix of the form
and we want to set to zero the elements in column
below
.
The method for doing this, multiplying by the elimination matrix
where
fails when the divisor
is zero.
The solution is obvious, if
swap the
-th with some
other row
with
, for which
.
This is always possible unless
for all
,
in which case the matrix must be singular.
Even when
is not zero, there may be advantages
in swapping rows to reduce rounding error.
We saw in the previous lecture that this is what Scilab's LU factorization does.
As has been mentioned, the point of pivoting, i.e. the
interchange of rows, is to to minimize the effect of rounding
errors1.
There are a number of approaches to pivoting, the most important
being partial pivoting.
In partial pivoting, when we reach the stage
we choose as the pivot element the element
,
,
of largest magnitude, that is the largest element on or below
the diagonal in the
th column, and swap row
with row
.
Intuitively the justification for this is that by choosing
the pivot element as large as possible, the multipliers are
as small as possible and previous rounding errors will be
not be amplified in the multiplication by the elimination
matrix.
We will use the same example as in Lecture 8:
The element of largest magnitude in the first column is 3,
so we swap the first and third rows
The elimination matrix is
and
The largest element on or below the diagonal in the second column
is
so no row interchange is needed at this step.
The elimination matrix is
and
This is the same upper triangular matrix which was computed
by Scilab at the end of Lecture 8.
A permutation matrix is a
matrix
with exactly one 1 in each row and each column and zeros elsewhere,
or, equivalently, an identity matrix with its rows and
columns permuted.
Some properties of permutation matrices:
- The inverse of a permutation matrix
is its
transpose
.
- The product of two permutation matrices is again a permutation
matrix.
- If
is a permutation matrix and
is any
matrix then
- The matrix product
permutes
the rows of
.
- The matrix product
permutes
the columns of
.
Let
be the permutation matrix
and let
Then
permutes the rows of
in the order
and
permutes the columns of
in the order
.
When performing LU factorization with partial pivoting
we must keep track of the row interchanges we perform.
Row interchanges can be performed by multiplying by
a permutation matrix. To interchange rows
and
of a matrix
we multiply by the permutation
matrix
obtained by swapping rows
and
of the identity matrix.
For example, the following
permutation
matrix swaps the second and fourth rows:
These particular permutation matrices are symmetric, i.e.
satisfy
,
and so are their own inverse,
.
The effect of partial pivoting is to multiply by a permutation
matrix before multiplying by the elimination matrix at each step.
So instead of performing the elimination by
where the
are elimination matrices, we compute instead
where the
are permutation matrices.
Now the inverse of the matrix
is
where
is the inverse of
and,
as mentioned above, the
are their own inverses.
Once more we have the factorization
with
and
as above, but while
is upper triangular, the matrix
is, in general,
no longer lower
triangular because of the permutation matrices in its construction.
Starting with the matrix
we computed
by first swapping the first and third rows, corresponding
to the permutation matrix
then applying the elimination matrix
There is now swapping of rows at the second step, so
The second elimination matrix was
so the matrix
is
The matrix
is then given by
This is exactly the result given by Scilab.
With partial pivoting the matrix
is not lower
triangular, however it is a row permutation of a lower triangular
matrix. More precisely we compute a factorization
such that
is upper triangular and there is
a permutation matrix
such that
is lower triangular.
Multiplying the equation above by the permutation matrix
we have, equivalently,
where
is lower triangular.
The permutation matrix
is given by
where the matrices
are the permutation matrices
associated with pivoting introduced in previous section.
Suppose we now have a LU factorization
and we wish to solve a linear system
Multiply both sides by
to give
This system can be solved by successive substitution:
Previously we computed
and the permutation matrices used were
Now
and the required lower triangular form of
is
Thus we have the factorization
with
To solve the linear system
we compute
and then
- Solve
for
.
The solution is
- Solve
for
.
The solution is, as before,
There is a second form of the lu command in Scilab:
[l,u,p] = lu(a)
which computes the LU factorization we have described above.
For our example
-->a = [1 2 3
-->2 3 1
-->3 1 2]
a =
! 1. 2. 3. !
! 2. 3. 1. !
! 3. 1. 2. !
-->[l,u,p] = lu(a)
p =
! 0. 0. 1. !
! 0. 1. 0. !
! 1. 0. 0. !
u =
! 3. 1. 2. !
! 0. 2.3333333 - 0.3333333 !
! 0. 0. 2.5714286 !
l =
! 1. 0. 0. !
! 0.6666667 1. 0. !
! 0.3333333 0.7142857 1. !
which agrees with our calculations.
AMTH247 Lecture 9
Linear Equations III
This document was generated using the
LaTeX2HTML translator Version 2K.1beta (1.61)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split +0 lecture.tex
The translation was initiated by amth247 on 2003-04-07
Footnotes
- ...
errors1
- Heath, Example 2.15, gives a theoretical example
to show the importance of pivoting. We will see a practical example
in Practical 6.
amth247
2003-04-07