# Solving Systems of Equations Using Matrices

Instructor: Gerald Lemay

Gerald has taught engineering, math and science and has a doctorate in electrical engineering.

Systems of equations appear in all types of real-world applications. A nice way to solve these equations is to use matrix operations like row exchange, multiplication and addition. In this lesson, we show how this is done.

## Solving Systems of Equations

One of my favorite neighborhood stores is the no-name convenience store. They sell lots of food at wonderful prices. But this is a low-overhead store. The cans are not labeled and the prices are not quoted. You select your produce and pay for it with cash. This morning I bought 4 cans of soup and 3 cans of tuna. All for \$6.50. In the afternoon, I returned and paid \$2 for 1 can of soup and 1 can of tuna. No receipts are given at this store. The cost of each item is obvious. Or is it?

Using matrices, we will set up and solve the equations to determine the cost of each item.

## Setting Up the Equations

The morning \$6.50 purchase of 4 cans of soup and 3 cans of tuna could be written:

The afternoon shopping for 1 can of each totaling \$2 is the equation:

A matrix is convenient for storing the data in this system of equations. The number of cans purchased are the coefficients of the variables s and t. These coefficients are placed in a matrix having 2 rows and 2 columns. Let's call this the A matrix and write it as:

It is customary to write Ax = b where the x is a matrix with a single column containing the unknown variables. In our case, x has the s and t variables. The b is the right-hand side of the equations. For us, that's the 6.5 and the 2.

To include the right-hand side of our equations within the matrix, write a new matrix called C. This matrix is called the augmented matrix because we have made the matrix A 'bigger'. Here's the C matrix:

Before solving for the prices of the no-name food, let's look at some operations we can do to the augmented matrix.

## Operating on the Augmented Matrix

Exchanging one row for another in the augmented matrix is like re-ordering the equations. Multiplying a row by a constant is like multiplying each side of an equation by the same number. Both of these actions are allowed with ordinary equations. Also, we can add one row to another row. This makes sense in terms of how equations work because left-hand sides equal right-hand sides.

The solving strategy is to continue operating on the rows of the augmented matrix until:

We are done when the identity matrix has replaced the A matrix. An identity matrix has 1's along the diagonal and 0's everywhere else. The b1 value will be the solution for s while the b2 value is the solution for t.

If multiplying matrices is something new, here's a brief example. Let's say we would like to multiply the following two matrices:

The resulting matrix will have 2 rows and 2 columns. Row 1 of the first matrix is [2 3]. Multiply this with column 1 of the second matrix. This is a term-by-term multiplication where we add the products. It's 2(6) + 3(8) = 12 + 24 = 36. This 36 is entered as the first row, first column in the result matrix. Row 1 of the first matrix times column 2 of the second matrix is 2(7) + 3(9) = 14 + 27 = 41, which we put in the first row, second column of the result matrix. The first matrix, row 2 times the second matrix, column 1 gives 4(6) + 5(8) = 64. And the first matrix, row 2 times the second matrix column 2 is 4(7) + 5(9) = 73. The completed matrix multiplication is:

## Solving the System of Equations

To solve our system of equations, we want to turn the A part of our augmented matrix (the first 2 rows and 2 columns) into the identity matrix. Notice the second row of the C matrix for our convenience store prices has a 1 in the first entry.

We could exchange the first row with the second row. Then, the first row, first column entry would be set to a 1. The shorthand for this exchange is R1↔ R2. In words: row 1, R1, is exchanged with row 2, R2. This exchange of rows can happen by multiplying the C matrix with the following E matrix:

It's like magic! Multiplying by the E matrix, does a row exchange:

To unlock this lesson you must be a Study.com Member.

### Register to view this lesson

Are you a student or a teacher?

#### See for yourself why 30 million people use Study.com

##### Become a Study.com member and start learning now.
Back
What teachers are saying about Study.com

### Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.