Multiplying Matrices

Multiplying matrices can be confusing, but if you’re organized and disciplined, it’s not difficult. Just make sure to keep things straight.

Let’s multiply two matrices: \[\color{red}{A = \begin{bmatrix} 5 & 1 & 3 \\ 4 & 2 & -1 \end{bmatrix}} \quad \color{blue}{B = \begin{bmatrix} 8 & 11 \\ -6 & 7 \\ 0 & 9 \end{bmatrix}}\]

First, think about \(C = AB\). Can we multiply this? We start by deciding what the size of the product matrix \(C\) will be. Since the dimensions of \(A\) are \(2 \times 3\) and the dimensions of \(B\) are \(3 \times 2\), the dimensions of \(C\) will be \((2 \times 3)(3 \times 2) = 2 \times 2\).

We can only create a product matrix if the number of columns of the first matrix is the same as the number of rows in the second matrix. The size of the product matrix will be the number of rows of the first matrix and the number of columns of the second matrix.

We create a blank 2 x 2 matrix, with enough room to fill in the values: \[\color{green}{C = \begin{bmatrix} \_\_\_\_ & \_\_\_\_ \\ \_\_\_\_ & \_\_\_\_ \end{bmatrix}}\]

We look at the first matrix (\(A\)) in terms of rows. We will put the values from the first row of \(A\) in the first row of \(C\), and the same for the second row. Since there are three elements in each row of \(A\), we will create three terms in each element of \(C\). That is: \[\color{green}{C = \begin{bmatrix} \color{red}{5}\cdot\_+\color{red}{1}\cdot\_+\color{red}{3}\cdot\_ & \color{red}{5}\cdot\_+\color{red}{1}\cdot\_+\color{red}{3}\cdot\_ \\ \color{red}{4}\cdot\_+\color{red}{2}\cdot\_+\color{red}{-1}\cdot\_ & \color{red}{4}\cdot\_+\color{red}{2}\cdot\_+\color{red}{-1}\cdot\_ \end{bmatrix}}\]

Make sure to leave the blanks! At this point, we’re focusing only on the first matrix, but we want to make sure to leave space for the numbers from the second matrix.

Now we look at the second matrix (\(B\)) in terms of columns. We will put the values from the first column of \(B\) in the first column of \(C\), and so on for the other column. This will give us: \[\color{green}{C = \begin{bmatrix} \color{red}{5}\cdot\color{blue}{8}+\color{red}{1}\cdot\color{blue}{-6}+\color{red}{3}\cdot\color{blue}{0} & \color{red}{5}\cdot\color{blue}{11}+\color{red}{1}\cdot\color{blue}{7}+\color{red}{3}\cdot\color{blue}{9} \\ \color{red}{4}\cdot\color{blue}{8}+\color{red}{2}\cdot\color{blue}{-6}+\color{red}{-1}\cdot\color{blue}{0} & \color{red}{4}\cdot\color{blue}{11}+\color{red}{2}\cdot\color{blue}{7}+\color{red}{-1}\cdot\color{blue}{9} \end{bmatrix}}\]

To reiterate: We fill in the values from each ROW of \(A\) in every element of the matching ROW of \(C\), and the values from each COLUMN of \(B\) in every element of the matching COLUMN of \(C\). At this point, let’s get rid of the color and see what we have: \[C = \begin{bmatrix} 5\cdot8+1\cdot-6+3\cdot0 & 5\cdot11+1\cdot7+3\cdot9 \\ 4\cdot8+2\cdot-6-1\cdot0 & 4\cdot11+2\cdot7-1\cdot9 \end{bmatrix}\]

Finally, we evaluate each element of the matrix for our solution: \[C = \begin{bmatrix} 34 & 89 \\ 20 & 49 \end{bmatrix}\]

