# How do you solve x+y+z=-9, x-y+5z=-19, 5x+y+z=-29 using matrices?

Oct 11, 2017

$x = - 5 , y = - 1 , z = - 3$

Oh my goodness these are tedious. But, here goes....

#### Explanation:

You have 3 equations in 3 unknowns, which you should know how to solve.

The matrix technique is a streamlined, shorthand version of the procedure. You start by writing the coefficients for the variables x, y, and z, together with the right hand side, as a matrix.
For this example, we would have:

[ (1,1,1,|,-9), (1,-1,5,|,-19), (5,1,1,|,-29) ]

(this is going to be hard to read because of the spacing between the numbers...)
The numbers in each column represent the coefficients of the variables in the corresponding equations.

...and then you manipulate this matrix using a set of rules, until you can read off the values for the variables. You want to end up with something like:

[ (1,0,0,|,x), (0,1,0,|,y), (0,0,1,|,z) ]
It's been years since I've done this, but some of the rules I can remember are:
- you can re-arrange the rows in any order you want.
- you can replace a row by adding or subtracting one of the other rows to it (or from it).
- you can replace a row by multiplying every value in it by a constant.
- you can combine these operations, but be careful to do the arithmetic correctly.
For this example, we can replace the bottom row with the remainder of subtracting from it the top row. So we'd get:

[ (1,1,1,|,-9), (1,-1,5,|,-19), (4,0,0,|,-20) ]

...see what I did there? 1st column is 5 -1, second column is 1 - 1, 3rd column is 1 - 1, last colum is -29 - (-9).
Now replace the bottom row by dividing every value by 4:

[ (1,1,1,|,-9), (1,-1,5,|,-19), (1,0,0,|,-5) ]

...the last row is the representation of : 1x + 0y + 0z = -5, so this lets you read off the value for the x variable: -5.
You now have to reduce the other two rows.
...replace the 2nd row with the result of adding rows 1 and 2:

[ (1,1,1,|,-9), (2,0,6,|,-28), (1,0,0,|,-5) ]

...replace the 2nd row by subtracting 2 times the 3rd row:

[ (1,1,1,|,-9), (0,0,6,|,-18), (1,0,0,|,-5) ]

...divide the 2nd row by 6:

[ (1,1,1,|,-9), (0,0,1,|,-3), (1,0,0,|,-5) ]

(which now gives you the value for z: -3

Now, replace row 1 by subtracting from it rows 2 and 3:

[ (0,1,0,|,-1), (0,0,1,|,-3), (1,0,0,|,-5) ]

In the textbooks, they always rewrite this in the classic "identity matrix" form, with 1's down the diagonal:

[ (1,0,0,|,-5), (0,1,0,|,-1), (0,0,1,|,-3) ]

so $x = - 5 , y = - 1 , z = - 3$

CHECK YOUR WORK. Plug these values back into the original equations and make sure the result is true:

$x + y + z = - 9$
$x - y + 5 z = - 5 - \left(- 1\right) + \left(5 \cdot \left(- 3\right)\right) = - 4 - 15 = - 19$
$5 x + y + z = - 25 - 1 - 3 = - 29$

GOOD LUCK