Skip to ContentGo to accessibility pageKeyboard shortcuts menu
OpenStax Logo
Intermediate Algebra

4.5 Solve Systems of Equations Using Matrices

Intermediate Algebra4.5 Solve Systems of Equations Using Matrices

Learning Objectives

By the end of this section, you will be able to:
  • Write the augmented matrix for a system of equations
  • Use row operations on a matrix
  • Solve systems of equations using matrices

Be Prepared 4.5

Before you get started, take this readiness quiz.

  1. Solve: 3(x+2)+4=4(2x1)+9.3(x+2)+4=4(2x1)+9.
    If you missed this problem, review Example 2.2.
  2. Solve: 0.25p+0.25(x+4)=5.20.0.25p+0.25(x+4)=5.20.
    If you missed this problem, review Example 2.13.
  3. Evaluate when x=−2x=−2 and y=3:2x2xy+3y2.y=3:2x2xy+3y2.
    If you missed this problem, review Example 1.21.

Write the Augmented Matrix for a System of Equations

Solving a system of equations can be a tedious operation where a simple mistake can wreak havoc on finding the solution. An alternative method which uses the basic procedures of elimination but with notation that is simpler is available. The method involves using a matrix. A matrix is a rectangular array of numbers arranged in rows and columns.

Matrix

A matrix is a rectangular array of numbers arranged in rows and columns.

A matrix with m rows and n columns has order m×n.m×n. The matrix on the left below has 2 rows and 3 columns and so it has order 2×3.2×3. We say it is a 2 by 3 matrix.

Figure shows two matrices. The one on the left has the numbers minus 3, minus 2 and 2 in the first row and the numbers minus 1, 4 and 5 in the second row. The rows and columns are enclosed within brackets. Thus, it has 2 rows and 3 columns. It is labeled 2 cross 3 or 2 by 3 matrix. The matrix on the right is similar but with 3 rows and 4 columns. It is labeled 3 by 4 matrix.

Each number in the matrix is called an element or entry in the matrix.

We will use a matrix to represent a system of linear equations. We write each equation in standard form and the coefficients of the variables and the constant of each equation becomes a row in the matrix. Each column then would be the coefficients of one of the variables in the system or the constants. A vertical line replaces the equal signs. We call the resulting matrix the augmented matrix for the system of equations.

The equations are 3x plus y equals minus 3 and 2x plus 3y equals 6. A 2 by 3 matrix is shown. The first row is 3, 1, minus 3. The second row is 2, 3, 6. The first column is labeled coefficients of x. The second column is labeled coefficients of y and the third is labeled constants.

Notice the first column is made up of all the coefficients of x, the second column is the all the coefficients of y, and the third column is all the constants.

Example 4.37

Write each system of linear equations as an augmented matrix:

