How to use the LU Decomposition Calculator
- 1. Enter matrix AOne row per line, 2×2 up to 6×6. Add b if you also want to solve Ax = b.
- 2. Pick a methodDoolittle puts 1s on the diagonal of L; Crout puts 1s on the diagonal of U.
- 3. Read L, U and xEach entry is shown with its formula, then the forward and back substitution.
How LU decomposition works
LU decomposition writes A as the product of a lower triangular matrix L and an upper triangular matrix U. To solve Ax = b, first solve Ly = b by forward substitution, then Ux = y by back substitution. Once L and U are known, each new right-hand side costs very little, which is why LU is used inside most equation solvers.
In Doolittle's method lᵢᵢ = 1: uᵢⱼ = aᵢⱼ − Σ lᵢₖuₖⱼ and lⱼᵢ = (aⱼᵢ − Σ lⱼₖuₖᵢ)/uᵢᵢ. In Crout's method uᵢᵢ = 1 and L carries the diagonal. The determinant is the product of the diagonal entries of U (Doolittle) or L (Crout).
Worked example
Solve 2x + 3y + z = 9, x + 2y + 3z = 6, 3x + y + 2z = 8 by Doolittle. Row 1 of U is (2, 3, 1). Then l₂₁ = 1/2, l₃₁ = 3/2. Next u₂₂ = 2 − (1/2)·3 = 1/2, u₂₃ = 3 − (1/2)·1 = 5/2, l₃₂ = (1 − (3/2)·3)/(1/2) = −7, and u₃₃ = 2 − 3/2 + 7·5/2 = 18.
Forward substitution gives y = (9, 3/2, 5). Back substitution gives x = 35/18, y = 29/18, z = 5/18, and |A| = 2 × 1/2 × 18 = 18.
When LU fails
If a zero appears on the diagonal during the process, A cannot be factored without swapping rows. Reorder the equations and try again, or use Gauss elimination with pivoting.
Frequently asked questions
What is the difference between Doolittle and Crout?
Both give A = LU. Doolittle fixes the diagonal of L at 1; Crout fixes the diagonal of U at 1. The solution x is the same.
Why is LU useful if Gauss elimination already works?
LU stores the elimination. Solving for a new b then needs only two quick substitutions instead of a full elimination.
What does a zero pivot mean?
The leading entry became zero, so the plain LU factorisation does not exist in that order. Swapping rows (PA = LU) fixes it.
Can I get only L and U?
Yes. Leave the b box empty and the tool shows just the decomposition and the determinant.
Is this calculator free?
Yes. You fill a short form once when you see your first result, and other Uncodemy tools then open without the form. Everything is calculated in your browser.