math.wiki
Linear algebra › Row reduction › Augmented matrices and row operations
Open on the map
Precalculus

Augmented matrices and row operations

Elimination keeps copying the same letters while only the numbers change. Can the letters be dropped, and which moves on the numbers alone are guaranteed never to change the solutions?

Where you are 7 in Row reduction

When you reach for it

In Solving systems by elimination a system is solved by adding a multiple of one equation to another until a variable cancels, copying x and y at every step although only the numbers change. Writing the system as AX = B already sorted those numbers into a coefficient matrix A and a column of constants B. Setting B beside A and dropping the letters gives the augmented matrix, and the moves of elimination become three row operations on it.

You reach for this whenever a linear system is to be solved with matrices, by hand or by a calculator: it is the format of Gaussian elimination.

The procedure

The augmented matrix

Take a linear system with every equation lined up: variable terms on the left in the same order, the constant on the right. Its augmented matrix [A \mid B] has one row per equation. The columns left of the bar hold the coefficients, one column per variable, and the column right of the bar holds the constants. For the system x + 3y = 5, 2x - y = 3,

[A \mid B] = \left[\begin{array}{cc|c} 1 & 3 & 5 \\ 2 & -1 & 3 \end{array}\right]

The bar marks where each equals sign stood. A number’s column says which variable it multiplies, which is why the equations must be lined up first and a missing variable still gets its entry, 0.

The three row operations

OperationNotationThe same move on the equations
Swap two rowsR_i \leftrightarrow R_jwrite the equations in another order
Multiply a row by a number c \ne 0cR_i \to R_imultiply both sides of one equation by c
Add a multiple of another row (j \ne i)R_i + cR_j \to R_iadd c times one equation to another

The arrow means “the result becomes the new row i”. Every row not named after the arrow is copied unchanged, including the row R_j that was used. An operation acts on the whole row, the entry right of the bar included, because that entry is the right side of the same equation.

On the matrix above, R_2 - 2R_1 \to R_2 replaces row 2 by row 2 minus twice row 1, entry by entry: 2 - 2(1) = 0, -1 - 2(3) = -7, 3 - 2(5) = -7.

1 3 5 2 −1 3
R_2 - 2R_1 \to R_2
1 3 5 0 −7 −7
\begin{aligned} x + 3y &= 5 \\ 2x - y &= 3 \end{aligned}
\begin{aligned} x + 3y &= 5 \\ -7y &= -7 \end{aligned}
Figure 1One replacement on the matrix is one step of elimination on the equations. Row 1 is copied unchanged; only row 2 is replaced.

Read back, the new matrix says x + 3y = 5 and -7y = -7. On the equations, this was subtracting twice the first equation from the second so that x cancels: exactly the step elimination would take. Now y = 1, and the first row gives x = 5 - 3 = 2. Two matrices joined by a chain of row operations are called row equivalent.

Why the solutions do not change

The argument has two halves.

Every solution of the old system solves the new one. A swap only reorders the equations. If an equation is true at a point, multiplying both sides by c keeps it true, by the multiplication property of equality. If the equations of rows i and j are both true at a point, then adding c times the equal sides of row j to the equal sides of row i gives equal results, so the new row i is true there as well; row j is still in the system.

Every solution of the new system solves the old one. Each operation is undone by an operation of the same kind:

OperationUndone by
R_i \leftrightarrow R_jR_i \leftrightarrow R_j again
cR_i \to R_i\displaystyle \frac{1}{c}R_i \to R_i
R_i + cR_j \to R_iR_i - cR_j \to R_i

The last undo works because row j was not changed. Since the new system turns back into the old one by row operations, the first half, run in that direction, finishes the argument.

The undo table is where c \ne 0 matters. In the system x + y = 5, x - y = 1, whose only solution is (3, 2), the move 0R_2 \to R_2 turns row 2 into 0 \;\; 0 \mid 0, the equation 0 = 0. What is left is x + y = 5 alone, which (5, 0) also solves, although 5 - 0 \ne 1. The solution set grew, and undoing the step would mean dividing by 0. For the same reason a replacement adds a multiple of a different row: R_1 - R_1 \to R_1 is 0R_1 \to R_1 in disguise.

