LU decomposition calculator
Factor a square matrix into lower and upper triangular parts, with every multiplier shown. Cholesky decomposition included for symmetric positive-definite matrices.
Enter a square matrix, open the Decompositions tab and press LU(A). Because the answer is a pair of matrices rather than one, it lives entirely in the step-by-step panel, which opens by itself and shows L and U side by side at the end.
What the factors are
LU writes A = L·U, with L lower triangular and U upper triangular. Neither is mysterious: U is exactly the row echelon form you get from Gaussian elimination, and L records the multipliers you used along the way. Doing the elimination once gives you both.
Worked example
| 4 | 3 |
| 6 | 3 |
| 1 | 0 |
| 3/2 | 1 |
| 4 | 3 |
| 0 | −3/2 |
The 3/2 in L is the multiplier that cleared the 6 below the pivot. Notice the determinant is now free: multiply the diagonal of U, giving 4 · (−3/2) = −6.
Why it is worth doing
Solving Ax = b from scratch costs about n³/3 operations. With L and U in hand, each additional right-hand side costs only n²: forward substitution followed by back substitution. If you are solving the same system against many different b vectors — which is the normal case in engineering and simulation — the saving is enormous.
Common mistakes
- Assuming every matrix factors. A zero in a pivot position breaks plain LU. The fix is a permutation matrix:
P·A = L·U. - Using Cholesky on the wrong matrix. It requires symmetry and positive definiteness; the calculator tells you when the condition fails.
- Forgetting the row swaps in the determinant. Each swap flips its sign.