LU Decomposition Calculator
Factor a square matrix into lower and upper triangular matrices with partial pivoting.
About LU Decomposition Calculator
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
Worked example
With the default values below, LU Decomposition Calculator returns L (Lower Triangular) of 1 0 0 0.666667 1 0 0.333333 0.6 1. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Matrix A (rows separated by newlines or semicolons; values by commas or spaces)
- 2 3 1 4 7 5 6 18 10
Results
- 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
- 1Matrix A= 2 3 1 4 7 5 6 18 10
- 2L (lower triangular, unit diagonal)= 1 0 0 0.666667 1 0 0.333333 0.6 1
- 3U (upper triangular)= 6 18 10 0 -5 -1.666667 0 0 -1.333333
- 4Permutation P= 3, 2, 1
- 5Verification: P·A = L·U
Assumptions and limits
- The result is derived only from the single input listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 8 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
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.
