What is Matrix Multiplication on Excel?

Explanation

Matrix multiplication is one of the useful features of excelUseful Features Of ExcelThe top features of MS excel are - Shortcut keys, Summation of values, Data filtration, Paste special, Insert random numbers, Goal seek analysis tool, Insert serial numbers etc. read more 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 resulting matrix size is taken from the number of rows of the first array and the number of columns of the second array. However, there is a condition to matrix multiplication. The number of columns in the first matrix should equal the number of rows in the second matrix.

The predefined MMULT function presented in the Excel software is used to perform the matrix multiplication. Excel matrix multiplication reduces a lot of time incurred in manually calculating the product of matrices.

In general, we can do matrix multiplication in two ways. First, simple scalar multiplication is performed using the basic arithmetic operations. Second, advanced matrix multiplication is managed with the help of array function in excelArray Function In ExcelArray formulas are extremely helpful and powerful formulas that are used in Excel to execute some of the most complex calculations. There are two types of array formulas: one that returns a single result and the other that returns multiple results.read more.

The Excel formula used for multiplicationExcel Formula Used For MultiplicationMultiplication in excel is performed by entering the comparison operator “equal to” (=), followed by the first number, the “asterisk” (*), and the second number.read more is entered in two ways, including manually typing the MMULT function after the equal sign or selecting the Math and Trig function library presented under the “Formulas” tab. The mathematical function MMULT helps in returning the multiplication of two arrays. It is one of the predefined excel functionsExcel FunctionsExcel functions help the users to save time and maintain extensive worksheets. There are 100+ excel functions categorized as financial, logical, text, date and time, Lookup & Reference, Math, Statistical and Information functions.read more used in worksheets to perform calculations in a short time..

You are free to use this image on you website, templates, etc., Please provide us with an attribution linkHow to Provide Attribution?Article Link to be HyperlinkedFor eg:Source: Excel Matrix Multiplication (wallstreetmojo.com)

Syntax

The required syntax that we should follow for the matrix multiplication is:

  • Parameters: Array1 and array2 are the two required parameters to perform multiplication.Rule: Columns of array1 should be equal to rows of array2, and the size of the product must be equal to the number of rows in array1 and the number of columns in array2.Returns: The MMULT function generates the numbers in the product matrix. It is inserted as a formula or worksheet function in Excel calculations.

Let us consider the below image.

Then, the product of A*B is as follows:

How to do Matrix Multiplication in Excel? (with Examples)

Matrix multiplication in Excel has some real-time applications. There are two ways to do matrix multiplication. Below are some examples of Excel matrix multiplication.

Example #1 – Multiplying a matrix with a scalar number.

Example #2 – Matrix Multiplication of Two Individual Arrays

  • Step 1: First, we should enter data into an array A size of 3×3.

  • Step 2:  Then, insert 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 columnsRows And ColumnsA cell is the intersection of rows and columns. Rows and columns make the software that is called excel. The area of excel worksheet is divided into rows and columns and at any point in time, if we want to refer a particular location of this area, we need to refer a cell.read more 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.

Next, we must insert the values to calculate the product of A and B.

  • Firstly, we must enter data into the array. Then, we must select a scalar value that we need to multiply with an array, i.e., 3. Estimate the rows and columns of the resultant array. Here, the resultant array will be of size 3 x 3. After that, we must select the range of cells equal to the size of the resultant array to place the result and enter the normal multiplication formula. On entering the formula, we must press Ctrl + Shift + Enter. Consequently, the result will be obtained, as shown below.

Once we enter the formula, press Ctrl + Shift + Enter to get the result. The results we can obtain by multiplying two arrays are as follows. The size of the resultant array is 3X3.

Example #3

Matrix multiplication between arrays with a single row and single column. Let’s consider the elements of matrices as follows:

Matrix A is 1×3, and matrix B is 3×1. So the size of the product A*B [AB] matrix is 1×1. So,  we must now insert the matrix multiplication formula in the cell.

Press the “Enter” key to get the result.

Example #4 – Matrix Multiplication Between Arrays with Single Column and a Single Row

Matrix A is 3×1, and matrix B is 1×3. The size of the product A*The B [AB] matrix is 3×3.

So, the answer will be:

Example #5 – Determining the square of a matrix using MMULT in ExcelMMULT In ExcelMMULT is an in-built Math & Trigonometry function in Excel that performs matrix multiplication of 2 arrays where the columns of Array 1 are equivalent to the rows for Array 2. read more

The square of matrix A is determined by multiplying A with A.

The resulting matrix is obtained as:

Things to Remember

  • The number of columns presented in array1 and the number of rows present in array2 must be equal to perform matrix multiplication.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, it may create only a single element.The elements of an array should not be null, and we should not use text 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.The multiplication of AB is not equal to the BA in matrix multiplication.Multiplying a matrix with unit matrix results in the same matrix (i.e., [A]*[Unit matrix]=[A]).

This article has been a guide to Excel Matrix Multiplication. Using the scalar method and MMULT() function with examples and a downloadable Excel template, we discussed matrix multiplication in Excel. You can learn more about Excel from the following articles: –

  • Excel Inverse MatrixUsing VBA ArraysUsing SUMPRODUCT with Multiple Criteria COUNTIF with Multiple Criteria