LU Factorization
Factor Once, Solve Many Times
Gaussian elimination converts a system Ax = b into an upper-triangular system. LU factorization records that work as PA = LU: P is a permutation matrix for any row swaps, L is lower triangular with unit diagonal in the usual convention, and U is upper triangular. If no swap is required, P is the identity.
The multipliers used to eliminate entries below a pivot become the entries below the diagonal of L.
For example, eliminating the lower-left entry of A = [[4, 2], [6, 7]] uses multiplier 6/4 = 3/2. The resulting factors are L = [[1, 0], [3/2, 1]] and U = [[4, 2], [0, 4]].
Multiplying them reconstructs A, which is the fastest check that factors have been recorded consistently.
With pivoting, the row swap is part of the equation. If a row swap occurs, solve Ly = Pb, then Ux = y; do not solve Ly = b unless P is the identity.
Pivoting chooses a nonzero, usually suitably large pivot to avoid division by zero and reduce avoidable arithmetic amplification. Detailed conditioning analysis is a separate question from recording the algebra correctly.
The payoff appears with many right-hand sides. Factoring a fixed matrix costs the elimination once. Each new vector b then needs one inexpensive forward substitution and one back substitution. Triangular solves proceed in an order forced by the zeros: top to bottom for L, bottom to top for U.
Mark Yourself Question
- Grab a piece of paper and try this problem yourself.
- When you're done, check the "I have answered this question" box below.
- View the solution and report whether you got it right or wrong.
Factor A = [[2, 3], [4, 11]] into unit-lower L and upper U without pivoting. Then solve Ax = b for b = [5, 19]T.
Mark Yourself Question
- Grab a piece of paper and try this problem yourself.
- When you're done, check the "I have answered this question" box below.
- View the solution and report whether you got it right or wrong.
A matrix has already been factored without pivoting as L = [[1,0,0],[3,1,0],[-1,2,1]] and U = [[2,1,0],[0,4,2],[0,0,5]]. Use these factors to solve for x when b = [2, 14, 3]T.