# Linear Algebra: Determinant Formulas and Cofactors

## Determinant Formulas and Cofactors

**Transcript:** OK, this is the second lecture on determinants.

There are only three. With determinants it's a fascinating, small topic inside linear algebra.

Used to be determinants were the big thing, and linear algebra was the little thing, but they -- those changed, that situation changed. Now determinants is one specific part, very neat little part.

And my goal today is to find a formula for the determinant.

It'll be a messy formula. So that's why you didn't see it right away. But if I'm given this n by n matrix then I use those entries to create this number, the determinant.

So there's a formula for it. In fact, there's another formula, a second formula using something called cofactors.

So you'll -- you have to know what cofactors are.

And then I'll apply those formulas for some, some matrices that have a lot of zeros away from the three diagonals. OK.

So I'm shooting now for a formula for the determinant.

You remember we started with these three properties, three simple properties, but out of that we got all these amazing facts, like the determinant of A B equals determinant of A times determinant of B.

But the three facts were -- oh, how about I just take two by twos. I know, because everybody here knows, the determinant of a two by two matrix, but let's get it out of these three formulas.

OK, so here's my, my two by two matrix.

I'm looking for a formula for this determinant. a b c d, OK. So property one, I know what to do with the identity.

Right? Property two allows me to exchange rows, and I know what to do then. So I know that that determinant is one. Property two allows me to exchange rows and know that this determinant is minus one.

And now I want to use property three to get everybody, to get everybody. And how will I do that? OK. So remember that if I keep the second row the same, I'm allowed to use linearity in the first row. And I'll just use it in a simple way. I'll write this vector a b as a 0 + 0 b. So that's one step using property three, linearity in the first row when the second row's the same. OK. But now you can guess what I'm going to do next. I'll -- because I'd like to -- if I can make the matrices diagonal, then I'm clearly there.

So I'll take this one. Now I'll keep the first row fixed and split the second row, so that'll be an a 0 and I'll split that into a c 0 and, keeping that first row the same, a 0 d. I used, for this part, linearity. And now I'll -- whoops, that's plus because I've got more coming.

This one I'll do the same. I'll keep this first row the same and I'll split c d into c 0 and 0 d. OK.

Now I've got four easy determinants, and two of them are -- well, all four are extremely easy.

Two of them are so easy as to turn into zero, right? Which two of these determinants are zero right away? The first guy is zero.

Why is he zero? Why is that determinant nothing, forget him? Well, it has a column of zeros.

And by the -- well, so one way to think is, well, it's a singular matrix. Oh, for, for like forty-eight different reasons, that determinant is zero. It's a singular matrix that has a column of zeros. It's, it's dead.

And this one is about as dead too. Column of zeros. OK.

So that's leaving us with this one.

Now what do I -- how do I know its determinant, following the rules? Well, I guess one of the properties that we actually got to was the determinant of that -- diagonal matrix, then -- so I, I'm finally getting to that determinant is the a d.

And this determinant is what? What's this one? Minus -- because I would use property two to do a flip to make it c b, then property three to factor out the b, property c to factor out the c -- the property again to factor out the c, and that minus, and of course finally I got the answer that we knew we would get.

But you see the method. You see the method, because it's method I'm looking for here, not just a two by two answer but the method of doing -- now I can do three by threes and four by fours and any size. So if you can see the method of taking each row at a time -- so let's -- what would happen with three by threes? Can we mentally do it rather than I write everything on the board for three by threes? So what would we do if I had three by threes? I would keep rows two and three the same and I would split the first row into how many pieces? Three pieces.

I'd have an A zero zero and a zero B zero and a zero zero C or something for the first row.

So I would instead of going from one piece to two pieces to four pieces, I would go from one piece to three pieces to -- what would it be? Each of those three, would, would it be nine? Or twenty-seven? Oh yeah, I've actually got more steps, right. I'd go to nine but then I'd have another row to straighten out, twenty-seven.

Yes, oh God. OK, let me say this again then.

If I -- if it was three by three, I would -- separating out one row into three pieces would give me three, separating out the second row into three pieces, then I'd be up to nine, separating out the third row into its three pieces, I'd be up to twenty-seven, three cubed, pieces.

