# Determinant when row is added

## Video transcript

Let's keep messing with our determinants to see if we can get more useful results. And they might not be obviously useful right now, but maybe we'll use them later when we are exploring other parts of linear algebra. So let's say I have some matrix, let's call it matrix X. Matrix X is equal to-- I'll just start with a 3 by 3 case because I think the 2 by 2 case is a bit trivial. Actually, why don't I just start with a 2 by 2 case. Let's say matrix X is a, b, and then it has x1, x2. I could have called these c and d, but you'll see why I called them x1 and x2 in a second. And I'll say I have another matrix. Let's say matrix Y is identical to matrix X except for this row. So matrix Y is a, b y1 and y2. And let's say we have a third matrix Z. That's identical to the first two matrices on the first row. So a, b. but on the second row it's actually the sum of the two rows of x and y. So it's going to be, this entry's going to be x1 plus y1, and this entry right here is x2 plus y2. Just like that. I want to be very clear, Z is not X plus Y. All of the terms of Z are not the sum of all the terms of X and Y. I'm only focusing on one particular row. And this is just a general theme that you'll see over and over again, and we saw it in the last video and I guess you'll see it here, is that determinants or finding the determinants of matrices aren't linear on matrix operations, but they are linear on operations that you do just to one row. So in this case, everything else is equal except for this row, and Z has the same first row as these guys, but its second row is the sum of the second row of these guys. So let's explore how the determinants of these guys relate. So the determinant-- let me do it in X's color. The determinant of X-- I'll write it like that-- is equal to a ax2 minus bx1. You've seen that multiple times. The determinant of Y is equal to ay2 minus by1. And the determinant of Z is equal to a times x2 plus y2 minus b times x1 plus y1, which is equal to ax2 plus ay2-- just distributed the a-- minus bx1 minus by1. And if we just rearrange things, this is equal to a-- let me write it this way-- this is equal to ax2 minus bx1. That's that term and that term, we switched colors. So that's those two guys. And then plus ay2 minus by1. Now what is this right here? That is the determinant of X. And this right here is the determinant of Y. So there you have it. If we have matrices that are completely identical except for one row-- and in this case it's a 2 by 2 matrix, so it looks like half of the matrix-- and Z's, that row that we're referring to that's different, Z's is the sum of the other two guys' rows, then Z's determinant is the sum of the other two determinants. So this is a very special case. I want to keep reiterating it. It only works in the case where this row and only this row is the sum of this row and this row, and the matrices are identical everywhere else. Let me show you the 3 by 3 case, and I think it'll be a little bit more general. And then we'll go to n by n. The n by n is actually, on some level, the easiest to do, but it's kind of abstract so I like to save that for the end. So let's redefine all those guys into the 3 by 3 case. So let's say that X is equal to a, b, c-- let's just do, let's make the third row the row we're going to use to determine our determinant. a, b, c, d, e, f-- actually let me do the middle row, because I don't want to make you think it always has to be the last row. So let's say it's x1, c2, x3, and you have d, e, f. And what's the determinant of X going to be? The determinant of X is going to be equal to-- let's say we're going along this row right here, that's the row in question. It's going to be equal to-- well you remember your checkerboard pattern-- so it's going to be-- remember, plus, minus, plus, minus, plus-- you remember all the rest how it goes. So it's going to start with a minus x1 times the sub matrix-- you get rid of that column, that row-- b, c, e, f. Then you have plus x2 times the sub matrix-- get rid of that column, that row-- a, c, d, f. And then finally minus x3-- you get rid of its row and column-- you have a, b, d, e. Now let me define another matrix Y that is identical to matrix X, except for that row. So it's a, b, c. Then down here d, e, f. That middle row is different. It's y1, y2, and y3. What's the determinant of Y going to be? Determinant of Y? Well it's going to be identical to the determinant of X because all the sub-matrices are going to be the same when you cross out this row and each of the columns. But the coefficients are going to be different. Instead of an x1, you have a y1. So it's going to be equal to minus y1 times the determinant b, c, e, f plus y 2 times the determinant of a, c, d f minus y3 times the determinant of a, b, d, e. I think you see where this is going. Now I'm going to create another matrix. I'm going to create another matrix Z just like that that is equal to-- it's identical to these two guys on the first and third rows, a, b, c, d, e, f. Just like that. But this row just happens to be the sum of this row and this row. And when we figured out this determinant we went along that row-- you can see that right there. So this row right here is going to be x1 plus y1, that's its first term. x2 plus y2, and then you have x3 plus y3. Now what's the determinant of Z going to be? Well, we can go down this row right there. So it's going to be minus x1 plus y1 times its sub-matrix-- get rid of that row, that column-- you get b, c, e, f. I think you definitely see where this is going. Plus this coefficient, plus x2 plus y2 times its sub-matrix-- get rid of that row, that column-- a, c, d, f. And then you have minus this guy right here, x3 plus y3 times its sub matrix-- get rid of that column and row-- a, b, d, e. Now what do you have right here? This is the determinant of Z. This right here is the determinant of Z. This thing right here. I think you can see immediately that if you were to add this to this you would get this right here, right? Because you have this coefficient and this coefficient on that. If you added them up you would get minus x1 plus y1. This guy and this guy add up to this guy. And then if I were to do this guy and this guy, add up to that guy. Let me do another one. And then finally that term plus that term add up to that term. So you immediately see that the determinant, or hopefully you immediately see, that the determinant of X plus the determinant of Y is equal to the determinant of Z. So we did it for the 2 by 2 case, we just did it for the 3 by 3 case. Might as well do it for the n by n case so we know that it works. But the argument is identical to this 3 by 3 case. So that's good to keep in your mind because 3 by 3 is easy to visualize, n by n is sometimes a little bit abstract. So let me re-define my matrices again. I'm just going to do the same thing over again. So I'm going to have a matrix X. But it's an n by n matrix. So let me write it this way. Let's say it is a 1, 1, a 1, 2, all the way to a 1, n. And there's some row here, let's say that there's some row here on row i-- let's call this row i right here-- and here it has the terms x1, x2, all the way to xn, but everything else is just the regular a's. So then you have a-- let me make this as a21, all the way to a2n. And then if you went all the way down here you would have an1, and you'd go all the way to ann. So essentially you could imagine our standard matrix where everything is defined in a, but I replaced row i with certain numbers that are maybe a little different. And I think you'll see where I'm going. Now let me define my other matrix. Let me define matrix Y. Let me define matrix Y to be essentially the same thing. This is a11-- it's the same a11. This is a12, all the way to a1n. This is a21, we could go all the way to a a2n. And then on row i, the same row, this is n by n, this is the same n by n-- if this was 10 by 10, this is 10 by 10. If this is row seven, then this is row seven. It has different terms. It's identical to matrix X except for row i. In row i it is y1, y2, all the way to yn. And if you keep going down, of course, you have an1, all the way to ann. Fair enough. Now let's say we have a third matrix. Let's have a third matrix. Let me draw it right here. So you have Z, Z is equal to-- I think you could imagine where this is going. Z is identical to these two guys except for row i. So let me write that out. So Z looks like this. You have a11, a12, all the way to a1n. And then you go down and then row i happens to be the sum of the row i of matrix X and matrix Y. So it is x1 plus y1, x2 plus y2, all the way to xn plus yn. And then it you keep going down, everything else is identical, an1 all the way to ann. So all of these matrices are identical except for row X has a different row i than matrix Y does. And row Z is identical everywhere except its row i is the sum of this row i and that row i. So it's a very particular case, but we can figure out their determinants. So what are the determinants? The determinant of X, the determinant of matrix X-- and hopefully you're maybe a bit comfortable with writing sigma notation, we did this in the last matrix. We can go down this row right there, and for each of these guys we can say so the determinant is going to be equal to the sum. Let's say we start from j is equal to 1-- j's going to be the column, so we're going to take the sum of each of these terms from j is equal to 1 to n. And then remember our checkerboard pattern, so we don't know if this is a positive or negative. We can figure it out by taking negative 1 to the i plus j-- remember, this is the ith row that we're talking about-- times xj-- xj is the coefficient, xsubj, times the sub matrix for xsubj. So if you get rid of this guy's row and this guy's column, what is it going to be? We could say that that's the same thing as the sub matrix, if we called this guy-- let me write it this way-- if we got rid of this guy's row and this guy's column, if we had just our traditional matrix where this wasn't replaced. If we just had an ai1 here, ai2, its sub matrix would be the same thing, because we're crossing out this row and this column. So it would be all of these guys and all of these guys down here. So it would be the sub matrix-- this is a n minus 1 by n minus 1 matrix-- it would be the sub matrix for aij. That's for the first term-- sorry, the determinant. Don't want to lose the determinant there-- times the determinant of the sub matrix aij. And so that's for the first term, and then you're going to add it to the second term, and then you're just going to keep doing that. That's what this sigma notation is. That's the determinant of X. Now what's the determinant of Y? The determinant of Y is equal to the sum-- we could do the same thing-- j is equal to 1 to n of negative 1 to the i plus j. We're going to go along this row right here, the ith row. So we're going to have ysubj-- right, we're going to start with ysub1, then plus ysub2, times the determinant of its sub matrix, which is the same as the determinant of this sub matrix. So you get rid of that row and that column for each of these guys, that everything else on the matrix is the same. So aij. The matrix of aij. Now what is the determinant of Z. I'm pretty sure you know exactly where this is going. The determinant-- this should be a capital Y right there-- the determinant of Z is equal to the sum, from j is equal to 1 to n, of negative 1 to the i plus j. We're going along this row. But now the coefficients are xj, that's what we're indexing along, xj plus yj. And then times its sub matrix, which is the same as these sub matrices. So aij, which you might immediately see is the sum of these two things. If I, for every j, I just summed these two things up, you're having two coefficients-- you could have this coefficient and that coefficient on your aij term, and then when you add them up you can factor this guy out and you will get this right here. So you get the determinant of X plus the determinant of Y is equal to the determinant of Z. So hopefully that shows you the general case. But I want to make it very clear, this is just for a very particular scenario where three matrices are identical, except for on one row. And one of the matrices on that special row just happens to be the sum of the other two matrices for that special row, and everything else is identical. That's the only time where the determinant of-- not the only time, but that's the only time we can make the general statement where the determinant of Z is equal to the determinant of X plus the determinant of Y. It's not the case-- let me write what is not the case-- so not the case that if Z is equal to X plus Y, it is not the case that the determinant of Z is necessarily equal to the determinant of X plus the determinant of Y. You cannot assume this. Determinant operations are not linear on matrix addition. They're linear only on particular rows getting at it. Anyway, hopefully you found that vaguely useful.