Introduction

An LU factorization of a matrix is simply a lower triangular matrix and an upper triangular matrix such that .

For example

  1. or
  2. Observe:
  • In 1., both and have ones on the diagonal, and all matrices are square.
  • In 2., and are not square, has ones on the diagonal, while has other values: .

We require the matrix to have ones on the diagonal, while the matrix may have other diagonal values.

A more general rule for called “row-echelon form” will be explained below; it is applicable when zeros on the diagonal crop up in the process; in essence it means the entries should be mashed “high and to the right.”

Keys to LU factorization

The principle of elimination is to use row-add matrices acting on the left in order to eliminate nonzero entries of that are below the main diagonal entries, clearing a column. These row-add matrices are then collected into a single lower-triangular matrix that combines the actions of all of them.

Creating columns:
Observe first that we can combine row-add matrices which add from the same row into a single matrix having a single column of nonzero subdiagonal entries, for example:

The order in the product on the RHS does not matter!

Keys to LU factorization (part 2)

Combining columns:
Furthermore, we can break up any lower-triangular matrix into a product of single-column matrices like the one above:

Combining columns – order matters

The three factors in the RHS product cannot be reordered without changing the result!

By combining the above two factorizations, we can write any lower-triangular matrix (with ones on the diagonal) as a product of row-add matrices, and these row-add matrices can be grouped into single-column row-add combo matrices. If is lower-triangular with rows, and we write for the single-column combo with nonzeros in the column, then we have . When you see you should think “single-column, row-add combo” and remember that the column of nonzeros lies below the main diagonal of ones.

Inverse of :
The last critical fact is that the inverse of any single-column row-add combo is the same matrix but with opposite signs on the subdiagonal entries:

Computing LU factorizations

Here is the plan:

  1. Postulate hypothetically that , where are single-column row-add combos which combine to form the hypothetical . We know and we seek and .
  2. Act upon and on the left simultaneously by , then by , etc., through . We must invent , etc. as we go along:
    1. Choose such that has all zeros in the first column on the subdiagonal: In each nonzero subdiagonal entry of , put such that row-add of the top entry into entry eliminates entry , and so on to create the entire first column of which acts to clear the first column of .
    2. Continue with chosen such that now has zeros in the first and second columns, and has subdiagonal entries in the second column.
    3. Continue through and obtain . By flipping signs on for , we now know and simply combine the subdiagonal columns of all to create the whole .
    4. Notice! The matrix is exactly the unique single-column row-add combo matrix which has column cleared by whatever clears the column of . In other words, we cook up so that the same elimination works both on and on , the difference being that has a at the top entry by definition, while the corresponding entry of may have other values.

In other words, we find the matrices by backwards reasoning: row-add eliminations performed on should simultaneously effect eliminations on , converting them each to the identity matrix . If this works, we know we have the ingredients inside the factorization .

Pivoting

The algorithm presented above for LU factorization can fail down because of zeros. For example, consider :

We cannot even begin to eliminate using row-add steps. In this situation, it is best to pivot to a different top row by using a row-swap permutation. The new top row is sometimes called the pivot row, and the new entry used to eliminate others by row-adding may be called the pivot entry or simply the pivot.

Write for the row-swap matrix that swaps rows and . After pivoting, we have a new matrix:

The new matrix has an LU factorization now:

It is appropriate to say that “ has an LU factorization with pivots”, or to say that “we have a factorization .” We do not say simply that “ has an LU factorization” if pivots are required.

Every matrix has a factorization of the form .

Numerical methods

For numerical stability, it is preferable to always pivot to the largest entry in a given column before performing elimination. This technique is called “partial pivoting.”

(“Complete pivoting” refers to a technique where elimination is performed to clear any uncleared column by choosing the largest remaining entry across the matrix. It is computationally expensive and therefore rarely used.)

The general procedure for computing factorizations is fairly complex because the natural algorithm interlaces elimination (using factors ) with permutations for the pivots (using row-swap matrices ). You are not required to master this procedure for exams.

The general process of computing by successive elimination of terms with pivots, clearing out one column at a time, is called row reduction (see below). You are required to master row-reduction for exams.

The difference between row-reduction and the procedure for is that in the latter we do not keep track of and and do not calculate and , we simply perform the row-add operations on until the factor inside is gone (by clearing columns) and the result is .

Here is the theory for producing in general:

Factorization

For , work through row of :

  1. Choose a row of to pivot into the first row, defining the corresponding row-swap matrix . After swapping we have . (For numerical stability, choose the row of with largest entry in the first column; but in principle, can choose any row with nonzero entry in the first column.)
  2. Construct to eliminate entries in row and below, clearing column of . Obtain .
  3. Proceed to row : choose a pivot row and define row-swap and obtain .
  4. Construct to clear column of .
  5. Repeat with a row-swap putting a chosen pivot from below row into row .
  6. Repeat with clearing the column below the row.
  7. End when .

In this way we build a sequence:

If we didn’t have all the matrices interlaced between the ’s, this would be , and therefore as in the ordinary LU factorization. So what we want to do here is to extract the ’s out to the right and group them into . This is the hardest part!

There is a trick we can use to make this happen. It turns out that (for ) is the same as , except that the nonzero stack of entries undergoes the row-swap of . Using this fact, together with the fact that because swaps two rows, we can rewrite our sequence in terms of other single-column matrices called . For example, in the case , we could write:

From these definitions, it follows that

and thus

where we define and .

Here is a concise computational algorithm to perform these steps on a computer:

Algorithm on entries for factorization

Initialize: .
For to :

  • Choose with maximum (or simply nonzero) .
    – That is: is the new pivot row index.
  • Exchange .
    – That is: swap current row with new pivot row on future columns of .
  • Exchange .
    – That is: swap current row with new pivot row on all of to create .
  • Exchange .
    – That is: swap current row with new pivot row on the subdiagonal entries of to create .
  • For to :
    • Set
      – That is: write next subdiagonal stack of : add terms to to create .
    • Set
      – That is: clear subdiagonals of column of by row-adding.

To understand the step of setting for , it is useful to make the following observation:

This notation is a little misleading though, because on the RHS has subdiagonals permuted by , whereas on the LHS does not. The factor will, though. Therefore, the meaning of changes at each step in the comments on the above algorithm.

Row-echelon form

When has a number of zeros cropping up, we can sometimes use pivoting to clear out more columns. For example, consider the matrices:

Here is technically upper-triangular and satisfies the rules for in an LU factorization. However, it is possible to perform a pivot and obtain , which can be further reduced by two elimination steps to obtain .

The form of is called row-echelon form, or sometimes just echelon form. To be precise: in row-echelon form, the leading entry (left-most nonzero entry) in each row is somewhere to the right of the leading entries in the rows above, and rows of only zeros are at the bottom.

The combined process of creating as in LU decomposition and then continuing pivots and eliminations to put in row-echelon form is called row reduction.

  • Row-echelon form for is very useful for inversion problems (see below).
    – For inversion problems, we will perform row reduction simultaneously on and on a vector or matrix upon which we are inverting the action of .
  • Row-echelon form for is not needed for finding determinants (see below).
    – Indeed, row-echelon can only differ from other triangular when the determinant is zero.