Linear Algebra Tool

LU Decomposition Calculator

Factor any square matrix into a product of a Lower triangular and Upper triangular matrix (PA = LU) with partial pivoting and step-by-step explanations.

[
]

Enter a matrix and click Decompose
or press Enter

What is LU Decomposition?

LU decomposition (also known as LU factorization) is a method of decomposing a square matrix A into the product of a lower triangular matrix L and an upper triangular matrix U, such that A = LU. When partial pivoting is used, the decomposition takes the form PA = LU, where P is a permutation matrix that records row swaps.

The "L" stands for lower triangular (all entries above the main diagonal are zero), and "U" stands for upper triangular (all entries below the main diagonal are zero). The diagonal entries of L are typically set to 1 (Doolittle's method).

PA = LU

How Does LU Decomposition Work?

LU decomposition is essentially a systematic recording of Gaussian elimination. The algorithm proceeds column by column:

  1. Select a pivot: For numerical stability, find the largest absolute value in the current column (partial pivoting) and swap rows if needed. Record the swap in P.
  2. Compute multipliers: For each row below the pivot, calculate the multiplier m = A[i][k] / A[k][k]. Store these multipliers in L.
  3. Eliminate: Subtract the appropriate multiple of the pivot row from each lower row. The result builds U.
  4. Repeat for each column until U is fully upper triangular.

Why is LU Decomposition Useful?

LU decomposition is one of the most widely used matrix factorizations in numerical computing:

Computational Complexity

LU decomposition of an n×n matrix requires approximately 2n³/3 floating-point operations. Once computed, each subsequent solve (forward and back substitution) requires only 2n² operations. This makes LU decomposition far more efficient than Gaussian elimination when solving multiple systems with the same coefficient matrix.

When to Use LU Decomposition

Limitations

Other Decomposition Types

QR

QR Decomposition

Decompose into orthogonal Q and upper triangular R. Ideal for least squares problems.

Open calculator →
SVD

Singular Value Decomposition

The most general decomposition. Factor any matrix into UΣVᵀ.

Open calculator →
LL

Cholesky Decomposition

Efficient factorization for symmetric positive definite matrices.

Open calculator →
λ

Eigendecomposition

Find eigenvalues and eigenvectors of square matrices.

Open calculator →