 Hi, I'm Zor. Welcome to Unizor Education. We continue talking about properties of matrix multiplication. Now, let's recall that I started looking for a reasonable definition of the matrix multiplication based on the property, the property of the following type. If you combine two linear transformations of one particular vector, first with the matrix A and then with the matrix B, it would be the same as if properly defined multiplication of these two matrices is applied to the same vector U. So, then we were talking about that this is actually associativity. So, we introduced the multiplication of matrix by vector and matrix by matrix using this particular property. And finally, at the previous lecture, in the general case of multiplication of any matrices, I basically defined the final form of the matrix multiplication. Now, what I would like to do is basically going backwards from the definition as it was given in the previous lecture, the general definition of the product of two matrices. I will derive all the nice properties including the associativity. So, that's the purpose of today's lecture. Actually, it will be two lectures because it's too long actually. So, having this in mind, I would like to spend a few minutes just talking about notation which I'm going to use. So, matrices, let's use capital Latin letters. We'll have dimensions, number of rows and number of columns. Let's say K times L, which means K rows L columns. And elements of these matrices will have two indices, the row index and the column index where they are staining. So, if you have a matrix and it has certain elements, so this particular element would be in the i's row and j's column, right? So, I will use the lower case usually for the elements of the matrix and ij means basically the element which stands on i's row and j's column. Now, if I would like to talk about the whole row which is a row vector, then I will use this bar on the top to signify this is a vector. i is fixed because this is the i's row and this is a star instead of a column which means everything in that row. Now, if I would like to talk about the vector which is the column vector in the matrix, I will use the second index equal to the column number and the first one would be a star which means everything in this particular column. Now, using this language, I can say the following as far as the definition. If you have a matrix A times matrix B and this is matrix C, then cij which means the element in the product of two matrices which is in i's row and j's column is a scalar product of row vector i in the matrix A and column vector j in the matrix B. So, this is basically the definition and this scalar product means a i1 times b1j plus a, let me just write it down, a1 i1 times b1j plus a i2 times b2j plus etc. A, whatever the last index is, L, let's say, iL times bLj. In other words, I might actually use the expression which contains a Greek symbol sigma, capital sigma, which basically is the same thing as this. Let's use index q, for instance, times bqj where index q is from 1 to the capital L. So, this is just a shorter notation for this one. So, I'm going to use this particular notation. Another thing also sometimes might be handy. If my matrix A has dimensions, let's say k by L, most likely I will use indices lowercase k and lowercase L for elements of this matrix which in turn it implies actually that lowercase k is changing from 1 to capital K, lowercase L is changing from 1 to capital L. So, that's just a convenience to remind basically the dimensions of the matrix. Now, the first and very important property of this multiplication which I wanted to talk about is actually a requirement. It's not a property. It's a very immediate consequence from the definition. Now, the property is the following. If A has size k by L and B has a size m by n, then multiplication is possible only if L is equal to m. The number of columns in the A which is on the left is equal to number of rows in the B which is on the right of the product. Why? It's obvious why, because again, every element, again, Cij is equal to A i star times B star j. Now, this is a scalar product of a row vector by a column vector. Scalar product can only be obtained if the dimensions of these two vectors is the same. Now, what's the dimension of the row vector A? That's the number of elements in one row, which is number of columns in the whole table, right? If this is the table, this is the row, number of elements in the row, that's number of columns. Now, this is a column vector, which is this one, right? Number of elements in the column is equal to number of rows. So number of rows here should be equal to number of columns here. So that's why L should be equal to m. So now, whenever I will have something like this, I will not have k, L, and m, n. I would have k, m, and m, n. So these two are supposed to be the same. And what's the dimension of the result? Obviously, this is number of rows and this is number of columns. Again, from the same formula, because the index c can be changed anywhere from the beginning of the number of rows in A to the very end, which means from one to k in this case. And number j, this is the j's column vector. And if it's a column vector, it means it's changing as much as the number of columns, which is here. So m should be the same. This is number of column equal to number of rows. Number of rows here and number of columns on the right are the results of the dimension. So this is the property, if you wish, of the multiplication. Let me rewrite it in this way. k times L matrix. If you multiply it by L times n as a matrix, the result would be k times n, right? So just keep it in mind. This is the dimension of the matrix, which is a product. Now, next is related to the following fact. When you were talking about multiplication of numbers, there are two numbers which are actually like standing aside from anything else. They are very particular numbers and we really treat them separately, if you wish. These numbers are zero and one. Why? Well, for obvious reasons. If you multiply anything by zero, you will get zero. And if you multiply anything by one, you get that anything you had before, right? So these are properties of numbers. Now, my question is, is there anything analogous among the matrices? And the answer is yes. The obvious analog of the zero in the matrix world is the matrix which contains only zeros. Now, if you have a product of two matrices and all elements of B is equal to zero, then obviously all elements of C would be equal to zero as well, right? Because, again, from the same formula, these are all elements which are equal to zero and we summarize them for all the different indices which are within star. So you sum zeros, you'll get zero. So, matrix which has all the elements equal to zero plays the role of zero in multiplication, which means everything multiplied by this matrix, by the way, on the right or on the left, doesn't really matter, would result in zero, regardless of the value of the second matrix. So that's obvious. Now, how about one? One is a little more interesting, I would say. But again, here is basically the something which you can think about it. Let's approach this from transformation, linear transformation standpoint. Now, is there a linear transformation which really combined with anything else, any other transformation, would basically result in the same other transformation, whatever it was? Or, if you wish, going back to the vectors, is there a linear transformation of the vectors which does not change the vectors? Obviously, yes, there is. How about this one? In two-dimensional space, for instance, it's this one. Right? It doesn't change anything. And if you combine this with anything else, it would be like that anything else acted alone, right? Now, how this transformation can be written as a matrix? Well, let's just write it slightly differently. For the matrix U2, I will have 0 times U1 plus 1 times U2. And this is not just U1, it's 1 times U1 plus 0 times U2. So what's the matrix of transformation? Now you see the matrix, right? It's the coefficients. It's 1, 0, 0, 1. So the matrix has 1s along the main diagonal. And obviously, if you have, instead of two-dimensions, three-dimensions would be exactly the same. It would be diagonal matrix. So any matrix which has only elements along the main diagonal from the top left to the bottom right equal to 1 and all others are 0, these matrices represent an identity transformation. Transformation which does not change the vectors and it doesn't change any other matrix if you multiply. And let's just try to prove it. And it's very simple. So let's consider that these guys, aii, are equal to 1 and aij equals to 0 for i not equal to j, right? So that's what main diagonal is equal to 1 and everything outside of the main diagonal, which means column not equal to rho. On the main diagonal column and rho have exactly the same index, right? From 1 to the maximum. And everything outside of the main diagonal has different row and column numbers. So this is a condition. Okay. Now this is a summation, right? It's a summation from ai1 times b1j plus ai2 times b2j plus etc., right? So only one ai something is not equal to 0. Only the one which has two indices equal to i. So this is basically equal to iibij, right? So when this index is equal to i, only in this case we have i11, aii is equal to 1. All others are 0 and will be dismissed. And this is equal to, since this is 1, this is equal to bij. So what do we have? Cij is equal to bij, right? So if my matrix A is identity matrix, then B and C are exactly the same. Which means multiplication by this identity matrix doesn't really change it. Now this is multiplication on the left and obviously if instead of A you have B matrix which is equal to unit matrix, you will have exactly the same thing. Then A would be preserved. So that's another property of the multiplication. It has, as we see, an equivalent of a unit matrix and equivalent of a zero matrix. Well, actually many different equivalents for different sizes. For each size we have it's over. Alright, now the last thing which I wanted to talk about in this presentation, the last property, is commutative property. Well, we know that multiplication of numbers has this property. Numbers are commuting if we multiply them. How about matrices? Well, before addressing this in some kind of a general matrix notation with indices i, j, k, l, etc., etc., I would like to talk more geometrically if you wish. Now matrices are reflecting linear transformations of vectors, right? Now let's think about two different linear transformations. Apply these two transformations to the same vector in one order and then we will change the order of these transformations and see if we will get the same result. Well, what kind of transformation we can apply? Well, we know we can stretch it in any direction or just increase the length which means any direction. Or we can reflect relative to some axis, right? Or we can rotate. Well, let's think about it. If we rotate by angle, let's say, phi and then rotate by angle psi, is it the same as rotation first by psi and then by phi? Well, yes. So these two transformations do commute. Let's say another. Let's say you are stretching everything. Every vector, you are increasing the length of this vector, preserving the direction. You are increasing the length by, let's say, some factor, like two. And then you increase again by another factor of three. Would these two commute? Is it the same? You stretch it by factor of two and then by three? Or you first by three and then by two? The answer is yes. They do commute. But let me tell you another transformation which is not exactly commuting with some other transformation which I wanted to present to you. Let's take the transformation of stretching along some axis. Let's say along the x-axis. Now, what does it mean? Well, if you have a vector here, let's say it has a unit length, then the result would be, and I'm stretching by a factor of two. The result would be two. Now, if you have a unit length, if you have a vector with two coordinates, one-one, I'm stretching all along the x-axis. So the result of this would be this vector. So this would be stretched to this. This would be stretched to this. Because I'm stretching only relative to the, along the x-direction, only. Right? Is it linear transformation? Yes, of course it is linear transformation. Can it be expressed in the formula? Of course it can. v1 is equal to two u1 and v2 is equal to u2. Right? So this is abscissa, x-coordinate, this is ordinate, y-coordinate. So y-coordinate remains the same, and x-coordinate is increased by the factor of two. So this is my linear transformation, and obviously it is linear. And let's consider another transformation. Another transformation would be reflection relative to the bisector of the main angle. Now, how this reflection can be expressed in the form of linear transformation? Well, we are changing consistency to ordinate and ordinate to abscissa, right? So it would be v1 is equal to u2 and v2 is equal to u1. We are exchanging x and y-coordinates. This used to be abscissa, now it is ordinate. This used to be ordinate, now it is abscissa. That is what symmetry relative to the bisector of the main diagonal is. Now, what if we combine these two? Are these commuting transformations? Well, let's think about this unit vector along the x-axis. So let's first apply stretching along the x-axis. So from this, it became this. Now we are reflecting relatively to the axis, so it becomes this. This is my final point. All right. What if I will change the order of transformation? First I will reflect and then I will stretch along the x-axis. If I reflect my one vector, my unit vector along the x-axis, if I will reflect it relative to this, I will get vector which is this. One vector along the y-axis. Now I am stretching, but only across the x-axis. So if x-axis was equal to zero, it doesn't really stretch at all, so the vector remains as is. And the result is basically this smaller vector. Different result. So we suspect that these two transformations stretching along the x-axis and reflection relative to bisector of the angle are not commuting. Well, let's check it explicitly using the algebra of matrices. We have two different transformations. Let's just describe these transformations in a matrix format and then we will multiply these matrices A times B or B times A and see if we will have different results, right? So what is this matrix? Well, let's think about this way. This is not just U2. This is zero times U1 plus U2. One times U2 plus zero times U2, right? So two zero zero one, two zero zero one. Now this one, I can write it down as zero times U1 plus one times U2. One times U1 plus zero times U2. So this matrix B is equal to zero one one zero. All right? Okay, great. Now let's multiply. According to the rules of matrix multiplication. So now we will check with an algebra our geometric intuition. All right. A times B equals this matrix times this. This is 2 by 2. This is 2 by 2. Result would be 2 by 2. And coordinate one one means first row times first column. Two times zero zero times one. It's zero and zero and zero. Now this is first row second column. First row vector second column vector. Two times one two zero times zero zero. Now element two one. So it's second row vector times the zero times zero one times one. Add a map we'll get zero, we'll get one. And finally two two. So it's second row by second column zero times one. It's zero one times zero zero add a map zero. So this is the result. Great B times A. So it's this times this. Let's just change the order. Okay. One one means first row times first column. Which is zero times two plus one times zero. It's zero. One two. So it's first row second column. Zero zero plus one times one is one. Element two one. Second row first column. One times two it's two and zero it's zero two. And element two two it's second row times second column. Zero times one and one times zero is zero. So as you see we have different matrices as a result of multiplication. So that was my point. Matrices do not necessarily commute. Interesting, maybe disappointing, I don't know. But actually the transformations which are not really commuting with each other are quite often happened in mathematics. It's only with numbers seems to be everything seems to be okay. With vectors if you don't go beyond the scalar product it's also fine. But even if you go to a vector product of the vectors like cross product it's already non-commuting. So in principle commutative property is not always adhered to in different. Associative is much more often actually applicable to different operations and transformations. That was the first part of my theoretical foundation where I wanted to explain different properties of the operation of multiplication. The second part would also be with some other properties and that would probably conclude my theory about matrices. Then we will go to the problems etc. That's it for today. I do suggest you to read exactly the same material in the notes for this lecture on unizor.com. Also if you sign in as a student and if you do have a supervisor or a parent who can enroll you into different topics you can also take exams on these topics which is very very useful thing. I do suggest you to do this. Okay, that's it for today. Thanks very much and good luck.