LU decomposition explained

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

(The last form in his alternate yet equivalent matrix notation appears as

g x h

). While most elimination and LU algorithms employ equations of the form

element:=element-vector x vector

Banachiewicz wrote it as

vector:=vector-submatrix x vector

, in this way revealing additional problem symmetry.

Definitions

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

coefficients while two triangle matrices combined contain coefficients, therefore coefficients of matrices are not independent. Usual convention is to set unitriangular, i.e. with all main diagonal elements equal one. However, setting instead matrix unitriangular reduces to the same procedure after transpose of matrix product (cf. properties of matrix transposition): B = A^\textsf = (LU)^\textsf =U^\textsfL^\textsf.After transposition, is lower triangle while is upper unitriangular factor of . This demonstrates also, that operations on rows (e.g. pivoting) are equivalent to those on columns of a transposed matrix, and in general choice of row or column algorithm offers no advantage.

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: \begin a_ & a_ & a_ \\ a_ & a_ & a_ \\ a_ & a_ & a_ \end = \begin \ell_ & 0 & 0 \\ \ell_ & \ell_ & 0 \\ \ell_ & \ell_ & \ell_ \end \begin u_ & u_ & u_ \\ 0 & u_ & u_ \\ 0 & 0 & u_ \end.

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 a_ = \ell_ u_. If a_ = 0, then at least one of \ell_ and u_ 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 a_, a_ with a_, 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 a_ of large absolute value (cf. pivoting).

LU Through recursion

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),...

and then let us write matrix product

A\equivA(0)=L(0)U(0)

in such way that these rows and columns are separated from the rest. In doing so we shall use block matrix notation, such that e.g.

a\equiva11

is an ordinary number,

{\bf

sf{T}\equiv(a
w}
12

,a13)sf{T}

is a row vector and

{\bfv}=(a21,a31)

is a column vector and

A'

is sub-matrix of matrix

A(0)

without top row and leftmost column. Then we can replace

A(0)=L(0)U(0)

with a block matrix product. Namely it turns out that one can multiply matrix blocks in such way as if they were ordinary numbers, i.e. row times column, except that now their components are sub-matrices, sometimes reduced to scalars or vectors. Thus

u{\bfl}

denotes a vector obtained from

{\bfl}

after multiplication of each component by a number

{\bflu}sf{T}

is an outer product of vectors i.e. a matrix which first column is next is

u13{\bfl}

and so on for all components of

{\bfu}

and

L(1)U(1)

is a product of sub-matrices of

L(0), U(0)

\begin \left(\begin a & ^\textsf \\ \hline \\[-0.5em] & \quad A' \quad \\[-0.5em] \\ \end \right) &= \left(\begin & ^\textsf \\ \hline \\[-0.5em] & \quad L^ \quad \\[-0.5em] \\ \end \right)\; \left(\begin u & ^\textsf \\ \hline \\[-0.5em] & \quad U^ \\[-0.5em] \\ \end \right) \\&=\left(\begin u & ^\textsf \\ \hline \\[-0.5em] u & \quad ^\textsf + L^U^ \\[-0.5em] \\ \end \right)\end

From equality of first and last matrices follow final

{\bfl}={(1/a)}{\bfv}

while matrix

A'

becomes updated/replaced with

A(1)\equivL(1)U(1)=

Now comes the crucial observation: nothing prevents us to treat

A(1)

the same way as we did with repeatedly. If dimension of

A

is, after such steps all columns

\bfv

form sub-diagonal part of triangle matrix

L

and all pivots

a

combined with rows

{\bfw}sf{T}

form upper triangle matrix as required. In the above example so only two steps suffice.

The above procedure demonstrates that at no step the top diagonal pivot element

a

of consecutive sub-matrices can be zero. To avoid it columns or rows may be swapped so that

a

becomes nonzero.Such procedure involving permutation is called LUP, decomposition with pivoting.

Permutation of columns corresponds to matrix product

AQ(0)

where

Q(0)

is a permutation matrix, i.e. the identity matrix

I

after the same column permutation. After all steps such LUP decomposition applies to Present computation scheme and similar in Cormen et al. are examples of . They demonstrate two general properties of LU factorization:Recurrence algorithms are not overly costly in terms of algebraic operations yet they suffer from practical disadvantage due to need to update and store most elements of at each step. It will be seen that by reordering calculations it is possible to dispose with storage of intermediate values.

LU factorization with partial pivoting

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): PA = LU, \quad (AQ=LU),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.

LU factorization with full pivoting

An involves both row and column permutations to find absolute maximum element in the whole submatrix: PAQ = LU, where,, and are defined as before, and is a permutation matrix that reorders the columns of .

Lower-diagonal-upper (LDU) decomposition

A (LDU) is a decomposition of the form A = LDU, where is a diagonal matrix, and and are unitriangular matrices, meaning that all the entries on the diagonals of and are one.

Rectangular matrices

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 .

Example

We factor the following matrix: \begin 4 & 3 \\ 6 & 3 \end = \begin \ell_ & 0 \\ \ell_ & \ell_ \end \begin u_ & u_ \\ 0 & u_ \end.

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\left\

Notes and References

  1. .