LU Decomposition
LU decomposition is a matrix factorization technique that expresses a square matrix as the product of a unit lower triangular matrix L and an upper triangular matrix U, serving as the algebraic representation of Gaussian elimination.
LU decomposition, also called LU factorization, is a direct numerical method in linear algebra and scientific computing that factors a square matrix A โ โnรn (or โnรn) into the product of a lower triangular matrix L and an upper triangular matrix U. Introduced in modern matrix notation by Alan Turing in 1948 to analyze rounding errors in automated computing machines, LU decomposition is the matrix-algebraic formulation of Gaussian elimination. Once a matrix A is factored as PA = LU (incorporating a permutation matrix P for row pivoting), any linear system Ax = b can be solved in O(n2) arithmetic operations by two triangular sweeps: forward substitution on Ly = Pb followed by back substitution on Ux = y.
Compared with QR decomposition, which requires (4/3)n3 floating-point operations (flops) for a square matrix, LU decomposition requires only (2/3)n3 flopsโhalf the arithmetic workโmaking it the default general-purpose solver for dense non-symmetric systems of linear equations, matrix inversion, determinant evaluation, and the inner linear solves of Newton's method for nonlinear systems. When A is symmetric and positive-definite, LU decomposition specializes to Cholesky decomposition (A = LLT), which further halves the arithmetic cost to (1/3)n3 flops.
Mathematical Foundation and Existence Conditions
In standard Doolittle convention, L โ โnรn is a unit lower triangular matrix (meaning lii = 1 along the main diagonal and lij = 0 for j > i), while U โ โnรn is an upper triangular matrix (uij = 0 for i > j). At step k of Gaussian elimination (for k = 1, โฆ, n โ 1), multiples of row k are subtracted from rows i = k + 1, โฆ, n using the multipliers lik = aik(k) / akk(k) to zero out all entries below the pivot ukk = akk(k). Recording each elimination stage as a unit lower triangular Frobenius matrix Mk yields Mnโ1โฏM2M1A = U. Because the inverse of a Frobenius elimination matrix simply negates its subdiagonal multipliers, the product L = M1โ1M2โ1โฏMnโ1โ1 assembles all multipliers lik directly into their corresponding subdiagonal positions without any additional arithmetic.
A square matrix A possesses a unique unpivoted LU decomposition with unit lower triangular L if and only if all of its leading principal submatrices A1:k, 1:k for k = 1, โฆ, n โ 1 are non-singular (having non-zero leading principal minors). Even when A itself is invertibleโfor example, the 2 ร 2 permutation matrix [0, 1; 1, 0]โa zero pivot ukk = 0 causes unpivoted elimination to halt at that step unless rows are reordered.
Doolittle, Crout, and LDU Variants
Three closely related normalizations of the triangular factors appear in numerical software:
- Doolittle algorithm: Sets the diagonal of L to unity (lii = 1) and leaves the pivots on the diagonal of U. This is the standard convention in LAPACK (dgetrf), MATLAB, and SciPy.
- Crout algorithm: Sets the diagonal of U to unity (uii = 1) and places the pivots on the diagonal of L.
- LDU decomposition: Factors U = DUฬ, yielding A = LDUฬ, where both L and Uฬ are unit triangular and D = diag(d1, โฆ, dn) is diagonal. For symmetric matrices (A = AT), symmetry forces Uฬ = LT, giving the symmetric indefinite LDLT factorization.
Pivoting and Numerical Stability in Floating-Point Arithmetic
Even when every pivot ukk is non-zero, an unpivoted pivot of tiny magnitude (|ukk| โช โAโ) produces huge multipliers lik = aik(k) / ukk. In finite-precision floating-point arithmetic, multiplying row k by a large multiplier lik and subtracting it from row i swamps the existing entries of row i with rounded multiples of row k, destroying accuracy.
Partial, Complete, and Rook Pivoting
To bound multiplier magnitude, Gaussian elimination with partial pivoting (GEPP) searches the active column k from row k to row n at each stage and swaps row k with the row p โฅ k that maximizes |apk(k)|. This produces the factorization:
PA = LU,
where P โ {0, 1}nรn is a row permutation matrix, and ensures that every off-diagonal multiplier satisfies |lik| โค 1. James H. Wilkinson proved that the computed factors Lฬ and ร satisfy the backward-error relation Lฬร = PA + ฮA with โฮAโโ / โAโโ โค n3 ฯn ฮตmach, where ฯn = maxi,j,k |aij(k)| / maxi,j |aij| is the pivot growth factor. Although Wilkinson constructed pathological matrices where partial pivoting suffers worst-case growth ฯn = 2nโ1, in practical scientific and engineering workloads ฯn almost never exceeds O(n1/2), making partial pivoting backward stable in practice. When stricter guarantees are required, complete pivoting (PAQ = LU, searching the entire active trailing submatrix) bounds ฯn โ O(n(1/2) ln n) at the cost of O(n3) comparisons, while rook pivoting searches one row and one column alternatingly to achieve near-complete stability with only O(n2) comparison overhead.
| Factorization Variant | Matrix Class | Leading Flop Count | Pivoting Strategy | Backward Stability |
|---|---|---|---|---|
| Unpivoted LU (A = LU) | Diagonally dominant / M-matrices | (2/3)n3 | None (P = I) | Stable when diagonally dominant |
| Partial Pivoting (PA = LU) | General non-singular dense A | (2/3)n3 | Column search (|lik| โค 1) | Stable in practice (ฯn โ n1/2) |
| Complete Pivoting (PAQ = LU) | Rank-deficient / pathological A | (2/3)n3 + O(n3) search | Full submatrix search | Provably small growth factor |
| Cholesky (A = LLT) | Symmetric positive-definite A | (1/3)n3 | None needed | Unconditionally backward stable |
Block Algorithms, Sparse Direct Solvers, and ILU Preconditioning
On modern cache-hierarchical CPUs and GPUs, element-by-element elimination is bottlenecked by memory bandwidth rather than floating-point throughput. Block LU decomposition partitions A into panels of width b (typically 64 to 256 columns), factors the current n ร b panel using partial pivoting, and updates the trailing (n โ b) ร (n โ b) Schur complement A22 โ A22 โ L21U12 via a single Level-3 BLAS dgemm matrix-matrix multiplication.
For large sparse matrices arising from finite-element or finite-volume discretizations of partial differential equations, direct LU factorization introduces fill-inโnon-zero entries appearing in L and U at positions where A was zero. Sparse direct solvers (such as SuperLU, UMFPACK, and PARDISO) reorder rows and columns prior to elimination using minimum-degree or nested-dissection graph orderings to minimize fill-in. For 3D meshes where even reordered direct LU exceeds memory budgets, incomplete LU (ILU) factorization drops fill-in entries outside a prescribed sparsity pattern (ILU(0)) or below a numerical drop tolerance (ILUT), serving as an algebraic preconditioner that accelerates Krylov subspace solvers such as the generalized minimal residual method and the biconjugate gradient stabilized method.
Frequently Asked Questions
How does LU decomposition speed up solving multiple right-hand sides?
Factoring PA = LU costs (2/3)n3 flops once. Each subsequent right-hand side vector b(m) requires only forward substitution (Ly = Pb(m), costing n2 flops) and back substitution (Ux = y, costing n2 flops), for a total of 2n2 flops per solveโorders of magnitude faster than refactoring or computing Aโ1 explicitly.
How is the determinant of a matrix computed from its LU factorization?
Because det(L) = 1 for a unit lower triangular matrix and det(P) = (โ1)s where s is the number of row swaps in P, the determinant of A is simply det(A) = (โ1)s โi=1n uii, computed in O(n) multiplications after factoring.
References
- Turing, A. M. (1948). Rounding-off errors in matrix processes. The Quarterly Journal of Mechanics and Applied Mathematics, 1(1), 287โ308. https://doi.org/10.1093/qjmam/1.1.287
- Wilkinson, J. H. (1961). Error analysis of direct methods of matrix inversion. Journal of the ACM, 8(3), 281โ330. https://doi.org/10.1145/321075.321076
- Trefethen, L. N., & Schreiber, R. S. (1990). Average-case stability of Gaussian elimination. SIAM Journal on Matrix Analysis and Applications, 11(3), 335โ360. https://doi.org/10.1137/0611023
- Higham, N. J. (2002). Accuracy and Stability of Numerical Algorithms (2nd ed.). Society for Industrial and Applied Mathematics. https://doi.org/10.1137/1.9780898718027