What is Matrix Multiplication on Excel?
In excel we have an inbuilt function for matrix multiplication and it is MMULT function, it takes two arrays as an argument and returns the product of two arrays, given that both the arrays should have the same number of rows and the same number of columns.
Matrix multiplication is one of the useful features of excel presented to do mathematical operations. It helps to gain the product of two matrices. The matrices that want to multiply have a certain number of rows and columns to present the data. The size of the resulted matrix is taken from the number of rows of the first array and the number of columns of the second array. There is a condition to matrix multiplication; the number of columns in the first matrix should be equal to the number of rows in the second matrix.
To perform the matrix multiplication, the predefined MMULT function presented in the excel software is used. Excel matrix multiplication reduces a lot of time incurred in calculating the product of matrices manually.
In general, matrix multiplication is done in two ways. Simple scalar multiplication is performed by using the basic arithmetic operations, and advanced matrices multiplication is managed with the help of array function in excel.
The Excel formula used for multiplication is entered in two ways, including manually typing MMULT function after the equal sign or selecting the Math and Trig function library presented under the ‘Formulas’ tab. The mathematic function MMULT helps in returning the multiplication of two arrays. It is one of the predefined excel functions used in worksheets to perform calculations in a short time.
The required syntax that should be followed for the matrix multiplication is that
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
- Parameters: Array1 and Array2 are the two parameters required to do multiplication
- Rule: Columns of array1 should be equal to rows of array2, and the size of the product is equal to the number of rows in array1 and number of columns in array2
- Returns: The MMULT function generates the numbers in the product matrix. It is entered as a formula or worksheet function in excel calculations.
Then the product of A*B is as follows.
How to do Matrix Multiplication in Excel? (with Examples)
Matrices multiplication in excel has some real-time application. There are two ways to do matrix multiplication. Below are some examples of the Excel Matrix Multiplication.
Example #1 – Multiplying a matrix with a scalar number.
- Step 1: First of all, data should be entered into the array.
- Step 2: Select a scalar value that we are going to multiply with an array, i.e., 3
- Step 3: Estimate the rows and columns of the resultant array. Here resultant array will be of size 3 x 3.
- Step 4: Select the range of cells equal to the size of the resultant array to place the result and enter the normal multiplication formula.
- Step 5: Once you enter the formula, press Ctrl + Shift + Enter. And the result will be obtained, as shown in the below-mentioned figure.
Example #2 – Matrix Multiplication of Two Individual Arrays
- Step 1: First of all, data should be entered into array A size of 3×3
- Step 2: Enter data into the second array called B size of 3×3
- Step 3: We need to ensure that columns of the first array are the same in size as rows of the second array
- Step 4: Estimate the rows and columns of the resultant array.
- Step 5: Select the range of cells equal to the size of the resultant array to place the result and enter the MMULT multiplication formula.
Enter the values to calculate the Product of A & B.
Once you enter the formula, press Ctrl + Shift + Enter to get the result. The results obtained by multiplying two arrays as follows, and the size of the resultant array is 3X3.
Matrix Multiplication between arrays with a single row and single column. Let consider the elements of matrices as
Matrix A is of 1×3, and matrix B is of 3×1. The size of the product A*B [AB] matrix is 1×1. So Enter the Matrix Multiplication formula in the cell.
Press Enter to get the result.
Example #4 – Matrix Multiplication Between Arrays with Single Column and a Single Row
Matrix A is of 3×1, and matrix B is of 1×3. The size of the product A*B [AB] matrix is 3×3.
So, the answer will be,
Example #5 – Determining the square of a matrix using MMULT in Excel
The square of matrix A is determined by multiplying A with A.
The resulting matrix is obtained as
Things to Remember
- To perform matrix multiplication, the number of columns presented in the array1 and the number of rows presented in the array2 are equal.
- It is hard to change the part of an array since the array is a group of elements.
- While performing an array multiplication, CTRL+SHIFT+ENTER should be used to produce all elements of the result matrix. Otherwise, only a single element is produced.
- The elements of an array should not be null, and text should not be used in matrices to avoid errors.
- The size of the product array is equal to rows of the first array and columns of the second array.
- Multiplication of A*B is not equal to the multiplication of B*A in matrix multiplication.
- Multiplying a matrix with unit matrix results in the same matrix (i.e. [A]*[Unit matrix]=[A])
This has been a guide to Excel Matrix Multiplication. Here we discussed how to do Matrix Multiplication in Excel using Scalar Method and MMULT() Function with examples and a downloadable excel template. You can learn more about excel from the following articles –