CHAPTER 04.01 - 04.05: PRIMER ON SIMULTANEOUS LINEAR EQUATIONS: Adding Two Matrices

 

In this segment, we'll talk about how to add two matrices. Now, you can add two matrices, but they have to be of the same order.  So let's go ahead and see what we mean by that. 

 

So A and B can be added, so if you have two matrices, A and B, they can be added if A and B are of the same size.  So what that means is that the number of rows and columns, so the number of rows of A has to be same as the number of rows in B, number of columns in A has to be same as the number of columns in B, only then you can add.  So, and the way you get the addition is that, you will have, let's suppose, m rows and n columns in A, then B also has to have m rows and n columns, and that will result in m rows and n columns when you add the two matrices, and the individual elements of the added matrix are given by simply by adding the individual elements of B . . . A and B, but with the corresponding row and column.  So you take, let's suppose, ith row, jth column of A, ith row, jth column of B, and when you add the two elements, you will get the element of the ith row and jth column of the . . . of the resulting matrix, C, there. 

 

So let's go ahead and take an example and see how that works, so somebody, let's suppose, says, hey, go ahead and add these matrices, so you've got 2, 3, -6.4, 2.1, 3.8, and 1.9, and somebody says, hey, add it to this particular matrix here, which is 6, -3.1, 2.9, 1.9, 1.2, and 2.2. So if somebody's telling you to add them, what that means is that you're going to take this particular matrix and this particular matrix, when you add the two, what you're going to get is . . . what you're going to get is, you're going to do element-by-element addition.  That means that you take the first row, first column element of A, of the first matrix, you've got to add it to the first row, first column of the second matrix.  So, that means that 2 will be added to 6, so you get 2 plus 6 here, then first row, second column, with the first row, second column, here, first row, third column, first row, third column, here, first . . . second row, first column, second row, first column, second row, second column, second row, second column, third row, second column, third row, second column. So the resulting matrix will turn out to be, adding now, this gives me 8, this gives me -0.1, this gives me -2.5, yeah . . . not 2.5, 3.5 . . . -3.5, and this gives me 4.0, this gives me 5.0, and this gives me 4.1.  So that's what you get by adding those two matrices, and again you're finding out that this is a 3-by-2 matrix, this is a 3-by-2 matrix, and the resulting matrix is also going to be a 3-by-2 matrix.  So all these matrices which you have, this matrix being added to this matrix, the first thing which you have to check, whether the number of rows is same as the number of rows here, number of columns the same as the number of columns here, only then you can add the two matrices, and then you are doing element-by-element addition, 2 gets added to 6, 3 gets added to -3.1, and so on and so forth, and resulting in, again, the same number of rows which you have in your A and B matrix, and same number of columns which you have in your A and B matrix, and that's what the result is.  And that's the end of this segment.