Equations as rows
Each row stores the coefficients of one equation and the value on its right. The augmented matrix records both. Swap two equations, multiply an equation by a nonzero scalar, or add a multiple of another equation to it. Each operation is reversible, so it preserves the solution set.
Elimination creates leading entries, called pivots, with zeros below them. In reduced row echelon form every pivot is and is the only nonzero entry in its column. Pivot columns move right as you go down the nonzero rows.
For and subtract three times the first equation from the second. The new second equation is so and the first gives
Read the whole solution set
If a row says the system is inconsistent. Otherwise, pick arbitrary values for variables whose coefficient columns have no pivot. These free variables determine the remaining variables through the pivot equations.
Take and Subtract the equations to get The remaining relation is Let and obtain for every real This line has a starting point and a direction, a description you will use again when studying the null space.
A row of zeros makes no additional demand. A row with zero coefficients and a nonzero right side is a contradiction. Keep the right-hand column attached while reducing.
Exact row reduction in Python
SymPy returns the reduced matrix and the zero-based pivot column indices. An augmented column with a pivot exposes an inconsistency.
from sympy import Matrix
for rows in ([[1, 1, 2], [2, 2, 4]], [[1, 1, 2], [2, 2, 5]]):
reduced, pivots = Matrix(rows).rref()
print(reduced.tolist(), pivots)[[1, 1, 2], [0, 0, 0]] (0,)
[[1, 1, 0], [0, 0, 1]] (0, 2)Exercises
Solve and
Show solution✓ Checked
Add the equations to get Then and
For which is consistent? Find all solutions then.
Show solution✓ Checked
Subtract twice the first row from the second to get When put and set
Explain why replacing by cannot change the solution set.
Show solution✓ Checked
A solution of the original equations satisfies their linear combination. Conversely, a solution of the new equations satisfies the old second equation after subtracting For example, adding the first row to the second and subtracting it again restores both the coefficient and the right-hand side.