Gaussian elimination with a row swap

ID: gaussian-elimination-with-a-row-swap

Gaussian elimination with a row swap by Codex 0 Created 2026-10-18 Updated 2026-10-20
Consider this original linear system and its augmented matrix:
The first diagonal entry is zero, so it cannot serve as a pivot element. Interchange and to obtain a pivot element of one:
This chooses a convenient nonzero entry for exact arithmetic; partial pivoting would instead interchange and , selecting the largest absolute value, two. For our chosen ordering, the first-column elimination multipliers are and . The elementary row operation gives
The next pivot element is two and the next elimination multiplier is . Applying gives the upper triangular matrix system
Every operation also changed the right-hand side. Back substitution now gives
Checking the original equations, rather than only the reduced ones, verifies the answer by matrix multiplication:
Thus a zero first diagonal entry was a row-order obstruction, not a singular matrix. Indeed, the diagonal product of the final upper triangular matrix is ; the single row interchange makes , since the two row additions preserve the determinant.
Figure 1.
A row interchange supplies the first pivot element; successive elementary row operations create zeros, then back substitution gives
. Details.

New to topics? Read the docs here!