Worked examples

Example 1

Writing an augmented matrix

Write the augmented matrix of the system 3x - 2y + z = 7, x + 4z = -1, y = 2z + 5.

Solution

Use the order x, y, z. The second equation has no y, so its y entry is 0. The third must be lined up first: subtracting 2z from both sides gives y - 2z = 5, with no x term.

\left[\begin{array}{ccc|c} 3 & -2 & 1 & 7 \\ 1 & 0 & 4 & -1 \\ 0 & 1 & -2 & 5 \end{array}\right]
Example 2

One operation of each kind

Start from the matrix

M = \left[\begin{array}{ccc|c} 1 & -2 & 3 & 4 \\ 2 & 6 & -4 & 10 \\ 3 & -1 & 0 & 2 \end{array}\right]

and apply each operation to M itself: (a) R_1 \leftrightarrow R_3; (b) \displaystyle \frac{1}{2}R_2 \to R_2; (c) R_3 - 3R_1 \to R_3.

Solution

(a) Rows 1 and 3 trade places, so the top row is now 3 \;\; -1 \;\; 0 \mid 2 and the bottom row 1 \;\; -2 \;\; 3 \mid 4; row 2 stays.

(b) Every entry of row 2 is halved, the constant included, giving 1 \;\; 3 \;\; -2 \mid 5.

(c) Row 3 minus three times row 1, entry by entry: 3 - 3(1) = 0, -1 - 3(-2) = 5, 0 - 3(3) = -9, 2 - 3(4) = -10. The new row 3 is 0 \;\; 5 \;\; -9 \mid -10, which reads 5y - 9z = -10: x is gone from it. Row 1 is unchanged although it was used.

Example 3

Row operations beside elimination

Solve 2x + 5y = 4, x + 3y = 3 with row operations, writing the equations beside each matrix.

Solution
\begin{aligned} 2x + 5y &= 4 \\ x + 3y &= 3 \end{aligned} \qquad \left[\begin{array}{cc|c} 2 & 5 & 4 \\ 1 & 3 & 3 \end{array}\right]

A top row whose x coefficient is 1 makes clearing x below it easy, so swap: R_1 \leftrightarrow R_2 is writing the equations in the other order.

\begin{aligned} x + 3y &= 3 \\ 2x + 5y &= 4 \end{aligned} \qquad \left[\begin{array}{cc|c} 1 & 3 & 3 \\ 2 & 5 & 4 \end{array}\right]

Now R_2 - 2R_1 \to R_2 subtracts twice the first equation from the second: 2 - 2 = 0, 5 - 6 = -1, 4 - 6 = -2.

\begin{aligned} x + 3y &= 3 \\ -y &= -2 \end{aligned} \qquad \left[\begin{array}{cc|c} 1 & 3 & 3 \\ 0 & -1 & -2 \end{array}\right]

Every step kept the solutions, so the last system has the same ones as the first. Its second row gives y = 2, and its first gives x = 3 - 3(2) = -3. Check in the original: 2(-3) + 5(2) = 4 and -3 + 3(2) = 3.

Example 4

Naming an operation and undoing it

Let

P = \left[\begin{array}{ccc|c} 1 & 4 & -2 & 3 \\ 0 & 2 & 1 & -1 \\ 5 & 0 & 3 & 6 \end{array}\right]

(a) One row operation turns P into the matrix with the same rows 1 and 2 and row 3 equal to 0 \;\; -20 \;\; 13 \mid -9. (b) Another turns P into the matrix with the same rows 1 and 3 and row 2 equal to 0 \;\; -6 \;\; -3 \mid 3. Name each operation and the operation that undoes it.

Solution

(a) Only row 3 changed, and its first entry went from 5 to 0, which suggests taking away five copies of row 1. Test it on every entry: 5 - 5(1) = 0, 0 - 5(4) = -20, 3 - 5(-2) = 13, 6 - 5(3) = -9. All four match, so the operation is R_3 - 5R_1 \to R_3. It is undone by R_3 + 5R_1 \to R_3, which adds the five copies back.

(b) Every entry of row 2 is -3 times the old one: 0, -6, -3, 3 against 0, 2, 1, -1. The operation is -3R_2 \to R_2, undone by \displaystyle -\frac{1}{3}R_2 \to R_2.

