Last updated October 12, 2026 · Report an error
Plain LU decomposition (Doolittle's method) fails outright whenever it hits a zero pivot during elimination — LUP decomposition fixes this by swapping in whichever remaining row has the largest value in that column before eliminating, tracking every swap in a permutation P.
This calculator factors a square matrix into PA = LU using partial pivoting.
How it works
Enter your square matrix. The calculator eliminates column by column, but before each step it swaps in the row with the largest remaining value in that column (partial pivoting) — this guarantees a usable pivot whenever the matrix is non-singular, and improves numerical stability generally.
- Click Calculate to see your results.
Examples
A matrix with a zero in the top-left
A matrix like [[0,2],[3,4]] has no pivot in its original top-left position, so LUP decomposition swaps the rows first, producing L = [[1,0],[0,1]] and U = [[3,4],[0,2]], with the row order recorded as the permutation.
Who should use it
- Decomposing a matrix that fails on the plain LU Decomposition Calculator due to a zero pivot.
- Studying how partial pivoting works in a numerical linear algebra course.
Industry applications
- Numerical linear algebra and mathematics education
- Scientific computing and engineering coursework
Advantages
- Succeeds on any non-singular matrix, unlike the pivot-free LU decomposition.
- Reports the exact row permutation used, for full transparency.
Limitations
- Still requires a square, non-singular matrix — singular matrices have no valid LU/LUP factorization at all.
Common mistakes to avoid
- Forgetting that the resulting L and U factor the row-permuted matrix (PA), not the original matrix A directly.
- Assuming a matrix is impossible to decompose just because plain LU decomposition failed on it — try LUP decomposition first.
Best practices
- If the site's plain LU Decomposition Calculator reports a zero-pivot failure, retry the exact same matrix here — partial pivoting resolves that specific failure case.
Tips
- Partial pivoting (choosing the largest available pivot) is standard practice in professional numerical linear algebra libraries, precisely because it improves stability even on matrices that don't strictly require row swaps to avoid a zero pivot.