LU Decomposition Calculator
Calculate LU Decomposition
Factorize matrix into lower (L) and upper (U) triangular matrices. Solve linear equations efficiently with step-by-step solutions.
LU Decomposition Result
Original Matrix A
Product L × U
Lower Triangular (L)
Upper Triangular (U)
Step-by-Step Decomposition:
Matrix Structure Visualization:
Decomposition Properties:
LU decomposition factors a square matrix into lower and upper triangular matrices for efficient linear equation solving.
What is LU Decomposition?
LU Decomposition (also called LU factorization) is a matrix decomposition method that factors a square matrix into the product of a lower triangular matrix (L) and an upper triangular matrix (U). This decomposition is fundamental in numerical linear algebra for solving systems of linear equations, computing determinants, and finding matrix inverses.
LU Decomposition Methods
Doolittle Algorithm
L has 1's on diagonal
Most common method
Crout Algorithm
U has 1's on diagonal
Alternative method
Cholesky Decomposition
For symmetric positive definite
Special case of LU
LDU Decomposition
L and U unit triangular
D is diagonal
Mathematical Formulation
1. Basic LU Decomposition
2. Doolittle Algorithm (L has 1's on diagonal)
3. Matrix Equations
Matrix Decomposition Comparison
| Decomposition | Formula | Requirements | Applications |
|---|---|---|---|
| LU Decomposition | A = LU | Square matrix, non-zero principal minors | Linear equation solving, determinants |
| QR Decomposition | A = QR | Any matrix | Least squares, eigenvalues |
| Singular Value (SVD) | A = UΣVᵀ | Any matrix | Data compression, PCA |
| Eigenvalue Decomposition | A = PDP⁻¹ | Diagonalizable matrix | Differential equations, stability |
Real-World Applications
Scientific Computing & Engineering
- Circuit analysis: Solving systems of linear equations for circuit currents
- Structural analysis: Finite element method for stress calculations
- Fluid dynamics: Solving Navier-Stokes equations numerically
- Heat transfer: Temperature distribution calculations
Computer Science & Data Analysis
- Linear programming: Solving optimization problems
- Computer graphics: 3D transformations and rendering
- Machine learning: Linear regression and least squares
- Cryptography: Matrix-based encryption algorithms
Economics & Finance
- Portfolio optimization: Markowitz portfolio theory
- Input-output analysis: Leontief economic models
- Risk analysis: Covariance matrix calculations
- Econometrics: Simultaneous equation models
Everyday Applications
- GPS positioning: Solving trilateration equations
- Image processing: Filter operations and transformations
- Audio processing: Digital signal filtering
- Game physics: Collision detection and response
LU Decomposition Properties
| Property | Description | Mathematical Expression | Implication |
|---|---|---|---|
| Uniqueness | LU decomposition is unique if L has 1's on diagonal | If A = L₁U₁ = L₂U₂, then L₁ = L₂, U₁ = U₂ | Unique factorization for given ordering |
| Determinant | det(A) = product of diagonal elements of U | det(A) = ∏ uᵢᵢ | Efficient determinant calculation |
| Inverse | A⁻¹ = U⁻¹L⁻¹ | Inverse via triangular matrix inverses | Efficient matrix inversion |
| Solution of Ax=b | Solve Ly = b, then Ux = y | O(n²) instead of O(n³) for each new b | Efficient for multiple right-hand sides |
Step-by-Step Calculation Examples
Example 1: 2×2 Matrix
Given: A = [[4, 3], [3, 2]]
- Set L₁₁ = 1, U₁₁ = A₁₁ = 4
- U₁₂ = A₁₂ = 3
- L₂₁ = A₂₁ / U₁₁ = 3/4 = 0.75
- U₂₂ = A₂₂ - L₂₁ × U₁₂ = 2 - 0.75×3 = 2 - 2.25 = -0.25
- Result: L = [[1, 0], [0.75, 1]], U = [[4, 3], [0, -0.25]]
- Verify: L × U = [[1×4+0×0, 1×3+0×(-0.25)], [0.75×4+1×0, 0.75×3+1×(-0.25)]] = [[4, 3], [3, 2]] = A
Example 2: 3×3 Matrix
Given: A = [[2, 1, 1], [4, 3, 3], [8, 7, 9]]
- First column of U: U₁₁ = 2, U₁₂ = 1, U₁₃ = 1
- First column of L: L₂₁ = 4/2 = 2, L₃₁ = 8/2 = 4
- Update A₂₂: 3 - 2×1 = 1, A₂₃: 3 - 2×1 = 1, A₃₂: 7 - 4×1 = 3, A₃₃: 9 - 4×1 = 5
- Second column: U₂₂ = 1, U₂₃ = 1, L₃₂ = 3/1 = 3
- Update A₃₃: 5 - 3×1 = 2
- Third column: U₃₃ = 2
- Result: L = [[1,0,0], [2,1,0], [4,3,1]], U = [[2,1,1], [0,1,1], [0,0,2]]
Example 3: Solving Linear Equations
Given: Ax = b, where A = [[4,3], [3,2]], b = [5, 4]
- From LU decomposition: L = [[1,0], [0.75,1]], U = [[4,3], [0,-0.25]]
- Solve Ly = b: y₁ = 5, 0.75×5 + y₂ = 4 → y₂ = 4 - 3.75 = 0.25
- Solve Ux = y: 4x₁ + 3x₂ = 5, -0.25x₂ = 0.25 → x₂ = -1
- Substitute: 4x₁ + 3×(-1) = 5 → 4x₁ = 8 → x₁ = 2
- Solution: x = [2, -1]
Algorithm Visualization
Related Calculators
Frequently Asked Questions (FAQs)
Q: What's the difference between LU and QR decomposition?
A: LU decomposition factors a square matrix into lower and upper triangular matrices (A = LU). QR decomposition factors any matrix into an orthogonal matrix Q and upper triangular matrix R (A = QR). LU is used for solving linear equations, while QR is used for least squares problems.
Q: When does LU decomposition fail?
A: LU decomposition without pivoting fails when any leading principal minor is zero (i.e., when Gaussian elimination would require division by zero). This can be fixed using partial pivoting (PA = LU) or complete pivoting.
Q: What is pivoting in LU decomposition?
A: Pivoting rearranges rows (partial pivoting) or rows and columns (complete pivoting) to avoid division by zero and improve numerical stability. With partial pivoting, we get PA = LU where P is a permutation matrix.
Q: How is LU decomposition used to solve linear equations?
A: After decomposing A = LU, solve Ax = b in two steps: (1) Solve Ly = b using forward substitution, (2) Solve Ux = y using back substitution. This is O(n²) after the initial O(n³) decomposition.
Master matrix computations with Toolivaa's free LU Decomposition Calculator, and explore more mathematical tools in our Math Calculators collection.