In this segment, we're going to talk about how to subtract two matrices. This is one of the binary matrix operations which you can conduct on two matrices.  So first, subtraction . . . subtracting two matrices is only allowed . . . only allowed if the size of the two matrices is same.


So one cannot subtract a matrix of one size from another if they are different.  What that means is that the number of rows, let's suppose, if you are trying to subtract B from another matrix, A, then if this has m-by-n, if the size is m-by-n, if there's m rows and n columns, then B also has to have m rows and n columns.  So the size of the two matrices has to be same, and the subtraction of the two matrices is then defined by another matrix, called C, which is also of the same size, m-by-n, m rows and n columns. Now, each of the elements of C will be then given by the element of A, corresponding element of A, minus the corresponding element of B. That means that if you are calculating the ith row and jth column of the C matrix, then it'll be same as subtracting the ith row, jth column of the A matrix minus the ith row, jth column of the B matrix, and, of course, the limits of i and j are based on whatever the size of the matrix is, for example, i will go from . . . i will be going from 1 to all the way up to m, and j will go all the way from 1 to . . . 1 to n, those are the limits of i and j, so that's how we'll find it. 


Let's go ahead and take an example and see that how subtraction of two matrices works.  So let's take an example here, so let's suppose somebody says, hey, go ahead and subtract A from . . . B from A, so let's suppose A is 2, -3, 6, 7, 9, -2.2, and let's suppose B is given as 8, -3.3, 6, 2.1, -2.3, and 5.6, let's suppose.  So somebody's telling you to find A minus B. So, in this case, what that means is that simply I have to subtract, element-by-element, each of the elements of A and B from each other, and that's how I'll be able to find out what A minus B is.  So A minus B will be simply equal to the A matrix, which is 2, -3, 6, 7, 9, -2.2, minus the B matrix, which is 8, -3.3, 6, 2.1, -2.3, and 5.6.  Again, I'm able to subtract the two matrices because this matrix is 2 rows, 3 columns, this matrix also 2 rows . . . 2 rows, 3 columns, and that's the reason, only reason why I'm able to subtract the two matrices because the size of the matrices is the same.  So now going to do element-by-element, which means that I'm going to take the first row, first column here, subtract the first row, first column there, so I get 2 minus 8, then here I'll take the first row, second column, which is -3, then subtract this, which is that particular element, then I take the first row, third column, and first row, third column there, I get that, then second row, first column minus the second row, first column, second row, second column minus the second row, second column there, and same thing here, third . . . second row, third column minus the second row, third column, which is there. And this will result in, now I have to do the arithmetic operations here, this will give me -6, this will give me -3 plus 3.3, which is 0.3, that'll give me 0, 7 minus 2.1 is 4.9, and this one will give me 11.3, because minus minus becomes plus, and this becomes -7.8. So that's the . . . so that's the resulting matrix by subtracting the two matrices.  So all you have to do is to be sure that the size of the two matrices which you are subtracting are the same, that means the same number of rows in both matrices, same number of columns in both matrices, and then you can subtract by element-by-element.  And that's the end of this segment.