 Hi, I'm Zor. Welcome to a new Zor education. This is the second part of the lecture dedicated to properties of matrix multiplication. Now, today we will consider a little bit, I would say, more interesting properties, like associative law, distributive law, etc. Last lecture was about some preliminary characteristics of the matrix multiplication and commutative property. But unfortunately, commutative property is not really the property of the matrix multiplication and I basically gave you an example why it's not really commutative. But associative and distributive laws do present in matrix multiplication and they do require some proof. So, that's what we are going to do right now. So, we will prove the following. That matrix multiplication is associative, which means no matter what order of parentheses you put, as long as you don't change the places of A, B and C, they're still in the same sequence. But parentheses indicate which operation you do first and which you do second. So, in this case, first you multiply B times C and then A multiplied by the result. In this case, you first multiply A times B and the result of this you multiply by C. The question is, do we have the same or different result? Well, the answer is the same and here's how we can prove it. Okay, first of all, let's consider dimensions of these matrices. Let's say K by L, B would be L by M and C would be M by M. Okay, now, why did I use the same letters? Well, you know that multiplication is possible only if the left matrix has the same number of columns as number of rows in the right matrix, right? If you have a multiplication of two matrices. Now, B and C must have this letter should be the same and the result would be the number of rows in B and number of columns in C. And since this is columns, L is a column of A, it's supposed to be equal to the L in this case. And same thing on the right side. So, this is the requirement as far as the dimensions are concerned. Now, I will use indices for each matrix. I will use indices which correspond to the dimensions. So, for C for instance, I will use lowercase M, lowercase N, which is implying that lowercase M is changing from 1 to capital M, lowercase N is changing number of columns from 1 to capital N, etc. Alright, so let's multiply B times C first. Let's say it's R. Now, what is element Rij? Well, I shouldn't really say Rij because I know the dimension of the BC. It would be L times N. So, I will use Ln. So, element Ln of the matrix R, which is row L column N is equal to scalar product of L's row in B, which is BL star times N's column, which is C star N of the matrix C. Or if you wish, I can write it as a sigma, which means summation by probably the most interesting here that I can use the letter M as an index here, right? So, it's BLM times CMN. And M means from, again, the fact that I'm using the letter lowercase M means that I'm summing up from 1 to the capital M. So, let's keep it in mind. Now, I'm multiplying A by the result of this operation, right? Now, the result of this operation is R. And R has a dimension L times N, right? So, A times R, let's say it's a matrix S. Now, S would have a dimension K times N, right? R has a dimension L times N. A has a dimension K times L. So, it would be K times N. So, lowercase K and N element of the matrix S equals to A K star times R star N. Or we can sum it up by L index A K L R L N. Okay, but we don't know this. It's this. So, sigma summing by L A K L times this thing. Okay, fine. What can we do now? Now, we can say the following. Now, A K L is a constant because L is fixed, K is fixed. Only M is changing here. L 1, L 2, L 3, 1 N, 1 2, 3 N, etc. So, I can always insert using the distributive law of the multiplication among numbers, because this is a sum of certain numbers and this is one multiplier. So, I can say this. I leave this as is, but I will put A K L inside. That's it. So, we have these things where K and N are fixed. First, M is changing and we are summing up together. M is changing from 1 to capital M and then L is changing from 1 to capital L. But this is basically the expression which is on the left. This is an expression of S K N. Now, let's do exactly the same thing with the right side. First, we multiply A times B. Alright. Now, A times B, which letter will we use? Let's say F equals A times B. Now, what's the dimension? Remember, A is K times L, B is L times M and C is M times N. So, A B, A B is K M, right? So, F K M equals A K star times B star M, right? Or, with a summation, it's A K 1 times 1 M, K 2 times 2 M, K 3 times B 3 M, etc., etc. So, basically it's A K L times B L M. And summation is by L, by the number of columns, right? Okay, great. Now, let's multiply this by C. So, let's say T is equal to F times C, A B times C. So, T, which is supposed to have a dimension of K M. This is K M times M N. So, it's K N. By the way, the same as this one. So, the dimensions we have correctly established in both cases, the final dimension of this product and this product is K times N. So, what is K N? The element of... Yeah, I should actually use lower case here. So, element T K N means row of vector F number K times column of vector C number N. Okay. Now, what is the summation in this case? Summation is by M, right? Because number of elements in each row of matrix F, which is multiplication of these two is... It's K by M, so it's M. So, multiplication... Summation by M of F K M times C M N equals to... We know what F K M is. It's this one. So, it's summing by M, open parenthesis, summing by L, A K L B L M times C M N. Now, these are all numbers and summation. So, I can actually multiply the sum of these elements by C and insert C into this every member, right? Because this is summation by L. This is constant. So, all these members are multiplied by exactly the same constant called C M N, which means it's equal to... This is a T K N. It's equal to sum by M, sum by L, A K L B L M C M N. Okay, that's interesting. Are these two the same? Well, on one hand, no, because you see this is summation first by M and then by L. And this is summation by L and then by M. But, and by the way, K and N are constant, because this is the K N coordinates of the left, and this is S and G's, K's row and N's column on the right. Well, but if you think about this, this is actually exactly the same thing, because what does it mean, actually, that we are first summing by M and then by L and this by L and then by... If you will position these into some kind of a table with, let's say, M rows and L columns, and on each crossing you will put this particular element. Then one is to sum up first by rows and then by columns. Another is, this one is first sum by columns and then by rows. But the result is a sum of all the elements which are fit into this table, because all these elements fit into one particular table. There are dimensions of capital M by capital L, because L and M are moving from one to L and from one to M. So they all fill up this table. And how you summarize the elements of this table doesn't really matter, either by columns or by rows. So the result is exactly the same, and that's exactly the point I wanted to make when talking about associativity. The result of this is exactly the same as the result of that. In both cases it's K by N matrix. Each element of the matrix on the left is this, each element of the matrix on the right is this, and these are exactly the same thing, because we're summing the same elements, we're just summing it differently. And that's the end of the proof of associativity. Next. Next is distributive law. Can that be proven? Actually, this is really easy. Why? Well, let's just think about it this way. You remember that adding two matrices is basically adding each element to each corresponding element. So they're supposed to be of the same size. So let's say this is size of A and B is K by L, and size of C is L by M. So some of these two matrices is exactly of the same size, so the product would be KL and LM, so the product on the left would be KM. The product of this, A times C, KL and LM would be KM, and this would be KM, and their sum would be K by M. So the sizes are K, no problem. Now let's compare each element here and there. All right. So let's talk about element of this matrix. Let's call it S. KM, right? So it's K times L, and this is L times M. So the result would be K by M. So element KM is equal to K's row of this times M's column of the C. Now, what is a K's row of A plus B? Since A plus B is a result of the summation of element by element, the K's row of the A plus B is equal to sum of K's rows of A and B, right? That's what it is. Times C star M. So I'm using the fact that the sum of two matrixes is element by element summation with each element is summarized with the corresponding element having exactly the same row and column, which means that the vector, the row vector of the result is sum of corresponding row vectors. K's row vector of the result is sum of K's row vectors of the components. All right. Now, we do know that scalar product is distributive. That's one of the properties of the scalar product. We learned about this before. So I can say it this way. Now, if you will think about what is this, you will see that each element, KM element of this is equal to this and KM element of this is equal to this and KM element of the sum is supposed to be a sum of KM element this and this. So that's basically the proof. The proof is based on the distributive property of the scalar product. That's it. Easy. Another is associative property of multiplication by a constant. So if I have a constant lambda multiplied by matrix A and the result multiplied by B, it would be the same as if I multiply A and B by themselves and then multiply this scalar. Well, I can do it in two different ways. The first way, which is kind of tempting actually, okay, let's consider lambda a matrix of one by one dimension. Can we do that? Well, not exactly because then you cannot multiply by any matrix A. So it doesn't really work that well. What is working is just go by definition of multiplication of matrix by scalar. Now, what is this? Well, it's an element by element multiplication of each element of the matrix A. In this case, product A B by this particular scalar. So each element is multiplied by this scalar. Well, but again, if each element is multiplied by this scalar lambda, then let's consider this matrix C. So I can say that Cij is equal to lambda times Aij, right? Now, Cij star a vector which is a row vector of this product, obviously is equal to lambda and row vector of A, the corresponding row vector. Just because multiplication by vector is defined exactly this way. And since this, now if I will multiply it by B, so if I will multiply it by B, Cij star times B star i, it's equal to lambda Aij star B star j. But again, property of this scalar product is such that it is associative relative to multiplication by a constant. So it's lambda times Aij star times B star j. Now, if you will start from this, you will see exactly this property. You will see that each element of this product is equal to A times B. And if you multiply by a constant, that's what it is. So you do exactly come up with the same result. So that's also easy. Now something which is a little bit more logical and a little bit unexpected. At least it was for me. Do you remember the operation of transposition? It's when we change rows and columns. What if we transpose the product? Well, the answer is you do actually can transpose each matrix by itself, but you have to change the order. That's an interesting property. Now how can we prove it? Well, let's think about this way. Let's take this matrix A, B, T and consider one particular element of this matrix. Let's say A is matrix dimension K by L. B is L by M. Otherwise we could not multiply them. Now A, T has dimension of L by K. Since we are changing rows and columns, each column becomes a row. So number of columns becomes number of rows, number of rows becomes number of columns. And B, T transpose has M by L. By the way, now you see why we have to change the order here. Because M by L matrix, we can multiply by matrix L by K. But not the other way around. This matrix we cannot multiply by this because K and M are different. Let's take the matrix A times B transposed. Since we know that A times B has a dimension, what? KM. I will use KM here. No, sorry. I didn't finish. B A, sorry. A B transposed has M by K. Since A B is K by M, A B transposed is M by K. So A B transposed has M by K. So element row M column K of this matrix. Now, what is this? Well, by definition of the transposition, this is this. So since all rows are columns and all columns are rows in the transposed matrix, the element which stands in M's row and K's column in the transposed matrix is exactly the same element which is in K's row and M's row of the original matrix. That was the definition of the transposition. If you will take a matrix, let's say 1, 2, 3, 4, 5, 6, and you transpose it, you will get the first row becomes first column, 1, 2, 3, and the second row becomes the second column. So matrix of the element, let's say this one. It has coordinate 2, 2. Well, that's a bad example. Let's take this coordinate. 6. 6 has coordinate 2, 3. And here it's 3, 2. Third row, second. So 2, 3, 3, 2. 1 K K M, right? So we know as much as this. Now let's transpose it somehow. What is this? This is A K K N star times B star M. That's what it is. So K M element of this product is K's row of the A scalarly multiplied by M's column by the matrix B. So that's my final form for this, the M K's element of this. Now how about this guy? First of all, what's the dimension? Well, B T has M times L, A T has L times K. So B T times A T is M times K. Same as this one, right? So, which is a good sign. Alright, so B T A T, what's the M K element? Well, it's M's row of this matrix, right? Let me use this. M star times K's column of this matrix. Star K. So this is a row vector in the M's row and this is the column vector in K's column. But now let's think about it again. Columns are rows and rows are columns in the transposed matrix. So M's row of the B transposed matrix is M's column in the regular B matrix, right? M's row in the transposed is M's column in the regular. So it's B star M. Same thing here. This is K's column of the transposed matrix, which is K's row in the original matrix, right? Now, let's compare this and this. This is my element M K of the left. This is my element M K on the right. This is a scalar product of two vectors. They are exactly the same except the order, but scalar product is commutative, as you remember. And that's basically the end of the proof. These are two equal values. And that's basically the end of the proof of this particular formula. So transposition of the product is a product of two transpositions in the reverse order. Okay, that's it basically for today. This is the end of the elementary properties of the matrix multiplication. There might be certain problems. I do suggest you to go through the lecture on unizor.com. The comments contain, the notes for the lecture contains basically the same thing. And I think it would be very useful if you just go through this and just familiarize yourself once again. It would be even better if you can just do it by yourself, for yourself, without looking at the notes. That's an extremely useful exercise. Well, that's it. Thank you very much for your attention and good luck.