But a lot of them would be zero.

So now when would they not be zero? Tell me the pieces that would not be zero. Now I will write the non-zero ones. OK, so I have this matrix. I think I have to use these, start using these double symbols here because otherwise I could never do n by n. OK.

OK. So I split this up like crazy.

A bunch of pieces are zero. Whenever I have a column of zeros, I know I've got zero. When do I not have zero? When do I have -- what is it that's like these guys? These are the survivors, two survivors there.

So my question for three by three is going to be what are the survivors? How many survivors are there? What are they? And when do I get a survivor.

Well, I would get a survivor -- for example, one survivor will be that one times that one times that one, with all zeros everywhere else. That would be one survivor.

A one one zero zero zero a two two zero zero zero a three three. That's like the a d survivor.

Tell me another survivor. What other thing -- oh, now here you see the clue. Now can -- shall I just say the whole clue? That I'm having -- the survivors have one entry from each row and each column. One entry from each row and column.

Because if some column is missing, then I get a singular matrix. And that, that's one of these guys. See, you see what happened with -- this guy? Column one never got used in 0 b 0 d. So its determinant was zero and I forget it. So I'm going to forget those and just put -- so tell me one more that would be a survivor? Well -- well, here's another one. a one one zero zero -- now OK, that's used up row -- row one is used.

Column one is already used so it better be zero.

What else could I have? Where could I pick the guy -- which column shall I use in row two? Use column three, because here if I use column -- here I used column one and row one.

This was like the column -- numbers were one two three, right in order. Now the column numbers are going to be one three, column three, and column two.

So the row numbers are one two three, of course.

The column numbers are some -- OK, some permutation of one two three, and here they come in the order one three two.

It's just like having a permutation matrix with, instead of the ones, with numbers.

And actually, it's very close to having a permutation matrix, because I, what I do eventually is I factor out these numbers and then I have got.

So what is that determinant equal? I factor those numbers out and I've got a one one times a two two times a three three.

And what does this determinant equal? Yeah, now tell me the, this -- I mean, we're really getting to the heart of these formulas now.

What is that determinant? By the laws of -- by, by our three properties, I can factor these out, I can factor out the a one one, the a two three, and the a three two. They're in separate rows.

I can do each row separately. And then I just have to decide is that plus sign or is that a minus sign? And the answer is it's a minus. Why minus? Because these is one row exchange to get it back to the identity. So that's a minus.

Now I through? No, because there are other ways. What I'm really through with, what I've done, what I've, what I've completed is only the part where the a one one is there.

But now I've got parts where it's a one two.

And now if it's a one two that row is used, that column is used. You see that idea? I could use this row and column.

Now that column is used, that column is used, and this guy has to be here, a three three.

And what's that determinant? That's an a one two times an a two one times an a three three, and does it have a plus or a minus? A minus is right.

It has a minus. Because it's one flip away from an id- from the, regular, the right order, the diagonal order. And now what's the other guy with a -- with, a one two up there? I could have used this row. I could have put this guy here and this guy here. Right? You see the whole deal? Now that's an a one two, a two three, a three one, and does that go with a plus or a minus? Yeah, now that takes a minute of thinking, doesn't it, because one row exchange doesn't get it in line.

So what is the answer for this? Plus or minus? Plus, because it takes two exchanges.

I could exchange rows one and three and then two and three.

Two exchanges makes this thing a plus. OK. And then finally we have -- we're going to have two more. Zero zero a one three, a two one zero zero, zero a three two zero.

And one more guy. Zero zero a one three, zero a two two zero, A three one zero zero.

And let's put down what we get from those.

An a one three, an a two one, and an a three two, and I think that one is a plus.

And this guys is a minus because one exchange would put it -- would order it. And that's a minus.

All right, that has taken one whole board just to do the three by three. But do you agree that we now have a formula for the determinant which came from the three properties? And it must be it.

And I'm going to keep that formula.

That's a famous -- that three by three formula is one that if, if the cameras will follow me back to the beginning here, I, I get the ones with the plus sign are the ones that go down like down this way. And the ones with the minus signs are sort of the ones that go this way.

