next up previous contents
Next: Solution Up: Procedures Previous: Solution

 

LU Decomposition

Matrices are used widely in Numerical Computing, many algorithms involve decomposing a matrix, A into an equivalent pair L and U, where L and U are lower and upper triangular matrices respectively and tex2html_wrap_inline3452 .

Consider the following system of equations,

eqnarray2937

here

equation2939

so

equation2944

and

equation2949

Both L and U can be stored in the same matrix; since the diagonal of L is always unity it does not have to be store, the combined LU matrix can be stored as

equation2955

Now, given that

equation2960

then we solve for tex2html_wrap_inline3462 where

equation2967

(recall that the diagonal of L will be all 1s) and then solve

equation2971

The advantage of this method is that the triangular system of equations is very easy to solve. tex2html_wrap_inline3468 can be solved by forward substitution and tex2html_wrap_inline3470 by backward substitution. tex2html_wrap_inline3462 is calculated by forward substitution as follows :

eqnarray2982

Once tex2html_wrap_inline3462 is known tex2html_wrap_inline3476 can easily be obtained by backwards substitution:

eqnarray2997

The LU decomposition algorithm is as follows:

For each row k from 1 to n-1 in order,

The algorithm will not work if the A matrix is singular, that is, if any of the rows of A are all zero.

This algorithm omits the issue of pivoting so can be unstable - your program will work for the 3 by 3 matrix given here.

The an HPF program with subroutines to perform LU decomposition and forward and backwards substitution.

Go back to Notes gif




next up previous contents
Next: Solution Up: Procedures Previous: Solution

©University of Liverpool, 1997
Thu May 29 10:11:26 BST 1997
Not for commercial use.