Let’s try it the other way: \(D = BA\). What will be the size of \(D\)? Since the dimensions of \(B\) are \(3 \times 2\) and the dimensions of \(A\) are \(2 \times 3\), the dimensions of \(D\) will be \((3 \times 2)(2 \times 3) = 3 \times 3\).

We create a blank 3 x 3 matrix: \[\color{purple}{D = \begin{bmatrix} \_\_\_\_ & \_\_\_\_ & \_\_\_\_ \\ \_\_\_\_ & \_\_\_\_ & \_\_\_\_ \\ \_\_\_\_ & \_\_\_\_ & \_\_\_\_ \end{bmatrix}}\]

This time, we look at \(B\) in terms of rows. We put the values from the first row of \(B\) in the first row of \(D\), and so on for the other two rows, just as before. Since there are two elements in each row of \(B\), we will create two terms in eacn element of \(D\). That is: \[\color{purple}{D = \begin{bmatrix} \color{blue}{8}\cdot\_ + \color{blue}{11}\cdot\_ & \color{blue}{8}\cdot\_ + \color{blue}{11}\cdot\_ & \color{blue}{8}\cdot\_ + \color{blue}{11}\cdot\_ \\ \color{blue}{-6}\cdot\_ + \color{blue}{7}\cdot\_ & \color{blue}{-6}\cdot\_ + \color{blue}{7}\cdot\_ & \color{blue}{-6}\cdot\_ + \color{blue}{7}\cdot\_ \\ \color{blue}{0}\cdot\_ + \color{blue}{9}\cdot\_ & \color{blue}{0}\cdot\_ + \color{blue}{9}\cdot\_ & \color{blue}{0}\cdot\_ + \color{blue}{9}\cdot\_ \end{bmatrix}}\]

Now, we look at \(A\) in terms of columns, placing the values of each column in the blanks in \(D\): \[\color{purple}{D = \begin{bmatrix} \color{blue}{8}\cdot\color{red}{5} + \color{blue}{11}\cdot\color{red}{4} & \color{blue}{8}\cdot\color{red}{1} + \color{blue}{11}\cdot\color{red}{2} & \color{blue}{8}\cdot\color{red}{3} + \color{blue}{11}\cdot\color{red}{-1} \\ \color{blue}{-6}\cdot\color{red}{5} + \color{blue}{7}\cdot\color{red}{4} & \color{blue}{-6}\cdot\color{red}{1} + \color{blue}{7}\cdot\color{red}{2} & \color{blue}{-6}\cdot\color{red}{3} + \color{blue}{7}\cdot\color{red}{-1} \\ \color{blue}{0}\cdot\color{red}{5} + \color{blue}{9}\cdot\color{red}{4} & \color{blue}{0}\cdot\color{red}{1} + \color{blue}{9}\cdot\color{red}{2} & \color{blue}{0}\cdot\color{red}{3} + \color{blue}{9}\cdot\color{red}{-1} \end{bmatrix}}\]

Without the color, this is: \[D = \begin{bmatrix} 8\cdot 5 + 11\cdot 4 & 8\cdot 1 + 11 \cdot 2 & 8 \cdot 3 + 11 \cdot -1 \\ -6 \cdot 5 + 7 \cdot 4 & -6 \cdot 1 + 7 \cdot 2 &  -6 \cdot 3 +  7 \cdot -1 \\ 0 \cdot 5 + 9 \cdot 4 & 0 \cdot 1 + 9 \cdot 2 & 0 \cdot 3 + 9 \cdot -1 \end{bmatrix}\]

Evaluating each element gives us: \[D = \begin{bmatrix} 84 & 30 & 13 \\ -2 & 8 & -25 \\ 36 & 18 & -9 \end{bmatrix}\]

If you would like to check your work, here is an online matrix multiplication calculator. Make up some small matrices and practice multiplying them, then check your answer! (Remember: These tools are provided so you can check your work, not to help you cheat.)

Leave a Reply

Your email address will not be published. Required fields are marked *