Matrix-Matrix multiplication Matrix-Matrix multiplication is a mathematical operation that multiplies the two matrices.The first matrix (the "a" matrix) is multiplied by the second matrix (the "b" matrix). Theresulting third matrix is called a "c" matrix.Matrix-Matrix multiplication is an operation that combines two matrices together to create athird matrix. The process involves multiplying every element of one matrix by thecorresponding element of another, and then adding up all of these products.The result is a new matrix that can be used to describe the combined effect of two originalmatrices. A matrix-matrix multiplication can be used to determine the value of one variablefrom others, or it can be used as a way to multiply two vectors into each other. If you want to find the entries of the product of two matrices, A and B -- where A and B areboth matrices -- then you get the product AB. We are referring to matrices, which are now a special case of vectors, since by taking thematrix with one row, we get back a vector. Although matrices are typically used torepresent vectors, a vector can also be represented by a matrix of unit width. Let us assume that A is a 3 by 4 matrix. So it has three rows, four columns. And here, weare not going to give the values because we will not compute everything. It would take toomuch time. And let us assume that B is maybe size 4 by 2. So it has two columns and fourrows. Let's say, for example, that we have the following: the second row is 0, 3, 0, 2. So A timesB, claimed, will have as its entries the dot products between these rows and thesecolumns. We have two columns and three rows. Let us assume there are three roles. Therefore, weshould get 3 x 2 different possibilities. The answer will have size 3 by 2. Very good, butyou didn't got numbers, so we cannot compute all of them. One of the possibilities we can compute is the one that goes here, namely this one in thesecond column. Thus, we select the second column of B. And in the first row, I take the number 1 and multiply it by 0 to get 0, then I take the number2 and multiply it by 3 to get 6 plus 0 plus 8, which should result in 14. This entry here is 14.Nice. So here is another way to set it up so that you'll remember what goes where more easily. To solve this equation, we can place A here. We can put B up here and get the answerhere. If we want to find what goes in a given slot, then we look to its left and above it andfind a good product between these guys. Understandable? That's a handy way to remember. First, it tells you what the size of the answer will be. Thesize will be-- well, whatever fits nicely in this box should have the same width as B and thesame height as A. Second, it indicates which dot products to compute for each position. So you just look at what's to the left and above the given position. But there's a catch: Canyou multiply anything by anything? No. There would not be such a question otherwise.
To perform the dot product, we need to make sure that we have the same number ofentries on both sides of the equation. Otherwise, we can't multiply this term by that term,plus this term by that term, etc., if we run out of space on one side before the other. So a necessary condition is that the width of A must equal the height of B. OK. Sorry it's abit cluttered.