{5x3y=−1y=2x2{5x3y=−1y=2x2 {6x5y+2z=32x+y4z=53x3y+z=−1{6x5y+2z=32x+y4z=53x3y+z=−1

Try It 4.73

Write each system of linear equations as an augmented matrix:

{3x+8y=−32x=−5y3{3x+8y=−32x=−5y3 {2x5y+3z=83xy+4z=7x+3y+2z=−3{2x5y+3z=83xy+4z=7x+3y+2z=−3

Try It 4.74

Write each system of linear equations as an augmented matrix:

{11x=−9y57x+5y=−1{11x=−9y57x+5y=−1 {5x3y+2z=−52xyz=43x2y+2z=−7{5x3y+2z=−52xyz=43x2y+2z=−7

It is important as we solve systems of equations using matrices to be able to go back and forth between the system and the matrix. The next example asks us to take the information in the matrix and write the system of equations.

Example 4.38

Write the system of equations that corresponds to the augmented matrix:

[4−3312−1−2−13|−12−4].[4−3312−1−2−13|−12−4].

Try It 4.75

Write the system of equations that corresponds to the augmented matrix: [1−12321−214−120].[1−12321−214−120].

Try It 4.76

Write the system of equations that corresponds to the augmented matrix: [111423−1811−13].[111423−1811−13].

Use Row Operations on a Matrix

Once a system of equations is in its augmented matrix form, we will perform operations on the rows that will lead us to the solution.

To solve by elimination, it doesn’t matter which order we place the equations in the system. Similarly, in the matrix we can interchange the rows.

When we solve by elimination, we often multiply one of the equations by a constant. Since each row represents an equation, and we can multiply each side of an equation by a constant, similarly we can multiply each entry in a row by any real number except 0.

In elimination, we often add a multiple of one row to another row. In the matrix we can replace a row with its sum with a multiple of another row.

These actions are called row operations and will help us use the matrix to solve a system of equations.

Row Operations

In a matrix, the following operations can be performed on any row and the resulting matrix will be equivalent to the original matrix.

  1. Interchange any two rows.
  2. Multiply a row by any real number except 0.
  3. Add a nonzero multiple of one row to another row.

Performing these operations is easy to do but all the arithmetic can result in a mistake. If we use a system to record the row operation in each step, it is much easier to go back and check our work.

We use capital letters with subscripts to represent each row. We then show the operation to the left of the new matrix. To show interchanging a row:

A 2 by 3 matrix is shown. Its first row, labeled R2 is 2, minus 1, 2. Its second row, labeled R1 is 5, minus 3, minus 1.

To multiply row 2 by −3−3:

A 2 by 3 matrix is shown. Its first row is 5, minus 3, minus 1. Its second row is 2, minus 1, 2. An arrow point from this matrix to another one on the right. The first row of the new matrix is the same. The second row is preceded by minus 3 R2. It is minus 6, 3, minus 6.

To multiply row 2 by −3−3 and add it to row 1:

A 2 by 3 matrix is shown. Its first row is 5, minus 3, minus 1. Its second row is 2, minus 1, 2. An arrow point from this matrix to another one on the right. The first row of the new matrix is preceded by minus 3 R2 plus R1. It is minus 1, 0, minus 7. The second row is 2, minus 1, 2.

Example 4.39

Perform the indicated operations on the augmented matrix:

Interchange rows 2 and 3.

Multiply row 2 by 5.

Multiply row 3 by −2−2 and add to row 1.

[6−5221−43−31|35−1][6−5221−43−31|35−1]

Try It 4.77

Perform the indicated operations on the augmented matrix:

Interchange rows 1 and 3.

Multiply row 3 by 3.

Multiply row 3 by 2 and add to row 2.

[5−2−24−1−4−230|−24−1][5−2−24−1−4−230|−24−1]

Try It 4.78

Perform the indicated operations on the augmented matrix:

Interchange rows 1 and 2,

Multiply row 1 by 2,

Multiply row 2 by 3 and add to row 1.

[2−3−241−3504|−42−1][2−3−241−3504|−42−1]

Now that we have practiced the row operations, we will look at an augmented matrix and figure out what operation we will use to reach a goal. This is exactly what we did when we did elimination. We decided what number to multiply a row by in order that a variable would be eliminated when we added the rows together.

Given this system, what would you do to eliminate x?

The two equations are x minus y equals 2 and 4x minus 8y equals 0. Multiplying the first by minus 4, we get minus 4x plus 4y equals minus 8. Adding this to the second equation we get minus 4y equals minus 8.

This next example essentially does the same thing, but to the matrix.

Example 4.40

Perform the needed row operation that will get the first entry in row 2 to be zero in the augmented matrix: [1−14−8|20]. [1−14−8|20].

Try It 4.79

Perform the needed row operation that will get the first entry in row 2 to be zero in the augmented matrix: [1−13−6|22].[1−13−6|22].

Try It 4.80

Perform the needed row operation that will get the first entry in row 2 to be zero in the augmented matrix: [1−1−2−3|32].[1−1−2−3|32].

Solve Systems of Equations Using Matrices

To solve a system of equations using matrices, we transform the augmented matrix into a matrix in row-echelon form using row operations. For a consistent and independent system of equations, its augmented matrix is in row-echelon form when to the left of the vertical line, each entry on the diagonal is a 1 and all entries below the diagonal are zeros.

Row-Echelon Form

For a consistent and independent system of equations, its augmented matrix is in row-echelon form when to the left of the vertical line, each entry on the diagonal is a 1 and all entries below the diagonal are zeros.

A 2 by 3 matrix is shown on the left. Its first row is 1, a, b. Its second row is 0, 1, c. An arrow points diagonally down and right, overlapping both the 1s in the matrix. A 3 by 4 matrix is shown on the right. Its first row is 1, a, b, d. Its second row is 0, 1, c, e. Its third row is 0, 0, 1, f. An arrow points diagonally down and right, overlapping all the 1s in the matrix. a, b, c, d, e, f are real numbers.

Once we get the augmented matrix into row-echelon form, we can write the equivalent system of equations and read the value of at least one variable. We then substitute this value in another equation to continue to solve for the other variables. This process is illustrated in the next example.

Example 4.41

How to Solve a System of Equations Using a Matrix

Solve the system of equations using a matrix: {3x+4y=5x+2y=1.{3x+4y=5x+2y=1.

Try It 4.81

Solve the system of equations using a matrix: {2x+y=7x2y=6.{2x+y=7x2y=6.

Try It 4.82

Solve the system of equations using a matrix: {2x+y=−4xy=−2.{2x+y=−4xy=−2.

The steps are summarized here.

How To

Solve a system of equations using matrices.

  1. Step 1. Write the augmented matrix for the system of equations.
  2. Step 2. Using row operations get the entry in row 1, column 1 to be 1.
  3. Step 3. Using row operations, get zeros in column 1 below the 1.
  4. Step 4. Using row operations, get the entry in row 2, column 2 to be 1.
  5. Step 5. Continue the process until the matrix is in row-echelon form.
  6. Step 6. Write the corresponding system of equations.
  7. Step 7. Use substitution to find the remaining variables.
  8. Step 8. Write the solution as an ordered pair or triple.
  9. Step 9. Check that the solution makes the original equations true.

Here is a visual to show the order for getting the 1’s and 0’s in the proper position for row-echelon form.

The figure shows 3 steps for a 2 by 3 matrix and 6 steps for a 3 by 4 matrix. For the former, step 1 is to get a 1 in row 1 column 1. Step to is to get a 0 is row 2 column 1. Step 3 is to get a 1 in row 2 column 2. For a 3 by 4 matrix, step 1 is to get a 1 in row 1 column 1. Step 2 is to get a 0 in row 2 column 1. Step 3 is to get a 0 in row 3 column 1. Step 4 is to get a 1 in row 2 column 2. Step 5 is to get a 0 in row 3 column 2. Step 6 is to get a 1 in row 3 column 3.

We use the same procedure when the system of equations has three equations.

Example 4.42

Solve the system of equations using a matrix: {3x+8y+2z=−52x+5y3z=0x+2y2z=−1.{3x+8y+2z=−52x+5y3z=0x+2y2z=−1.

Try It 4.83

Solve the system of equations using a matrix: {2x5y+3z=83xy+4z=7x+3y+2z=−3.{2x5y+3z=83xy+4z=7x+3y+2z=−3.

Try It 4.84

Solve the system of equations using a matrix: {−3x+y+z=−4x+2y2z=12xyz=−1.{−3x+y+z=−4x+2y2z=12xyz=−1.

So far our work with matrices has only been with systems that are consistent and independent, which means they have exactly one solution. Let’s now look at what happens when we use a matrix for a dependent or inconsistent system.

Example 4.43

Solve the system of equations using a matrix: {x+y+3z=0x+3y+5z=02x+4z=1.{x+y+3z=0x+3y+5z=02x+4z=1.

Try It 4.85

Solve the system of equations using a matrix: {x2y+2z=1−2x+yz=2xy+z=5.{x2y+2z=1−2x+yz=2xy+z=5.

Try It 4.86

Solve the system of equations using a matrix: {3x+4y3z=−22x+3yz=−12x+y2z=6.{3x+4y3z=−22x+3yz=−12x+y2z=6.

The last system was inconsistent and so had no solutions. The next example is dependent and has infinitely many solutions.

Example 4.44

Solve the system of equations using a matrix: {x2y+3z=1x+y3z=73x4y+5z=7.{x2y+3z=1x+y3z=73x4y+5z=7.

Try It 4.87

Solve the system of equations using a matrix: {x+yz=02x+4y2z=63x+6y3z=9.{x+yz=02x+4y2z=63x+6y3z=9.

Try It 4.88

Solve the system of equations using a matrix: {xyz=1x+2y3z=−43x2y7z=0.{xyz=1x+2y3z=−43x2y7z=0.

Media

Access this online resource for additional instruction and practice with Gaussian Elimination.

Section 4.5 Exercises

Practice Makes Perfect

Write the Augmented Matrix for a System of Equations

In the following exercises, write each system of linear equations as an augmented matrix.

196.


{3xy=−12y=2x+5{3xy=−12y=2x+5
{4x+3y=−2x2y3z=72xy+2z=−6{4x+3y=−2x2y3z=72xy+2z=−6

197.


{2x+4y=−53x2y=2{2x+4y=−53x2y=2
{3x2yz=−2−2x+y=55x+4y+z=−1{3x2yz=−2−2x+y=55x+4y+z=−1

198.


{3xy=−42x=y+2{3xy=−42x=y+2
{x3y4z=−24x+2y+2z=52x5y+7z=−8{x3y4z=−24x+2y+2z=52x5y+7z=−8

199.


{2x5y=−34x=3y1{2x5y=−34x=3y1
{4x+3y2z=−3−2x+y3z=4x4y+5z=−2{4x+3y2z=−3−2x+y3z=4x4y+5z=−2

Write the system of equations that corresponds to the augmented matrix.

200.

[ 2 −1 1 −3 | 4 2 ] [ 2 −1 1 −3 | 4 2 ]

201.

[2−43−3| −2 −1 ] [2−43−3| −2 −1 ]

202.

[ 1 0 −3 1 −2 0 0 −1 2 | −1 −2 3 ] [ 1 0 −3 1 −2 0 0 −1 2 | −1 −2 3 ]

203.

[ 2 −2 0 0 2 −1 3 0 −1 | −1 2 −2 ] [ 2 −2 0 0 2 −1 3 0 −1 | −1 2 −2 ]

Use Row Operations on a Matrix

In the following exercises, perform the indicated operations on the augmented matrices.

204.

[ 6 −4 3 −2 | 3 1 ] [ 6 −4 3 −2 | 3 1 ]

Interchange rows 1 and 2

Multiply row 2 by 3

Multiply row 2 by −2−2 and add row 1 to it.

205.

[ 4 −6 3 2 | −3 1 ] [ 4 −6 3 2 | −3 1 ]

Interchange rows 1 and 2

Multiply row 1 by 4

Multiply row 2 by 3 and add row 1 to it.

206.

[ 4 −12 −8 4 −2 −3 −6 2 −1 | 16 −1 −1 ] [ 4 −12 −8 4 −2 −3 −6 2 −1 | 16 −1 −1 ]

Interchange rows 2 and 3

Multiply row 1 by 4

Multiply row 2 by −2−2 and add to row 3.

207.

[ 6 −5 2 2 1 −4 3 −3 1 | 3 5 −1 ] [ 6 −5 2 2 1 −4 3 −3 1 | 3 5 −1 ]

Interchange rows 2 and 3

Multiply row 2 by 5

Multiply row 3 by −2−2 and add to row 1.

208.

Perform the needed row operation that will get the first entry in row 2 to be zero in the augmented matrix: [12−3−4|5−1].[12−3−4|5−1].

209.

Perform the needed row operations that will get the first entry in both row 2 and row 3 to be zero in the augmented matrix: [1−233−1−22−3−4|−45−1].[1−233−1−22−3−4|−45−1].

Solve Systems of Equations Using Matrices

In the following exercises, solve each system of equations using a matrix.

210.

{ 2 x + y = 2 x y = −2 { 2 x + y = 2 x y = −2

211.

{ 3 x + y = 2 x y = 2 { 3 x + y = 2 x y = 2

212.

{ x + 2 y = −2 x + y = −4 { x + 2 y = −2 x + y = −4

213.

{ −2 x + 3 y = 3 x + 3 y = 12 { −2 x + 3 y = 3 x + 3 y = 12

In the following exercises, solve each system of equations using a matrix.

214.

{ 2 x 3 y + z = 19 −3 x + y 2 z = −15 x + y + z = 0 { 2 x 3 y + z = 19 −3 x + y 2 z = −15 x + y + z = 0

215.

{ 2 x y + 3 z = −3 x + 2 y z = 10 x + y + z = 5 { 2 x y + 3 z = −3 x + 2 y z = 10 x + y + z = 5

216.

{ 2 x 6 y + z = 3 3 x + 2 y 3 z = 2 2 x + 3 y 2 z = 3 { 2 x 6 y + z = 3 3 x + 2 y 3 z = 2 2 x + 3 y 2 z = 3

217.

{ 4 x 3 y + z = 7 2 x 5 y 4 z = 3 3 x 2 y 2 z = −7 { 4 x 3 y + z = 7 2 x 5 y 4 z = 3 3 x 2 y 2 z = −7

218.

{ x + 2 z = 0 4 y + 3 z = −2 2 x 5 y = 3 { x + 2 z = 0 4 y + 3 z = −2 2 x 5 y = 3

219.

{ 2 x + 5 y = 4 3 y z = 3 4 x + 3 z = −3 { 2 x + 5 y = 4 3 y z = 3 4 x + 3 z = −3

220.

{ 2 y + 3 z = −1 5 x + 3 y = −6 7 x + z = 1 { 2 y + 3 z = −1 5 x + 3 y = −6 7 x + z = 1

221.

{ 3 x z = −3 5 y + 2 z = −6 4 x + 3 y = −8 { 3 x z = −3 5 y + 2 z = −6 4 x + 3 y = −8

222.

{ 2 x + 3 y + z = 12 x + y + z = 9 3 x + 4 y + 2 z = 20 { 2 x + 3 y + z = 12 x + y + z = 9 3 x + 4 y + 2 z = 20

223.

{ x + 2 y + 6 z = 5 x + y 2 z = 3 x 4 y 2 z = 1 { x + 2 y + 6 z = 5 x + y 2 z = 3 x 4 y 2 z = 1

224.

{ x + 2 y 3 z = −1 x 3 y + z = 1 2 x y 2 z = 2 { x + 2 y 3 z = −1 x 3 y + z = 1 2 x y 2 z = 2

225.

{ 4 x 3 y + 2 z = 0 −2 x + 3 y 7 z = 1 2 x 2 y + 3 z = 6 { 4 x 3 y + 2 z = 0 −2 x + 3 y 7 z = 1 2 x 2 y + 3 z = 6

226.

{ x y + 2 z = −4 2 x + y + 3 z = 2 −3 x + 3 y 6 z = 12 { x y + 2 z = −4 2 x + y + 3 z = 2 −3 x + 3 y 6 z = 12

227.

{ x 3 y + 2 z = 14 x + 2 y 3 z = −4 3 x + y 2 z = 6 { x 3 y + 2 z = 14 x + 2 y 3 z = −4 3 x + y 2 z = 6

228.

{ x + y 3 z = −1 y z = 0 x + 2 y = 1 { x + y 3 z = −1 y z = 0 x + 2 y = 1

229.

{ x + 2 y + z = 4 x + y 2 z = 3 −2 x 3 y + z = −7 { x + 2 y + z = 4 x + y 2 z = 3 −2 x 3 y + z = −7

Writing Exercises

230.

Solve the system of equations {x+y=10xy=6{x+y=10xy=6 by graphing and by substitution. Which method do you prefer? Why?

231.

Solve the system of equations {3x+y=12x=y8{3x+y=12x=y8 by substitution and explain all your steps in words.

Self Check

After completing the exercises, use this checklist to evaluate your mastery of the objectives of this section.

This table has 4 columns 5 rows and a header row. The header row labels each column I can, confidently, with some help and no, I don’t get it. The first column has the following statements: Write the augmented matrix for a system of equations, Use row operations on a matrix, Solve systems of equations using matrices, Write the augmented matrix for a system of equations, Use row operations on a matrix. The remaining columns are blank.

After looking at the checklist, do you think you are well-prepared for the next section? Why or why not?

Citation/Attribution

This book may not be used in the training of large language models or otherwise be ingested into large language models or generative AI offerings without OpenStax's permission.

Want to cite, share, or modify this book? This book uses the Creative Commons Attribution License and you must attribute OpenStax.

Attribution information
  • If you are redistributing all or part of this book in a print format, then you must include on every physical page the following attribution:
    Access for free at https://openstax.org/books/intermediate-algebra/pages/1-introduction
  • If you are redistributing all or part of this book in a digital format, then you must include on every digital page view the following attribution:
    Access for free at https://openstax.org/books/intermediate-algebra/pages/1-introduction
Citation information

© Feb 9, 2022 OpenStax. Textbook content produced by OpenStax is licensed under a Creative Commons Attribution License . The OpenStax name, OpenStax logo, OpenStax book covers, OpenStax CNX name, and OpenStax CNX logo are not subject to the Creative Commons license and may not be reproduced without the prior and express written consent of Rice University.