Factor a square matrix as : is the upper triangular matrix that Gaussian elimination produces, and is lower triangular with s on the diagonal and the elimination multipliers below it.
| Step | On | |
|---|---|---|
| 1 | Check the first pivot. It must be nonzero. If it is zero, swap rows and switch to . | |
| 2 | Clear column 1 and record the multipliers. The multiplier is ; subtract times row 1 from row . | , : rows 2 and 3 become , |
| 3 | Clear column 2 the same way. Use the new pivot in row 2; continue until the matrix is upper triangular. | : row 3 becomes |
| 4 | Read off U and L. is the final matrix. has s on the diagonal and each multiplier in the position of the zero it created. | , |
| 5 | Check by multiplying. must give back . As a bonus, the determinant is the product of the pivots (determinant via LU). | ✓, |