LU factorization decomposes a matrix into a lower-triangular matrix and an upper-triangular matrix .

We get the lower-triangular matrix by multiplying the inverse of elementary matrices we get from Gaussian elimination. And the remaining matrix in row echelon form is the upper-triangular matrix .

Compare to Gaussian elimination, LU decomposition can save computation when we solve repeatedly with different s. To solve , we can let and then first solve for and then for . Since and are triangular matrices, we can solve the above equation trivially by forward and back substitution.