โ† Wiki Index / Computation & Algorithms / LU Decomposition
๐Ÿ’ป Computation & Algorithms

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 VariantMatrix ClassLeading Flop CountPivoting StrategyBackward Stability
Unpivoted LU (A = LU)Diagonally dominant / M-matrices(2/3)n3None (P = I)Stable when diagonally dominant
Partial Pivoting (PA = LU)General non-singular dense A(2/3)n3Column search (|lik| โ‰ค 1)Stable in practice (ฯn โ‰ˆ n1/2)
Complete Pivoting (PAQ = LU)Rank-deficient / pathological A(2/3)n3 + O(n3) searchFull submatrix searchProvably small growth factor
Cholesky (A = LLT)Symmetric positive-definite A(1/3)n3None neededUnconditionally 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

  1. 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
  2. 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
  3. 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
  4. 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
๐Ÿงฌ Support Open Science
Explore interactive science games on LowKey Games or browse scientific apparel & accessories in the CRV Science Shop.
๐Ÿ’ก Spot an inaccuracy or have primary literature to expand this article?
Submit a citation or revision note using your shared CRV Science / LowKey Games profile ID.
Suggest Revision