I won't make that precise. For two reasons, one, it would clutter up the board, and second reason, it wouldn't be right for four by fours.

For four by four, let me just say right away, four by four matrix -- the, the cross diagonal, the wrong diagonal happens to come out with a plus sign.

Why is that? If I have a four by four matrix with ones coming on the counter diagonal, that determinant is plus. Why? Why plus for that guy? Because if I exchange rows one and four and then I exchange rows two and three, I've got the identity, and I did two exchanges.

So this down to this, like, you know, down toward Miami and down toward LA stuff is, like, three by three only. OK.

But I do want to get now -- I don't want to go through this for a four by four. I do want to get now the general formula. So this is what I refer to in the book as the big formula. So now this is the big formula for the determinant. I'm asking you to make a jump from two by two and three by three to n by n.

OK, so this will be the big formula.

That the determinant of A is the sum of a whole lot of terms. And what are those terms? And, and is it a plus or a minus sign, and I have to tell you which, which it is, because this came in -- in the three by three case, I had how many terms? Six. And half were plus and half were minus. How many terms are you figuring for four by four? If I get two terms in the two by two case, three -- six terms in the three by three case, what's that pattern? How many terms in the four by four case? Twenty-four.

Four factorial. Why four factorial? This will be a sum of n factorial terms. Twenty-four, a hundred and twenty, seven hundred and twenty, whatever's after that.

OK. Half plus and half minus.

And where do those n factorial -- terms come from? This is the moment to listen to this lecture. Where do those n factorial terms come from? They come because the first, the guy in the first row can be chosen n ways.

And after he's chosen, that's used up that, that column. So the one in the second row can be chosen n minus one ways. And after she's chosen, that second column has been used.

And then the one in the third row can be chosen n minus two ways, and after it's chosen -- notice how I'm getting these personal pronouns. But I've run out.

And I'm not willing to stop with three by three, so I'm just going to write the formula down.

So the one in the first row comes from some column alpha. I don't know what alpha is. And the one in the -- I multiply that by somebody in the second row that comes from some different column. And I multiply that by somebody in the third row who comes from some yet different column.

And then in the n-th row, I don't know what -- I don't know how to draw. Maybe omega, for last. And the whole point is then that -- that those column numbers are different, that alpha, beta, gamma, omega, that set of column numbers is some permutation, permutation of one to n. It, it, the n column numbers are each used once. And that gives us n factorial terms. And when I choose a term, that means I'm choosing somebody from every row and column. And then I just -- like the way I had this from row and column one, row and column two, row and column three, so that -- what was the alpha beta stuff in that, for that term here? Alpha was one, beta was two, gamma was three. The permutation was, was the trivial permutation, one two three, everybody in the right order. You see that formula? It's -- do you see why I didn't want to start with that the first day, Friday? I'd rather we understood the properties. Because out of this formula, presumably I could figure out all these properties. How would I know that the determinant of the identity matrix was one, for example, out of this formula? Why is -- if A is the identity matrix, how does this formula give me a plus one? You see it, right? Because, because almost all the terms are zeros. Which term isn't zero, if, if A is the identity matrix? Almost all the terms are zero because almost all the As are zero. It's only, the only time I'll get something is if it's a one one times a two two times a three three. Only, only the, only the permutation that's in the right order will, will give me something. It'll come with a plus sign.

And the determinant of the identity is one. So, so we could go back from this formula and prove everything. We could even try to prove that the determinant of A B was the determinant of A times the determinant of B.

But like next week we would still be working on it, because it's not -- clear from -- if I took A B, my God. You know --.

The entries of A B would be all these pieces.

Well, probably, it's probably -- historically it's been done, but it won't be repeated in eighteen oh six. OK.

It would be possible probably to see, why the determinant of A equals the determinant of A transpose.

That was another, like, miracle property at the end. That would, that would, that's an easier one, which we could find.

OK. Is that all right for the big formula? I could take you then a, a typical -- let me do an example.

Which I'll just create. I'll take a four by four matrix. I'll put some, I'll put some ones in and some zeros in.

