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

More on matrix addition and scalar multiplication

More on Matrix Addition and Scalar Multiplication. Created by Sal Khan.

Want to join the conversation?

Video transcript

In the last video we started off with two linear transformations. We had the linear transformation s that was a mapping from Rn to Rm. And then we had the linear transformation t, that was also a mapping from Rn to Rm. And we defined the idea of the addition of these two transformations. So s plus t, this transformation of x we defined as being equal to s of x, this vector plus t of x. And of course, this input is still from Rn, and then each of these are vectors in Rm. If we add two vectors in Rm to each other, we get another vector in Rm because Rm is a valid subspace. It's also closed under addition. So this is still a mapping. So s plus t is still a mapping from Rn to Rm. And we also said that every linear transformation we've shown in a previous video, can be represented as a matrix. We could say that s of x is equal to some matrix a times x. And we could also say that t of x is equal to some matrix b times x. And both of these would be m by n matrices. And let me write that m by n, both of these. Because these are both mappings from Rn to Rm. And what we did is we made a another definition. This was a definition right here and then we made another definition. We defined the addition of two matrices. We said any matrix a plus b, they both have to have the same dimensions. So they're both m by n in this case. And we defined this addition to be a new matrix, where each column of this matrix is the sum of the corresponding columns of these matrices. So this matrix's first column will be the sum of a's first column and b's first column. So a1 plus b1, the second column I'll do a little line here is, a2 plus b2. And it goes all the way to An plus Bn. This was a definition. And the whole reason why we made this definition, is because if you defined matrix addition in this way, then this thing, when you replace it with Ax plus Bx, you get to that this thing over here is equal to the corresponding matrices by this definition, a plus b times x. This was the motivation to get to a nice expression, like this, for defining matrix addition in this way. Now this all seems very abstract, so let's actually add a matrix, or let's add two matrices. So we'll start off with a two-by-two case. So let's say I'm adding the matrix 1, 3, minus 2, 4 to the matrix, remember they have to have the same dimensions, to the matrix 2, 7, minus 3, minus 1. What do we get? Well by definition, you just add up their corresponding columns. You add up the first column. When you add up the corresponding columns, what happens when you add up two columns, two vectors? Well, you just add up their corresponding entries. So essentially, when you add up to matrices, you're just adding up all of the corresponding entries. I'll talk about it in this way, just because that's how I defined it, but they're all equivalent. The first thing, the first column, in this matrix right here, is going to be this column plus this column. So it's going to be 1 plus 2, let me write it like this, and then minus 2, minus 3. And then the second column, that one right there, is going to be 3 plus 7 and then 4 minus 1. And so this will be equal to 3, 10, minus 5, and 3, just like that. And notice, even though the definition is I'm adding up corresponding columns. Well, what in effect happened? Well, I'm just adding up the corresponding entries. I added the 1 to the 2, the 3 to the 7, the minus 2 to the minus 3, the 4 to the minus 1. It's that straightforward. Nothing fancier than that. In fact, we could have rewritten this definition. If we say that the vector or the matrix a is equal to a11 a12, all the way to a1n. And then if you go down this is a21 all the way to a1n. And then you go all the way down there to ann. We've seen that before. And then the matrix b, just by the same argument or by similar definition, this is b11, that entry is b11, that's b12, all the way to b1n. This is b21, second row, all the way down to bn, sorry this is m, we have m rows, so this is mn. So this right here is bm1, this would be bm2, all the way down to this is bmn, right there. Want to be very careful, these are m by n matrices. So this row down here is the mth row in both cases. But we could redefine our matrix, or another way of stating this matrix addition definition, is to say, if I'm going to add a plus b, I'm just going to add up the corresponding entries. So this entry up here is going to be-- do it in a different color --it's going to be a11 plus b11 this one's going to be a21 plus b21 all the way down to am1 plus bm1. And then this is going to be, of course, a12 plus b12 all the way to a1n-- let me scroll over a little bit --all the way over to a1n plus b1n, and then all the way down to amn plus bmn. These are equivalent definitions. This takes a lot less space to write in and I felt comfortable doing it because we've already defined vector addition. But it essentially boils down to you just add up all the corresponding entries. That's all matrix addition is. It's probably one of the simplest things that you've seen in your recent mathematical experience. Now, matrix scalar multiplication, very similar idea. We defined scalar multiplication times a transformation of x to be equal to a scalar times the transformation of x. This was a definition. And we also defined scalar times some matrix a to be equal to the scalar. A new matrix where each of its columns are the scalar times the column vectors of a. So a1, and then the next column is ca2, and then you go all the way to can. And the whole motivation for this was, because this could be simplified to-- well t I've said was equal to Bx, a times the transformation of x --the transformation t of x was equal to. So we still have our c. So it's going to be c times the matrix B, times the vector x. That's what the transformation of x could be written as. And so this would be equal to by just manipulating-- and we did this in the last video by actually breaking this up in the column vectors multiplying them by each of the components of x, and then distributing the c and rearranging them a little bit. We can now say, using this definition, that this is equal to some new matrix cB. We're using this definition, some new matrix cB, where it's essentially c times each of the column vectors of B times x. This right here was our motivation. We wanted to be able express this as a product of some new matrix and a vector, because any linear transformation should be expressible in that way. And that's why we made this definition. Now let's apply it. And I wanted to show you that this is perhaps even simpler than matrix addition. So if we want to multiply the scalar 5 times the matrix, I'll do a 3 by 2 matrix. So 1, minus 1, 2, 3, 7, 0. This will just be equal to-- by this definition I'm just saying, I'm multiplying the scalar times each of the column vectors. So it's 5 times 1, 2, 7. But what's that? That's just 5 times each of the entries. It's 5 times 1, which is 5. 5 times 2, which is 10. 5 times 7, which is 35. Then the next column is going to be 5 times this column right here, which is just 5 times each of its entries. So 5 times minus 1 is minus 5. 5 times 3 is 15. 5 times 0 is 0. It's that simple. You literally, if we go back to this definition, we can define scalar multiplication of a matrix. So we could also define cA as being equal to, if we'd say this is a representation for A, of the scalar c times each of the entries of A. That's it. So it's c times a11, c times a12 all the way to c times a1n. You go down this way, c times a21 all the way down to c times am1 and then if you go down the diagonal, it's be c times amn. You literally just take your scalar and multiply it times every entry in A. And that's all you have to do. So hopefully this clarified things up a little bit, or maybe it was a bit of a review from things you might have learned in highschool.