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

Let us begin by recalling scalar multiplication, which is much simpler than matrix multiplication. Scalar multiplication involves multiplying a matrix by a scalar (or a number). For example, consider the matrix

If we wanted to multiply this matrix by a scalar 2, we would multiply each of the components of the matrix by 2:

We can see that multiplying a matrix by a scalar is simple. However, it is much more complicated to multiply a matrix by another matrix. Before we can discuss how to multiply a matrix by another matrix, we need to understand when it is possible to multiply a pair of matrices.

Recall that the order of a matrix is given by

For instance, a matrix with rows and columns is said to be an matrix. In order to multiply a pair of matrices, their orders must be compatible.

### Rule: Criterion for Matrix Multiplication

Let and be matrices. To compute matrix multiplication , the number of columns in must equal the number of rows in . If is an matrix for some positive integers and , must be an matrix for some positive integer . In this case, is an matrix.

From this criterion for matrix multiplication, we can see that is not the same as for matrices and . In fact, it is possible for one of these to be defined while the other is not. For instance, say that matrices and are of order and respectively. Then, the number of columns of is equal to the number of rows of , which means that the matrix multiplication is defined. On the other hand, the number of columns of is not equal to the number of rows of . This means that the matrix multiplication is not defined. This tells us that matrix multiplication is not commutative, which means that the order of matrices in matrix multiplication cannot be changed.

In the first example, we will find the order of a matrix resulting from matrix multiplication.

### Example 1: Order of Matrices in Matrix Multiplication

If is a matrix of order and is a matrix of order , then matrix is of order .

### Answer

Recall that the number of columns in matrix must be equal to the number of rows in matrix to compute matrix multiplication . We also recall that the order of a matrix is given by

Since the order of matrix is , this tells us that the number of columns in matrix is 3. The order of is , which means that matrix has 1 row and 3 columns. is the transpose of , and we know that the transpose of a matrix changes the rows of the matrix to columns of its transpose. Since the transpose of has 1 row and 3 columns, matrix must have 3 rows and 1 column. This tells us that the number of columns in matrix and the number of rows in matrix are both equal to 3, which means that matrix multiplication is valid.

Recall that the multiplication of a matrix of order by a matrix of order results in a matrix of order . In this example, we are multiplying a matrix by a matrix. This means

Hence, , , and . The order of matrix is . This is option B.

In the next example, we will find the order of a matrix being multiplied, based on the order of the product matrix as well as the order of the other matrix.

### Example 2: Order of Matrices in Matrix Multiplication

If matrix is of order and matrix is of order , then matrix is of order .

### Answer

Recall that the number of columns in matrix must be equal to the number of rows in matrix to compute matrix multiplication . We also recall that the order of a matrix is given by

Since the order of matrix is , this tells us that the number of columns in matrix is 1. This number must equal the number of rows in matrix . Hence, the number of rows in matrix must be equal to 1.

We also recall that the number of rows in matrix is equal to the number of rows in matrix , and likewise the number of columns in is equal to the number of columns in matrix . We are given that matrix is of order and matrix is of order , and we can see that the numbers of rows in matrices and are the same. Since matrix has 2 columns, this tells us that the number of columns in must be equal to 2.

Hence, matrix is of order . This is option D.

In the next example, we will check the criterion for matrix multiplication to determine whether the given matrix multiplication is well defined.

### Example 3: Finding the Product of Two Given Matrices

Given that determine if possible.

### Answer

Recall that the number of columns in matrix must equal the number of rows in matrix to compute matrix multiplication . We also recall that the order of a matrix is given by

We can see that matrix has 2 rows and 3 columns and matrix has 2 rows and 2 columns. Since the number of columns in is not equal to the number of rows in matrix , the matrix multiplication is undefined.

In the previous examples, we considered the property of the order of matrices in matrix multiplication. Now that we know when a pair of matrices can be multiplied, let us consider how to multiply matrices. The simplest matrix multiplication is the multiplication of a row matrix by a column matrix.

### How To: Multiplying Row Matrices by Column Matrices

Let and be row and column matrices respectively. Then, matrix is well defined and is of order . The entry of this matrix is obtained by multiplying each entry in the row matrix by the corresponding entry in the column matrix and then summing all the products.

