Calculator · Engineering Mathematics
LU Decomposition Calculator
Factor a square matrix as P A = L U with partial pivoting, and check the factorisation instead of trusting it: the residual ‖PA − LU‖_F is computed and reported alongside the three matrices.
Matrix A
One row per line; entries separated by spaces or commas. Scientific notation such as 1.5e-3 is accepted. At most 10 × 10; ragged rows and blank entries are refused, never repaired.
What Anemodia read
| 2 | 1 | -1 |
| -3 | -1 | 2 |
| -2 | 1 | 2 |
Results
| Size | 3 × 3 |
|---|---|
| Row swaps | 2 |
| Permutation (row order of P A) | 2, 3, 1 |
| Numerically singular | No |
| Factorisation residual ‖PA − LU‖_F | 1.110e-16 |
| Relative factorisation residual ‖PA − LU‖_F / ‖A‖_F | 2.062e-17 |
| Pivot growth ρ = max|uᵢⱼ| / max|aᵢⱼ| | 1 |
| Pivot threshold (eps · n · ‖A‖∞) | 3.997e-15 |
| Determinant (secondary information) | -1 |
Factors
| 0 | 1 | 0 |
| 0 | 0 | 1 |
| 1 | 0 | 0 |
| 1 | 0 | 0 |
| 0.6667 | 1 | 0 |
| -0.6667 | 0.2 | 1 |
| -3 | -1 | 2 |
| 0 | 1.667 | 0.6667 |
| 0 | 0 | 0.2 |
Row swaps: step 1: rows 1 ↔ 2; step 2: rows 2 ↔ 3.
Continue
The matrix continues into the Lab's Factorize workspace. No right-hand side is carried over, because this calculator does not have one — supply b in the Lab to solve from the same factorisation.
Assumptions & validity
- · A must be square and at most 10 × 10.
- · The convention is P A = L U with L UNIT lower triangular (ones on the diagonal) and U upper triangular. The same convention is used everywhere in Anemodia.
- · A numerically zero pivot — below eps · n · ‖A‖∞ — is never divided by. The matrix is reported as rank deficient instead.
- · A singular matrix can still have a valid P A = L U. U then has a zero on its diagonal: it is NOT invertible, and no unique triangular solve exists.
- · Singularity is decided by the pivot magnitude relative to the matrix scale, not by the determinant.
- · This page factorises only. Solving from the factorisation lives in the Linear Algebra Lab, where the right-hand side has room to be displayed properly.
Technical reference
P A = L U
L y = P b, U x = y
‖P A − L U‖_F and ‖P A − L U‖_F / ‖A‖_F
ρ = max|uᵢⱼ| / max|aᵢⱼ|
- P
- permutation matrix recording the row interchanges
- L
- unit lower triangular factor holding the multipliers
- U
- upper triangular factor left by elimination
- ρ
- pivot growth factor
- ‖·‖_F
- Frobenius norm, the entrywise Euclidean norm
The factorisation is elimination with its bookkeeping kept: L stores the multipliers that were used to clear each column, U is what elimination left behind, and P records which rows were swapped to put the largest available pivot on the diagonal.
Once P, L and U exist, any right-hand side costs only a forward and a back substitution — which is why factorisation is worth separating from solving when many systems share one matrix.
Pivot growth compares the largest entry of U with the largest entry of A. Large growth means elimination amplified the data, which can indicate numerical sensitivity for this matrix. It is an indicator, not a pass/fail threshold, and partial pivoting keeps it modest for almost every matrix met in practice.
The factorisation residual is the honest check that the reported P, L and U actually multiply back to the matrix you entered. A factorisation printed without that check is a guess.