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?

  • piceratops ultimate style avatar for user Kevin Weatherwalks
    Was the intuition of the mathematicians who defined matrix addition really that arbitrary? Can matrices be considered as vectors, in a way, with the addition and subtraction properties of matrices being similar to that of vectors?
    (45 votes)
    Default Khan Academy avatar avatar for user
    • winston baby style avatar for user ahmet
      I guess Sal was being kind to say so and saved the better stuff at linear algebra courses where we learn that indeed matrices are group of vectors which are indeed at heart of the whole matter. We use matrix notation to solve n dimensional vector space linear systems.
      (12 votes)
  • aqualine tree style avatar for user shaash
    What are matrices used for? What is the point of a matrix?
    (25 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Nishant C.
    Is it possible to add a real number to a matrix, or is it undefined?
    (23 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Mary
    In the video Sal keeps mentioning the mathematic mainstream, so does that mean, and who are they?
    (13 votes)
    Default Khan Academy avatar avatar for user
  • leaf grey style avatar for user Shefali Patel
    Questions for +/- matrices of different dimensions. What if we add 0's to make matrices in even dimensions? Is there some reason we can't do this?
    A [1 2 3] + B[ 1 2] = undefined
    But what if we do this:
    A [1 2 3] + B[ 1 2 0]= C[2 4 3]
    (7 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user kubleeka
      It's certainly true that [1 2 3]+[1 2 0] is well-defined, but [1 2 0] is not the same object as [1 2].

      Besides, if we try to extend matrices like this, how do we know whether [1 2] should become [1 2 0] or [0 1 2]?
      (8 votes)
  • starky tree style avatar for user Ryan Robles
    At about , Sal said that you can't just put a matrix in any order when multiplying and dividing. I understand why you wouldn't be able to put the matrices in any order while dividing, but since multiplying is simply repeated addition, wouldn't the order of two matrices not matter?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user George Arrington
      Actually, repeated addition of a matrix would be called scalar multiplication. For example, adding a matrix to itself 5 times would be the same as multiplying each element by 5.

      On the other hand, multiplying one matrix by another matrix is not the same as simply multiplying the corresponding elements. Check out the video on matrix multiplication. Indeed, matrix multiplication is not commutative.
      (6 votes)
  • piceratops ultimate style avatar for user Kevin George Joe
    so i can add or subtract matrices if they have the same dimensions (rows and columns), right?!
    (4 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user Noble Chea
    What are the point of matrixes? I don't really get how you would use this in real life.
    (0 votes)
    Default Khan Academy avatar avatar for user
  • hopper cool style avatar for user kristobal.hoch
    At , Sal says that addition and subtraction with matrices of different dimensions is undefined. Why can't one just insert entries of 0s in the missing areas of a matrix in addition and subtraction? Would the matrix be different at that point? If so, is that the case with augmented matrices?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      Matrices as I understand were made for matrix multiplication, specifically with matrices with dimension nx1 (where n is any number) called a vector. So adding 0s does make them different. Some places moreso than others, but in the worst case it can make it so the two matrices can't be multiplied.

      Augmented matrices are a special case, which is why they got their name. Specifically it is when a sum or difference of vectors, or more commonly a system of equations, actually has answers. the answers are not really part of the matrix so they get their own part of aan augmented matrix.

      in non system cases, think about if you have just y = mx+b or y equals a number. if you have a number instead of y (and m of course) you can solve for x, while having y there makes it only so you can find a function you can graph.

      Let me know if this didn't help
      (3 votes)
  • leaf yellow style avatar for user Sejal
    If I want to add two matrices with dimensions 3 x 2 and 2 x 3, can I transpose one of them to get two matrices with dimensions 3 x 2 and 3 x 2 and then perform addition? Will this be a valid way of addition? Or is it that such kinds of matrices with different dimensions can never be added?
    (3 votes)
    Default Khan Academy avatar avatar for user

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.