So, today we are going to talk about multiplication. But not the “regular” multiplication, like when you take 2 and multiply it by 3 to get 6. That kind of multiplication is the multiplication of integers, or two whole numbers. Today we are going talk about matrix multiplication, which is a whole different ballgame.

Let’s start with a brief review of matrices (singular: matrix). Broadly speaking, a matrix is defined as a set of numbers that are arranged in rows and columns. One example of a simple matrix is shown below:

 

matrix

 

We use big square brackets on both sides of the matrix, so that we can clearly see what numbers are part of the matrix. We characterize a matrix by the number of rows and columns it contains, so the matrix above would be called a “2 x 3 matrix” (two rows by three columns). Matrices can have the same number of rows and columns, which classifies them as a “square matrix,” or they can have different numbers of rows and columns. There are no limits to the numbers of rows and columns that are possible; as long as there is at least one row and one column, we call the set of numbers a matrix.

Why would I care about matrices, you may be wondering? Well, it turns out that matrices are useful in a whole variety of real-world settings. Essentially, any time you are working with a lot of numbers, and they can be characterized in rows and columns, it makes sense to think about using a matrix. In a very common example, people who design video games use matrices all the time to design and manipulate three-dimensional figures. In this kind of system, each position of the figure in space is represented by three numbers (X-, Y-, and Z-coordinates). This means that the overall location of the figure can be represented by a matrix, and moving the figure in space requires manipulating (mathematically) the matrix that you have set up!

Other examples where we use matrices in real life include in traffic control and design (trying, although not necessarily succeeding, to minimize traffic on the road); in medicine, when healthcare systems determine how to best diagnose and treat patients; and in cryptography, so people can send coded messages to each other without worrying about someone intercepting the message along the way.

Now that we understand that matrices can be useful ways to represent and manipulate lots of data, let’s talk about their mathematical operations. Most operations that we do with “regular’ numbers (addition, subtraction, and multiplication) can also be done with matrices. Interestingly, you cannot divide matrices like you do with regular numbers, for reasons which are beyond the scope of this post.

But even though we can add, subtract, and multiply matrices, each one of those operations is more complex than the analogous operation would be if we were working with single numbers.

Today we are going to focus on matrix multiplication.

First note: Unlike regular multiplication, matrix multiplication is not commutative. This means that even though in regular multiplication, 2 x 3 is the same as 3 x 2, and they both equal 6, matrix multiplication is different! For matrix multiplication, the order in which you write the two matrices matters.

Second note: In order to be able to multiply two matrices, the number of columns in the first matrix has to equal the number of rows in the second matrix. Otherwise, the multiplication cannot happen. Some examples below show when matrix multiplication is possible and when it is not:

 

matrix multiplication possibilities

 

In the top example, there are three columns in the first matrix and three rows in the second matrix, which means that matrix multiplication can occur. Neither of the other two examples fulfill the necessary criteria, which means that they cannot be multiplied.

Let’s focus on the first example. To do multiplication, we are going to multiply the first row of the first matrix by the first column of the second matrix

More specifically, we are going to multiply 2 (the first number in the first row of the first matrix) by 3 (the first number in the first column of the second matrix), 1 (the second number in the first row of the first matrix) by 1 (the second number in the first column of the second matrix), and 3 (the third number in the first row of the first matrix) by 7 (the third number in the first column of the second matrix), and add those values all together:

2*3 + 1*1 + 3*7 = 6 + 1 + 21 = 28

This number is going to be the first number of the first column of the new matrix.

We are then going to multiple the first row of the first matrix by the second column of the second matrix. Using the same logic, we get the following:

2*8 + 1*9 + 3*-5 = 16 + 9 -15 = 10

This number is going to be the first number of the second column of the new matrix.

Then we multiply the second row of our first matrix by the first column of the second matrix:

-2*3 + 0*1 + 5*7 = -6 + 0+ 35 = 29

This number is going to be the second number of the first column of the new matrix.

Finally, we multiply the second row of our first matrix by the second column of the second matrix:

-2*8 + 0*9 + 5*-5= -16 + 0 – 25= -41

This number is going to be the second number of the second column of the new matrix.

Our answer, therefore, is a matrix that looks like this:

 

matrix

 

Even though this felt kind of complicated, we can use a visual depiction of what we just did to try to make things easier:

 

matrix multiplication examples

 

A few important notes about matrix multiplication, before we do some practice examples.

Now for some examples! For each of the examples shown below, we are going to use the procedure that we outlined above in order to calculate the matrix product.

Example 1: What is the matrix product of the following two matrices?

example 1

Answer:

General strategy: We are going to multiple each row of the first matrix by each column of the second matrix.

example 1 answer

Example 2: What is the matrix product of the following two matrices?

example 2

Answer:

General strategy: We are going to multiple each row of the first matrix by each column of the second matrix.

example 2 solution

Example 3: What is the matrix product of the following two matrices?

example 3

Answer:

General strategy: We are going to multiple each row of the first matrix by each column of the second matrix.

example 3 answer

Example 4: What is the matrix product of the following two matrices?

example 4

Answer:

General strategy: We are going to multiple each row of the first matrix by each column of the second matrix.

example 4 answer

Example 5: What is the matrix product of the following two matrices?

example 5

Answer:

General strategy: We are going to multiple each row of the first matrix by each column of the second matrix.

example 5 answer

 

Author: Mindy Levine, PhD