in this video we're going to focus on using the gaussian elimination to solve a system of equations with three variables so let's start with this problem let's say we have X Plus y minus Z is equal to negative two and two x minus y plus Z let's say that's equal to five Negative X plus 2y Plus 2z and let's say that's equal to one so how can we use matrices to solve this system of equations the first thing we need to do is convert it to an augmented Matrix so let's write the coefficients in this Matrix so we have One X plus one y minus one Z and let's use a vertical bar to separate the left side from the right side of the equation so I'm going to put negative 2 on this side now for the second equation the coefficients are 2 negative 1 and 1. now for the last equation it's negative 1 2 2 and 1. now what I'm going to do is convert this Matrix into row Echelon form so I want these three numbers to be one and I want these numbers to be zero so let's make those three numbers in blue zero first so what I'm going to do is I'm going to add Row one and Row three together and I'm going to apply that change to Row three so first let's rewrite the Matrix the first row is not going to change all of the changes will be applied to Row three so I can rewrite Row one row two is not going to change now Row one plus Row three so for column one it's going to be one plus negative 1 and so that's going to be zero and then it's one plus two which is three and then it's a negative one plus two which is one and then it's going to be negative two plus one which is negative one now the next thing I want to do is convert this 2 into a zero so I'm going to apply the changes to row 2. I'm going to multiply Row one by negative 2 because this will become negative 2. and then add that to row 2. so I'm going to write it out step by step for this one so here's the operation that I'm applying it's called The Matrix row operation so for column one and in row one we have an entry one so R1 is going to be one and for row two column one the entry is two so negative two plus two is zero so this is going to be zero now for column two we're going to use these two numbers so in column two R1 is 1. and R2 is negative one so this is going to give us negative 3. now for column three R1 is negative one and R2 is one so negative two times negative one is two and then add one to that that will give you three now for the fourth column R1 is negative two and R2 is 5. negative two times negative two is four plus five that's nine everything else will be the same so let's rewrite the other numbers and then let's get rid of this so what do you think is the next thing that we should do at this point now we need this number to be a zero so all we got to do is ADD rows two and three and we need to apply the changes in Row three so it's going to be R2 plus R3 so rule once and row two will stay the same so if we add R2 plus R3 from column one that's zero plus zero so that's equal to zero and for column two R2 plus R3 is going to be negative three plus three which is zero which is what we want and then for column three it's three plus one which is going to be four and then for the fourth column nine plus negative one is eight now if I wanted to I can convert this back to a system of linear equations and use back substitution to get X Y and Z in this form but what I want to do is convert it to row Echelon form so I want to convert these three numbers into a 1. I don't need to change this this is already one but these two they need to be converted into a one so therefore simultaneously for Row 2 I'm going to multiply by negative one-third R2 and for Row three I'm going to multiply it by 1 4. so Row 1 will not change so let's rewrite that and Row 2 we're going to multiply everything by negative one-third we'll divide everything by negative three so negative 3 divided by negative 3 or negative 3 times negative one-third that's positive one three times negative 1 3 is negative one and nine times negative one-third is negative 3. now 4 times 1 4 is 1 and 8 times 1 4 is 2. so now what we need to do is convert this back into a system of linear equations so column one is the coefficients for X this is for y and z so the first equation is X Plus 1y minus one Z is equal to two so the second one is one y minus one Z is equal to negative three and the last one is One X is equal to 2. so in this form we automatically get the solution for x now it shouldn't be X it should be Z because this is the column for Z so we should have that Z is equal to 2 and not X so we have the solution for Z and one other thing I missed this is negative two I forgot to transfer the sign here so that should be negative 2 as well so now that we have Z let's plug it into the second equation to get y so y minus Z or Y minus 2 is equal to negative 3. now let's add 2 to both sides so negative 3 plus 2 is negative 1. therefore y is equal to negative one now let's take Y and Z and let's plug it into the first equation so we're going to have X plus Y where Y is negative 1 minus Z and Z is two and that's equal to negative two so negative one minus two is negative 3. and if we add 3 to both sides negative two plus three is one so X is equal to 1. now we have the final answer so in the form of x y z it's going to be one negative one comma two so this is the solution and keep this in mind this form is rho echelon form where you have a diagonal of ones and zeros beneath it it really doesn't matter what's here so keep that in mind so that's the row Echelon form now let's work on another example so let's say we have 2X plus y minus Z let's say that's equal to one and three x plus 2y plus Z let's say that's equal to 10 and 2x minus y Plus 2z is equal to 6. so use the gaussian elimination with back substitution to solve this system of equations now I'm not going to convert it all the way to row Echelon form I simply want to make these three a zero if I do that I have enough to solve the system of equations use an elimination that is the gaussian elimination so first let's convert it into an augmented Matrix so the coefficients are two one negative one and then 3 2 1 with a 10 on the other side and then 2 negative 1 2 with a six so I'm going to convert this number into a zero first so therefore on Row three I'm going to subtract Row one and Row three so two minus two is zero and then one minus the negative one that's one plus one so that's going to be two and then negative one minus 2 that's negative three and one minus six is negative five everything else will stay the same so now notice that If I subtract actually I need to make this a zero I wanted to subtract these two if I do that this will no longer be zero now I'm going to apply changes to the second row so I'm going to multiply this number by negative 3. so this could become negative 6. and I'm going to multiply this number by 2. so that can become positive six and then apply the changes to row two so that this will turn into zero but first let's rewrite everything that don't change so rows one and three will not change so now let's write this equation for this row operation negative three r one plus 2r2 so for column one R1 is 2. and R2 that's Row 2 column one the entry is 3. so we have negative six plus six and that's equal to zero now for column two we're dealing with those numbers so R1 is one and row two column two the entry is 2. so that's a negative three plus four which is positive one now let's take the information for column three so in row one column three the entry is negative one and for row two column three the entry is one so we have negative three times negative one which is three plus two times one so that's equal to five now for column four Row one that's one and for row two it's ten so we have negative three plus twenty which is 17. now the next thing I need to do is make this a zero so I need to apply changes to Row three so I need to multiply this by negative 2 and then add it to this so it's going to be negative 2 R2 Plus R3 so let's write the operation first and let's be careful with every step so Row one is going to be the same Row 2 is not going to change but Row three will change so for row two and three column one it's zero and zero so negative two times zero plus zero that's not going to change that's going to be zero but for column two we should have some changes so if a column two row two the entry is one and column two Row three the entry is two it's a negative two plus two that will give us the zero that we wanted now for column three Row 2 that's going to be five and Row three is negative 3. so 2 negative 2 times 5 is negative 10 plus negative three that's going to be negative 13. and then we have column four negative two times R2 which is 17. plus R3 which is negative 5. so this is negative 34 plus negative 5. that's equal to negative 39. now once you have these three zeros you can go ahead and get all the answers without putting it in row Echelon form which is what we're going to do in this example so this is X y and z so the first Formula is going to be 2X Plus 1y minus 1z and that's equal to 1. and then it's going to be y Plus 5z which is equal to 17. and then negative 13 Z is equal to negative 39. so let's start with this formula and let's divide both sides by negative 13. negative 39 divided by negative 13 is negative 3. and that is the solution actually not negative three I'll take that back that is positive 3. but that's the solution for Z Z is equal to 3. two negative numbers I'm going to divided by each other should give us a positive result now let's take Z and plug it into the second equation so y plus five times three is equal to 17. 5 times 3 is 15. and if we subtract both sides by 15 minus 15 is 2. so y is equal to 2. now let's move on to the first equation so let me get rid of this so we have 2X plus y and Y is 2 minus Z but z a string so 2 minus 3 is negative 1. and if we add 1 to both sides one plus one is two and if we divide both sides by two we can see that X is equal to one so now we have everything so the answer is one comma two comma three x is one y is two Z is three and that's it