
In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix (see matrix multiplication and matrix decomposition). The product sometimes includes a permutation matrix as well. LU decomposition can be viewed as the matrix form of Gaussian elimination. Computers usually solve square systems of linear equations using LU decomposition, and it is also a key step when inverting a matrix or computing the determinant of a matrix. It is also sometimes referred to as LR decomposition (factors into left and right triangular matrices). The LU decomposition was introduced by the Polish astronomer Tadeusz Banachiewicz in 1938, who first wrote product equation
LU=A=hTg
g x h
element:=element-vector x vector
vector:=vector-submatrix x vector
Let be a square matrix. An LU factorization refers to expression of into product of two factors – a lower triangular matrix and an upper triangular matrix : . Sometimes factorization is impossible without prior reordering of to prevent division by zero or uncontrolled growth of rounding errors hence alternative expression becomes, where in formal notation permutation matrices factors and indicate permutation of rows (or columns) of . In theory (or) are obtained by permutations of rows (or columns) of the identity matrix, in practice the corresponding permutations are applied directly to rows (or columns) of .
Matrix of side has
n2
In the lower triangular matrix all elements above the main diagonal are zero, in the upper triangular matrix, all the elements below the diagonal are zero. For example, for a matrix, its LU decomposition looks like this:
Without a proper ordering or permutations in the matrix, the factorization may fail to materialize. For example, it is easy to verify (by expanding the matrix multiplication) that . If , then at least one of and has to be zero, which implies that either or is singular. This is impossible if is nonsingular (invertible). In terms of operations, zeroing/elimination of remaining elements of first column of involves division of with , impossible if it is 0. This is a procedural problem. It can be removed by simply reordering the rows of so that the first element of the permuted matrix is nonzero. The same problem in subsequent factorization steps can be removed the same way. For numerical stability against rounding errors/division by small numbers it is important to select of large absolute value (cf. pivoting).
The above example of matrices demonstrates that matrix product of top row and leftmost columns of involved matrices plays special role for to succeed. Let us mark consecutive versions of matrices with
(0), (1),...
A\equivA(0)=L(0)U(0)
a\equiva11
{\bf
| sf{T}\equiv(a | |
| w} | |
| 12 |
,a13)sf{T}
{\bfv}=(a21,a31)
A'
A(0)
A(0)=L(0)U(0)
u{\bfl}
{\bfl}
{\bflu}sf{T}
u13{\bfl}
{\bfu}
L(1)U(1)
L(0), U(0)
From equality of first and last matrices follow final
{\bfl}={(1/a)}{\bfv}
A'
A(1)\equivL(1)U(1)=
A(1)
A
\bfv
L
a
{\bfw}sf{T}
The above procedure demonstrates that at no step the top diagonal pivot element
a
a
Permutation of columns corresponds to matrix product
AQ(0)
Q(0)
I
It turns out that a proper permutation of rows (or columns) to select column (or row) absolute maximal pivot is sufficient for numerically stable LU factorization, except for known pathological cases. It is called (LUP):where and are again lower and upper triangular matrices, and and are corresponding permutation matrices, which, when correspondingly left- and right-multiplied to, reorder the rows and columns of . It turns out that all square matrices can be factorized in this form,[1] and the factorization is numerically stable in practice. This makes LUP decomposition a useful technique in practice.
A variant called at each step involves search of maximum element the way rook moves on a chessboard, along column, row, column again and so on till reaching a pivot maximal in both its row and column. It can be proven that for large matrices of random elements its cost of operations at each step is similarly to partial pivoting proportional to the length of matrix side unlike its square for full pivoting.
An involves both row and column permutations to find absolute maximum element in the whole submatrix:where,, and are defined as before, and is a permutation matrix that reorders the columns of .
A (LDU) is a decomposition of the formwhere is a diagonal matrix, and and are unitriangular matrices, meaning that all the entries on the diagonals of and are one.
Above we required that be a square matrix, but these decompositions can all be generalized to rectangular matrices as well. In that case, and are square matrices both of which have the same number of rows as, and has exactly the same dimensions as . 'Upper triangular' should be interpreted as having only zero entries below the main diagonal, which starts at the upper left corner. Similarly, the more precise term for is that it is the row echelon form of the matrix .
We factor the following matrix:
One way to find the LU decomposition of this simple matrix would be to simply solve the linear equations by inspection. Expanding the matrix multiplication gives