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

# n x n determinant

## Video transcript

so far we've been able to define the determinant for a two-by-two matrix this is our definition right here ad minus BC and then we were able to broaden that a bit by creating a definition for the determinant of a 3x3 matrix and we did that right here we did that right here where we essentially said the determinant is equal to each of these terms you could call these maybe the coefficient terms times the determinant of the matrix you can kind of view it as the sub matrix produce when you get rid of each of these guys column and row so when you got rid of this guy this guy's column and row you're left with this matrix so we said this guy times the determinant of this and then we kept switching signs minus this guy times the determinant if you remove his column in his row so it was left with these terms right there to get that determinant then finally you switch signs again so Plus this guy times the determinant of the 2x2 matrix if you get rid of this row and this column so it's this thing right here which was this matrix now let's see if we can extend this to a general n by n matrix so let's write out our and by n matrix right over here do it in blue so let's say I have some matrix a that is an N by n matrix so it's going to look like it's going to look like this this would be a 1 1 at B a 1 2 and we go all the way to you're going to have n columns a 1n and when you go down this is going to be your second row a21 it's going to go all the way down to a + 1 because you have n rows as well and then if you go down the diagonal all the way this right here would be a + n so there is my n by n matrix now before I define how to find the determinant of this let me make another definition let me define so this is my matrix a let me define let me define a sub matrix a I J to be equal to the this is n by n right so this is going to be an N minus 1 by n minus 1 matrix so this is 7 by 7 the sub matrix is going to be six by six one less in each of in each direction so this is going to be the n minus 1 by n minus 1 matrix matrix you get you get you get if you if you essentially ignore if you if you ignore or if you take away maybe I should say take away let's say ignore I like the word ignore if you ignore the I throw the I throw this right here is the road.the I throw and and the jth column column of a so for example let's go back to our 3x3 right here this thing could be denoted based on that definition I'd we could have called this this was a 1 1 this term right here we could denote the matrix when you get rid of the first column in the first row or the first or the first column we could call this thing right here we could call that big matrix a11 so this was big matrix a11 this is big matrix a 2 1 or actually this matrix was called C so this would be C 1 1 this would right there c 1 1 we could call this 1 this would be matrix c c1 2 c1 2 why is that because if you get rid of the first row if you get rid of the first row let me get rid of the first row right the first term is your row you get rid of the first row and the second column this is the matrix that's left over 2 3 4 1 so this is this guy and this guy 2 3 4 1 2 3 4 1 so this is the sub matrix C because this is the big matrix C but this one is C 1 2 I know it's a little bit messy there C 1 2 so that's all we mean by the sub matrix very similar to what we did in the 3x3 case you essentially get rid of so if you want to if you want to find out this guy's sub matrix you would call that a 1 1 and you would literally cross out the first row and the first column and everything left over here would be that sub-matrix now with that out of the way we can create a definition and it might seem a little circular to you at first and on some level it is we're going to define the determinant of a to be equal to to be equal this is interesting it's actually a recursive definition I'll talk about that in a second it's equal to we start with a plus it's equal to a11 times the sub matrix when you were if you remove this guy's row and column so that by definition is just a big capital a one one's determinant so that's exactly what we did let me write that a little bit neater so time's the determinant of the sub of its sub matrix so the determinant of a 1 1 so you take a 1 1 you get rid of its column it's row or its row and it's column and you everything else you find the determinant of that actually let me write it in terms of let me write it this way a 1 1 times the determinant of the sub-matrix a 1 1 and then we switch sides we're going to go along this row we're just going to go along this row and then you do minus a 1 2 times the determinant of its sub-matrix which we'll just call a 1/2 we would get rid of this row and this column and everything left would be it's this matrix a 1 2 we want to find its determinant and then we'll take the next guy over here would be a 1 3 so we switch signs with - now you go + so a 1 3 times the determinant of its sub-matrix so these are if this is you know this is n by n these are each you're going to be n minus 1 by n minus 1 so the determinant of a 1 3 and you're just going to keep doing that keep switching signs so it's going to be minus and then a plus and you keep going all the way and then I don't know it depends on whether a n whether we're dealing with an odd number or an even number if we're dealing with an even number this is going to be a minus sign if it's an odd number it's going to be a plus sign but you get the idea see there going to be a plus or minus not just if it's if it's odd this is going to be a plus if it's a if it's an even N or it's going to be a minus all the way to a1 n the nth column times its sub-matrix a1 n where that sub matrix get rid of the first row and the nth column and it's going to be everything that's left in between and you immediately might say Sal what kind of a definition is this you've defined and determinant for arbitrary n by n matrix in terms of another definition of a determinant how does this work and the reason why this works is because every the determinant that you use in the definition our determinant of a smaller matrix so this is a determinant of an N minus 1 by n minus 1 matrix now you're saying hey Sal that you know that still doesn't make any sense because we don't know how to find the determinant of an n minus 1 by n minus 1 matrix well you apply this definition again and then it's going to be in terms of n minus 2 times n or n minus 2 by n minus 2 matrices you like how do you do that well you keep doing it and you're going to get all the way down to a 2 by 2 matrix you're going to get all the way down to a 2 by 2 matrix and that one we defined well we define the determinant of a 2 by 2 matrix not in terms of a determinant we just defined it in terms of a times we defined it as let me write it up here it was a times D minus B times C and you can see I mean we could just go down to the 3 by 3 but the 2 by 2 is really the most fundamental definition and you could see that the definition of a 3 by 3 determinant is essentially it's a special case of the general case for an N by n we take this guy and we multiply him times the determinant of his sub matrix right there then we take this guy when we switch signs we have a minus and we multiply him times the determinant of his sub matrix which is that right there and you have then you do a plus you switch signs and then you took multiply this guy times the determinant of his sub matrix which is that right there so this is a general case of what I just defined but we know it's never that satisfying to deal in the abstract or the generalities we want to do a specific case and actually before I do that let me just introduce the term to you this is called a recursive formula recursive and if you become a computer science major you will see this a lot but a recursive function or recursive formula that is defined in terms of itself but the things that you use in the definition use a slightly simpler version of it and you keep going through you keep recursing through it you get simpler and simpler versions of it until you get to some type of base case in this case our base case is the case of a 2x2 matrix you keep doing this and eventually you'll get to a determinant of a 2 by 2 matrix and we know how to find those so this is a recursive definition recursive definition but let's actually apply it because I think that's what actually makes things concrete so let's take let's take a this is going to take be computationally intensive but I think if we focus we can get there so I'm gonna have a four by four matrix one two three four one throw some zeros in there to make the computation a little bit simpler zero one two three and then two three zero zero so let's figure out this determinant let's figure out this determinant right there this is the determinant of the matrix if I put some brackets there that would've been the matrix but this is must find the determinant of this matrix so this is going to be equal to by our definition it's going to be equal to 1 times the determinant of this matrix right here if you get rid of this row and this column so it's going to be 1 times the determinant of 0 2 0 1 2 3 3 0 0 that's just this guy right here this matrix right there then I'm going to have a 2 if I'm going to switch sign so it's minus 2 minus 2 times the determinant if I get rid of that row and this column so it's 1 2 0 I'm ignoring the 0 because they're in the same column as the 2 1 2 0 so 1 2 0 0 2 3 0 2 3 and then 2 0 0 2 0 0 and then I switch signs again it was a minus so now I go back to plus I do that guy so plus 3 times the determinant of his sub matrix get rid of that row get rid of that column I get a 1 0 0 1 0 0 I get a 0 1 3 right 0 1 3 0 1 3 I skipped this every time then I get a two three zero I get a two three zero just like that we're almost done one more in this column let me switch to another color and I could have used the blue in this yet so then I'm going to do a minus four remember it's plus minus plus minus four times the determinant of its sub-matrix that's going to be that right there so it's 1 0 2 0 1 2 2 3 0 just like that and now we're down to the 3 by 3 case we could use the definition of the 3 by 3 but we could just keep applying this recursive definition we could keep applying this recursive definition here so this is going to be equal to this is going to be equal to let me write it here so 1 times what's this determinant this determine is going to be 0 0 times the determinant of that sub matrix 2 3 0 0 2 3 0 0 that was this one right here and then we have minus 2 minus this 2 where I remember we switch signs plus minus plus so minus 2 times its sub-matrix so it's 1 3 3 0 1 3 3 0 and then finally plus 0 plus 0 times its sub-matrix which is this thing right here 1 2 3 0 1 2 3 0 just like that and then we have this next guy right here as you can see this can get a little bit tedious but we'll we'll keep our spirits up so minus 2 times minus 2 times 1 times its sub-matrix so that's this guy right here times the determinant of its sub-matrix 2 3 0 0 then minus 2 minus 2 times get rid of that row that column 0 3 2 0 0 3 2 0 and then plus 0 plus 0 times 0 2 2 0 0 2 2 0 that's this one right there halfway there at least for now and then we get this next one so we have a plus three plus three bring out our parentheses and then we're gonna have one times its sub I guess call it sub determinant so one times determinant one three three zero right you get rid of this guy's row and column you get this guy right there and then minus zero minus zero get rid of this row and column times zero three two zero zero three two zero and then you have plus zero plus zero times its sub determinant zero one two three zero one two three three-fourths of the way there one last term let's hope we haven't made any careless mistakes minus four times one times one two three zero right there one two three zero minus zero times get rid of those two guys zero two two zero zero two two zero and then plus two times zero one two three right plus to get rid of these guys zero one two three zero one two three now we've defined our or we've calculated or we've defined our determinant of this matrix in terms of just a bunch of two-by-two matrices so you hopefully you saw in this example that the recursion worked out so let's actually find what this number is equal to a determinant is always just going to be a number so let me get a nice vibrant color this is a zero times I don't kiss here times anything is going to be zero zero times anything is going to be zero zero times anything is going to be zero zero times anything is going to be zero just simplifying it these guys are zero because it's zero times at zero times this is going to be equal to zero so what are we left with what are we left with we this is going to be equal to one times this is all we have left here's a minus two times and what is this determinants 1 times 0 which is 0 its 0 let me write this this is going to be 1 times 0 0 - 3 times 3 0 - 9 so - 9 this right here is just minus 9 so minus 2 times minus 9 that's our first thing I'll simplify it in a second now let's do this term right here so it's minus 2 times now what's this determinant 2 times 0 minus 0 times 3 that's 0 minus 0 so this is 0 that guy became 0 so we can ignore that term this term right here 0 times 0 which is 0 minus 2 times 3 so it's minus 6 so it's minus 2 times so this is a minus 6 right here you have a minus 2 times a minus 6 so that's a plus 12 so I'll just write a plus 12 here this minus 2 is that minus 2 right there and then we have a plus 3 we have this plus 3 and then this first term is 1 times 0 which is 0 - make a parenthesis here 1 times 0 which is 0 minus 3 times 3 which is minus 9 times 1 so it's minus 9 everything else was a 0 or in the homestretch we have a minus of 4 minus 4 let's see this is 1 times 0 which is 0 minus 3 times 2 so minus 6 so this is minus 6 right here minus 6 this is 0 and then we have this guy right here so we have 0 times 3 which is 0 minus 2 times 1 so that's minus 2 that's minus 2 and then you have a minus 2 times a plus 2 is minus 4 so now we just have to make sure we do our arithmetic properly this is 1 times plus 18 so this is 18 right minus 2 times minus 9 this right here is minus 24 this right here is minus 27 and then this right here let's see this is minus 10 right here that is minus 10 minus 4 times minus 10 is plus 40 plus 40 plus 40 and let's see if we can simplify this a little bit if we simplify this a little bit I don't want to make a careless mistake right at the end so 18-24 18-24 24 minus 18 is 6 so this is going to be equal to minus 6 right 18 minus 24 is minus 6 and then we do it in green now what's the difference if we have minus 27 minus 27 plus 40 that's 13 right it's positive 13 so minus 6 plus positive 13 is equal to 7 and so we are done after all of that computation hopefully we haven't made a careless mistake the determinant of this character right here is equal to 7 the determinant is equal to 7 and so the one useful takeaway we know that this is invertible because it has a nonzero determinant hopefully you found that useful