OK. Let me -- I don't know how many to put in, to tell the truth.

I've never done this before. I don't know the determinant of that matrix. So like mathematics is being done for the first time in, in front of your eyes.

What's the determinant? Well, a lot of -- there are twenty-four terms, because it's four by four.

Many of them will be zero, because I've got all those zeros there. Maybe the whole determinant is zero. I mean, I -- is that a singular matrix? That possibility definitely exists. I could, I could, So one way to do it would be elimination.

Actually, that would probably be a fairly reasonable way.

I could use elimination, so I could use -- go back to those properties, that -- and use elimination, get down, eliminate it down, do I have a row of zeros at the end of elimination? The answer is zero.

I was thinking, shall I try this big formula? OK. Let's try the big formula.

How -- tell me one way I can go down the matrix, taking a one, taking a one from every row and column, and make it to the end? So it's -- I get something that isn't zero.

Well, one way to do it, I could take that times that times that times that times that.

That would be one and, and, and I just said, that comes in with what sign? Plus.

That comes with a plus sign. Because, because that permutation -- I've just written the permutation about four three two one, and one exchange and a second exchange, two exchanges puts it in the correct order.

Keep walking away, don't....

OK, we're executing a determinant formula here. Uh as long as it's not periodic, of course. If he comes back I'm in -- no.

All right, all right. OK, so that would give me a plus one. All right.

Are there any others? Well, of course we see another one here. This times this times this times this strikes us right away.

So that's the order three, the order -- let me make a little different mark here. Three two one four.

And is that a plus or a minus, three two one four? Is that, is that permutation a plus or a minus permutation? It's a minus.

How do you see that? What exchange shall I do to get it in the right order? If I exchange the one and the three I'm in the right orders, took one exchange to do it, so that would be a plus -- that would be a minus one.

And now I don't know if there're any more here.

Let's see. Let me try again starting with this. Now I've got to pick somebody from -- oh yeah, see, you see what's happening.

If I I start there, OK, column three is used.

So then when I go to next row, I can't use that, I must use that. Now columns two and three are used. When I come to this row I must use that. And then I must use that.

So if I start there, this is the only one I get.

And similarly, if I start there, that's the only one I get. So what's the determinant? What's the determinant? Zero.

The determinant is zero for that case.

Because we, we were able to check the twenty-four terms. Twenty-two of them were zero. One of them was plus one. One of them was minus one.

Add up the twenty-four terms, zero is the answer.

OK. Well, I didn't know it would be zero, I -- because I wasn't, like, thinking ahead.

I was a little scared, actually.

I said, that, apparition went by.

So and I don't know if the camera caught that.

So whether the rest of the world will realize that I was in danger or not, we don't know.

But anyway, I guess he just wanted to be sure that we got the right answer, which is determinant zero.

And then that makes me think, OK, the matrix must be, the matrix must be singular. And then if the matrix is singular, maybe there's another way to see that it's singular, like find something in its null space.

Or find a combination of the rows that gives zero.

And like what d- what, what combination of those rows does give zero. Suppose I add rows one and rows three. If I add rows one and rows three, what do I get? I get a row of all ones.

Then if I add rows two and rows four I get a row of all ones.

So row one minus row two plus row three minus row four is probably the zero row. It's a singular matrix.

And I could find something in its null space the same way.

That would be a combination of columns that gives zero.

OK, there's an example. All right. So that's, well, that shows two things.

That shows how we get the twenty-four terms and it shows the great advantage of having a lot of zeros in there.

OK. So we'll use this big formula, but I want to pick -- I want to go onward now to cofactors.

Onward to cofactors. Cofactors is a way of breaking up this big formula that connects this n by n -- this is an n by n determinant that we've just have a formula for, the big formula. So cofactors is a way to connect this n by n determinant to, determinants one smaller. One smaller.

And the way we want to do it is actually going to show up in this. Since the three by three is the one that we wrote out in full, let's, let me do this three by -- so I'm talking about cofactors, and I'm going to start again with three by three. And I'm going to take the, the exact formula, and I'm just going to write it as a one one -- this is the determinant I'm writing.

