Elimination finishes at an augmented matrix like
from which the solution can be read straight off. Carrying elimination all the way to a shape like that is called putting the matrix in reduced row echelon form (RREF). A matrix is in RREF when:
Every matrix has exactly one RREF, and the three row operations — swap two rows, scale a row by a nonzero number, add a multiple of one row to another — are all you need to reach it.
Task: write rref(matrix). It takes a list of rows (each a list of numbers, with at least one row and one column, any shape) and returns its RREF as a new list of rows.
Once a system's augmented matrix is in RREF, the chapter's three cases are visible at a glance: a row reading means no solution; a column of unknowns with no pivot means a free unknown and infinitely many solutions; otherwise the last column is the one and only answer.