Skip to main content

Section 2.5 \(LU\) Factorization

Handout 2.5 \(LU\) Factorization

We have learned several techniques for solving the equation \(A\vec x = \vec b\text{.}\) We could solve \(A\vec x=\vec b\) using \(\vec x=A^{-1}\vec b\text{,}\) but this requires computing the inverse of an \(n\times n\) matrix, which becomes difficult for large \(n\text{.}\) Gaussian elimination is better, but still inefficient for large systems.
More efficient and numerically stable methods rely on matrix factorizations. A matrix factorization (or matrix decomposition) is a factorization of a matrix into a product of matrices. Such factorizations help solve \(A\vec x=\vec b\) and reveal matrix structure. Several matrix factorizations appear throughout this course. In this section, we factor a matrix into lower and upper triangular matrices.
A rectangular matrix \(A\) is upper triangular if \(a_{i,j}=0\) whenever \(i>j\text{.}\)
\begin{equation*} \begin{bmatrix} 1 \amp 5 \amp 0\\ 0 \amp 2 \amp 4 \end{bmatrix}, \quad \begin{bmatrix} 1 \amp 0 \amp 0 \amp 1\\ 0 \amp 2 \amp 1 \amp 0\\ 0 \amp 0 \amp 1 \amp 0\\ 0 \amp 0 \amp 0 \amp 1 \end{bmatrix}, \quad \begin{bmatrix} 2\\0\\0\\0 \end{bmatrix} \end{equation*}
A rectangular matrix \(A\) is lower triangular if \(a_{i,j}=0\) whenever \(i<j\text{.}\)
\begin{equation*} \begin{bmatrix} 1 \amp 0 \amp 0\\ 3 \amp 2 \amp 0 \end{bmatrix}, \quad \begin{bmatrix} 3 \amp 0 \amp 0 \amp 0\\ 1 \amp 1 \amp 0 \amp 0\\ 0 \amp 0 \amp 1 \amp 0\\ 0 \amp 2 \amp 0 \amp 1 \end{bmatrix}, \quad \begin{bmatrix} 1\\2\\1\\2 \end{bmatrix} \end{equation*}
Can you have a matrix that is both upper and lower triangular?

Example 2.39.

If \(A\) is a \(3 \times 2\) matrix, then its LU factorization has the form:
\begin{equation*} A=LU= \begin{bmatrix} 1 \amp 0 \amp 0\\ \ast \amp 1 \amp 0\\ \ast \amp \ast \amp 1 \end{bmatrix} \begin{bmatrix} \ast \amp \ast\\ 0 \amp \ast\\ 0 \amp 0 \end{bmatrix} \end{equation*}
How do we find \(L \) and \(U\text{?}\) Suppose \(A\) can be row reduced to echelon form \(U\) without interchanging rows. Then
\begin{equation*} E_p\cdots E_1A=U, \end{equation*}
where the \(E_j\) are elementary row-operation matrices. These matrices are lower triangular and invertible. For example,
\begin{equation*} \begin{bmatrix} 1 \amp 0 \amp 0\\ 0 \amp 1 \amp 0\\ 2 \amp 0 \amp 1 \end{bmatrix}^{-1} = \begin{bmatrix} 1 \amp 0 \amp 0\\ 0 \amp 1 \amp 0\\ -2 \amp 0 \amp 1 \end{bmatrix}. \end{equation*}
Therefore:
\begin{equation*} A = E_1^{-1}\cdots E_p^{-1}U = LU. \end{equation*}
To compute an LU factorization:
  1. Reduce \(A\) to an echelon form \(U\) using only row replacement operations. So no row swapping or scaling.
  2. Place entries in \(L\) so that the same sequence of row operations reduce \(L\) to \(I\text{.}\)
Note, in MATH 1554, the only allowed row replacement operation can be written in the form \(R_i - kR_j \rightarrow R_i\text{.}\) The number \(k\) is what should go into the \(i^\text{th}\) row and \(j^\text{th}\) column of \(L\text{,}\) so \(\ell_{i,j} = k\text{.}\)
Caution 1: Note that \(\ell_{i,j}\) is the opposite of the scalar used in the row replacement. This is because the formula \(R_i - kR_j \rightarrow R_i\) has a negative sign built in.
Caution 2: Note that you are only guaranteed to find the correct \(\ell_{i,j}\) if you are working from left to right and from top to bottom. So, start with the leftmost pivot column and use its pivot row to elimnate all nonzero entries below it. Then move to the next pivot column (from the left) and repeat.

Example 2.40.

Compute the LU factorization of:
\begin{equation*} A= \begin{bmatrix} 4 \amp -3 \amp -1 \amp 5\\ -16 \amp 12 \amp 2 \amp -17\\ 8 \amp -6 \amp -12 \amp 22 \end{bmatrix}. \end{equation*}

Example 2.41.

Compute the LU factorization of:
\begin{equation*} A= \begin{bmatrix} 3 \amp -1 \amp 4 \amp 5\\ 6 \amp 0 \amp 10 \amp 12\\ 3 \amp 3 \amp 8 \amp 10\\ 6 \amp 2 \amp 12 \amp 15\\ 3 \amp 3 \amp 8 \amp 9 \end{bmatrix}. \end{equation*}
How do we use \(LU\) factorization to help us solve \(A\vec x=\vec b\text{?}\)
If \(A = LU\text{,}\) then the equation \(A \vec x = \vec b \) can be written \(LU \vec x = \vec b \text{,}\) or equivalently, \(L (U\vec x) = \vec b \text{.}\) Setting \(\vec y = U\vec x \text{,}\) we do the following:
  1. Forward substitution to solve for \(\vec y\) in \(L\vec y=\vec b\text{.}\)
  2. Backward substitution to solve for \(\vec x\) in \(U\vec x=\vec y\text{.}\)
Since \(L\) is an invertible matrix, the system \(L\vec y = \vec b\) will always be consistent and have a unique solution. The system \(U\vec x = \vec y\) may be inconsistent. Since \(U\) is in echelon form, we can quickly determine whether \(U\vec x = \vec y\) is inconsistent by checking if there is a nonzero entry in \(\vec y\) that corresponds to a row of zeros in \(U\text{.}\)

Example 2.42.

Solve the linear system with:
\begin{equation*} A=LU= \begin{bmatrix} 1 \amp 0 \amp 0 \amp 0\\ 1 \amp 1 \amp 0 \amp 0\\ 0 \amp 2 \amp 1 \amp 0\\ 0 \amp 0 \amp 1 \amp 1 \end{bmatrix} \begin{bmatrix} 1 \amp 0 \amp 0\\ 0 \amp 2 \amp 1\\ 0 \amp 0 \amp 2\\ 0 \amp 0 \amp 0 \end{bmatrix}, \qquad \vec b= \begin{bmatrix} 2\\5\\8\\2 \end{bmatrix}. \end{equation*}