 Welcome back to our lecture series math 1050 college algebra for students at Southern Utah University. As usual I'll be your professor today Dr. Andrew Misseldine. Lecture 14 is a direct continuation of lecture 13 for which last time we were solving systems of linear equations by reducing the associated augmented matrix via the some type of combination of three elementary row operations and we would use these operations to transform the augmented matrix into an equivalent matrix which was an echelon form. When the matrix is an echelon form it was a whole lot easier to solve perhaps using the methods of back substitution and in this lecture 14 we want to continue doing that but instead of being so mysterious about it like we were in lecture 13 we want to be very precise about how we make the decisions we do and thus presenting the so-called Gauss-Jordan elimination algorithm here. Related to this is known as the Gauss elimination technique sometimes called Gaussian elimination. Some people use those two terms interchangeably Gaussian elimination versus Gauss-Jordan elimination. For the purpose of this class I'm not going to enforce a strict adherence to one term or the other there is a slight difference in technique and I'll point it out when we get there but honestly whichever approach you would take isn't going to make much of a difference for you as you work with this method to solve systems of linear equations. So let's talk about the Gauss-Jordan elimination technique. So the idea is that we use this technique to solve systems of linear equations and we first do that by translating a augmented matrix excuse me we first start by translating a linear system into an augmented matrix like we did in the previous lesson. So for the sake of example consider the following augmented matrix. So we'll have entries three zero three negative six augment with 18 that's the first row the second row will be three negative seven sixteen negative five and then lastly we have three negative nine twelve and negative nine. So this is just an example matrix and associated to this would be a system of linear equations. The first equation would be three y minus six z is equal to 18 the second equation would be three x minus seven y plus 16 z is equal to negative five and then the last equation would be three x minus nine y plus 12 z is equal to negative nine. Remember each of the columns inside the matrix in the side the coefficient side of the matrix is associated to a variable the right side this augmented column is associated to the right hand side of those equations and this vertical line is exactly where the equal signs would be. So we've just encoded the linear system as a matrix. So this is what we learned about in lesson 13 and we're going to utilize this to help us to solve some linear systems much more efficiently. So the first step of Gaussian elimination is once you have your augmented matrix here you're going to begin with the leftmost non-zero column. This is what's going to become the current pivot column and the pivot column will be at the very top of this column. All right so when you look at this matrix right here you don't see any zero columns a zero column would be like zero zero zero it has only zeros inside of it. Okay since we don't have anything like that the left column is the leftmost non-zero column that's typically going to be the case. So this right here is what we refer to as our pivot column and it gets the name pivot because the rest of the calculations the row operations we're going to do in in short order here is going to be pivoting around the pivot position we're now going to introduce in two sides of the matrix. Now given our pivot column we're going to put the pivot position in the topmost spot that we can do. Right now that's the very top of the column but as we start to move to the right in our matrix your next pivot position can't be higher than the previous pivot position because we're trying to put a matrix initial on form so you take the top most spot that the pivot position can be in for the very first column that's non-zero that's going to be the very top. Now it's okay that there's a zero in that position you just can't you don't have a pivot in a zero column but the pivot position could have a zero inside of it that's okay that actually leads to the second step in Gaussian elimination here so the second step is that you're going to select a non-zero entry in the pivot column and you're going to move it into the pivot position and you will want to use your interchange operation to do that okay so looking at our matrix here there is in fact a zero in the pivot column we don't in the pivot position excuse me we don't want a zero in the pivot position ideally we would love a one but honestly any non-zero number will work for us so we have to put something non-zero in the pivot position and we can do that by interchange and how we do that exactly it doesn't really matter as long as you grab some non-zero entry and put it in the pivot position because it's a non-zero column there is at least some number in that column that's non-zero make that interchange and it doesn't really matter which one you do for the sake of this example I'm going to interchange the first and third rows so interchanging row one and three which I will typically denote using this arrow here just connecting the rows that we're swapping here and so if we interchange those rows we'll get something like the following the third row now becomes the first row three minus nine sorry three negative nine twelve negative nine again then the second row we didn't do anything to it so three negative seven sixteen negative five and then the first rows down at the bottom zero three negative six eighteen so we interchange the two rows but be aware that the pivot position is still one one the top left position there and the pivot position didn't move but everything moves around the pivot position as we were explaining just a moment ago okay now with your pivot position it's really nice if you have a one in the pivot position there like so that's what I was just saying earlier now it's not necessary to have a one but it's super super nice the proper gauss-jordan elimination technique would actually postpone this step until later but if we can get a one in here that's really really nice why might you postpone it well there's a lot of possible reasons like if you took like for example if we had interchanged rows one and two so what have we put this row actually in the first spot in order to get a one in the pivot position you have to scale the entire row by three which is does perfectly great right here you get a one but here you would get a negative seven thirds here you get a sixteen thirds here you're going to get a negative five thirds fractions are a nightmare to most college algebra students and so dividing by three just to get a one isn't necessarily the best thing to do we can actually talk about that in a later video in this lecture here we'll stick with this one for now the reason I actually grabbed the third row as opposed to the second row is I noticed that in the third row which was originally the third row it's now the first row everyone in the first row is divisible by three so if I were to divide row one by three I could get a one in my pivot position which is extremely ideal but I also don't get any fractions because everyone was divisible by three so if you divide the first row by three we get one negative three four and negative three now again getting the entire row divisible by a factor is not always the simplest thing sometimes you have to accept fractions the good news is that you can usually procrastinate fractions so that's another thing you know we don't like fractions sometimes we like to procrastinate in which case in this situation we do both and it makes us all happy that's perfectly great so now we get a one in this position that's ideal not necessary step three sort of like an optional step when it comes to Gaussian elimination if you don't do it now you can do it later many of us like to do it now but certainly not at the price of introducing fractions into this thing okay so then we look at step four once we have a non-zero entry in a pivot position ideally a one we can start using row replacement to zero out all of the zeros above or below the pivot position right so with this matrix there is a three below the pivot position we want to get rid of that this one's already a zero so we don't have to do anything with it the nice thing about having a one in this pivot position is that in order to get rid of this number you're just going to look at that number and pick its additive inverse that is in order to get rid of the three we're going to replace row two with row two minus three times row one okay now if this number is not a one you're gonna have to probably use fractions to make this thing work so again this is the procrastination of the fractions here if we can we like to avoid the fractions as much as possible having a one in your pivot position is super nice in that regard okay so in that the next step now we're going to do replacement we've done interchange we've done scaling now we're going to do replacement so we're going to take row one and times everything by negative three for convenience i like to take this entire row we times everything by negative three and i'm going to write a little superscript up here so for the first column one times negative three is negative three for the next one negative three times negative three is positive nine the next one four times negative three is negative 12 and then for the last one negative three times three is again a positive nine like so and so then i just write these little superscripts because i don't want to do too much in my head the more i do in my head the more difficult this can get but at the same time i don't want to write endlessly lines of matrices right here so these little superscripts have been a useful tool to help us do our math with fewer mistakes i'm not changing anything in the first row so we're going to get one negative three four and negative three nothing in the third row changed either zero three negative six and 18 there it's the second row that changes again i'm going to add these superscripts here three minus three is zero i get a zero below the one which is what i was looking for negative seven plus nine is a positive two 16 minus 12 is a positive four and then nine minus five is a positive four as well and so at this point let's see we use row replacement to create zeros and all of the positions above and below the pivot in the first situation you didn't have a pivot you didn't have anything above the pivot so we just did everything below and so next what we're going to do is we're going to focus our attention because with this pivot column we've now finished it we have a one in the pivot position we have zeros everywhere else that's exactly what we want to do next we're going to switch our attention to this sub matrix um looking at the sub matrix here where is the first we're going to start repeating we're going to start repeating the operations here so we now look at the sub matrix and we identify so let's read step five here i didn't do that yet consider the sub matrix by ignoring any rows or columns containing a previously used pivot position so we're going to remove this row remove this column so we get a sub matrix so then we're going to start step one again which remember because you can't see it on the screen right now with step one we're going to look for the leftmost non-zero column which is going to be this one right here and then we're going to put a pivot in the very top now it's important you look at the sub matrix because even though that this number here is non-zero I only care about these right here if both of those numbers were zero we'd actually have to move over to the next column to look for the leftmost non-zero column even if this one is non-zero it's only in the sub matrix the rows and columns that contain pivots we're ignoring as we go through this algorithm so this is going to be our new pivot position so let's put it right here and then we we're going to repeat steps two through five that is we repeat this whole process until we finish so I'm going to move to another screen so I have a little bit more space to work this thing out here if I copy down the matrix we had just a moment ago because it's now gone the first column was now reduced row reduced so we had the one zero zero the next row currently looks like excuse me next column currently looks like negative three two and three uh then four four negative six and then negative three four and 18 like so okay our pivot position now is going to move to the two two spot and some people like to write all the pivot pivot positions that we've used so far like I might keep a box in the one one spot now and focusing on the two two spot and I want to start row reducing the matrix there all right so I have a two in the pivot position I would love it if there was a one a quick examination it's like oh wow everything in the second row is divisible by two so I could actually divide by two and then row reduce the matrix in that way oftentimes as you see these problems we're going to connect matrices together with this little twiddle symbol here the idea is these matrices are not equal to each other because as you change the numbers that changes the matrix and a matrix is only equal if all of the numbers inside of the matrix are equal to each other but it is row equivalent as in we do row operations to change the matrix and that's how they're the same they're not equal matrices they're row equivalent matrices are just equivalent matrices for short and so thus we don't use an equal sign we use a little twiddle to suggest the equivalence there so this gives me a one in the pivot position and the next thing I'm going to do is I'm now going to use row replacement I didn't have to interchange anything this time because I had a non-zero entry in my pivot and I actually like that one because I could get a one there very nicely so next what we're going to do is we're going to get rid of the zeros above and below the pivot so I want to get rid of this negative three right here so I'm going to take row one plus three times row two so what this means is I'm going to take one times three it goes right here two times three gives me a six and then two times three gives me another six if I add those together it's going to get rid of the negative three but I'm going to back to that in just a second I also want to get rid of this three right here and to do that I'm going to take row three and replace it with row three minus three times row two so this gives me a three sorry a minus three a minus six and a minus six right feel free to use lots of paper here because these matrices can get big but this I promise you is a very efficient way of writing these things down so I kind of can't see that matrix there let's do try this again so I didn't do anything to the first pivot column you never that's never going to change for the rest of the problem next we're going to get negative three plus three which is zero four plus six which is ten and then the augmented column there six minus three is equal to three the second row doesn't change this time zero one two and two and then for the third row we have the zero then we're going to have three minus three which is zero and then we're going to get negative six minus six be careful on that one it's not zero that's a negative 12 and then you're going to get 18 minus six which is 12 like so so now if you look at the first column it's completely row reduced to one in the pivot position zeroes everywhere else then you look at the second pivot column there's a one in the pivot position and there's zeros everywhere else it's completely row reduced so with that now done we move to the next column over and look for a non-zero number in rows that don't already have pivots so that means our next pivot position is going to be this one right here three three and then we continue to row reduce this thing I would level one to be there so if I would divide everything by negative 12 so take row three and divide everything by negative 12 fortunately again there's no fractions here I did choose this example so that in the end fractions were never needed because I know many of us are deathly afraid of those fractions so if you divide negative 12 by negative 12 you're going to get a one if you divide positive 12 by negative 12 you're going to get a negative one like so and so again we still have our pivots in particular it's this final pivot that we're interested in but for the sake of illustration I like to put all of the pivot boxes there now that we have a one in the pivot position we got rid of all the zeros in the column other than that one which means we got rid of this 10 right here we can do that by replacing row one with row one minus 10 times row three so we're going to get a negative 10 right here we're going to get a positive 10 right there now for the second row we want to get rid of this two right here to accomplish that we're going to replace row two with row two minus two times row three so we have one times negative two which is negative two we take negative one times negative two that gives us a positive two and then we're going to add these things together and our matrix to then be row reduced at that moment so looking at the first row you're going to go one zero zero ten minus ten is zero then you get three plus ten which is 13 then for the next row you're going to get zero one zero because again two minus two is zero then you're going to get two plus two which is four and then lastly you get zero zero one and then we didn't do anything to negative one that time so looking at the coefficient matrix we now have it row reduced this matrix now is in row reduced echelon form that is the coefficient matrix right here and then once it's in row reduced echelon form this right here should be in fact our solution then fact that the solution to this equation to the system of linear equations you have three variables x y and z for which x should equal 13 y should equal 4 and z should equal 1 that solves the that solves the problem the system of linear equations we accomplish this using this method of gaussian jordan elimination so the idea of gaussian jordan elimination is that you use repeated uses of scaling replacement and interchange to row reduce the coefficient matrix until you obtain the row reduced echelon form and once this once the coefficient matrix has been row reduced to its r re f then the augmented column should bear the solution to this system of linear equations we'll demonstrate how to do this in a few more examples but this at least explains the gaussian jordan elimination technique how we can use it to row reduce matrices and solve systems of linear equations