We will demonstrate this process in the next example.

### Example 4: Finding the Product of Two Given Matrices

Consider the matrices

Find , if possible.

### Answer

We know that matrix multiplication is only possible if the number of columns of the first matrix matches the number of rows of the second matrix. We note that the number of columns of the first matrix and the number of rows of the second matrix are both equal to 3, so it is possible to compute matrix multiplication .

We also know that the multiplication of an matrix by an matrix results in an matrix. We can see that the orders of matrices and are and respectively. Hence, , , and . This tells us that matrix is of order .

Since matrix has only one row, it is a row matrix. Likewise, matrix is a column matrix. Recall that we can multiply a row matrix by a column matrix by multiplying each entry in matrix by the corresponding entry in the column of and summing all the products. In the following computation, we have highlighted the corresponding entries in each matrix with the same color:

We can see that the order of is , as expected.

Hence, .

In the previous example, we multiplied a row matrix by a column matrix, which resulted in a matrix with a single entry, by multiplying the th entry of the row matrix by the th entry of the column matrix and summing all the products. The resulting matrix had only one entry because the first matrix in matrix multiplication had one row and the second matrix had one column.

This process can be generalized to multiply any pair of matrices with compatible orders, where the resulting matrix may have multiple entries. To multiply a matrix with multiple rows by a matrix with multiple columns, we need to pick one row from the first matrix and one column from the second matrix. Treating the selected row and column as row and column matrices, respectively, we can multiply the row matrix and the column matrix using the method introduced earlier. We continue this process until each of the rows of the first matrix is multiplied by each of the columns of the second matrix.

### How To: Multiplying Matrices

Let and be matrices of orders and respectively. For each and , we can compute the entry in the th row and th column of matrix by multiplying the th row of by the th column of .

We know that if we multiply a matrix of order by a matrix of order , we obtain a matrix of order . This means that we need to compute this times to complete the matrix multiplication.

Let us demonstrate this process graphically by multiplying a matrix by a matrix. We know that the resulting matrix will be of order , which means that we need to multiply a row by a column 9 times. Consider the following matrices:

We can see that matrix has 2 columns and matrix has 2 rows. Hence, we can compute the product . We also know that the product will be of order . First, we can multiply the first row by the first column to find the entry in the first row and first column of matrix :

Next, we multiply the first row of by the second column of to obtain

This process continues until we have completed the matrix multiplication:

### Example 5: Finding the Product of Two Given Matrices

Given that find if possible.

### Answer

We know that matrix multiplication is only possible if the number of columns of the first matrix matches the number of rows of the second matrix. We note that the number of columns of the first matrix and the number of rows of the second matrix are both equal to 3, so it is possible to compute matrix multiplication .

We also know that the multiplication of an matrix by an matrix results in an matrix. We can see that the orders of matrices and are and respectively. Hence, , , and . This tells us that matrix is of order . We need to compute the entries of this matrix.

Recall that the entry in the th row and th column of matrix is obtained by multiplying the th row of by the th column of . We begin by taking the first row of , which can be written as a column matrix . We also take the first (and only) column of , which can be written as the column matrix . Multiplying each entry in the row matrix by the corresponding entry in the column matrix and then summing all the products,

Since this is the product of the first row of and the first column of , this tells us that 7 is the entry in the first row and first column of matrix .

Next, we multiply the second row of , , by the first column of , , which leads to

Hence, 5 is the entry in the second row and first column of matrix . This leads to

In the previous example, we multiplied a pair of matrices that had compatible orders. We did this by taking the row submatrices of the first matrix and the column submatrices of the second matrix and then multiplying them together. While this is the correct process for multiplying two matrices, it is not efficient to write out the row and column matrices each time. Instead, we can abbreviate these computations by writing the product of the corresponding row and column matrices within each entry of the resulting matrix, as seen in the following formula.

### Definition: Matrix Multiplication

Let and be matrices of orders and , respectively, given by

Then, the product matrix has order and is given by where

In the next example, we will multiply a pair of matrices using this formula.

### Example 6: Finding the Product of Two Given Matrices

Consider the matrices

Find , if possible.

### Answer

