LU Factorization Calculator
Free LU factorization calculator. Decompose matrices using Doolittle, Crout, or Cholesky methods with partial pivoting (PA=LU), step-by-step solutions, and determinant.
Enter vector b to find x
L (Lower Triangular)
Unit lower triangular — diagonal entries are all 1
U (Upper Triangular)
Upper triangular factor with pivot values on diagonal
Step-by-Step Solution
See how the decomposition is computed
What Is LU Factorization?
Decomposing a matrix into triangular factors
LU factorization (also called LU decomposition) writes a square matrix A as the product of a lower triangular matrix L and an upper triangular matrix U, so that A = LU. It is one of the most fundamental algorithms in numerical linear algebra.
Triangular systems are cheap to solve — forward substitution for L and back substitution for U each take O(n²) operations. By paying an O(n³) cost once to factor A, you can solve Ax = b for many different right-hand sides b in O(n²) time each.
Lower Triangular (L)
Non-zero on and below diagonal
Upper Triangular (U)
Non-zero on and above diagonal
Decomposition Methods
Doolittle, Crout, Cholesky, and PA=LU compared
Doolittle
Produces a unit lower triangular L and upper triangular U. The most commonly taught method.
Crout
Produces a lower triangular L and unit upper triangular U. Reverses the Doolittle convention.
Cholesky
Decomposes A into L × Lᵀ. ~2× faster than Doolittle but requires symmetric positive definite input.
PA = LU
Uses partial pivoting for numerical stability. The default in production numerical libraries.
| Property | Doolittle | Crout | Cholesky | PA=LU |
|---|---|---|---|---|
| L diagonal | 1s | Computed | Computed | Multipliers |
| U diagonal | Computed | 1s | Lᵀ diagonal | Pivots |
| Requires | Non-zero pivots | Non-zero pivots | SPD matrix | Nothing |
| Stability | Fragile | Fragile | Guaranteed | Robust |
| Cost | ⅔n³ | ⅔n³ | ⅓n³ | ⅔n³ + swaps |
Worked Examples
Step-by-step calculations with color-coded values
Example 1 — 3×3 Doolittle Decomposition
A
3×3
matrix
L[2][1]
−2
multiplier
U[2][2]
4
pivot
det(A)
24
determinant
Example 2 — 2×2 with Ax = b
A
[[4,3],[6,3]]
input
b
[10, 12]
RHS
det(A)
−6
non-singular
x
[1, 2]
solution
Formulas & Algorithms
How each element of L and U is computed
First compute row i of U, then column i of L.
Only valid for symmetric positive definite matrices. About half the computation of Doolittle.
Tips & Best Practices
When to use each method and how to avoid pitfalls
Which method should I use?
Doolittle is the standard choice for most matrices. Use PA=LU when the matrix may have zero or near-zero pivots. Use Cholesky only for symmetric positive definite matrices — it's faster but restrictive.
Solving linear systems with LU
Once you have A = LU, solve Ax = b in two steps: (1) Forward substitution to solve Ly = b, then (2) Back substitution to solve Ux = y. This is faster than Gaussian elimination when solving multiple systems with the same A.
Computing the determinant
det(A) = det(L) × det(U). Since L and U are triangular, their determinants are just the product of their diagonal entries. For PA=LU, multiply by (−1)^s where s is the number of row swaps.
When LU factorization fails
Doolittle and Crout fail when a zero pivot is encountered. Switch to PA=LU with partial pivoting to handle this. If the matrix is truly singular (det = 0), no method can produce a unique factorization.
Common Mistakes
Pitfalls to avoid when computing LU factorizations
Using Cholesky on non-symmetric matrices
Cholesky requires A = Aᵀ and all positive eigenvalues. Applying it to a general matrix silently gives wrong results. Use Doolittle or PA=LU instead.
Ignoring zero pivots
Proceeding with Doolittle or Crout when U[i][i] = 0 causes division by zero. Switch to PA=LU with partial pivoting to handle this automatically.
Confusing L and U conventions
Doolittle puts 1s on L's diagonal; Crout puts 1s on U's diagonal. Mixing conventions when comparing results leads to apparent mismatches.
Forgetting the permutation matrix
When PA=LU is used, you must apply P to b first: solve Ly = Pb, then Ux = y. Ignoring P gives the wrong solution.
Frequently Asked Questions
Common questions and detailed answers
Embed LU Factorization Calculator
Add this calculator to your website or blog for free.
You Might Also Like
Related calculators from other categories
Last updated Apr 26, 2026