I'm just going to say a one one times what? A one one times what? And it's a one one times a two two a three three minus a two three a three two.

Then I've got the a one two stuff times something.

And I've got the a one three stuff times something.

Do you see what I'm doing? I'm taking our big formula and I'm saying, OK, choose column -- out of the first row, choose column one.

And take all the possibilities. And those extra factors will be what we'll call the cofactor, co meaning going with a one one. So this in parenthesis are, these are in, the cofactors are in parens. A one one times something. And I figured out what that something was by just looking back -- if I can walk back here to the, to the a one one, the one that comes down the diagonal minus the one that comes that way.

That's, those are the two, only two that used a one one. So there they are, one with a plus and one with a minus. And now I can write in the -- I could look back and see what used a one two and I can see what used a one three, and those will give me the cofactors of a one two and a one three.

Before I do that, what's this number, what is this cofactor? What is it there that's multiplying a one one? Tell me what a two two a three three minus a two three a three two is, for this -- do you recognize that? Do you recognize -- let's see, I can -- and I'll put it here. There's the a one one.

That's used column one. Then there's -- the other factors involved these other columns.

This row is used. This column is used.

So this the only things left to use are these.

And this formula uses them, and what's the, what's the cofactor? Tell me what it is because you see it, and then -- I'll be happy you see what the idea of cofactors. It's the determinant of this smaller guy. A one one multiplies the determinant of this smaller guy. That gives me all the a one one part of the big formula. You see that? This, the determinant of this smaller guy is a two two a three three minus a two three a three two.

In other words, once I've used column one and row one, what's left is all the ways to use the other n-1 columns and n-1 rows, one of each.

All the other -- and that's the determinant of the smaller guy of size n-1. So that's the whole idea of cofactors. And we just have to remember that with determinants we've got pluses and minus signs to keep straight. Can we keep this next one straight? Let's do the next one.

OK, the next one will be when I use a one two.

I'll have left -- so I can't use that column any more, but I can use a two one and a two three and I can use a three one and a three three. So this one gave me a one times that determinant. This will give me a one two times this determinant, a two one a three three minus a two three a three one. So that's all the stuff involving a one two. But have I got the sign right? Is the determinant of that correctly given by that or is there a minus sign? There is a minus sign. I can follow one of these. If I do that times that times that, that was one that's showing up here, but it should have showed -- it should have been a minus.

So I'm going to build that minus sign into the cofactor. So, so the cofactor -- so I'll put, put that minus sign in here. So because the cofactor is going to be strictly the thing that multiplies the, the factor. The factor is a one two, the cofactor is this, is the parens, the stuff in parentheses. So it's got the minus sign built in. And if I did -- if I went on to the third guy, there w- there'll be this and this, this and this. And it would take its determinant. It would come out plus the determinant. So now I'm ready to say what cofactors are. So this would be a plus and a one three times its cofactor. And over here we had plus a one one times this determinant. But and there we had the a one two times its cofactor, but the -- so the point is the cofactor is either plus or minus the determinant.

So let me write that underneath them.

What is the, what are cofactors? The cofactor if any number aij, let's say.

This is, this is all the terms in the, in the big formula that involve aij.

We're especially interested in a1j, the first row, that's what I've been talking about, but any row would be all right. All right, so -- what terms involve aij? So -- it's the determinant of the n minus one matrix -- with row i, column j erased. So it's the, it's a matrix of size n-1 with -- of course, because I can't use this row or this column again.

So I have the matrix all there. But now it's multiplied by a plus or a minus. This is the cofactor, and I'm going to call that cij. Capital, I use capital c just to, just to emphasize that these are important and emphasize that they're, they're, they're different from the (a)s. OK.

So now is it a plus or is it a minus? Because we see that in this case, for a one one it was a plus, for a one two I -- this is ij -- it was a minus.

For this ij it was a plus. So any any guess on the rule for plus or minus when we see those examples, ij equal one one or one three was a plus? It sounds very like i+j odd or even.

That, that's doesn't surprise us, and that's the right answer.

