Matrix multiplication means multiplications of two different arrays, 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 in Excel (Table of Contents)
What is Matrix Multiplication on Excel?
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 are managed with the help of array functions.
Explanation of Matrix Multiplication in Excel
The Excel formula used for multiplication is entered in two ways including manually typing MMULT function after the equal sign or selecting 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 function used in worksheets to perform calculations in a short time.
Matrix Multiplication Excel Syntax
The required syntax that should be followed for the matrix multiplication is that
- 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?
Matrices multiplication in excel has some real time application. There are two ways to do matrix multiplication. Below are some examples of Excel Matrix Multiplication.
Multiplying a matrix with a scalar number.
Step1: First of all data should be entered into the array
Step2: Select a scalar value that we are going to multiply with array i.e. 3
Step3: Estimate the rows and columns of the resultant array. Here resultant array will be of size 3 x 3.
Step4: Select the range of cells equal to the size of the resultant array to place the result and enter the normal multiplication formula
Step5: Once you enter the formula press Ctrl + Shift + Enter. And the result will be obtained as shown in the below-mentioned figure.
Matrix Multiplication of two individual arrays
Step1: First of all data should be entered into array A size of 3×3
Step2: Enter data into the second array called B size of 3×3
Step3: We needs to ensure that columns of the first array are the same in size to rows of the second array
Step4: Estimate the rows and columns of the resultant array.
Step5: 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 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. 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.
Matrix Multiplication between arrays with single Column and a single row
Matrix A is of 3×1 and matrix B is of 1×3. Size of the product A*B [AB] matrix is 3×3.
So, the answer will be,
Determining the square of a matrix using MMULT function
The square of matrix A is determined by multiplying A with A.
The resulting matrix is obtained as
Matrix Multiplication is widely is used in the determination of sales and overall weight of products sold to the customers. The use of matrix multiplication is real life applications explained by the following example.
In this example, matrix multiplication is used to determine the sales generated in selling different items books, pens, and pencils to two customers and a total weight of the items sold to each customer. Quantity of items, price, and weight are shown in the matrix format.
Size of quantity matrix and price and weight matrix are 2×3 and 3×2 respectively. Sales and total weights have resulted in the matrix size of 2×2. The results will be obtained as shown in the below-mentioned figure.
Press Ctrl + Shift + Enter to get the answer.
To produce all the results properly, the formula should be used as an array formula shown in the figure. In this way, matrix multiplication is used in the determination of sales generated in a business.
Things to Remember
- To perform matrix multiplication, a number of columns presented in the array1 and 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 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
- Size of product array is equal to rows of 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 downloadable excel template. You can learn more about excel from the following articles –