# Explainer: Matrix Multiplication

In this explainer, we will learn how to identify the conditions for matrix multiplication and evaluate the product of two matrices if possible.

The multiplication of matrices can be divided into two categories: scalar multiplication and matrix multiplication. Scalar multiplication involves multiplying a matrix by a scalar (or a number). For example, given the matrix if we wanted to find , this would be considered a scalar multiplication. To find , we would multiply each of the components of the matrix by 2:

Matrix multiplication is somewhat more difficult, and there are particular criteria that need to be adhered to. Firstly, the dimensions of matrices need to be considered.

A matrix is often referred to in terms of its number of rows and columns. For example, a matrix with rows and columns is said to be an matrix. Two matrices can only be multiplied if the number of columns in the first matrix is equal to the number of rows in the second matrix.

More generally, if a matrix multiplication exists between two matrices and and the dimensions of are , then the dimensions of must be . A useful note is that the dimensions of the resultant multiplication of these two matrices would be . This is demonstrated in the picture below.

As we now know how to establish if a matrix multiplication exists, let us look at how to calculate this multiplication. We will demonstrate how to do this using an example. Consider a matrix and a matrix then, the product must exist and will have dimensions . How to complete this multiplication is demonstrated as follows:

If you are familiar with how to calculate the dot product, you may notice that this multiplication is very similar to finding the dot product of the vectors and . In fact, the dot product can be defined as a matrix multiplication for these two vectors if we consider the transpose of , notated . The product would then be the same as the product shown above.

Let us now look at how we would multiply a matrix by a matrix. We know that the multiplication exists as the number of columns of the first matrix matches the number of rows of the second matrix. We also know that the resulting matrix will be a matrix. As before, we need to multiply the rows and columns, but we now need to consider the position of each of the entries in the resulting matrix. For example, if we multiply the top row of the first matrix by the left-hand column of the second matrix, the result will be the top-left entry. The bottom row multiplied by the middle column would result in the bottom-middle entry. These steps are outlined by multiplying the following matrices:

First, we consider the top row and the left column:

Then, we consider the top row and the middle column:

This process continues until we have completed the matrix multiplication:

Let us look at another example.

### Example 1: Multiplying Matrices

Consider the shown matrices and :

Find , if possible.

We know that the multiplication exists as the number of columns of the first matrix matches the number of rows of the second matrix. We also know that the resulting matrix will be a matrix. First, we consider the top row of and the first column of in order to calculate the top-left entry of the result. Then, we consider the top row of and the middle column of to find the top-middle entry, and we continue this process until we have populated the whole matrix:

It is worth noting at this point that matrix multiplication is not commutative. That means, in general, given two matrices and , . This can easily be seen in example 3. The product would be a matrix, but the product would be a matrix. We can also find powers of matrices providing the product exists. Let us demonstrate this with another example.

### Example 2: Finding the Square of a Matrix

Given that find .

Remember that means . We multiply matrices by considering each of the rows and columns:

If we wanted to find , we would then multiply this result by on the right-hand side.

Before finishing, let us look at one final example.

### Example 3: Multiplying Matrices

Given that find if possible.

First, let us establish if the multiplication is possible. The first matrix has dimensions and the second matrix has dimensions . Therefore, as the number of columns of the first matrix is the same as the number of rows of the second matrix, the product exists and the resulting matrix will have dimensions . It is always worth doing this check to avoid making mistakes. We then need to multiply the matrices:

In the last couple of examples, we will use matrix multiplication to find unknown entries in matrices which are part of a product.

### Example 4: Finding Unknowns in Matrix Equations

Find the values of and given the following:

First, we inspect the entry in the first row and first column of the rightmost matrix:

This gives the equation , which yields . Now that we know the value of , we substitute it into the original equation:

We will now be able to find by examining the entry in the first row and second column of the rightmost matrix:

We must then solve , which gives . The final matrix equation is, therefore,

We could also check that the values of and are correct by calculating the two remaining entries in the second row of the rightmost matrix. Doing this will confirm that our values of and are correct.

### Example 5: Solving Matrix Equations with Unknowns on Both Sides

Find the values of and that solve

We begin by taking the rightmost matrix and looking at the entry in the first row and the first column. We also appropriately highlight the relevant entries from the two matrices on the left-hand side of the equation:

The rules of matrix multiplication imply that . Essentially, all this equation confirms is that , which is encouraging, even if slightly unhelpful.

Continuing, we now consider the entry in the first row and second column of the rightmost matrix:

This gives , which implies that or alternatively that . This means that has two possible values.

Next, we look at the entry in the first row and third column of the rightmost matrix:

This gives , which implies that and hence . The subsequent matrix equation is

Now that we have found , we only need to find . This variable appears only once, in the second row and third column of the rightmost matrix:

This gives , which gives .

### Key Points

1. Suppose that is a matrix with order and that is a matrix with order such that Then, the matrix multiplication is a matrix with order , hence having the following form: The entries are calculated by the pairwise summation of entries from and as shown:
2. In general, matrix multiplication is not commutative; that is, in general, for two matrices and , .