LU Decomposition Calculator

Free LU decomposition calculator with steps. Factor any square matrix into a lower triangular L and an upper triangular U, with partial pivoting (PA = LU) when a zero pivot appears.

Factor a square matrix into lower and upper triangular parts. Every elimination step is shown, the multipliers are collected into L, and the product LU is displayed as a check.

Matrix A — fractions like 3/4 are fine

How to do LU decomposition

  1. 1

    Enter a square matrix

    LU decomposition is only defined for square matrices. Set n and fill in the grid.

  2. 2

    Eliminate below each pivot

    For every entry below a pivot, work out the multiplier (entry divided by pivot) and subtract that many copies of the pivot row.

  3. 3

    Collect the multipliers into L

    Each multiplier goes into L at the position it cleared. L gets 1s on its diagonal.

  4. 4

    Check the factorisation

    Multiply L by U — you should recover the original matrix. The calculator shows this check automatically.

How the factorisation is built

Run ordinary forward elimination. Whenever you clear the entry in row i, column j by subtracting m times row j, two things happen: the entry becomes zero in U, and the multiplier m is written into position (i, j) of L.

After the last column is cleared, U holds the upper triangular result and L holds every multiplier below its diagonal of 1s. Multiplying them reverses the process exactly, which is why LU = A.

To then solve Ax = b, substitute A = LU: first solve Ly = b going downward, then Ux = y going upward. Two triangular solves cost about n² operations each, against roughly n³/3 for a fresh elimination.

LU decomposition by matrix size

Looking for the same tool under its other name? The LU factorization calculator covers the Doolittle and Crout variants and where each is used.

Frequently asked questions

What is LU decomposition?

LU decomposition factors a square matrix A into the product of a lower triangular matrix L and an upper triangular matrix U, so that A = LU. U is what forward elimination produces, and L stores the multipliers used along the way.

Why is LU decomposition useful?

Once you have L and U, solving Ax = b for any new right-hand side takes only two quick triangular solves instead of a full elimination. That matters when the same matrix is reused with many different b vectors, as happens in simulation and circuit analysis.

What is the difference between the Doolittle and Crout methods?

Doolittle puts the 1s on the diagonal of L, which is what this calculator uses and what most textbooks teach. Crout puts them on the diagonal of U instead. Both produce a valid factorisation; they just distribute the scaling differently.

What does PA = LU mean?

When a pivot position holds a zero, the rows must be swapped before elimination can continue. Those swaps are recorded in a permutation matrix P, and the factorisation becomes PA = LU rather than A = LU.

Can every matrix be LU decomposed?

Every square matrix has a PA = LU factorisation with row swaps allowed. Without swaps, a matrix only factors as A = LU when all of its leading principal minors are non-zero.

How does LU give the determinant?

Because L has 1s on its diagonal, det(A) is simply the product of U's diagonal entries, multiplied by -1 once for each row swap. The calculator shows this figure with the result.

About this Calculator

Free LU decomposition calculator with steps. Factor any square matrix into a lower triangular L and an upper triangular U, with partial pivoting (PA = LU) when a zero pivot appears.

Related Searches

lu decomposition calculatorlu decompositionlu decomposition with stepsdoolittle method calculatorplu decomposition calculatorlower upper decompositionlu decomposition 3x3