Factor any square matrix into A = LU using Doolittle's method — every entry of L and U derived step by step. Optionally solve Ax = b using forward and back substitution.
Matrix Setup
Also solve Ax = b (toggle to enable)
Result: A = L x U
Step-by-Step Derivation (Doolittle's Method)
Doolittle's Method recurrence:
U row k: $u_{kj} = a_{kj} - \displaystyle\sum_{p=1}^{k-1} l_{kp}\, u_{pj}$ for $j \geq k$
L col k: $l_{ik} = \dfrac{1}{u_{kk}}\!\left(a_{ik} - \displaystyle\sum_{p=1}^{k-1} l_{ip}\, u_{pk}\right)$ for $i > k$
Diagonal of L: $l_{ii} = 1$
Solving Ax = b via LU
Verification: L x U = A
LU Decomposition -- Theory
What is LU Decomposition?
Any square matrix A (without row swaps needed) can be written as A = LU where L is lower triangular with 1s on the diagonal (Doolittle form) and U is upper triangular.
Why use LU Decomposition?
Solving Ax = b becomes two triangular systems:
1. Forward substitution: Solve Ly = b
2. Back substitution: Solve Ux = y
LU decomposition writes A = LU, where L is lower triangular with 1s on the diagonal (Doolittle) and U is upper triangular. To solve Ax = b, solve Ly = b by forward substitution and then Ux = y by back substitution. If a zero pivot appears, rows must be exchanged, giving PA = LU. Without row exchanges, det(A) is the product of the diagonal entries of U.
Common questions
Why use LU decomposition?
Once A is factorised, many right-hand sides b can be solved quickly by two simple substitutions.
Does every matrix have an LU decomposition?
Not always without row exchanges; with a permutation matrix P, PA = LU exists for any invertible matrix.