# LU Decomposition Calculator

URL: https://speedycalculator.com/calculators/math/lu-decomposition/
Last updated: 2026-10-30

> The LU decomposition calculator factors a square matrix into a lower triangular L (with ones on the diagonal) and an upper triangular U, using row swaps (PA = LU) when needed.

## Inputs

- Matrix size
- a₁
- b₁
- c₁
- d₁
- a₂
- b₂
- c₂
- d₂
- a₃
- b₃
- c₃
- d₃
- a₄
- b₄
- c₄
- d₄

## Results

- Result
- L (lower triangular)
- U (upper triangular)
- P (permutation)

## Formula

```
A = L·U  (or P·A = L·U with a permutation matrix P)
```

## Explanation

LU decomposition is the matrix form of Gaussian elimination. Once A = LU is known, any system Ax = b is solved quickly by forward and back substitution – ideal when solving with many right-hand sides.

### How to use the LU Decomposition Calculator

- Choose the **matrix size** – the matching grid of fields appears.
- Enter the entries **row by row** (a₁ b₁ c₁ is the first row, a₂ b₂ c₂ the second, and so on).
- Read the result; integer matrices give exact fractions.

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

### How it works

Doolittle's algorithm computes the rows of U and the columns of L in turn. If a zero pivot appears, rows are swapped and the permutation is reported.

## Worked example

Inputs — Matrix size: 3 × 3; a₁: 4; b₁: 1; c₁: 2; a₂: 1; b₂: 3; c₂: 0; a₃: 2; b₃: 0; c₃: 5.

Results — **Result = A = L·U**; L (lower triangular) = ⎡ 1 0 0 ⎤
⎢ 1/4 1 0 ⎥
⎣ 1/2 −2/11 1 ⎦; U (upper triangular) = ⎡ 4 1 2 ⎤
⎢ 0 11/4 −1/2 ⎥
⎣ 0 0 43/11 ⎦.

## Key terms

- **Triangular matrix**: A matrix with zeros above (lower) or below (upper) the diagonal.

## FAQ

**Does every matrix have an LU decomposition?**
Every invertible matrix has a PA = LU decomposition; without row swaps it may not exist.

**What is the determinant from LU?**
The product of U's diagonal (times ±1 for swaps).

**How do I solve Ax = b with LU?**
Solve Ly = Pb, then Ux = y.

**What is Doolittle vs Crout?**
Doolittle puts ones on L's diagonal, Crout on U's.


## Sources

- [Wolfram MathWorld – LU decomposition](https://mathworld.wolfram.com/LUDecomposition.html)
- [MIT OpenCourseWare – 18.06 Linear Algebra (Gilbert Strang)](https://ocw.mit.edu/courses/18-06-linear-algebra-spring-2010/)
- [Jim Hefferon – Linear Algebra (free textbook)](https://hefferon.net/linearalgebra/)