Example 5

Clearing a column in three variables

Lautaro says (2, 1, 3) solves

\begin{aligned} x + 2y - z &= 1 \\ 3x + y + 2z &= 13 \\ -2x + y + 3z &= 6 \end{aligned}

Use row 1 to clear x from rows 2 and 3, read the new system back, and check his point in both systems.

Solution
\left[\begin{array}{ccc|c} 1 & 2 & -1 & 1 \\ 3 & 1 & 2 & 13 \\ -2 & 1 & 3 & 6 \end{array}\right]

The entry 3 is cleared by R_2 - 3R_1 \to R_2: 3 - 3 = 0, 1 - 6 = -5, 2 + 3 = 5, 13 - 3 = 10. The entry -2 is cleared by R_3 + 2R_1 \to R_3: -2 + 2 = 0, 1 + 4 = 5, 3 - 2 = 1, 6 + 2 = 8. Both use row 1, which neither changes, so they can be written in one step.

\left[\begin{array}{ccc|c} 1 & 2 & -1 & 1 \\ 0 & -5 & 5 & 10 \\ 0 & 5 & 1 & 8 \end{array}\right]

Read back: x + 2y - z = 1, -5y + 5z = 10, 5y + z = 8. The last two form a system in y and z alone. For (2, 1, 3), the original rows give 2 + 2 - 3 = 1, 6 + 1 + 6 = 13, -4 + 1 + 9 = 6, and the new rows give 1, -5 + 15 = 10, 5 + 3 = 8. Continuing in an organized order is Echelon forms and Gaussian elimination.

Example 6

Tickets at the escape room

Lautaro, Martina and Renata run an escape room with two rooms. A ticket for the Vault costs 28 dollars and a ticket for the Lab costs 22 dollars. On Saturday they sold 40 tickets for 1030 dollars. Write the augmented matrix and use row operations to find how many of each were sold.

Solution

Let v and l be the numbers of Vault and Lab tickets. Counting tickets gives v + l = 40; counting dollars gives 28v + 22l = 1030.

\left[\begin{array}{cc|c} 1 & 1 & 40 \\ 28 & 22 & 1030 \end{array}\right]

Martina clears the l column, since 22 copies of row 1 are easy to take away: R_2 - 22R_1 \to R_2 gives 28 - 22 = 6, 22 - 22 = 0, 1030 - 880 = 150. Then \displaystyle \frac{1}{6}R_2 \to R_2 scales that row to 1 \;\; 0 \mid 25.

\left[\begin{array}{cc|c} 1 & 1 & 40 \\ 1 & 0 & 25 \end{array}\right]

Read back: v + l = 40 and v = 25, so l = 15. They sold 25 Vault and 15 Lab tickets. Check: 28(25) + 22(15) = 700 + 330 = 1030.

Boundaries

  • Lined-up linear equations only. Each column must belong to one variable in every row, so the system must be linear and written in one variable order before the matrix means anything.
  • Scaling needs c \ne 0. Multiplying a row by 0 erases an equation and can enlarge the solution set; it cannot be undone.
  • A replacement adds a multiple of another row. Adding a multiple of a row to itself is scaling, and with the multiple -1 it erases the row.
  • Whole rows only. The entry right of the bar belongs to the row; changing only part of a row gives a different system.
  • The solutions are kept, not the matrix. A row operation can change the determinant of a square matrix, never the solutions of the system.

Where this goes next

Applied in a fixed order, row operations carry an augmented matrix to the staircase shape of Echelon forms and Gaussian elimination and on to Reduced row echelon form. Solving a system by row reduction: one, none or infinitely many solutions reads one, none or infinitely many solutions off the result, and Solving a system by row reduction: one, none or infinitely many solutions describes the infinite case. The number of nonzero rows left is the rank, and the effect of each operation on a determinant is Properties of determinants: row operations, products, transposes.

Exercises

