Matrix LU Decomposition
Solve Ax=b, Determinant & Step-by-Step
Decompose any 2×2, 3×3, or 4×4 matrix A into lower-triangular L and upper-triangular U using Doolittle's method. Shows each elimination step, uses LU to solve Ax=b via forward and back substitution, computes the determinant as the product of U's diagonal, and verifies A=LU.
Matrix size:
Matrix A and b
What Is the Matrix LU Decomposition?
LU decomposition factors a square matrix A into a lower-triangular matrix L (with 1s on the diagonal in Doolittle's method) and an upper-triangular matrix U. This factorization is essentially Gaussian elimination recorded in matrix form. Once A=LU is computed, solving Ax=b reduces to two easy triangular systems: Ly=b (forward substitution) then Ux=y (backward substitution). The determinant is simply the product of U's diagonal entries.
Matrix LU Decomposition Formula and Method
A = L · U
Solve Ax=b: L·y = b (forward), U·x = y (backward)
det(A) = u₁₁ · u₂₂ · … · uₙₙ
L = lower triangular (1s on diagonal), U = upper triangular
How to Use
- 1
Select matrix size: 2×2, 3×3, or 4×4
- 2
Enter the matrix entries or load a preset
- 3
Toggle "Solve Ax=b" to enter the vector b (optional)
- 4
Click Decompose
- 5
View L and U matrices with the verification A=LU
- 6
Read forward and back substitution steps for the system solution
- 7
Note the determinant = product of U diagonal elements
Matrix LU Decomposition Example
Example: Decompose [[2,1],[4,3]]
U₁₁ = 2 | U₁₂ = 1
L₂₁ = 4/2 = 2 | U₂₂ = 3 − 2·1 = 1
L = [[1,0],[2,1]] | U = [[2,1],[0,1]]
det(A) = U₁₁·U₂₂ = 2·1 = 2 ✓
Frequently Asked Questions
What is Doolittle's method?
Doolittle's method is an LU factorization variant that places 1s on the diagonal of L and non-trivial values in U. At each step, the multiplier lᵢⱼ = aᵢⱼ / uⱼⱼ is stored in L while U stores the updated row. An alternative, Crout's method, places 1s on the diagonal of U instead.
When does LU decomposition fail?
LU decomposition (without pivoting) fails when a zero pivot element is encountered (uⱼⱼ = 0). In practice, partial pivoting (swapping rows to put the largest element in the pivot position) improves numerical stability. The calculator will report an error for singular matrices.
Why use LU decomposition rather than Gaussian elimination directly?
If you need to solve Ax=b for multiple different right-hand sides b₁, b₂, …, decomposing A once costs O(n³) and each subsequent solve costs only O(n²). This is much more efficient than rerunning Gaussian elimination (O(n³)) for each new b.
How is the determinant computed from LU?
Since det(AB) = det(A)·det(B) and det(L)=1 (all 1s on its diagonal), we have det(A) = det(L)·det(U) = det(U) = u₁₁·u₂₂·…·uₙₙ. If row swaps are needed, each swap multiplies the determinant by −1.
You Might Also Like
Explore 450+ Free Calculators
From math and science to finance and everyday life — all free, no account needed.