numerical linear algebra
LU Decomposition
You should know: matrices
Overview
LU decomposition factors a square matrix A into the product of a lower triangular matrix L (with 1's on the diagonal) and an upper triangular matrix U, so that A = LU. It is the matrix formulation of Gaussian elimination: the multipliers used to eliminate entries below the diagonal during elimination become the entries of L, and the resulting row-echelon form is U. Once A is factored, solving Ax = b for many different right-hand sides b becomes cheap, since each solve reduces to a forward substitution (Ly = b) followed by a back substitution (Ux = y), each taking only O(n²) operations instead of the O(n³) needed to redo elimination from scratch. When a zero pivot would otherwise be encountered, row-permutation is added, giving PA = LU with a permutation matrix P.
Intuition
Gaussian elimination reduces a matrix to upper-triangular form by subtracting multiples of one row from rows below it; LU decomposition simply keeps a record of exactly which multiples were used, storing them below the diagonal of L while U holds the triangular result. Splitting the work this way pays off when the same system needs to be solved for many different right-hand sides: the expensive elimination step (forming L and U) is done once, and each new b only needs two cheap triangular solves — sliding down through L, then back up through U — like reusing a well-organized recipe instead of re-deriving it from scratch every time.
Formal Definition
For a square matrix A that admits decomposition without row swaps, A factors as:
Worked Examples
Eliminate the (2,1) entry: multiplier l₂₁ = a₂₁/a₁₁ = 4/2 = 2.
Subtract 2× row 1 from row 2 to get U: row 2 becomes (4−2·2, 7−2·3) = (0, 1).
L holds the multiplier below the unit diagonal.
Verify: LU should reconstruct A.
Answer: L = [[1,0],[2,1]], U = [[2,3],[0,1]], and LU = A exactly.
Practice Problems
Find the multiplier l₂₁ and the resulting U for A = [[3,6],[1,5]].
Why is LU decomposition preferred over plain Gaussian elimination when a structural engineer must solve Kd = F for many different load vectors F on the same stiffness matrix K?
Partial pivoting (giving PA = LU instead of A = LU) is used mainly to:
Quiz
Summary
- LU decomposition factors A = LU, recording Gaussian elimination's multipliers in L (lower triangular, unit diagonal) and the eliminated matrix in U (upper triangular).
- Once factored, Ax = b is solved cheaply for any b via forward substitution (Ly=b) then back substitution (Ux=y), each O(n²).
- Partial pivoting (PA = LU) swaps rows to avoid zero or small pivots, which is essential for numerical stability.
References
- WebsiteWikipedia — LU decomposition
Mathematics