LU Decomposition Calculator
Factor a square matrix into lower and upper triangular matrices with partial pivoting.
Inputs
L (Lower Triangular)
1 0 0 0.666667 1 0 0.333333 0.6 1
U (Upper Triangular)
6 18 10 0 -5 -1.666667 0 0 -1.333333
Permutation (P)
[3, 2, 1] (row permutation: row 1→3, 2→2, 3→1)
Determinant
-40.00000000
Step by step
Matrix A
= 2 3 1 4 7 5 6 18 10
L (lower triangular, unit diagonal)
= 1 0 0 0.666667 1 0 0.333333 0.6 1
U (upper triangular)
= 6 18 10 0 -5 -1.666667 0 0 -1.333333
Permutation P
= 3, 2, 1
Verification: P·A = L·U
How it works
LU decomposition factors a square matrix A into P·A = L·U where L is lower triangular with ones on the diagonal, U is upper triangular, and P is a permutation matrix representing row swaps for numerical stability. It is the foundation for efficiently solving linear systems, computing determinants, and finding inverses.
Formulas
LU Factorisation
P·A = L·U
- P
- Permutation matrix
- L
- Lower triangular (unit diagonal)
- U
- Upper triangular
Determinant
det(A) = (−1)^s × ∏ Uᵢᵢ
- s
- Number of row swaps
- Uᵢᵢ
- Diagonal of U
Frequently Asked Questions
What is partial pivoting?
At each elimination step, the row with the largest absolute value in the current column is swapped to the pivot position. This prevents division by small numbers and improves numerical accuracy.
Can LU decomposition fail?
With partial pivoting it fails only when the matrix is truly singular (has a zero row in U). For non-singular matrices it always succeeds.