Solving Systems with Row Reduction
Write linear systems as augmented matrices, solve them with Gaussian elimination, and recognize systems with one solution, none or infinitely many.
Welcome back!
Step 1 of 13Learn
Three equations, three unknowns
A bakery sells muffins, croissants and scones. On Monday it sold 1 muffin, 2 croissants and 1 scone to one customer for 9 dollars, 2 muffins, 1 croissant and 1 scone to another for 8 dollars, and 1 muffin, 1 croissant and 2 scones to a third for 9 dollars. What does each item cost?
Write the prices as x, y and z:
x + 2y + z = 9
2x + y + z = 8
x + y + 2z = 9
This is a system of linear equations. Each equation is linear: variables are only multiplied by constants and added. Geometrically, each equation in three variables is a plane, and a solution is a point lying on all three planes.
You could solve it by substitution, but with many variables that becomes chaos. Linear algebra strips away the variable names and keeps only the numbers in an augmented matrix:
| x | y | z | = |
|---|---|---|---|
| 1 | 2 | 1 | 9 |
| 2 | 1 | 1 | 8 |
| 1 | 1 | 2 | 9 |
Each row is an equation; each column belongs to one variable, with the right-hand sides in the last column. Now the task is to manipulate rows, not equations, until the answer is obvious. Computers solve systems with millions of variables this way, in weather forecasting, structural engineering and computer graphics.
Step 2 of 13Practice · Chart
Two equations, two lines: y = 5 − x and y = 2x − 1
With two unknowns, each equation is a line and a solution is a point on both. With three unknowns, like the bakery, each equation is a plane.
Tap the x value where both equations are true at once.
Tap the point that answers the question, then press Check.
| x | y = 5 − x | y = 2x − 1 |
|---|---|---|
| 0 | 5 | -1 |
| 1 | 4 | 1 |
| 2 | 3 | 3 |
| 3 | 2 | 5 |
| 4 | 1 | 7 |
Step 3 of 13Practice · Choose one
Which augmented matrix row represents the equation 3y − z = 4 in a system with variables x, y, z?
Step 4 of 13Learn
Elementary row operations
Three operations change the equations without changing their solutions:
- Swap two rows.
- Scale a row by a nonzero number.
- Replace a row by itself plus a multiple of another row.
Gaussian elimination uses these to create zeros below each leading entry, working left to right. For the bakery:
- R2 → R2 − 2R1 gives (0, −3, −1 | −10).
- R3 → R3 − R1 gives (0, −1, 1 | 0).
- Swap R2 and R3 to put the simpler row second: (0, −1, 1 | 0) and (0, −3, −1 | −10).
- R3 → R3 − 3R2 gives (0, 0, −4 | −10).
The matrix is now in row echelon form, a staircase shape with zeros below each pivot (the first nonzero entry in each row). Read from the bottom up, which is called back substitution:
- −4z = −10, so z = 2.5.
- −y + z = 0, so y = 2.5.
- x + 2y + z = 9, so x = 9 − 5 − 2.5 = 1.5.
Muffins cost 1.50, croissants 2.50 and scones 2.50 dollars. Always check in an original equation: 2(1.5) + 2.5 + 2.5 = 8. Correct.
If you keep going, scaling pivots to 1 and clearing entries above them too, you reach reduced row echelon form (RREF), where each pivot column has a single 1 and the solution can be read off directly. This is the Gauss–Jordan method.
Step 5 of 13Practice · Put in order
Put the steps of solving a linear system by Gaussian elimination in order.
Drag the items, or use the arrow buttons, to put them in order.
- Write the augmented matrix
- Back-substitute from the bottom row up and check the answer
- Repeat for each following column to reach row echelon form
- Use row operations to create zeros below the first pivot
- Check the last rows for a contradiction such as 0 = 5
Step 6 of 13Diagram
Gaussian elimination at a glance
Tap a shape with to see more.
- Augmented matrix
- Zeros below each pivot
Use row replacement, column by column, left to right.
- Row echelon form
A staircase of pivots.
- Check for 0 = c rows
A row (0 0 0 | c) with c ≠ 0 means no solution.
- Back substitution
Solve the last equation first and work upward.
Step 7 of 13Learn
One, none or infinitely many
Every linear system has exactly one of three outcomes, and the echelon form tells you which.
One solution. Every variable column has a pivot. The planes (or lines) meet at a single point, like the bakery system.
No solution (inconsistent). Elimination produces a row like (0, 0, 0 | 5), which says 0 = 5. In 2D this is two parallel lines; in 3D, planes that never share a common point.
Infinitely many solutions. No contradiction, but some variable column has no pivot. That variable is free: you can set it to any value t, and the others are expressed in terms of t.
Example. After elimination, suppose you get
x + 2y − z = 3
y + z = 1
0 = 0
z has no pivot, so it's free. Let z = t. Then y = 1 − t and x = 3 − 2(1 − t) + t = 1 + 3t. The solutions form a line: (1 + 3t, 1 − t, t) for every real t.
Notice what can't happen: a linear system can't have exactly two solutions. If it has two, the whole line through them works too, because linear equations treat averages and extensions of solutions as solutions.
A system with more unknowns than equations can never have exactly one solution: there aren't enough pivots to go around, so it has either none or infinitely many.
Step 8 of 13Practice · Sort into groups
Classify each system by its echelon form.
Tap an item, then tap its group (or drag it there).
Step 9 of 13Compare
The three possible outcomes
| Aspect | Exactly one | None | Infinitely many |
|---|---|---|---|
| Echelon form shows | A pivot in every variable column | A row (0 … 0 | c) with c ≠ 0 | No contradiction, but a free variable |
| Two lines in the plane | Cross at one point | Parallel, never meet | The same line |
| Example rows | (1, 1 | 3), (0, 1 | 1) | (1, 1 | 3), (0, 0 | 2) | (1, 1 | 3), (0, 0 | 0) |
Step 10 of 13Practice · Spot the mistake
A student solved a system by row reduction. Which step contains an invalid row operation?
Step 11 of 13Note
Step 12 of 13Practice · Work it out
Solve x + y = 7 and 2x − y = 2. What is x?
Step 13 of 13Practice · Choose one
A system has 3 equations and 5 unknowns, and it has at least one solution. What can you conclude?
Lesson complete!