LU decomposition is a matrix factorization that expresses a matrix as the product of lower and upper triangular matrices. In its simplest form, , where is lower triangular and is upper triangular. Practical implementations usually incorporate row permutations, giving . The factorization records the operations of Gaussian elimination in reusable form and is a central tool in numerical linear algebra, particularly for solving systems of linear equations. (cs.cornell.edu)
Definition and existence
For a square matrix, the triangular structure means
The usual normalization sets ; such an is called unit lower triangular. This convention removes the freedom to redistribute nonzero diagonal scaling between the factors. For a nonsingular matrix, a normalized unpermuted factorization exists and is unique precisely when every leading principal submatrix is nonsingular. Equivalently, all its leading principal minors are nonzero. These are the determinants of the upper-left submatrices, for . (cs.utexas.edu)
Nonsingularity alone does not guarantee an unpermuted LU factorization. For example,
is invertible, but its first pivot is zero. Exchanging its rows produces the identity matrix, which has trivial triangular factors. Every nonsingular square matrix admits a row-permuted factorization , with a permutation matrix. Some sources instead write , using the inverse permutation; these conventions must be distinguished when interpreting software outputs. (cs.cornell.edu)
Rectangular matrices also admit pivoted LU factorizations. For of size , setting gives factors of sizes and , with triangular or trapezoidal structure. A singular matrix can still be factored, although zero diagonal entries in prevent ordinary triangular solution of an arbitrary system. (netlib.org)
Construction by elimination
At elimination step , assuming a nonzero pivot, the algorithm forms multipliers
and updates the remaining entries:
Here denotes the matrix at the beginning of the step. The eliminated entries supply the multipliers stored in , while the remaining upper triangle becomes . The trailing update is an outer-product subtraction; in block form, the remaining matrix is a Schur complement. (cs.utexas.edu)
As a direct example,
The multiplier subtracts twice the first row from the second, leaving the second pivot equal to .
For a dense square matrix, conventional elimination requires approximately floating-point operations, counting multiplication and addition separately. Its computational complexity is therefore . Implementations commonly store both factors in one array: occupies the diagonal and upper triangle, and the strict lower triangle stores , whose unit diagonal is implicit. (cs.utexas.edu)
Pivoting and numerical accuracy
In floating-point arithmetic, a very small pivot can produce large multipliers and magnify rounding errors. Partial pivoting chooses an entry of largest absolute value in the active column and exchanges its row with the pivot row. This bounds the elimination multipliers in magnitude by one. Complete pivoting searches the entire active submatrix and exchanges both rows and columns, producing . (cs.cornell.edu)
Partial pivoting generally provides good numerical stability, but it is not an unconditional guarantee. Exceptional matrices can exhibit substantial growth in intermediate entries. Backward-error analysis relates the computed factors to a slightly perturbed input matrix, with error bounds depending on the factor magnitudes. Even a small backward error need not imply a small solution error: sensitivity also depends on the matrix’s condition number. (cs.cornell.edu)
Solving systems and computing determinants
Once is available, solving reduces to
Forward substitution solves the first triangular system, and backward substitution solves the second. Because has unit diagonal,
Each new right-hand side costs operations, so the expensive factorization can be reused. (cs.cornell.edu)
For unit-diagonal ,
where is the number of row exchanges. The permutation sign is essential. Thus, after factorization, the determinant requires only a diagonal product and parity calculation. (cs.cornell.edu)
Structured matrices and related factorizations
For a sparse matrix, elimination may create nonzero entries where the original matrix contained zeros, a phenomenon called fill-in. Sparse solvers use ordering strategies to limit storage and arithmetic. They often employ , with column permutations primarily reducing fill and row permutations supporting stability. (cs.cornell.edu)
Dense implementations instead exploit block updates and matrix multiplication to improve memory reuse and support parallel computing. Pivot searches and row exchanges introduce communication costs that can limit parallel performance. (cs.cornell.edu)
Related factorizations exploit different properties. For symmetric or Hermitian positive-definite matrices, Cholesky decomposition uses the symmetry and permits stable factorization without pivoting. Rectangular least-squares problems commonly use QR decomposition, while singular value decomposition supports least-squares solutions when rank deficiency must be accommodated. (cs.cornell.edu)