Solving Systems with Matrices
What You’ll Learn
Section titled “What You’ll Learn”In this lesson you’ll learn how to represent a system of linear equations as an augmented matrix and solve it using row reduction (Gaussian elimination). You’ll also learn how to interpret the three possible outcomes of a system.
The Concept
Section titled “The Concept”You already know how to solve systems by substitution or elimination. Row reduction is the same idea, just organized into a matrix so you can work with the numbers without rewriting x, y, z every time.
Start with a system of equations:
Write the coefficients and constants into an augmented matrix. The vertical line separates the left side from the right side of the equals sign:
The first column is the x-coefficients, the second is y, and the right side is the constants. Now the goal is to use row operations to turn this into a form where you can read off the answer.
You’re allowed three moves:
- Swap two rows
- Multiply an entire row by a nonzero number
- Add a multiple of one row to another row
These moves never change the solution. They’re the matrix version of the algebra moves you already know.
Let’s walk through it step by step.
Step 1: Eliminate x from Row 2
We want a zero in the bottom-left corner. Row 1 has a 1 in the x-column, and Row 2 has a 3. So we do R2 - 3(R1):
The matrix is now:
That zero in the bottom-left is the whole point. We’ve eliminated x from the second equation.
Step 2: Solve for y from Row 2
Row 2 now says -2y = -4, so y = 2.
You can also clean it up by dividing Row 2 by -2:
Step 3: Back-substitute into Row 1
Row 1 says x + 2y = 5. We know y = 2, so x + 4 = 5, which gives x = 1.
Solution: x = 1, y = 2.
Here’s the whole process as a visual:
The key insight: each row operation is just algebra you already know (multiply both sides, subtract equations), but organized so you only track the numbers.
What can go wrong (or go right)?
There are three possible outcomes when you row-reduce a system. Here’s what each one looks like geometrically:
One unique solution
Every variable ends up with its own pivot row, and you can solve for each one. Geometrically, the equations describe lines (in 2D) or planes (in 3D) that all meet at exactly one point. That point is your answer. The example above is this case: the two lines cross at (1, 2) and nowhere else. In the left graph, the blue and orange lines intersect at the green dot.
No solution
You end up with a row like [0 0 | 5], which says 0 = 5. Think about what that row means if you translate it back to an equation: 0x + 0y = 5. No matter what x and y are, the left side is always zero, so it can never equal 5. That’s a contradiction. Geometrically, the original equations describe parallel lines (in 2D) or parallel planes (in 3D) that never intersect. They have the same slope but different y-intercepts, so they run side by side forever. The system was asking “where do these lines meet?” and the answer is “they don’t.” The middle graph shows this: same direction, but they never touch.
Infinitely many solutions
You get a row of all zeros like [0 0 | 0], which translates back to 0x + 0y = 0. That’s true for every x and y, so it gives you no new information. It means one of the original equations was redundant (just a multiple or combination of the others). Geometrically, the lines or planes overlap completely. They’re the same line, so every point on it is a solution. You end up with a “free variable” that can be anything, and the other variables depend on it. Instead of one answer, you get a whole family of answers. The right graph shows this: the dashed orange line sits right on top of the blue one.
Worked Example
Section titled “Worked Example”Example 1: A 3x3 system
Solve:
Augmented matrix:
Step 1: Eliminate x from R2 and R3.
R2 - 2(R1) and R3 - R1:
Step 2: Eliminate y from R3.
R3 - R2:
Step 3: Back-substitute.
Row 3: 3z = 6, so z = 2.
Row 2: y - z = 2, so y - 2 = 2, y = 4.
Row 1: x + y + z = 6, so x + 4 + 2 = 6, x = 0.
Solution: (0, 4, 2).
Example 2: No solution
If during row reduction you get:
The last row says 0x + 0y + 0z = 5, which means 0 = 5. Impossible. No solution.
Example 3: Infinitely many solutions
If you get:
The last row is 0 = 0, which is always true but tells you nothing. z is a free variable. Let z = t, then x = 3 - 2t and y = 4 + t. Every value of t gives a different solution.
Real-World Application
Section titled “Real-World Application”Solving systems with matrices is used in:
- Business (resource allocation, production planning)
- Engineering (balancing forces, circuit analysis)
- Computer science (graphics transformations, machine learning)
- Chemistry (balancing chemical equations with multiple variables)
- Logistics (optimizing transportation routes)
Example: a company making three products with limited raw materials can set up a system of equations and row-reduce to find the optimal production quantities.