So it's a plus if i+j is even and it's a minus if i+j is odd.

So if I go along row one and look at the cofactors, I just take those determinants, those one smaller determinants, and they come in order plus minus plus minus plus minus. But if I go along row two and, and, and take the cofactors of sub-determinants, they would start with a minus, because the two one entry, two plus one is odd, so the -- like there's a pattern plus minus plus minus plus if it was five by five, but then if I was doing a cofactor then this sign would be minus plus minus plus minus, plus minus plus -- it's sort of checkerboard. OK.

OK. Those are the signs that, that are given by this rule, i+j even or odd.

And those are built into the cofactors.

The thing is called a minor without th- before you've built in the sign, but I don't care about those.

Build in that sign and call it a cofactor. OK. So what's the cofactor formula? What's the cofactor formula then? Let me come back to this board and say, what's the cofactor formula? Determinant of A is -- let's go along the first row.

It's a one one times its cofactor, and then the second guy is a one two times its cofactor, and you just keep going to the end of the row, a1n times its cofactor.

So that's cofactor for -- along row one.

And if I went along row I, I would -- those ones would be Is. That's worth putting a box over. That's the cofactor formula.

Do you see that -- actually, this would give me another way I could have started the whole topic of determinants.

And some, some people might do it this -- choose to do it this way.

Because the cofactor formula would allow me to build up an n by n determinant out of n-1 sized determinants, build those out of n-2, and so on.

I could boil all the way down to one by ones. So what's the cofactor formula for two by two matrices? Yeah, tell me that.

What's the cofactor for us? Here is the, here is the world's smallest example, practically, of a cofactor formula. OK.

Let's go along row one. I take this first guy times its cofactor. What's the cofactor of the one one entry? d, because you strike out the one one row and column and you're left with d.

Then I take this guy, b, times its cofactor.

What's the cofactor of b? Is it c or it's -- minus c, because I strike out this guy, I take that determinant, and then I follow the i+j rule and I get a minus, I get an odd. So it's b times minus c.

OK, it worked. Of course it, it worked. And the three by three works.

So that's the cofactor formula, and that is, that's an -- that's a good formula to know, and now I'm feeling like, wow, I'm giving you a lot of algebra to swallow here. Last lecture gave you ten properties. Now I'm giving you -- and by the way, those ten properties led us to a formula for the determinant which was very important, and I haven't repeated it till now.

What was that? The, the determinant is the product of the pivots. So the pivot formula is, is very important. The pivots have all this complicated mess already built in.

As you did elimination to get the pivots, you built in all this horrible stuff, quite efficiently.

Then the big formula with the n factorial terms, that's got all the horrible stuff spread out.

And the cofactor formula is like in between.

It's got easy stuff times horrible stuff, basically. But it's, it shows you, how to get determinants from smaller determinants, and that's the application that I now want to make.

So may I do one more example? So I remember the general idea.

But I'm going to use this cofactor formula for a matrix -- so here is going to be my example.

It's -- I promised in the, in the lecture, outline at the very beginning to do an example.

And let me do -- I'm going to pick tri-diagonal matrix of ones. I could, I'm drawing here the four by four. So this will be the matrix.

I could call that A4. But my real idea is to do n by n. To do them all.

So A -- I could -- everybody understands what A1 and A2 are.

Yeah. Maybe we should just do A1 and A2 and A3 just for -- so this is A4.

What's the determinant of A1? What's the determinant of A1? So, so what's the matrix A1 in this formula? It's just got that. So the determinant is one.

What's the determinant of A2? So it's just got this two by two, and its determinant is -- zero.

And then the three by three. Can we see its determinant? Can you take the determinant of that three by three? Well, that's not quite so obvious, at least not to me.

Being three by three, I don't know -- so here's a, here's a good example. How would you do that three by three determinant? We've got, like, n factorial different ways. Well, three factorial.

So we've got six ways. OK.

I mean, one way to do it -- actually the way I would probably do it, being three by three, I would use the complete the big formula.

I would say, I've got a one from that, I've got a zero from that, I've got a zero from that, a zero from that, and this direction is a minus one, that direction's a minus one. I believe the answer is minus one.