Augmented matrices

  1. Write the augmented matrix of 4x - y = 9, x + 2y = -3.
  2. Write the augmented matrix of a + b - 2c = 0, 3a + c = 7, 2b - c = -5, in the order a, b, c.
  3. Write the augmented matrix of y = 3x - 2, 2y + x = 10, in the order x, y.
  4. Write the system, in x and y, for \left[\begin{array}{cc|c} 2 & 5 & -1 \\ 0 & 3 & 6 \end{array}\right].
  5. Write the system, in x, y and z, for \left[\begin{array}{ccc|c} 1 & 0 & -1 & 2 \\ 0 & 1 & 4 & -3 \\ 0 & 0 & 1 & 5 \end{array}\right].

Perform the operation

For exercises 6 to 10, apply the operation to N = \left[\begin{array}{ccc|c} 1 & -1 & 2 & 3 \\ 4 & 2 & 0 & -2 \\ -3 & 5 & 1 & 7 \end{array}\right] itself.

  1. R_2 \leftrightarrow R_3
  2. \displaystyle \frac{1}{2}R_2 \to R_2
  3. R_2 - 4R_1 \to R_2
  4. R_3 + 3R_1 \to R_3
  5. -R_1 \to R_1
  6. Apply R_2 - 4R_1 \to R_2 and R_3 + 3R_1 \to R_3 to N together, and read the new system back in x, y, z.

Name the operation and undo it

  1. \left[\begin{array}{cc|c} 3 & 6 & 9 \\ 1 & -2 & 4 \end{array}\right] became \left[\begin{array}{cc|c} 1 & 2 & 3 \\ 1 & -2 & 4 \end{array}\right].
  2. \left[\begin{array}{cc|c} 1 & 5 & 2 \\ 2 & 7 & 1 \end{array}\right] became \left[\begin{array}{cc|c} 1 & 5 & 2 \\ 0 & -3 & -3 \end{array}\right].
  3. \left[\begin{array}{cc|c} 5 & -1 & 4 \\ 1 & 0 & 6 \end{array}\right] became \left[\begin{array}{cc|c} 1 & 0 & 6 \\ 5 & -1 & 4 \end{array}\right].

Row operations as elimination

  1. Use one replacement on the augmented matrix of x + 4y = 9, 3x + 2y = 7, read the system back, and solve it.
  2. Use a swap and then a replacement on the augmented matrix of 2x - 3y = 12, x + y = 1, read the system back, and solve it.
  3. For x + y + z = 2, 2x + 3y - z = 9, x - y + 2z = -3, clear x from rows 2 and 3 using row 1, and read back the two equations in y and z. Check that (1, 2, -1) satisfies the original system and the new one.

At the escape room

  1. Renata sells a gift cards at 25 dollars and b at 40 dollars, 18 cards for 555 dollars in all. Write the augmented matrix and use row operations to find a and b.
  2. Lautaro builds a room from 12 puzzles: l locks taking 5 minutes each, c ciphers taking 4 minutes and r riddles taking 3 minutes, 50 minutes in all, with twice as many locks as riddles. Write the augmented matrix in the order l, c, r, apply R_2 - 5R_1 \to R_2 and R_3 - R_1 \to R_3, and check that (4, 6, 2) satisfies the new system.

Reasoning

  1. Martina writes R_1 + 2R_1 \to R_1. Explain why this is an allowed operation in disguise, and why R_1 - R_1 \to R_1 is not.
  2. Explain why R_2 + cR_1 \to R_2 can always be undone, and why the undo would fail if the operation had changed row 1 as well.
  3. Renata swaps the two columns left of the bar in \left[\begin{array}{cc|c} 1 & 3 & 5 \\ 2 & -1 & 3 \end{array}\right] and reads the result back in x and y. Solve both systems and explain what the column swap did.
  4. Lautaro replaces row 2 by 2R_2 + 3R_1. Explain why the solutions are unchanged, and why replacing row 2 by 3R_1 alone would not be allowed.
