CHAPTER 03.15: BINARY OPERATIONS: Is matrix multiplication commutative?     In this segment we’re going to talk about is A times B same as B times A? Basically we’re trying to see that whether the commutative law of multiplication of matrices is valid. So the first thing which you have to understand is that if A times B is possible, then the number of columns of A has to be the same as the number of rows of B. So let’s suppose this is m by n and this is n by p; yes A times B is possible. Then if I try to say hey, B times A, this is n rows and p columns and this is M rows and n columns. I already see that the number of columns here is not the same as the number of rows here. Unless p is the same as M. So if P is the same as M, then I have to know that hey, then the size of the matrix B has to be square, and A also has to be square and they have to be the same dimension. Only then is there a possibility that A times B would be the same as B times A.   So we can very well see that if A times B is allowed, B times A cannot be allowed, and I think we only allowed now if this is the same as this. And if we consider this to be the same as this, then we have to also assume that it has to be a square matrix. Both of these have to be square matrices in order for that to be possible. But even then, if we have two square matrices-  if I have two squared matrices let’s suppose, of the same size n by n, and I say hey, is this true? No this is not generally true, even if you have two matrices which are squared and of the same size, even then you will find out that the commutative law of multiplication is not valid.   Let’s take an example. If we have A given as 6, 3, 2, 5, and B given as -3, 2, 1, 5. So we got these two matrices here, and then we find out if A times B is allowed. Because the number of columns here is the same as the number of rows here. But if we do the matrix multiplication by what we have learned matrix multiplication. We get -15, 27, -1, 29. And then if we want to calculate B times A, do we get the same matrix? I don’t know. So let’s see what we get for B times A, B times A turns out to be -14, 1, 16 and 28. And that’s all the same matrix, so in this case A times B is not equal to, B times A. So in most cases, you will find out that commutative law of multiplication is not possible for multiplication. Commutative law is not valid for multiplication.   So there are two things that are going on. First, you have to match the orders, in such a fashion that A and B are both of the same size and they’re both squared. And that’s the only necessary condition. And by the sufficient condition then is to multiply two matrices and see whether they are the same element to element, which we don’t find to be the case in here, but there are cases where A times would be equal to B times A. That’ll be more clear when we see some special cases where, let’s suppose this matrix is the inverse of that matrix or this matrix is the inverse of that matrix. Then that will be true. But that’s down the road we’re going to look at that. But this is the end of this segment.