If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:14:14

Video transcript

we've learned about matrix addition matrix subtraction matrix multiplication so you might be wondering is is there the equivalent of matrix division and before we get into that well let me introduce some concepts to you and then we'll see that there is something that maybe is it exactly division but it's analogous to it so before we introduce that let's I'm going to introduce you to the concept of an identity matrix so the identity matrix is a matrix and I'll denote that by capital I when I multiply it times another matrix times another matrix I don't know if I should write that day but anyway when I multiply it times another matrix I get that other matrix or when I multiply that matrix times the identity matrix I get the matrix again and it's important to realize in when we're doing matrix multiplication that direction matter so it's actually this is I've actually given you some information here that you know we can't just assume when we were doing regular multiplication that you know a times B is always equal to B times a it's important when we're doing matrix multiplication to kind of confirm that it matters what direction you do the multiplication in but anyway and I should I just want to make for this this works both ways only if we're dealing with only if we're dealing with square matrices it can work in one direction or another if if this matrix is non square but it won't work in both and you can think about that just in terms of how we learn matrix multiplication why that happens but anyway I've defined this matrix now what does this matrix actually look like it's actually pretty simple if we have a 2 by 2 matrix the identity matrix is 1 0 0 1 if you want 3 by 3 its 1 0 0 0 1 0 0 0 1 I think you see the pattern if you want a 4 by 4 the identity matrix is 1 0 0 0 0 1 0 0 0 0 1 0 0 0:01 so you can see all the identity matrix is for given dimension I mean we could extend this to an N by n matrix is that you just have ones along this top left to bottom right diagonals and everything else is a 0 so I've told you that let's prove that it actually works so let's take this matrix and multiply it times another matrix and confirm that that matrix doesn't change so if we take 1 0 0 1 let's multiply it times let's do a general matrix just so you see that this works for all numbers a b c d so what does that equal one time so we're going to multiply this row times this column one times a plus 0 times c is a and that row times this column 1 times B plus 0 times D that's B then this row times this column 0 times a plus 1 times C C and then finally this row times this column 0 times B plus 1 times D well that's just D there you have it and it might be a fun exercise to try it the other way around as well and I think if and actually it's or even better exercise to try this with a 3x3 and you'll see it all works out and and a good exercise for users to kind of think about why it works and if you think about it because you're getting your row information from here and your column information from here and essentially anytime you're multiplying let's say this vector times this vector you're multiplying the corresponding terms and then adding them right so if you have a 1 and a 0 the 0 is going to cancel out anything but the first term in this column vector so that's why you're just left with a and that's why it's going to cancel out everything with the first term in this column vector and that's why you're left with just B and similarly this will cancel out everything but the second term so that's why you're left with just C there right this times this you're just left with C this times this you just left with D and that same thing applies when you go to 3x3 or n by n vectors so that's interesting you have the identity vector now if we wanted to complete our analogy so let's say goodbye we know in regular mathematics if I have you know 1 times I get a and we also know that one over a times a this is just regular math this has nothing to do with matrices is equal to one right so and you know we call this the inverse of a and that's also the same thing as dividing by the number a right so is there a matrix analogy is there a matrix and let me switch colors because I've used this green a little bit too much is there a matrix where if I have the matrix a and I multiply it by this matrix and I'll call that the inverse of a is there a matrix where I am left with not the number one but I'm left with kind of the one equivalent in the matrix world where I'm left with the identity matrix and it would be extra nice if I could actually switch this multiplication around so a time times a inverse should also be equal to the identity matrix and if you think about it if both of these things are true then they're actually not only is a and versity inverse of a but a is also the inverse of a inverse so they're each other's inverses that's the only that's all I meant to say it turns out there is such a matrix it's called the inverse of a as I've said three times already and I will now show you how to calculate it so let's do that and we'll see calculating it for 2x2 is fairly straightforward although you might see think it's a little mysterious as to how people came up with the with the the mechanics of it or the algorithm for it 3x3 becomes a little hairy 4x4 will take you all day 5x5 well you know you're you're almost definitely going to do a careless mistake if you did a did the inverse of a 5x5 matrix and that's better left to to a computer but anyway how do we calculate the matrix so let's do that and then what will confirm that it really is the inverse so if I have a matrix a if I have a matrix a and that is let's just say a b c d and i want to calculate the inverse it's inverses actually and this is going to seem like voodoo and in future videos i will give you a little bit more intuition for why this works or actually show you how this came about but for now it's almost better just to memorize the steps just so you have the confidence that you know that you can calculate an inverse it's equal to one over this number times this a times D minus B times C a D minus BC and this quantity down here ad minus BC will we'll learn soon has a special well actually we'll have to learn it soon and that's called the determinant of the matrix a and we're going to multiply that and so this is just a number right this is just a scalar quantity and we're going to multiply that by you switch the a and the D do you switch the top left on the bottom right so you're left with D and a and you make these two you make the bottom left to the top right you make them negative so minus C and minus B and the determinant and once again this is something that you're just going to have to take a little bit on faith right now in future videos I promise to give you more intuition but it's actually kind of sophisticated to learn what the determinant is and if you're doing this in your high school class you kind of just have to know how to calculate it although I don't like telling you that so what is this so this is that this is also called the determinant of AIDS and you might see on an exam you know figure out the determinant of a so that let me just tell you that and that's donated by a and kind of absolute value signs and that's equal to ad minus BC so another way of saying this this could be 1 over the determinant so you could write a inverse is equal to 1 over the determinant of a times D minus B minus C a anyway you look at it but let's apply this to a real problem and you'll see that it's actually not so bad so let's say that I have a matrix let's take change letter it's just so you know it doesn't always have to be an A let's say I have a matrix B and the matrix B is 3 I'm just going to pick random numbers - 4 - -5 let's calculate B inverse so B inverse is going to be equal 1 over the determinant of B what's the determinant it's 3 times -5 minus 2 times minus 4 so 3 times minus 5 is minus 15 minus 2 times minus 4 2 times minus 4 is minus 8 we're going to subtract that 2 plus 8 plus 8 and we're going to multiply that times multiply that times what well we switch these two terms so it's minus 5 and 3 and we just make these 2 terms negative minus 2 and 4 right 4 is minus 4 so now it becomes 4 and let's see if we can simplify this a little bit so B inverse is equal to it's minus 15 plus 8 that's minus 7 so this is minus 1/7 so the determinant of B we could you know we could write B is determinant is equal to minus 7 that's minus 1/7 times minus 5 4 minus 2 3 which is equal to this is just a scalar this is just a number so we multiply times each of the elements so that is equal to minus minus plus so it's 5/7 5 7 s minus 4/7 see positive two 7s two 7s and then minus 3/7 minus 3/7 it's a little hairy we ended up with fractions and here in things but let's confirm that this really is the inverse of the matrix B let's multiply the math but before I do that create some space we create some space here I don't even need this anymore there you go okay so let's confirm that that times this or this times that is really equal to the identity matrix so let's do that so let me switch colors so B inverse is five over seven if I haven't made any careless mistakes - four or seven to over seven minus three or seven that's B inverse and let me multiply that by B 3 - 4 - -5 now this is going to be the product matrix I need some space to my calculations let's see first I'm going to take this let me take switch colors I'm going to take this row times this column so 5/7 times 3 is what 15 over 7 15 over 7 top up plus minus 4/7 times 2 so minus 4/7 times 2 is its - let me make sure that's right 5 times 3 is 15 over 7 - 4 - all right right 4 times 2 is 4 minus 8 over 7 minus 8 over 7 now we're going to multiply this row times this column so 5 times minus 4 is minus 20 over 7 so minus 20 over 7 plus minus 4 right so minus 4/7 times minus 5 that is plus 20 over 7 plus 20 over 7 my my brain is starting to slow down having to do matrix multiplications with fractions with negative numbers but this is a good exercise for for multiple parts of the brain but anyway so let's go down to this term so we're going to multiply we're going to multiply this row times this column so 2 7 times 3 is 6 7 plus -3 7 times 2 so that's minus 6 7 one term left homestretch 2/7 times minus 4 is minus eight seven - eight seven straight 2/7 times four is minus eight sevens plus minus 3/7 times minus five so those negatives cancel out and we're left with plus 15 over 7 do you know / 7 and if we simplify what do we get 15 7s - eight seven - seven sevens well that's just one this is zero clearly this is zero six seven two minus 6/7 is 0 and then minus eight sevens + 15 sevens that's 7/7 that's one again and there you have it we have actually managed to inverse this matrix and actually as you see it was actually harder to prove that it was Z inverse by multiplying it just going to do all this this this fraction and negative number math but hopefully that that satisfies you and you could try it the other way around to confirm that if you multiply the other way you would also get the identity matrix but anyway that is how you calculate the inverse of a 2x2 and as we'll see in the next video calculating by the universe of a 3x3 matrix is even more fun see you soon