Answers
  1. \left[\begin{array}{cc|c} 4 & -1 & 9 \\ 1 & 2 & -3 \end{array}\right]. The coefficient of -y is -1.
  2. \left[\begin{array}{ccc|c} 1 & 1 & -2 & 0 \\ 3 & 0 & 1 & 7 \\ 0 & 2 & -1 & -5 \end{array}\right]. Each missing variable gets a 0.
  3. Lined up: -3x + y = -2 and x + 2y = 10, so \left[\begin{array}{cc|c} -3 & 1 & -2 \\ 1 & 2 & 10 \end{array}\right].
  4. 2x + 5y = -1 and 3y = 6.
  5. x - z = 2, y + 4z = -3 and z = 5.
  6. Row 2 is now -3 \;\; 5 \;\; 1 \mid 7 and row 3 is 4 \;\; 2 \;\; 0 \mid -2; row 1 stays.
  7. Row 2 becomes 2 \;\; 1 \;\; 0 \mid -1; the other rows stay.
  8. Row 2 becomes 0 \;\; 6 \;\; -8 \mid -14: 4 - 4, 2 + 4, 0 - 8, -2 - 12.
  9. Row 3 becomes 0 \;\; 2 \;\; 7 \mid 16: -3 + 3, 5 - 3, 1 + 6, 7 + 9.
  10. Row 1 becomes -1 \;\; 1 \;\; -2 \mid -3; the other rows stay.
  11. x - y + 2z = 3, 6y - 8z = -14, 2y + 7z = 16. Both operations use row 1, which neither changes.
  12. \displaystyle \frac{1}{3}R_1 \to R_1, undone by 3R_1 \to R_1.
  13. R_2 - 2R_1 \to R_2 (2 - 2 = 0, 7 - 10 = -3, 1 - 4 = -3), undone by R_2 + 2R_1 \to R_2.
  14. R_1 \leftrightarrow R_2, undone by the same swap.
  15. R_2 - 3R_1 \to R_2 gives \left[\begin{array}{cc|c} 1 & 4 & 9 \\ 0 & -10 & -20 \end{array}\right]: x + 4y = 9, -10y = -20. So y = 2, x = 1.
  16. R_1 \leftrightarrow R_2, then R_2 - 2R_1 \to R_2, gives \left[\begin{array}{cc|c} 1 & 1 & 1 \\ 0 & -5 & 10 \end{array}\right]: x + y = 1, -5y = 10. So y = -2, x = 3.
  17. R_2 - 2R_1 \to R_2 and R_3 - R_1 \to R_3 give y - 3z = 5 and -2y + z = -5. Original: 1 + 2 - 1 = 2, 2 + 6 + 1 = 9, 1 - 2 - 2 = -3. New: 2 + 3 = 5, -4 - 1 = -5.
  18. a = 11, b = 7. From \left[\begin{array}{cc|c} 1 & 1 & 18 \\ 25 & 40 & 555 \end{array}\right], R_2 - 25R_1 \to R_2 gives the row 0 \;\; 15 \mid 105, so b = 7 and a = 18 - 7. Check: 275 + 280 = 555.
  19. \left[\begin{array}{ccc|c} 1 & 1 & 1 & 12 \\ 5 & 4 & 3 & 50 \\ 1 & 0 & -2 & 0 \end{array}\right]; the last row is l = 2r lined up. The operations give rows 0 \;\; -1 \;\; -2 \mid -10 and 0 \;\; -1 \;\; -3 \mid -12. For (4, 6, 2): 4 + 6 + 2 = 12, -6 - 4 = -10, -6 - 6 = -12.
  20. R_1 + 2R_1 is 3R_1, so it is the scaling 3R_1 \to R_1, allowed since 3 \ne 0. R_1 - R_1 is 0R_1: it turns row 1 into zeros, erasing its equation, and cannot be undone.
  21. Row 1 is untouched, so R_2 - cR_1 \to R_2 takes away exactly the c copies that were added. Had row 1 changed too, those copies could no longer be rebuilt from it.
  22. The original, x + 3y = 5, 2x - y = 3, has solution (2, 1). The swapped matrix reads 3x + y = 5, -x + 2y = 3, with solution (1, 2). Swapping columns swaps which variable each column multiplies, so it exchanges the roles of x and y: a different system, unless the variables are relabeled to match.
  23. It is 2R_2 \to R_2 (scaling by 2 \ne 0), then R_2 + 3R_1 \to R_2, two allowed operations. Replacing row 2 by 3R_1 is 0R_2 + 3R_1: row 2’s equation is lost for good.
kg1128 · updated 2026-10-20 · CC-BY-SA-4.0