How to Multiply Matrices of Different Sizes
- 1). Write the two matrices next to each other so that the number of columns in the first matrix equals the number of rows in the second. If the column to row relationship is not correct, the result is undefined. For example, create a 1x3 matrix with the numbers 1, 4, 6. Create a second 3x2 matrix with the first column of numbers being 2, 5, 7 and the second column 3, 8, 9.
- 2). Determine the final matrix dimensions by multiplying the number of columns in the first and the number of rows in the second. This result is the number of rows in the final matrix and the number of columns in the second matrix will equal the number of columns in the final. The final matrix for the example should be a 2x1, two rows and one column.
- 3). Find the first number in the result matrix by multiplying each element in the first row of the first matrix with the elements of the first column of the second matrix. The example would be (1x2), (4x5) and (6x7).
- 4). Add the result of the two elements from Step 3. For instance, (2+20+42)=64. This is the result for the first number of the first row.
- 5). Repeat the multiplication of the elements of the first row in the first matrix with the second column of the second matrix. The example would be (1x3), (4x8) and (6x9).
- 6). Add the results from Step 5 together to get the second number of the final matrix. The example is (3+32+54)=89.
- 7). Repeat this pattern if there are more rows, starting with the second row in the first matrix to fill in the remainder of the result.