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

Adding & subtracting matrices

Sal defines what it means to add or subtract matrices. He shows a few examples and discusses some important properties of matrix addition and subtraction. Created by Sal Khan.

Want to join the conversation?

Video transcript

Let's think about how we can define "Matrix Addition." And mathematicians could have chosen any of an arbitrary number of ways to define addition. But they've picked a way to define addition that seems – one – to make sense, and it also has nice properties that allow us to do interesting things with matrices later on. So if you were one of these mathematicians who were first defining how matrices should be added, how would you define adding this first matrix over here to the second one? Well, the most common-sense thing that might have jumped out at you – especially because these two matrices have the same dimensions – (This is a 2-by-3 matrix. It has 2 rows and 3 columns. This is also a 2-by-3 matrix. It also has 2 rows and 3 columns.) – is to just add the corresponding entries. And if that was your intuition, then you had the same intuition as the mathematical mainstream. That the addition of matrices should literally just be adding the corresponding entries. So in this situation, we would add 1 + 5 to get the corresponding entry in the sum – which is 6. You can add negative seven plus zero to get negative seven. You can add five plus three to get eight. You can add -and I'm running out of colours here- you could add zero plus eleven to get eleven. You can add three to negative one to get two. And you could add -and you could add negative ten plus seven to get negative three. And if you see this definition of matrix addition you see that it actually does not matter in what order that we actually add these matrices. I could've done this the other way around, if I did this the other way around -so let me copy and paste this- so if I were to add this matrix -so let me copy, let me paste it- if I were to add that matrix to -let me copy and paste the other one- this matrix, copy and paste, you'll see that the order in which I'm adding the matrices does not matter So this is just like adding numbers. A plus B is just the same thing as B plus A. What we'll see is this won't be true for every matrix operation that we study and in particular this will not be true for matrix multiplication. But if you add these two things, using the definition we just came up with, adding corresponding terms, you'll get the exact same result. Up here we added one plus five and we got six Her we'll add five plus one and we'll get six. We get the same result because one plus five is the same thing as five plus one. Here we have zero plus negative seven you get negative seven. So you're going to get the exact same thing as we got up here. So when you're adding matrices, if you were to call -if you were to call this matrix right over here matrix A which we normally denote with a capital, bolder letter, and you call this matrix right over here Matrix B Then when we take the sum of A plus B which is this thing right over here, and we see it's the exact same thing as B, as Matrix B plus Matrix A. Now let me ask you an interesting question. What if I wanted to subtract matrices? So let's once again think about matrices that have the same dimensions. So let's say I'm gonna do then two two-by-two matrices. So let's say it's zero, one, three, two, and from that I want to subtract negative one, three, zero, and five. So you might say well maybe we just subtract corresponding entries. And that indeed is how you can define matrix subtraction. In fact you don't even have to define matrix subtraction, you can let this fall out of what we did with scalar multiplication and matrix addition. We can view as the exact same thing -this as the exact same thing- as taking zero, one, three, two and to that we add negative one, negative one times negative one, three, zero, five. And if you work out the math you're going to get the exact same result as just subtracting the corresponding terms. So this is going to be -what is this going to be? Zero minus negative one is positive one, one minus three is negative two, three minus zero is three, two minus five is negative three. And you'll see that you get the exact same thing here. When you multiply negative one times negative one you get positive one, positive one plus zero is one. Negative one times three plus one is negative two. Fair enough. There might be a question that is lingering in your brain right now. "Okay Sal, I understand when I'm adding or subtracting matrices with the same dimensions I just add or subtract the corresponding terms. But what happens when I have matrices with different dimensions?" So, for example, what about the scenario where I want to add the matrix one, zero, three, five, zero, one to the matrix -so this a three-by-two matrix- and I wanna add it to, let's say, a two-by-two matrix. Five, seven, negative one, zero. What would we define this as? Well it turns out that the mathematical mainstream does not define this. This is undefined. This is undefined. So we do not define matrix addition, or matrix subtraction, when the matrices have different dimensions. There didn't seem to be any reasonable way to do this, that would actually be useful and logically consistent in some nice way.