Last modified: September 03, 2024
This article is written in: 🇺🇸
LU Decomposition
LU Decomposition (or LU Factorization) is a powerful and widely used technique in numerical linear algebra for solving systems of linear equations, computing inverses, and determining determinants. The core idea is to factorize a given square matrix into the product of a lower-triangular matrix and an upper-triangular matrix . This approach is particularly useful as it reduces complex operations such as solving into simpler, more structured subproblems. Once the decomposition is found, solving the system becomes a matter of performing forward and backward substitutions, which are both computationally inexpensive compared to other direct methods like Gaussian elimination performed from scratch for each right-hand-side vector .
Mathematical Formulation
Consider a square matrix :
The LU decomposition expresses as:
where
Here, is lower-triangular with ones on the diagonal, and is upper-triangular. The factorization is not always guaranteed to exist unless certain conditions are met (e.g., no zero pivots without partial pivoting, or being nonsingular and well-conditioned).
Derivation
The derivation of the LU decomposition closely follows the steps of Gaussian elimination. Gaussian elimination transforms the matrix into an upper-triangular matrix by adding multiples of one row to another. These multipliers can be stored in the entries of a lower-triangular matrix .
Starting from:
we write . Substitute to get:
Introducing an intermediate vector :
Since is lower-triangular and nonsingular (with ones on its diagonal), we can quickly solve for using forward substitution. Once is known, we solve the upper-triangular system via backward substitution.
The process of determining and essentially mimics the elimination steps:
I. Use the first row of to eliminate entries below .
II. Store these elimination factors in .
III. After the first column is dealt with, the submatrix of (excluding the first row and column) is similarly factorized.
IV. This process continues recursively until is fully decomposed into and .
Algorithm Steps
Given an matrix , the LU decomposition algorithm without pivoting can be described as follows:
I. Initialization:
Set (the identity matrix) and (the zero matrix).
II. Main Loop (for to ):
Compute the diagonal and upper elements of :
For to :
Compute the lower elements of :
For to :
III. After these loops complete, is obtained.
IV. Solving :
Forward substitution for :
For to :
Backward substitution for :
For down to :
Example
Consider the system of equations:
In matrix form:
Step-by-Step LU Decomposition
Step 1: Initialize
Set:
Compute First Row of :
Thus:
Compute First Column of (below diagonal):
For to 3:
Now:
Second Pivot (i=2):
Compute :
Compute :
Thus:
For :
Update :
Third Pivot (i=3):
Compute :
Carefully evaluate:
Thus:
So finally, we have:
Forward Substitution ():
Backward Substitution ():
Advantages
- Once is computed, solving multiple systems becomes efficient, as only forward and backward substitution are required for each new right-hand-side vector . This is particularly beneficial in applications requiring repeated solves with the same matrix .
- LU decomposition organizes the elimination steps into the matrices (lower triangular) and (upper triangular), simplifying the process and providing a structured representation of the system. Partial pivoting can be incorporated, enhancing numerical stability for a wide range of problems.
- It allows for the efficient computation of matrix determinants (via ) and matrix inverses, and serves as a building block for advanced numerical techniques, such as eigenvalue computations and solving partial differential equations.
Limitations
- Not all matrices are directly LU decomposable without row interchanges. For many practical cases, partial pivoting is required, resulting in a decomposition of the form , where is a permutation matrix.
- If the matrix has zero diagonal elements or does not meet certain structural conditions, direct LU decomposition without permutations may fail or lead to numerical instability.
- For large sparse matrices, naive LU decomposition can cause significant fill-in, where new nonzero elements appear in and . This increases both memory usage and computational complexity, potentially rendering the method impractical without specialized sparse matrix techniques.