In this Excel tutorial you teach yourself about matrix multiplication in Excel. You see how to use MMULT Excel function to multiply matrixes.
A matrix is a rectangular array of numbers, symbols, and expressions arranged in rows and columns. They are used to save large data sets that are in a relationship to each other. Matrices play a particularly important role in computer science and statistics, where huge data sets are often present. For our case matrixes have to contain just numbers.
Rules of calculations
There are a few rules to follow when you multiply matrices.
- To be able to multiply the first matrix (let’s call it matrix A) needs to have the same number of rows as the number of columns of the second matrix (let’s call it matrix B).
- Once we have the appropriate 2 matrices, what can we expect the resulting matrix (matrix C). It will have the size of the number of rows in matrix A and the number of columns in matrix B.
Here are my sample matrixes. Matrix A is 2×2 and Matrix is 2×3. The calculation is possible because the number of rows of matrix A is the same as the number of columns of matrix B. The numbers of columns of matrix A and rows of matrix B do not matter at all.
Then you need to use MMULT Excel function to multiply given arrays. We will use MMULT Excel function for matrix multiplication.
The syntax of MMULT function
=MMULT (array1, array2)
MMULT function takes arrays as arguments so it is obvious to use.
array1 – The first array to multiply
array2 – The second array to multiply.
For example, if you have two arrays, A1:B2 and C1:D2, you can multiply these arrays with the following formula:
The result of the formula will be placed in the top-left cell of the resulting array, and the rest of the cells in the array will be automatically filled in.
To use it, highlight the whole matrix and type formula in first cell.
MMULT formula in my example is =MMULT(A2:B3,D2:F3)
This is how multiplied matrix looks like.
Further reading: Matrix Multiplication in Python