Learning goals
The main algorithm of this chapter is Gauss--Jordan elimination. It is the computational engine behind solving systems, finding pivots, identifying free variables, detecting inconsistency, and eventually understanding rank and bases.
Compute
Perform elementary row operations and reduce matrices to row-echelon form or reduced row-echelon form.
Interpret
Read pivot variables, free variables, consistency, and solution type from the final matrix.
Express
Write solution sets clearly, including parametric vector form when free variables occur.
Elementary row operations
Each row of an augmented matrix represents one equation. Row operations rewrite the system without changing its solution set.
1. Swap rows
Only changes the order of equations.
2. Scale a row
Multiplies an equation by a nonzero number.
3. Replace a row
Adds a multiple of one equation to another.
Row-echelon form versus reduced row-echelon form
Row-echelon form
A staircase pattern of pivots, with zeros below each pivot.
Useful for back substitution.
Reduced row-echelon form
Each pivot is $1$ and is the only nonzero entry in its column.
Useful because solutions can be read off directly.
Interactive rref lab
Enter an augmented matrix or choose a preset. The tool performs exact Gauss--Jordan elimination using rational arithmetic, displays the row-operation steps, identifies pivots/free variables, and classifies the solution set.
Use one row per line. Entries may be integers, decimals, or fractions, for example 1 -3 -5 1 or 0 1 3/2 -1/2.
What to look for
| Final pattern | Meaning |
|---|---|
| Pivot in every variable column | Unique solution, unless contradiction appears |
| At least one free variable | Infinitely many solutions, unless contradiction appears |
| $[0\;0\;\cdots\;0\mid c]$, $c\ne0$ | No solution |
The three possible outcomes
Every variable is a pivot variable and there is no contradiction.
At least one free variable and no contradiction.
A contradiction row appears, such as $0=1$.
Homogeneous systems
A homogeneous system has the form $Ax=0$. It is always consistent because $x=0$ is always a solution.
Only zero solution
If every variable is a pivot variable, then $x=0$ is the only solution.
Infinitely many solutions
If at least one variable is free, then infinitely many solutions pass through the origin.
Rank preview
The rank of a matrix is the number of pivot positions in its row-echelon form. Rank measures how much independent information is contained in the rows or columns.
Python connection
For exact row reduction, use SymPy. For square systems with a unique numerical solution, NumPy's np.linalg.solve is convenient.
Exact rref with SymPy
import sympy as sp
M = sp.Matrix([
[1, -3, -5, 1],
[1, -1, -2, 0],
[3, -1, 1, 3]
])
M_rref, pivot_columns = M.rref()
M_rref, pivot_columnsNumerical solving with NumPy
import numpy as np
A = np.array([
[1, -3, -5],
[1, -1, -2],
[3, -1, 1]
], dtype=float)
b = np.array([1, 0, 3], dtype=float)
x = np.linalg.solve(A, b)
A @ xCommon mistakes
Using zero as a pivot
A pivot must be nonzero. Swap rows if needed.
Dividing by zero
Scaling a row is allowed only by a nonzero scalar.
Ignoring the right-hand side
In augmented matrices, operate on the entire row, including constants.
Losing free variables
Do not set free variables to zero unless you only want one particular solution.