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

## Video transcript

let's think about how we can define matrix addition and math mat 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 are 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 two by three matrix has 2 rows and 3 columns this is also 2 by 3 matrix 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 as the mathematical mainstream that the addition of matrices should literally just be adding the corresponding entries so in this situation we add 1 plus 5 to get the corresponding entry in the sum which is 6 you can add negative 7 plus 0 to get negative 7 you can add 5 plus 3 to get 8 you can add and I'm running out of colors here you could add a 0 plus 11 to get 11 you can add 3 to negative 1 to get 2 and you could add and you could add negative 10 plus 7 to get negative 3 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 have done this the other way around if I did this the other way around let me copy and paste this so if I were to add this matrix so let me copy and let me paste it if I were to add it this way that matrix 2 let me copy and paste the other one to this matrix so copy and paste if I were to go this way 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 the same thing as B plus a what we'll see is that this won't true for every matrix operation that we study 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 here 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 add 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 bolded letter and you call this matrix right over here matrix B then 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 B plus 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 going to do to have two two-by-two matrices so let's say it's 0 1 3 2 and from that I want to subtract negative 1 negative 1 3 0 and 5 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 could view the same this as the exact same thing as taking 0 1 3 2 and to that we add negative 1 negative 1 times negative 1 3 0 5 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 0 minus negative 1 is positive 1 1 minus 3 is negative 2 3 minus 0 is 3 2 minus 5 is negative 3 and you'll see that you get the exact same thing over here when you multiply negative 1 times a negative 1 you get a positive 1 positive 1 zero is 1 negative 1 times 3 is negative 3 plus 1 is negative 2 fair enough there might be a question that is lingering in your brain now ok Sal I understand when I'm add are 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 1 0 3 5 0 1 2 the matrix so this is a 3 by 2 matrix and I want to add it to let's say a 2 by a 2 by 2 matrix 5 7 negative 1 0 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