LU decomposition (or LU factorization) is a method used in linear algebra to factorize a square matrix ( A ) into the product of two matrices: a lower triangular matrix ( L ) and an upper triangular matrix ( U ). This decomposition is particularly useful for solving systems of linear equations, inverting matrices, and computing determinants efficiently.
The decomposition can be expressed as:
[
A = L \cdot U
]
Here:
- ( A ) is the original ( n \times n ) matrix.
- ( L ) is a lower triangular matrix (all entries above the main diagonal are zero) with ones on the diagonal (in the standard form, though this is not always required).
- ( U ) is an upper triangular matrix (all entries below the main diagonal are zero).
Key Concepts
-
Lower Triangular Matrix (( L )): A matrix where all elements above the main diagonal are zero. For example, a 3x3 lower triangular matrix looks like:
[
L = \begin{bmatrix}
1 & 0 & 0 \
l_{21} & 1 & 0 \
l_{31} & l_{32} & 1
\end{bmatrix}
]
Note: The diagonal entries are typically 1 in the standard LU decomposition (this is called the Doolittle factorization). However, in some variants (like Crout factorization), the diagonal of ( L ) may not be 1, and instead, the diagonal of ( U ) is adjusted.
-
Upper Triangular Matrix (( U )): A matrix where all elements below the main diagonal are zero. For example, a 3x3 upper triangular matrix looks like:
[
U = \begin{bmatrix}
u_{11} & u_{12} & u_{13} \
0 & u_{22} & u_{23} \
0 & 0 & u_{33}
\end{bmatrix}
]
-
Purpose of LU Decomposition:
- Solving Linear Systems: For a system ( A \mathbf{x} = \mathbf{b} ), once ( A = LU ), the system becomes ( LU \mathbf{x} = \mathbf{b} ). This can be solved in two steps:
- Solve ( L \mathbf{y} = \mathbf{b} ) for ( \mathbf{y} ) (forward substitution, since ( L ) is lower triangular).
- Solve ( U \mathbf{x} = \mathbf{y} ) for ( \mathbf{x} ) (backward substitution, since ( U ) is upper triangular).
- Efficiency: LU decomposition is computationally efficient, especially when solving multiple systems with the same ( A ) but different ( \mathbf{b} ).
- Determinant: The determinant of ( A ) is the product of the diagonal elements of ( U ) (and possibly a sign factor if pivoting is used).
- Matrix Inversion: LU decomposition can be used to compute the inverse of ( A ).
Steps of LU Decomposition (Without Pivoting)
The LU decomposition of a matrix ( A ) can be computed using Gaussian elimination. Below is an outline of the process for a matrix ( A ):
- Start with ( A ): Assume ( A ) is an ( n \times n ) matrix.
- Eliminate Below the Diagonal: Use row operations to transform ( A ) into an upper triangular matrix ( U ). While doing this, keep track of the multipliers used in the elimination steps to construct ( L ).
- For each pivot position ( a_{kk} ), eliminate the entries below it in column ( k ).
- The multiplier ( m_{ik} = \frac{a_{ik}}{a_{kk}} ) (for ( i > k )) is stored in the corresponding position of ( L ), i.e., ( l_{ik} = m_{ik} ).
- Construct ( L ): The matrix ( L ) is lower triangular with 1s on the diagonal and the multipliers ( m_{ik} ) below the diagonal.
- Result: After the process, ( A ) has been factored into ( L \cdot U ).
Example of LU Decomposition
Consider the matrix ( A ):
[
A = \begin{bmatrix}
2 & 1 & 1 \
4 & -6 & 0 \
-2 & 7 & 2
\end{bmatrix}
]
We want to factor ( A = LU ).
Step 1: Eliminate the first column below the pivot
The pivot is ( a_{11} = 2 ). We need to eliminate ( a_{21} = 4 ) and ( a_{31} = -2 ).
- For row 2: The multiplier is ( m_{21} = \frac{a_{21}}{a_{11}} = \frac{4}{2} = 2 ). Subtract 2 times row 1 from row 2.
- For row 3: The multiplier is ( m_{31} = \frac{a_{31}}{a_{11}} = \frac{-2}{2} = -1 ). Add row 1 to row 3.
After this step, the matrix becomes:
[
\begin{bmatrix}
2 & 1 & 1 \
0 & -8 & -2 \
0 & 8 & 3
\end{bmatrix}
]
The multipliers ( m_{21} = 2 ) and ( m_{31} = -1 ) are stored in ( L ).
Step 2: Eliminate the second column below the pivot
Now the pivot is ( a_{22} = -8 ). We need to eliminate ( a_{32} = 8 ).
- For row 3: The multiplier is ( m_{32} = \frac{a_{32}}{a_{22}} = \frac{8}{-8} = -1 ). Add row 2 to row 3.
After this step, the matrix becomes:
[
\begin{bmatrix}
2 & 1 & 1 \
0 & -8 & -2 \
0 & 0 & 1
\end{bmatrix}
]
The multiplier ( m_{32} = -1 ) is stored in ( L ).
Step 3: Construct ( L ) and ( U )
The matrix we obtained is ( U ), the upper triangular matrix:
[
U = \begin{bmatrix}
2 & 1 & 1 \
0 & -8 & -2 \
0 & 0 & 1
\end{bmatrix}
]
The matrix ( L ) is constructed using the multipliers, with 1s on the diagonal:
[
L = \begin{bmatrix}
1 & 0 & 0 \
2 & 1 & 0 \
-1 & -1 & 1
\end{bmatrix}
]
Step 4: Verify
To confirm, compute ( L \cdot U ):
[
L \cdot U = \begin{bmatrix}
1 & 0 & 0 \
2 & 1 & 0 \
-1 & -1 & 1
\end{bmatrix}
\begin{bmatrix}
2 & 1 & 1 \
0 & -8 & -2 \
0 & 0 & 1
\end{bmatrix}
= \begin{bmatrix}
2 & 1 & 1 \
4 & -6 & 0 \
-2 & 7 & 2
\end{bmatrix}
= A
]
The decomposition is correct.
Pivoting in LU Decomposition
In practice, LU decomposition often requires partial pivoting to ensure numerical stability, especially if a pivot element is zero or very small. With partial pivoting, the matrix ( A ) is factored as:
[
P \cdot A = L \cdot U
]
Here, ( P ) is a permutation matrix that reorders the rows of ( A ). The process is similar, but row swaps are performed to bring the largest element in a column to the pivot position before elimination.
Applications of LU Decomposition
- Solving Linear Systems: As described earlier, ( A \mathbf{x} = \mathbf{b} ) is solved in two steps using forward and backward substitution.
- Determinant: The determinant of ( A ) is the product of the diagonal elements of ( U ), adjusted by the sign of the permutation if pivoting is used: ( \det(A) = (-1)^s \cdot u_{11} \cdot u_{22} \cdots u_{nn} ), where ( s ) is the number of row swaps in ( P ).
- Matrix Inversion: To find ( A^{-1} ), solve ( A \mathbf{x}_i = \mathbf{e}_i ) for each column ( \mathbf{e}_i ) of the identity matrix using the LU decomposition.
- Numerical Stability: LU decomposition with pivoting is widely used in numerical software (e.g., MATLAB, NumPy) for solving linear systems efficiently and accurately.
Limitations
- LU decomposition is only applicable to square matrices.
- If ( A ) is singular (non-invertible), the decomposition may not exist or may require special handling.
- For very large or sparse matrices, other methods (e.g., iterative solvers) may be more efficient.
Summary
LU decomposition is a powerful tool in linear algebra that simplifies many matrix computations. By factoring a matrix into lower and upper triangular matrices, it enables efficient solutions to linear systems, determinant calculations, and matrix inversions. The method is foundational in numerical linear algebra and is implemented in many computational libraries.