 Welcome to the third topic in this video series where I'll be introducing the matrix and thinking about what is a matrix product. Alright, so essentially a matrix is nothing more than a grid of numbers, simply a grid of numbers that could be positive or negative or fractional or zeros and when we specify the shape of our grid of numbers or we do so simply by stating how many rows we have and how many columns. So we're going to hear about rows and columns a lot in this video. In this video course I'm going to use a particular way of writing a matrix as a symbol and I need to do that. I'm going to just use a capital letter and I'm going to, the letter is going to be double underlined. I'll double underline that symbol. So here we go, A underline that means the matrix A and how would we write it? So let's just like this, essentially a grid of numbers and we put it in curvy brackets just to give it some structure. So this is three rows, two columns. That one. Here's a matrix B. Let's make it a square matrix. Let's put in a fraction to show we can. Minus 10, zero. Okay, so there are two different examples of a matrix. Easy enough, but it gets more interesting when we try and combine them. So I want to talk about matrix multiplication. Edition is simple and it's just an element by element edition, but multiplication is not so simple. So here's how we write it. The multiplication of matrix A by matrix B is simply written like this, A, B and it gives us some new matrix C, which may be a difference shape from both A and B as we'll see. Let's give ourselves a couple of examples. Three, zero, minus one, two, three, four. And matrix B can be just one, two, zero, minus three. So there are two matrices. Here I've chosen them such that A, B, that multiplication will work. It will exist. But actually if we try it the other way round, it will turn out that the multiple of those two matrices doesn't even exist. It's not a well-defined thing. So this is an extreme case of an operation not being reversible in its order. In other words, matrix multiplication is not commutative. So let's just erase that and go ahead and see how the multiplication actually works. The trick is to multiply the each row of matrix A, the first matrix by each entire column of matrix B. What does that mean? Well, let's write out our example three, two, zero, three, minus four, minus one, minus one, four, one, zero, two, minus three. Now, I know that this guy is going to have three rows and two columns, the output matrix. You'll see why in a bit. I'll just put these blanks in for now. The question is how to work out each of these numbers. Let's choose this one first. Okay. Now notice this guy's address, if you like, is row one, column one of the output matrix C. I'm going to need to, in order to work this guy out, I'll need to look at the whole of row one in the first matrix in matrix A and the whole of column one in the matrix B. I'll need to combine those guys. And how do I combine them? I just multiply my element as I go along the row and down the column. So three times one just gives me three. And then I add on the next combination. Two times two is four. So three plus four is going to give me seven. That's how I combine those two. I'll jump back here and I'll erase there and I'll just put in my seven. All right. So that's the general way it works. Let's go ahead and do the other elements of our matrix C. Let's do this one. Notice this is still row one. So I want that first row. It's now column two, that's its address. I want the second column, three times zero and two times minus three is how I'll work that out. And that's just going to be minus six. So let me jump backwards and erase my blank symbol and write in minus six. Okay. Maybe I went a bit fast. Let me spell this one out more explicitly. Okay. So here I now have row two column one. That's the address of that guy. I want all of row two and all of column one. I want to look at those guys and I want to multiply along. So zero times one and three times two. That's going to give us just six in total when we add them up. So let me erase and put in six. And now this element, that's row two column two. So I want all of row two. I want all of column two and multiply zero times zero. And three times minus three is minus nine. So that's going to be a minus nine. If I go backwards and just put in minus nine here. Now we're finally on to the final third row. So we're going to want the third row of A. And in this case, the first column, that's one times minus one and four times two is eight. That's going to be seven minus one plus eight. And then finally last row, last column, four times minus three is 12 and zero minus 12. So there we are. That is our matrix product C formed by combining each row and each column. It's quite a lot of work and it would be even more if we had bigger matrices. But we said that we get something quite different if we try multiplying A and B in the other order. So let's go ahead and do that now. What if we have one, zero, two, minus three, that's B, on to three, two, zero, three, minus one, four, that's A. So we can try it. We try and multiply row one by column one and we immediately find we cannot because they are a different length, a different list. So there is no third element of our row to multiply with our third element of the column. Just pause the video here and have a look at that and see why that must be impossible for us. So sometimes matrix multiplication is impossible. All right, let's look at a few little further examples and you may want to pause the video to convince yourself in each case it's true. Is this thing possible? For example, pause it and think. This one is not possible. This is not possible again because there are two elements in say the first row of A and three elements in the column, single column of B. There's no way to do that as a series of element by element products. How about this? We just have this row matrix and this column matrix. Can we do that? Yes, this one is perfectly possible. Actually, it just produces a single number. In fact, it's a bit like a dot product. It's the whole of row one times which is the entire matrix and then the whole of column one in B. This thing is called a row matrix and this other guy is called a column matrix for obvious reasons. Okay, how about this? Let's have a look at this one. What if I swap the order of my row and column? I just swap them around. Can I do that? Is that going to produce a legitimate matrix? Actually, yes it will. This time, swapping our two matrices A and B around has produced something which exists. It's actually a huge matrix. It's three by three. It must have three rows and three columns because A has three rows and B has three columns. How does it work? Let's look at that guy for example. It's just simply the number there which is row one is just a number and column two is just a number, single number. So we just do that product. There's no problem. Pause the video if it's confusing. All right. So again, the point here is that A times B is generally not equal to B times A. Even if they both exist, they may not be the same. They may not even be the same shape. However, we can go on and ask about the other kinds of properties of the matrix product operation. A on to B times C is that the same as A times B on to C? Does the order matter? Actually, it is the same. It does work. In other words, we have the associative property. How about A into B plus C? Some of two matrices. Yes, we can have A on to B plus A on to C. That is therefore the distributive property. Matrix multiplication does satisfy those things. It's just not commutative. Okay, let me make a bit more room up here in the top of the screen and put one final puzzle up. Suppose I have this two row three column matrix and then a mystery matrix M and then I have a simple column matrix of two rows and I'm asking what shape should matrix M be? Or is it even? Is it possible? Pause and think about that. And in fact, it's just a column matrix of three elements. You may want to just meditate on that and see that it's correct. Okay, that's the end of this video.