The basic syntax of the MMULT function in Google Sheets is:
=MMULT(array1, array2)
Where:
array1 is the range of cells or an array that represents your first matrix.
array2 is the range of cells or an array that represents your second matrix.
Note: The number of columns in array1 must be equal to the number of rows in array2 for the multiplication to work, as this aligns with the rules of matrix multiplication.
Below, we outline the steps you can follow on how to use MMULT in Google Sheets, along with an example to illustrate the process better:
Matrix A: Arrange your first matrix in a range of cells. For example, let's use a 2x2 matrix and place it in cells A1:B2.
Matrix B: Arrange your second matrix in a range of cells. Ensure the number of rows in Matrix B matches the number of columns in Matrix A for multiplication to work. Let's place a 2x2 matrix in cells D1:E2.
Below are some sample matrices:
Matrix A (A1:B2)
1 2
3 4
Matrix B (D1:E2)
5 6
7 8
Select a range of cells where you want the result of the matrix multiplication to appear. The size of this range should match the number of rows in Matrix A by the number of columns in Matrix B.
For our example, we can select G1:H2, since both matrices are 2x2.
With the output range selected (for example, G1:H2), type the MMULT formula into the formula bar.
For our example, you would enter =MMULT(A1:B2, D1:E2).
For the given matrices, the multiplication result (in G1:H2) would be:
(15 + 27) (16 + 28)
(35 + 47) (36 + 48)
Which calculates to:
19 22
43 50
The resulting matrix (G1:H2) is the product of the matrix multiplication of Matrix A by Matrix B.
We hope that this article has helped you and given you a better understanding of how to use MMULT in Google Sheets. If you enjoyed this article, you might also like our articles on how to write an exponent in Google Sheets and where to find an alternative to VLOOKUP in Google Sheets.