We know that matrix multiplication is only possible if the number of columns of the first matrix matches the number of rows of the second matrix. We note that the number of columns of the first matrix and the number of rows of the second matrix are both equal to 2, so it is possible to compute matrix multiplication .

We also know that the multiplication of an matrix by an matrix results in an matrix. We can see that the orders of matrices and are and respectively. Hence, , , and . This tells us that matrix is of order . We need to compute 9 entries of this matrix.

Recall that the entry in the th row and th column of matrix is obtained by multiplying each entry of the th row of by the corresponding entry of the th column of and then summing all the products.

For instance, to obtain the entry in the first row and first column of matrix , we need to multiply the first row matrix of , , by the first column matrix of , . This means that we multiply each entry in the row matrix by the corresponding entry in the column matrix and then sum all the products. This gives

Hence, the entry in the first row and first column of matrix is . We can continue in the same manner until we complete the matrix:

In this explainer, we discussed how to multiply two matrices of compatible orders. We note that matrix multiplication is quite different from the multiplication of two real numbers as it has a more complex structure. While it is hard to see why we need to define matrix multiplication in this manner, there is a good reason for doing this. This reason will become clearer as we learn about more advanced topics on matrices. However, we can see a glimpse of this reason when we consider a real-world example that can be solved using matrix multiplication.

In our final example, we will consider a real-world application of matrix multiplication.

### Example 7: SolvingWord Problems by Applying Operations on Matrices

The table below shows the number of different types of rooms in three hotels owned by a company. If a single room costs 160 LE per night, a double room costs 430 LE per night, and a suite costs 740 LE per night, determine the companyโs daily income when all the rooms are occupied.

Hotel | Single Room | Double Room | Suite |
---|---|---|---|

First Hotel | 45 | 74 | 15 |

Second Hotel | 48 | 74 | 19 |

Third Hotel | 49 | 94 | 10 |

### Answer

In this example, we need to determine the companyโs daily income when all the rooms are occupied. This company owns three hotels, and the number of rooms of each type is listed in the given table. If we take only the numbers in the table, we can form a matrix, which we can write as

The first column of this matrix represents the number of single rooms in each hotel. To compute the companyโs income from these rooms, we need to multiply these numbers by 160 LE, which is the cost of a single room. Similarly, we need to multiply the second column by 430 LE, which is the cost of a double room. In the same manner, the entries in the third column should be multiplied by 740 LE, which is the cost of a suite. In the end, we can obtain the total daily income by summing all the entries of the resulting matrix:

If we sum the entries in each row, we obtain

The entry in each row of the matrix above tells us the daily income from each hotel. We can finish the computation by finding each entry above and adding up the entries. But let us pause here for a second to note that the matrix above can also be obtained when we multiply our original matrix by the column matrix containing the cost of each room type:

Let us consider this multiplication. We know that matrix multiplication is only possible if the number of columns of the first matrix matches the number of rows of the second matrix. We note that the number of columns of the first matrix and the number of rows of the second matrix are both equal to 3, so it is possible to compute this matrix multiplication.

We also know that we can multiply a pair of matrices by multiplying each row of the first matrix by each column of the second matrix. Let us multiply the first row of the matrix, , by the column of the second matrix, . This means that we multiply each entry in the row matrix by the corresponding entry in the column matrix and then sum all the products. This gives which is the same as the first row of the matrix given in (1). Similarly, we can see that multiplying the second and third rows of the matrix by the column matrix leads to the entries in the second and third rows of the matrix in (1). Computing each entry in (1) gives us

Adding up all the entries, we have

Hence, when all the rooms are occupied, the companyโs daily income is 159โโโ340 LE.

Let us finish by recapping a few important concepts from this explainer.

### Key Points

- Let and be matrices. To compute matrix multiplication , the number of columns in must be equal to the number of rows in . If is an matrix for some positive integers and , must be an matrix for some positive integer . In this case, is an matrix:
- Let and be row and column matrices respectively. Then, matrix is well defined and is of order . The entry of this matrix is obtained by multiplying each entry in the row matrix by the corresponding entry in the column matrix and then summing all the products.
- Let and be matrices of orders and , respectively, given by Then, the product matrix has order and is given by where