Solving Systems with Augmented Matrices
To solve a system with an augmented matrix, write the coefficients and constants of the equations as one matrix, with a bar before the constants. Then use row operations (swap rows, multiply a row by a nonzero number, add a multiple of one row to another) to reach row-echelon form, and finish with back substitution, a method called Gaussian elimination.
Before this lesson: You should know Matrix Operations, the Elimination Method and Systems of Equations in Three Variables.
Why Use an Augmented Matrix?
When you solve a system by elimination, you keep rewriting x, y and z even though only the numbers change. An augmented matrix drops the variables and keeps just the numbers, lined up in columns. Each row is one equation.
The row operations are the same moves you already use in elimination. Swapping two equations, multiplying an equation by a number, and adding equations never change the solution. The goal is a staircase of leading 1s with 0s below them, called row-echelon form.
Row Operations and Steps
| Row operation | Notation | Example |
|---|---|---|
| Swap two rows | R_1 \leftrightarrow R_2 | Put a row with a leading 1 on top |
| Multiply a row by a nonzero number | \frac{1}{2}R_1 \to R_1 | Turn a leading 2 into a 1 |
| Add a multiple of one row to another | R_2 - 3R_1 \to R_2 | Make a 0 below a leading 1 |
- Write the augmented matrix: one row per equation, one column per variable, then a bar and the constants.
- Get a 1 in the top-left corner, then use it to make 0s below it.
- Move to the next row and column, get a leading 1, and make 0s below it. Repeat.
- Turn the last row back into an equation, solve it, and back substitute up the rows.
- If a row reads 0 \; 0 \; | \; c with c \ne 0, there is no solution. If a row is all 0s, there may be infinitely many solutions.
Worked Examples
Example 1: Write an augmented matrix
Write the augmented matrix for 2x - y + z = 3, x + 3z = -1 and 4y - z = 5.
Line up the variables in the order x, y, z, and use 0 for a missing variable
2, -1, 1 \mid 3
Row 1 from 2x - y + z = 3.
1, 0, 3 \mid -1
Row 2 from x + 0y + 3z = -1.
0, 4, -1 \mid 5
Row 3 from 0x + 4y - z = 5.
Answer: \left[\begin{array}{ccc|c} 2 & -1 & 1 & 3 \\ 1 & 0 & 3 & -1 \\ 0 & 4 & -1 & 5 \end{array}\right]
Example 2: A system of two equations
Solve x + 2y = 5 and 3x - y = 1 with an augmented matrix.
\left[\begin{array}{cc|c} 1 & 2 & 5 \\ 3 & -1 & 1 \end{array}\right]Write the matrix.
Make a 0 below the leading 1 with R_2 - 3R_1 \to R_2: 3 - 3(1) = 0, -1 - 3(2) = -7, 1 - 3(5) = -14
\left[\begin{array}{cc|c} 1 & 2 & 5 \\ 0 & -7 & -14 \end{array}\right]Write the new matrix.
Row 2 says -7y = -14, so y = 2
x + 2(2) = 5
Back substitute into row 1, x + 2y = 5.
x = 1
Subtract 4 from both sides.
Answer: (1, 2). Check: 3(1) - 2 = 1.
Example 3: A system of three equations
Solve x + y + z = 6, 2x - y + z = 3 and x + 2y - z = 2.
\left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 2 & -1 & 1 & 3 \\ 1 & 2 & -1 & 2 \end{array}\right]Write the matrix.
R_2 - 2R_1 \to R_2 gives row 2: 0, -3, -1 \mid -9. R_3 - R_1 \to R_3 gives row 3: 0, 1, -2 \mid -4
Swap rows 2 and 3, R_2 \leftrightarrow R_3, to get a leading 1: row 2 is 0, 1, -2 \mid -4 and row 3 is 0, -3, -1 \mid -9
R_3 + 3R_2 \to R_3: -3 + 3(1) = 0, -1 + 3(-2) = -7, -9 + 3(-4) = -21, so row 3 is 0, 0, -7 \mid -21
Row 3 says -7z = -21, so z = 3
y - 6 = -4
Row 2 says y - 2z = -4.
y = 2
Add 6 to both sides.
x + 2 + 3 = 6
Row 1 says x + y + z = 6.
x = 1
Subtract 5 from both sides.
Answer: (1, 2, 3)
Example 4: No solution and infinitely many solutions
Solve each system: (a) x + 2y = 4 and 2x + 4y = 9; (b) x + 2y = 4 and 3x + 6y = 12.
(a) R_2 - 2R_1 \to R_2: \left[\begin{array}{cc|c} 1 & 2 & 4 \\ 0 & 0 & 1 \end{array}\right]
Row 2 says 0 = 1, which is false, so system (a) has no solution
(b) R_2 - 3R_1 \to R_2: \left[\begin{array}{cc|c} 1 & 2 & 4 \\ 0 & 0 & 0 \end{array}\right]
x = 4 - 2y
Row 2 says 0 = 0, always true, so only row 1 limits the answer.
Answer: (a) no solution, because the lines are parallel; (b) infinitely many solutions, (4 - 2y, y) for any y, because both equations describe the same line.
Example 5: Word problem with ticket sales
A theater sold 200 tickets: adult tickets for $12, student tickets for $8 and child tickets for $5. Ticket sales totaled $1,740, and there were twice as many student tickets as child tickets. How many of each were sold?
Let a, s and c be the numbers of tickets: a + s + c = 200, 12a + 8s + 5c = 1740 and s - 2c = 0
\left[\begin{array}{ccc|c} 1 & 1 & 1 & 200 \\ 12 & 8 & 5 & 1740 \\ 0 & 1 & -2 & 0 \end{array}\right]Write the matrix.
R_2 - 12R_1 \to R_2: 12 - 12 = 0, 8 - 12 = -4, 5 - 12 = -7, 1740 - 2400 = -660
Swap rows 2 and 3: row 2 is 0, 1, -2 \mid 0 and row 3 is 0, -4, -7 \mid -660
R_3 + 4R_2 \to R_3: -4 + 4 = 0, -7 + 4(-2) = -15, -660 + 0 = -660, so -15c = -660
Divide by −15: c = 44. Then s - 2(44) = 0, so s = 88
a + 88 + 44 = 200
Back substitute.
a = 68
Subtract 132 from both sides.
Answer: 68 adult, 88 student and 44 child tickets. Check: 12(68) + 8(88) + 5(44) = 816 + 704 + 220 = 1740.
Common Mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Leaving out a missing variable | Writing x + 3z = -1 as 1, 3 \mid -1 | Put a 0 in the y column: 1, 0, 3 \mid -1. |
| Changing only part of a row | Applying R_2 - 3R_1 to the coefficients but not the constant | Every entry in the row changes, including the one after the bar. |
| Multiplying a row by 0 | 0R_2 \to R_2 | That erases an equation. Multiply only by nonzero numbers. |
| Misreading a zero row | Calling 0 \; 0 \mid 1 “infinitely many” | 0 = 1 is false, so there is no solution. 0 \; 0 \mid 0 means infinitely many. |
| Sign slips with negatives | -1 - 3(2) = 5 | Do one entry at a time: -1 - 6 = -7. |
Related Methods
Reduced row-echelon form
If you keep going and make 0s above each leading 1 too, you reach reduced row-echelon form. Then the answers can be read straight from the last column. This is called Gauss-Jordan elimination.
Calculator rref
Graphing calculators have an rref command. Enter the augmented matrix, apply rref, and read the solution from the last column.
Other matrix methods
When the coefficient matrix is square, a system can also be solved with an inverse matrix or with determinants, using Cramer’s rule.
Practice Problems
- Write the augmented matrix for 3x + y = 7 and x - 4y = 2.
- The matrix \left[\begin{array}{ccc|c} 1 & 0 & 2 & 5 \\ 0 & 1 & -1 & 3 \\ 0 & 0 & 1 & 4 \end{array}\right] is in row-echelon form. Solve the system.
- Solve x - y = 1 and 2x + y = 11 with an augmented matrix.
- Solve 2x + 4y = 2 and 3x - y = 10 with an augmented matrix.
- Solve x + y - z = 2, 2x + y + z = 6 and x - y + 2z = 3.
- What does the matrix \left[\begin{array}{cc|c} 1 & -3 & 2 \\ 0 & 0 & 5 \end{array}\right] tell you?
- Solve x - y = 3 and -2x + 2y = -6.
- Use R_1 - 2R_2 \to R_1 to reduce \left[\begin{array}{cc|c} 1 & 2 & 4 \\ 0 & 1 & 1 \end{array}\right], then read the solution.
- Apply R_2 + 3R_1 \to R_2 to \left[\begin{array}{cc|c} 1 & 2 & 5 \\ -3 & 1 & -1 \end{array}\right].
- A jar has 30 coins: nickels, dimes and quarters worth $3.70 in all. There are 2 more dimes than nickels. How many of each coin are there?
Show answers
1.
Row 1 from 3x + y = 7; row 2 from x - 4y = 2
Answer: \left[\begin{array}{cc|c} 3 & 1 & 7 \\ 1 & -4 & 2 \end{array}\right]
2.
z = 4
Row 3 gives z.
Row 2: y - z = 3, so y - 4 = 3 and y = 7
Row 1: x + 2z = 5, so x + 8 = 5 and x = -3
Answer: (-3, 7, 4)
3.
\left[\begin{array}{cc|c} 1 & -1 & 1 \\ 2 & 1 & 11 \end{array}\right]Write the augmented matrix.
R_2 - 2R_1 \to R_2: 0, 3 \mid 9, so 3y = 9 and y = 3
x - 3 = 1
Back substitute into row 1.
x = 4
Add 3 to both sides.
Answer: (4, 3)
4.
\left[\begin{array}{cc|c} 2 & 4 & 2 \\ 3 & -1 & 10 \end{array}\right]Write the augmented matrix.
\frac{1}{2}R_1 \to R_1: 1, 2 \mid 1
R_2 - 3R_1 \to R_2: 0, -7 \mid 7, so y = -1
x + 2(-1) = 1
Back substitute into row 1.
x = 3
Add 2 to both sides.
Answer: (3, -1)
5.
R_2 - 2R_1 \to R_2: 0, -1, 3 \mid 2; R_3 - R_1 \to R_3: 0, -2, 3 \mid 1
R_3 - 2R_2 \to R_3: 0, 0, -3 \mid -3, so z = 1
Row 2: -y + 3(1) = 2, so y = 1; row 1: x + 1 - 1 = 2, so x = 2
Answer: (2, 1, 1)
6.
Row 2 says 0 = 5, which is false
Answer: the system has no solution
7.
R_2 + 2R_1 \to R_2: \left[\begin{array}{cc|c} 1 & -1 & 3 \\ 0 & 0 & 0 \end{array}\right]
x = y + 3
Only row 1 limits the answer.
Answer: infinitely many solutions, (y + 3, y)
8.
R_1 - 2R_2: 1 - 0 = 1, 2 - 2(1) = 0, 4 - 2(1) = 2
\left[\begin{array}{cc|c} 1 & 0 & 2 \\ 0 & 1 & 1 \end{array}\right]Write the new matrix.
Answer: x = 2, y = 1
9.
New row 2: -3 + 3(1) = 0, 1 + 3(2) = 7, -1 + 3(5) = 14
Answer: \left[\begin{array}{cc|c} 1 & 2 & 5 \\ 0 & 7 & 14 \end{array}\right], so y = 2 and x = 1
10.
Equations (in cents): n + d + q = 30, 5n + 10d + 25q = 370, -n + d = 2
Matrix rows: 1, 1, 1 \mid 30; 5, 10, 25 \mid 370; -1, 1, 0 \mid 2
R_2 - 5R_1: 0, 5, 20 \mid 220; R_3 + R_1: 0, 2, 1 \mid 32
\frac{1}{5}R_2: 0, 1, 4 \mid 44; R_3 - 2R_2: 0, 0, -7 \mid -56, so q = 8
Row 2: d + 4(8) = 44, so d = 12; row 1: n + 12 + 8 = 30, so n = 10
Answer: 10 nickels, 12 dimes and 8 quarters
FAQ
What is an augmented matrix?
It is a matrix made from a system of equations: the coefficients of the variables, then a bar, then the constants. Each row is one equation.
What are the three row operations?
Swap two rows, multiply a row by a nonzero number, and add a multiple of one row to another row. None of them changes the solution.
What is row-echelon form?
Each row’s first nonzero entry is a 1, every leading 1 is to the right of the one above it, and all entries below each leading 1 are 0.
How do you know if a system has no solution?
If a row becomes all 0s on the left of the bar but a nonzero number on the right, it says 0 = c, which is impossible. Then there is no solution.
Summary
- Write one row per equation: coefficients, a bar, then the constant.
- Use the three row operations to get leading 1s with 0s below them.
- Turn the last row into an equation and back substitute.
- A row 0 \; 0 \mid c with c \ne 0 means no solution; a row of all 0s can mean infinitely many.
- Change every entry in a row, including the constant.
Previous lesson: Matrix Multiplication
Next lesson: Determinant of a Matrix
Back to the Precalculus Index