this is our last video for section 2.2 in your textbook over elementary matrices and an algorithm for finding a inverse so before we start talking about elementary matrices I want to just make clear something that hopefully we already understand but I know that this course can just be a lot of new knowledge and so let's just reactivate that knowledge I have a matrix a it's obviously 3x3 and I have a matrix B that hopefully is very clear to you is the identity matrix with 3 rows and 3 columns because recall the identity matrix is made up of a diagonal of ones with all other values that was horrible circling with all other values being 0 and the whole point is if I take that identity matrix times any other matrix and we're actually going to multiply this out just for fun because who doesn't love multiplying matrices and hopefully before I even start multiplying this out you're saying professor brain don't waste my time I already know what the result is going to be and that's true hopefully you do because that's the point of the identity matrix but let's take one zero zero times my first column so I'll get 1 a + 0 D + 0 G so that's a and then time's the next column I would get 1 B + 0 e + 0 H and then times the next column and I would get 1 C + 0 F + 0 I and then I would move on to my next row 0 1 0 so 0 a + 1 D plus 0 G and hopefully we're sensing the pattern here and like I said this should have been the pattern that you knew was going to occur before I ever even started multiplying because the whole point of multiplying by the identity matrix is of course that I end up back where I started and that's what I did and notice I did the left vacation here and the reason I point that out is because with matrices we know it's important the order in which we multiply things multiplication is not commutative now knowing what just happened I want you to take a guess at what will occur when I take C times a so be thinking about that while I copy C and a so any guesses what do you think is gonna happen when I multiply C times a so the only difference between B and C is that C has a 4 where B has a 1 in that first row so my guess is something's going to get multiplied by 4 and hopefully you are being more specific than something but let's go ahead and see what happens so I'm going to take 4 0 0 times ad G so that first row times the first column and notice what I get is 4a plus 0 D plus 0 G so that's 4 a and then times the next column 4 B plus 0 e + 0 H so that's 4 B and then times the next column and I get 4 C plus 0 F plus 0 I and then moving on to the next two rows obviously and I'm not going to multiply those out because I already did on my last question and those two didn't change those two rows were exactly the same as they were up here so what happened when I made that a 4 is there some sort of row operation that we know let's just put it instead of an equal sign let's say what row operation did I use to get from well I don't want to make things confusing let's just recopy this a b c d e f g h i what row operation would i use to get to four a 4 B 4 c d e f g h i and hopefully we can say well if i took 4 times Row 1 that would be my new Row 1 so this obviously is a row operation that is equivalent to this matrix and that is a transformation because we know that these are just transformations so now that we're reminded about that relationship that exists between the row operations and the matrix and what transformation that is let's take a look at what an elementary matrix is an elementary matrix is a matrix obtained by performing only one row operation on an identity matrix so again I've rewritten that identity matrix for you up here because I'm just dealing with three by threes at this point and now let's take a look at E 1 what row operation is that equivalent to well I can see that these two rows seem to have been swapped and so that means Row 2 was swapped with Row 3 so if I want to undo that how am I going to do that and again if you need to take this times a b c d e f g h i to help you understand what happened I would get a b c and i would get 0 a plus 0 D plus 1 G and then I would get 0 B plus 0 e plus 1 H and 0 c plus 0 F plus 1 I and then I would get 0 a plus 1 D plus 0 G and so you get the idea that that's what would happen is that trim or sorry that swapped those two rows so if I want to undo that what would I then left multiply by this guy to get back here and by that I mean what is the inverse of this guy because we know the inverse means undo it so to get back from this matrix back to where I started I would then multiply again by this matrix so e1 inverse and II just means that it's an elementary matrix e1 inverse is 1 0 0 0 0 1 0 1 0 and again that means if I took that matrix and I multiplied it 0 0 1 0 1 0 and I multiply it by ABC gh i de f I shouldn't end up with a b c d e f g h i and i in fact do so the inverse again brings us back to where we started so I'm gonna erase this because I don't have enough room to show everything all right so now let's take a look and again the row operation that would switch it is of course just Row 3 swapped with row 2 or row 2 swapped with Row 3 looking at E 2 what would happen this one we should be familiar with because this is very similar to our last example on the previous slide this is obviously 5 times Row 2 would be my new Row 2 everything else remained the same and again notice that's just one row operation that's happening and I'm not going to multiply it by ABCDE F etc we already know what's going to happen we know that that second row is going to end up being 5 5 and 5 and hopefully you know that already based on the example that we just did so my question then is what is e 2 inverse which means what would I have to take times my new matrix to get back to where I started what would I have to do to undo what was done well if I had fives here then I would have to take zero because I don't want anything on the first row to change and 0 0 1 because I don't want anything in the last row to change but my middle row I want to be 1/5 of what it was before and again this correlates to my 1/5 Row 2 to be my new Row 2 last one let's take a look at what the row operation would be the first row remains the same the second row remains the same the third row it looks like I took 4 times Row 1 and added Row 3 to be my new Row 3 4 times Row 1 plus Row 3 to be my new Row 3 so now what now I have to be able to undo that or what is the inverse of e 3 how can I undo what was done so remember to undo what was done I really want this guy to get back to zero because that is going to get me back to what I started with and so my row operation would be negative for Row 1 plus Row 3 is my new Row 3 and that would look like zero oops 1 0 0 0 1 0 negative 4 0 1 and that would be my inverse of III and again I can always check that if I multiply III by the inverse of III and I'm not going to do that because I just don't have enough room ok I lied let's go ahead and do that if I multiply these I'm going to get hopefully the identity matrix because that's the whole point so I get 1 + 0 + 0 + 0 + 1 + 0 I'm sorry 0 + 0 + 0 + 0 + 0 + 0 next row I'm going to get 0 + 0 + 0 and then I'm going to get 0 + 1 + 0 + 0 + 0 + 0 and then my last row I'm going to get 4 plus 0 plus negative 4 which is 0 and then I'm going to get 0 + 0 + 0 and then I'm going to get 0 + 0 + 1 and notice I did multiply the matrix by the inverse and I ended up back at the identity now that we know what elementary matrices are we would need to talk about invertibility so we've talked about how to know if a 2x2 matrix is invertible but as we know in real life when we're dealing with values that we can put into matrices quite often it's not going to be two by two so I'm going to try to point out and this is going we're going to be talking about this a long time so I apologize then I'm going to try to point out the important things as we go first it says an N by n matrix so this is important because it tells us that this is a square matrix if it's not a square matrix it's not invertible so it has to be a square matrix it's invertible if and only if so hopefully you've seen this notation before if and only if means that we have to prove in two directions which means if P then Q needs to be proven and if Q then P needs to be proven and we'll do that together so hopefully I can make that make sense to you as we're proving this so we're saying we have the square matrix it's invertible if and only if a is row equivalent to i n which means of course to the identity matrix and any sequence of elementary row operations that reduces 8i n also transforms the identity to the inverse so let's kind of focus here on the first part an n-by-n matrix a is invertible if and only if a is row equivalent to the identity matrix so essentially we need to assume that a will row reduce to the identity and then prove invert invertible and then we need to assume it's invertible and prove that a reduces to the identity matrix so that's what I'm talking about here when I talk about proving in two directions so perhaps you've already done a lot of proofs like this but in case you haven't that's what it means when we say if and only if we'll get to all of this stuff here once we've done the proof so the first direction and I wasn't going to try to write and talk at the same time so here's the first direction so I'm assuming a is invertible that's this guy so I'm going to assume a is invertible since ax equals B has a unique solution for every B and that's theorem five from your textbook then a has a pivot position in every row which we already know from I don't remember what theorem it was but in our last chapter since a is a square matrix the pivots are in the diagonal which we know that implies that reduced row echelon form of a is the identity matrix so let's take a look at that again we assume it's invertible we know it has a solution for every B then a has a pivot position in every row and again we've got a square matrix and the pivot position in every row means these are all going to be ones however many ones we need and everything else is going to be zeros because that's how it works and no I'm sure I didn't get all of the zeros in here correctly but you get the idea missing several zeros but you get the idea that we know that if we have a matrix that is a square matrix and the only values are the diagonal and they're all ones then it of course is the identity matrix so we've proven the first direction now let's prove the second direction which is as you can see a little bit more involved so I'm going to try to walk you through this we are going to assume now that a row reduces to the identity that means that each step to row reduce a corresponds to left multiplication by an elementary matrix so let's talk about this sentence we just on our last slide talked about left multiplication and what that did that's what we're talking about here so we're saying we can do all of these row reduction steps using matrices instead of row operations and we're going to continue to multiply on the left side because that's the side we're going to need to multiply on for this all to work out and so essentially what's going to happen is if I have an elementary row operation 1 2 3 all the way up to P then I would start with the first so I'm going to have a and then I'm going to do that's equivalent to the elementary row operation the first one times a and then the second one times the result and then the third one times the result etc and we would continue to do that up until the point where we have this very last row operation and when I'm done I'm going to end up with the identity matrix because that's what we're assuming here that a does row reduced to the identity matrix now since the product of all of those elementary row operations of invertible matrices is invertible then we can say that if i take the inverse times all of those row operations times a then that's going to be equivalent to the inverse of all of those operations times the identity so why is that true because all I did was left multiplication times the inverse on each side from what I had just shown here now that also means then that a because as you'll notice what's going to happen with those two so a is equivalent to the inverse of all of that times the identity therefore a is invertible since it's the inverse of an invertible matrix so now we've proven the other direction so essentially i'm done with the proof but we really haven't gotten to why this is so important and it is so important and awesome and it's what we're going to do moving forward for anything that's not a two-by-two matrix so let's go back to this and any sequence of elementary row operations that reduces a to the identity also transforms the identity to the inverse so here's essentially what that means so we have any sequence of elementary row operations so I'm going to do the row operations all of these guys and that's what this is saying here all of these row operations that reduces a to the identity will also take the identity and turn it into the inverse of a which is fantastic so why do I care about that why am I so excited I'm math geeking out about it because all I have to do is do my normal row operations to reduce a to the identity and when I do that simultaneously I'm going to be turning the identity into the inverse and so that is how I'm going to solve for the inverse and that's what all of this stuff down here means so that might be very confusing I tried to explain it as best I could but it really makes so much more sense when we actually do a question together using this that brings us to the point of everything that we have just proven which is the algorithm for finding a inverse so in case you fell asleep while I was doing that last proof which is possible let's just recap what we know we know that if I can take a and row reduce it to the identity matrix then at the very same time the identity matrix using those same row operations can become a inverse or will become a inverse if it exists of course so this is how we know if it exists as we do the math so what that means for us is that we are going to take a 1 0 negative 2 negative 3 1 4 2 negative 3 4 on the left side on the right side we're going to put the identity matrix so what I'm going to do is I'm just going to do my normal row operations to turn the left side into reduced row echelon form also known as the identity matrix in this case because that's what's going to happen on the left so as I'm doing that I also have to do those same row operations on the right side and when I get done I'm just magically going to have a inverse so let's do this I should have done it ahead of time but I didn't so I'm hoping I don't mess up the first thing I'm going to do is of course I have one as my pivot which is what I wanted I need negative three to turn into a zero and two to turn into a zero so my first row operation I'm going to go ahead and copy this my first row operation is going to be to take three times Row one and add it to Row 2 so 3 times 1 is 3 plus negative 3 is 0 0 plus 1 is 1 negative 6 plus 4 is negative 2 3 plus 0 is 3 0 plus 1 is 1 and 0 plus 0 is 0 so again here's just your reminder whatever row operation you're doing to the left side you continue it on the right side then I also need to take Row 1 times negative 2 and add it to Row 3 so negative 2 plus 2 is 0 negative 2 times 0 is 0 plus negative 3 positive 4 plus 4 is 8 negative 2 plus 0 is negative 2 0 plus 0 is 0 and 0 plus 1 is 1 so far so good I have a pivot right here and I've got a pivot right here so obviously my next move is to turn that negative 3 into a 0 so Row 1 will remain the same whoa be very careful with your signs you don't want to have to keep doing this problem over and over Row 2 will remain the same and Row 3 I'm going to take Row 2 times 3 and add it to Row 3 so 0 3 times 1 is 3 plus 3 is 0 3 times negative 2 is negative 6 plus 8 is 2 3 times 3 is 9 plus negative 2 is 7 3 times 1 is 3 plus 0 is 3 3 times 0 is 0 plus 1 is 1 sorry if my mental math is annoying to you I have to say that loud or I will mess up next thing I've got one where I want it I've got one where I want it this guy is a pivot as well obviously I need to take half of everything sorry half of everything in Row 3 so Row 1 remains the same Row 2 remains the same Row 3 we go halfsies 0 0 1 7 halves 3 halves one half so we've got a pivot I've got a pivot I've got a pivot I need for my values here and here to become zeros so that is my next thing so I'm going to take 2 times Row 3 and add it to Row 1 so 2 times 0 plus 1 is 1 2 times 0 plus 0 0 2 times 1 plus negative 2 is 0 that's what I want it continued 7 halves times 2 is 7 plus 1 is 8 3 halves times 2 is 3 plus 0 is 3 and 1/2 times 2 is 1 plus 0 is 1 I'm going to do the same to Row 2 so 2 times Row 3 plus Row 2 0 plus 0 is 0 0 plus 1 is 1 2 plus negative 2 is 0 7 plus 3 is 10 3 plus 1 is 4 and 1 plus 0 is 1 this one is already where I want it so unless I made a glaring mistake this is now the identity and this is now a inverse so let's go back up here where we talked about it before a became the identity the inverse became I'm sorry the identity became a inverse so now the question is did I do it rights is that in fact the inverse how do I know well obviously I could use some technology to check it or to actually calculate it from the beginning but where is the fun in that if I take a inverse times a I should end up where big question where should I end up of course I should end up back at the identity so if I did everything correctly and I'm gonna double-check my signs before I multiply eight three one ten for one seven half three halves one half one zero negative two yep yep yep okay if I did everything right then would I multiply this I should end up at the identity so let's see if I know what I'm talking about let's take 8 plus negative 9 which is negative 1 plus 2 which is positive 1 whoo good thing so far and then 0 plus 3 plus negative 3 is 0 and then negative 16 plus 12 plus 4 is 0 so far I'm pretty excited 10 4 1 so I get 10 plus negative 12 which is negative 2 plus 2 which is 0 then I get 0 plus 4 plus negative 3 which is 1 and I get negative 20 plus 16 which is negative 4 plus 4 which is 0 woof I'm pretty stoked guys last one lots of fractions let's see how my mental math holds up 7 halves plus negative 9 halves is negative 2 halves or negative 1 plus positive 1 which is 0 0 plus 3 halves plus negative 3 halves is 0 and negative 7 plus 6 is negative 1 plus 2 is positive 1 I am the smartest person alive it's ok they gave yourself a pat on the back so what do I have here I have the identity matrix because I took a inverse times a I did it which means my solution for all of that a inverse is this side of the matrix which is of course 8 oops let's make that a better 8 8 3 1 10 4 1 7 halves three halves one half I do want to point one more thing out and that is in your textbook it doesn't show this line as it never does in our textbook which I hate but please do show that line I do want to see which side is which and I just think it makes a heck of a lot more sense