Would you do it another way? Here's another way to do it, look. Subtract row three from -- I'm just looking at this three by three.

Everybody's looking at the three by three.

Subtract row three from row two.

Determinant doesn't change. So those become zeros. OK, now use the cofactor formula.

How's that? How can, how -- if this was now zeros and I'm looking at this three by three, use the cofactor formula. Why not use the cofactor formula along that row? Because then I take that number times its cofactor, so I take this number -- let me put a box around it -- times its cofactor, which is the determinant of that and that, which is what? That two by two matrix has determinant one.

So what's the cofactor? What's the cofactor of this guy here? Looking just at this three by three. The cofactor of that one is this determinant, which is one times negative.

So that's why the answer came out minus one.

OK. So I did the three by three.

I don't know if we want to try the four by four.

Yeah, let's -- I guess that was the point of my example, of course, so I have to try it. Sorry, I'm in a good mood today, so you have to stand for all the bad jokes. OK. OK.

So what was the matrix? Ah.

OK, now I'm ready for four by four.

Who wants to -- who wants to guess the, the -- I don't know, frankly, this four by four, what's, what's the determinant.

I plan to use cofactors. OK, let's use cofactors.

The determinant of A4 is -- OK, let's use cofactors on the first row. Those are easy. So I multiply this number, which is a convenient one, times this determinant. So it's, it's one times the, this three by three determinant.

Now what is -- do you recognize that matrix? It's A3. So it's one times the determinant of A3. Coming along this row is a one times this determinant, and it goes with a plus, right? And then we have this one.

And what is its cofactor? Now I'm looking at, now I'm looking at this three by three, this three by three, so I'm looking at the three by three that I haven't X-ed out.

What is that -- oh, now it, we did a plus or a -- is it plus this determinant, this three by three determinant, or minus it? It's minus it, right, because this is -- I'm starting in a one two position, and that's a minus. So I want minus this determinant. But these guys are X-ed out.

OK. So I've got a three by three.

Well, let's use cofactors again.

Use cofactors of the column, because actually we could use cofactors of columns just as well as rows, because, because the transpose rule. So I'll take this one, which is now sitting in the plus position, times its determinant -- oh! Oh, hell. What -- oh yeah, I shouldn't have said hell, because it's all right.

OK. One times the determinant.

What is that matrix now that I'm taking the, this smaller one of? Oh, but there's a minus, right? The minus came from, from the fact that this was in the one two position and that's odd. So this is a minus one times -- and what's -- and then this one is the upper left, that's the one one position in its matrix, so plus.

And what's this matrix here? Do you recognize that? That matrix is -- yes, please say it -- A2.

And we -- that's our formula for any case.

A of any size n is equal to the determinant of A n minus one, that's what came from taking the one in the upper corner, the first cofactor, minus the determinant of A n minus two. What we discovered there is true for all n. I didn't even mention it, but I stopped taking cofactors when I got this one.

Why did I stop? Why didn't I take the cofactor of this guy? Because he's going to get multiplied by zero, and no, no use wasting time.

Or this one too. The cofactor, her cofactor will be whatever that determinant is, but it'll be multiplied by zero, so I won't bother.

OK, there is the formula. And that now tells us -- I could figure out what A4 is now. Oh yeah, finally I can get A4.

Because it's A3, which is minus one, minus A2, which is zero, so it's minus one.

You see how we're getting kind of numbers that you might not have guessed. So our sequence right now is one zero minus one minus one. What's the next one in the sequence, A5? A5 is this minus this, so it is zero. What's A6? A6 is this minus this, which is one.

What's A7? I'm, I'm going to be stopped by either the time runs out or the board runs out.

OK, A7 is this minus this, which is one.

I'll stop here, because time is out, but let me tell you what we've got. What -- these determinants have this series, one zero minus one minus one zero one, and then it starts repeating.

It's pretty fantastic. These determinants have period six. So the determinant of A sixty-one would be the determinant of A1, which would be one. OK.

I hope you liked that example. A non-trivial example of a tri-diagonal determinant. Thanks.

See you on Wednesday.