Solving a System of Linear Equations Using Matrices

We have seen how to write a system of equations with an augmented matrix, and then how to use row operations and back-substitution to obtain row-echelon form. Now, we will take row-echelon form a step farther to solve a 3 by 3 system of linear equations. The general idea is to eliminate all but one variable using row operations and then back-substitute to solve for the other variables.

Example 6: Solving a System of Linear Equations Using Matrices

Solve the system of linear equations using matrices.

xy+z=82x+3yz=23x2y9z=9xy+z=82x+3yz=23x2y9z=9

Solution

First, we write the augmented matrix.

[111231329 | 829]111231329 | 829

Next, we perform row operations to obtain row-echelon form.

2R1+R2=R2[111053329|8189]3R1+R3=R3[1110530112|81815]2R1+R2=R2111053329|81893R1+R3=R31110530112|81815

The easiest way to obtain a 1 in row 2 of column 1 is to interchange R2R2 and R3R3.

InterchangeR2andR3[111801121505318]InterchangeR2andR3111801121505318

Then

5R2+R3=R3[11101120057|81557]157R3=R3[1110112001|8151]5R2+R3=R311101120057|81557157R3=R31110112001|8151

The last matrix represents the equivalent system.

 xy+z=8 y12z=15 z=1 xy+z=8 y12z=15 z=1

Using back-substitution, we obtain the solution as (4,3,1)(4,3,1).

Example 7: Solving a Dependent System of Linear Equations Using Matrices

Solve the following system of linear equations using matrices.

x2y+z=12x+3y=2y2z=0x2y+z=12x+3y=2y2z=0

Solution

Write the augmented matrix.

[121230012 | 120]121230012 | 120

First, multiply row 1 by 11 to get a 1 in row 1, column 1. Then, perform row operations to obtain row-echelon form.

R1[121123020120]R1121123020120
R2R3[121012230 |102]R2R3121012230 |102
2R1+R3=R3[121012012|100]2R1+R3=R3121012012|100
R2+R3=R3[121012000|210]R2+R3=R3121012000|210

The last matrix represents the following system.

 x+2yz=1 y2z=0 0=0 x+2yz=1 y2z=0 0=0

We see by the identity 0=00=0 that this is a dependent system with an infinite number of solutions. We then find the generic solution. By solving the second equation for yy and substituting it into the first equation we can solve for zz in terms of xx.

 x+2yz=1 y=2zx+2(2z)z=1 x+3z=1 z=1x3 x+2yz=1 y=2zx+2(2z)z=1 x+3z=1 z=1x3

Now we substitute the expression for zz into the second equation to solve for yy in terms of xx.

 y2z=0 z=1x3y2(1x3)=0 y=22x3 y2z=0 z=1x3y2(1x3)=0 y=22x3

The generic solution is (x,22x3,1x3)(x,22x3,1x3).

Try It 5

Solve the system using matrices.

x+4yz=42x+5y+8z=15x+3y3z=1x+4yz=42x+5y+8z=15x+3y3z=1

Q & A

Can any system of linear equations be solved by Gaussian elimination?

Yes, a system of linear equations of any size can be solved by Gaussian elimination.

How To: Given a system of equations, solve with matrices using a calculator.

  1. Save the augmented matrix as a matrix variable [A],[B],[C],[A],[B],[C],.
  2. Use the ref( function in the calculator, calling up each matrix variable as needed.

Example 8: Solving Systems of Equations with Matrices Using a Calculator

Solve the system of equations.

5x+3y+9z=12x+3yz=2x4y+5z=15x+3y+9z=12x+3yz=2x4y+5z=1

Solution

Write the augmented matrix for the system of equations.

[539231145 | 521]539231145 | 521

On the matrix page of the calculator, enter the augmented matrix above as the matrix variable [A][A].

[A]=[539123121451][A]=539123121451

Use the ref( function in the calculator, calling up the matrix variable [A][A].

ref([A])ref([A])

Evaluate.

[13595150113214700124187]x+35y+95z=15 y+1321z=47 z=24187⎢ ⎢ ⎢13595150113214700124187⎥ ⎥ ⎥x+35y+95z=15 y+1321z=47 z=24187

Using back-substitution, the solution is (61187,92187,24187)(61187,92187,24187).

Example 9: Applying 2 × 2 Matrices to Finance

Carolyn invests a total of $12,000 in two municipal bonds, one paying 10.5% interest and the other paying 12% interest. The annual interest earned on the two investments last year was $1,335. How much was invested at each rate?

Solution

We have a system of two equations in two variables. Let x=x= the amount invested at 10.5% interest, and y=y= the amount invested at 12% interest.

 x+y=12,0000.105x+0.12y=1,335 x+y=12,0000.105x+0.12y=1,335

As a matrix, we have

[110.1050.12 | 12,0001,335][110.1050.12 | 12,0001,335]

Multiply row 1 by 0.1050.105 and add the result to row 2.

[1100.015 | 12,00075][1100.015 | 12,00075]

Then,

0.015y=75 y=5,0000.015y=75 y=5,000

So 12,0005,000=7,00012,0005,000=7,000.

Thus, $5,000 was invested at 12% interest and $7,000 at 10.5% interest.

Example 10: Applying 3 × 3 Matrices to Finance

Ava invests a total of $10,000 in three accounts, one paying 5% interest, another paying 8% interest, and the third paying 9% interest. The annual interest earned on the three investments last year was $770. The amount invested at 9% was twice the amount invested at 5%. How much was invested at each rate?

Solution

We have a system of three equations in three variables. Let xx be the amount invested at 5% interest, let yy be the amount invested at 8% interest, and let zz be the amount invested at 9% interest. Thus,

 x+y+z=10,0000.05x+0.08y+0.09z=770 2xz=0 x+y+z=10,0000.05x+0.08y+0.09z=770 2xz=0

As a matrix, we have

[1110.050.080.09201 | 10,0007700]1110.050.080.09201 | 10,0007700

Now, we perform Gaussian elimination to achieve row-echelon form.

0.05R1+R2=R2[11100.030.04201|10,0002700]2R1+R3=R3[11100.030.04023|10,00027020,000]10.03R2=R2[0110143023|10,0009,00020,000]2R2+R3=R3[11101430013|10,0009,0002,000]0.05R1+R2=R211100.030.04201|10,00027002R1+R3=R311100.030.04023|10,00027020,00010.03R2=R20110143023|10,0009,00020,0002R2+R3=R3⎢ ⎢11101430013|10,0009,0002,000⎥ ⎥

The third row tells us 13z=2,00013z=2,000; thus z=6,000z=6,000.

The second row tells us y+43z=9,000y+43z=9,000. Substituting z=6,000z=6,000, we get

y+43(6,000)=9,000y+8,000=9,000y=1,000y+43(6,000)=9,000y+8,000=9,000y=1,000

The first row tells us x+y+z=10,000x+y+z=10,000. Substituting y=1,000y=1,000 and z=6,000z=6,000, we get

x+1,000+6,000=10,000 x=3,000 x+1,000+6,000=10,000 x=3,000 

The answer is $3,000 invested at 5% interest, $1,000 invested at 8%, and $6,000 invested at 9% interest.

Try It 6

A small shoe company took out a loan of $1,500,000 to expand their inventory. Part of the money was borrowed at 7%, part was borrowed at 8%, and part was borrowed at 10%. The amount borrowed at 10% was four times the amount borrowed at 7%, and the annual interest on all three loans was $130,500. Use matrices to find the amount borrowed at each rate.

Solution