In this second of the videos on matrix multiplication, we're going to delve a little bit more deeply into matrix multiplication and look at some of the properties and the conditions under which different sorts of multiplication can be carried out. Let's start by looking at looking at a specific example in this example. Here I've written down to matrices M&N. And let's look at the sizes of these matrices. The first matrix M. Is a three row three column matrix, so it's three by three. And the second matrix N is 3 rows, two columns. So it's a 3 by 2. And we notice that these numbers are the same. The number of columns in the first is the same as the number of rows in the second, so we can perform this matrix multiplication and the size of the answer will be a three by two matrix. So right at the start we know the size of the answer. It's going to have three rows and two columns just like this one had. So the shape of the answer is. Like we have here and we're looking for these 6 numbers. In the product. Let's try and work it out. To find the number that's in the first row, first column. We work with the first row of the first matrix and the first column of the Second Matrix. What we want is 3 * 1 which is 3. 2 * -- 2 which is minus 4 and 1 * 3, which is 3. So we've got 3 ones or three. 2 * -- 2 is minus 4 and 1 * 3 is 3. We multiply the paired elements together and add the result. When we come to the first row, second column, we work with the first row here and the second column here. And again, pairing off 3 * -- 2 is minus 6. 2 * 3. Is 6. 1 * -- 4 is minus 4. So in each case, we're multiplying the paired elements together and adding the results. When we want the element that's going in here, which is in the 2nd row first column of the answer, we work with the 2nd row, first column of the given matrices 4 * 1 is 4. Minus 3 * -- 2 is +6. 2 * 3 is 6. And continuing in the same way, the answer that goes in the 2nd row, second column comes from taking the 2nd row, second column. 4 * -- 2 is minus 8. Minus 3 * + 3 is minus 9. 2 * -- 4 is minus 8. And finally on the last row to find the element in the first row. Sorry the 3rd row first column will work with the 3rd row, First Column, 5 ones of five. 4 * -- 2 is minus 8. 3 * 3 is 9. And similarly to find the last element, it will be 5 * -- 2, which is minus 10. 4 * 3 is 12 and 3 * -- 4 is minus 12. And if we just tidy up what we've got, we'll have 336 subtract 4, which is 2. Minus 6 + 6 zero subtract 4 is minus 4. Four and six is 10 and 616. Minus 8 -- 9 -- 8 is minus 25. 5 subtract 8 + 9. 6th and minus 10 + 12 -- 12 is minus 10. And this is the result of multiplying these two matrices together. What about if we try and multiply the two matrices together the opposite way round? Suppose we try and workout N * M. Now, in this case the size of the first matrix here is 3 rows and two columns, so that's a three by two and the size of the second matrix is 3 by 3, three rows, three columns. And what we observe now is that these two numbers here are not the same, they are not equal. That means that we cannot do the matrix multiplication in the order that I've written it down here. That matrix product doesn't exist. So this is the first point. I'd like to make that even when you can find a matrix product by multiplying two matrices together, it matters very much. The order in which you write them down. It may be possible to workout a product one way, but not another way. Let's look at some more examples. Suppose we've got two matrices C&D as I've written them down here, I'm going to try to work out the product C * D. And I'll also try and workout the product D times. See if either of these exist. But in the first case, we've got a two row three column matrix. And in the second example here, within the Second matrix here we've got three rows into two columns, so we can in fact work this product out because these numbers are the same and the result will be a two by two matrix. So the shape of the answer will be 2 rows and two columns. If we try and do this the other way round, D * C, The first matrix Now has got three rows and two columns. It's a three by two matrix and the second one's got two rows and three columns. It's a two by three matrix. So you can. You can see that we can still work it out because these two numbers are still the same 2 into the same, but this time the result is going to be a three by three matrix, so it's going to be a bigger matrix with three rows and three columns. We can use the process that we evaluate that we worked on before to evaluate the elements in the these matrices. So for example, the element that goes in here is 1 * 3 + 2 * 5 added to 3 * -- 1, which is 10. And you can check for yourself that the remaining elements are 131 and minus 11. So it's possible to workout C * D and the answer is a two by two matrix. When we do it the other way round, let's take an element here. Let's take the elements in the first row, first column and we obtain the answer by working with the first row, first column. Here, that's three times, one is 3 added to minus 7 * 4. That's three added to minus 28, which is minus 25. And you can proceed in the same way to fill out this resulting matrix and the numbers. You'll get a -- 25 -- 29 -- 33. 9. 1521 789 The important point that I want to make here is that when you multiply C * D together. It may be possible to also find D * C, But the answers that you get may have completely different sizes. It's certainly not true that CD is the same as DC, so one of the observations we take away straight away is that in general CD is not equal to DC. Even in situations where both of these products do exist, we say that matrix multiplication is not commutative. In general, it really doesn't matter the order in which you carry out the multiplication. Now that we know how to multiply 2 matrices together, I'm going to show you an important property of identity matrices. Suppose we have a two by two identity matrix, that's 1001. And suppose we have a second matrix, two 3 -- 4 and seven. And suppose I want to multiply these two together. The identity matrix is certainly a two by two matrix, and this matrix is also a two by two matrix. So because these numbers are the same, we can actually workout the product and the answer is also a two by two matrix. So the answer has this sort of shape with four elements in there. To get the first element in the answer, we want to pair 10 with 2 -- 4, multiply the paired elements together and add so we get 1 * 2 is 2 added to 0 * -- 4. Which is just 1 * 2 is 2. To get this element here, we want 1 * 3 which is 3 added to 0 * 7, which is just three. To get the element in here, we want to pair 01 with two and minus four, so it's 0 * 2, which is nothing 1 * -- 4 is minus 4, so we just get minus 4. And finally, the last element is 0 times. Three, which is nothing 1 * 7 is 7, so that's our answer. And if you look at the answer you'll see the answer is identical to the matrix we started with here. In other words, multiplying a matrix by an identity matrix when this multiplication is possible leaves an answer which is identical to the matrix you started with, and that's a very important property of identity matrices. The same result occurs if we do the multiplication the other way round. If we take two 3 -- 4 seven and we multiply it by the identity matrix, one nought nought one will find. It's also possible, and if you go through the operation 2 * 1 is 2 three times. Nothing is nothing. The result there is 2. Two times nothing is nothing 313. Minus 4 * 1 added to 7 times nought is minus 4. And minus four times North, which is nothing added to 717 and you'll see again this answer here is the same as this matrix here. So that's very important property to remember when you multiply a matrix by an identity matrix, it leaves the original matrix unaltered, identical to what it was before. The same works even if we haven't got square matrices. Suppose we have this identity matrix. And we multiply, for example by the Matrix 78. Well, this has got one row and two columns. It's a one by two matrix. This is got two rows, two columns, so we can perform the matrix multiplication and the result is going to be a one by two matrix that's the same shape as the one we started with. And if we carry out the operations, it's 7 * 1, which is 7 added to 8 times nothing, which is nothing. So the result is just 7th. 7 times and nothing is nothing and 8 * 1 is 8, so it's just eight. And again, this answer 7 eight is the same as the matrix we started with over here. So that's just to reinforce the message that multiplying by an identity matrix leaves the original matrix unaltered.