# Matrix Multiplication: Product of Two Matrices

Matrix multiplication is the “messy type” because you will need to follow a certain set of procedures in order to get it right. This is the “messy type” because the process is more involved. However, you will realize later after going through the procedure and some examples that the steps required are manageable. Don’t worry, I will help you with this!

But first, we need to ensure that the two matrices are “allowed” to be multiplied together. Otherwise, the given two matrices are “incompatible” to be multiplied. If this is the case, we say that the solution is undefined.

## Matrix to Matrix Multiplication a.k.a “Messy Type”

**Always remember this!**

In order for matrix multiplication to work, the **number of columns** of the left matrix MUST EQUAL to the **number of rows** of the right matrix.

Suppose we are given the matrices [latex]A[/latex] and [latex]B[/latex], find [latex]AB[/latex] (do matrix multiplication, if applicable). Determine which one is the left and right matrices based on their location. It is a very important step.

To determine if I can multiply the two given matrices, I need to pay attention to the number of columns of matrix [latex]A[/latex] and the number of rows of matrix [latex]B[/latex]. If they are equal, then I can proceed with Matrix Multiplication. Otherwise, I will conclude that the answer is undefined!

Because **Matrix A has the number of columns of 2**, and **Matrix B has the number of rows of 3**, and they are not equal **(2 â‰ 3)**, I conclude that [latex]AB[/latex] = **undefined**. That means their product can’t be found.

### Examples of Matrix Multiplication a.k.a. “Messy Type”

**Directions**: Given the following matrices, perform the indicated operation.

**Example 1**: Calculate, if possible, the product of [latex]B[/latex] and [latex]E[/latex].

In order for matrices [latex]B[/latex] and [latex]E[/latex] to have a product, the number of columns of left matrix B **must equal **the number of rows of right matrix E.

**Matrix B (left)**

number of columns = 3

**Matrix E (right)**

number of rows = 3

Since this is the case, then it is okay to multiply them together. Now, these are the steps:

**Step 1:** Place them side by side.

**Step 2:** Multiply the rows of [latex]B[/latex] into the columns of [latex]E[/latex] by multiplying the corresponding elements of each row to each element of the column, and then add them together.

**Please watch the animated solution carefully.**

If you have no patience watching the animated solution above on how to perform matrix multiplication, you can view the regular solution I have included below.

**Example 2**: Calculate, if possible, the product of [latex]E[/latex] and [latex]F[/latex].

Check first if the product of the two matrices exists by making sure that the number of columns of left matrix E **equals** the number of rows of right matrix F.

**Matrix E (left)**

number of columns = 2

**Matrix F (right)**

number of rows = 2

This is wonderful since the **number of columns of matrix **[latex]E[/latex] **equals the number of rows of matrix **[latex]F[/latex]. This means the product of [latex]EF[/latex] is defined so we can go ahead and perform matrix multiplication. See below for the animated step-by-step solution of matrix multiplication.

**Example 3**: Calculate, if possible, the product of [latex]F[/latex] and [latex]E[/latex].

In our previous example, we have successfully obtained the product of [latex]EF[/latex]. This time around, we want to find if we can find the product of [latex]E[latex] and [latex]F[/latex], in that order.

Just to remind you, real numbers are commutative under multiplication operation which means that the order of multiplication does not affect the final product. For instance…

So the big question becomes, does it work also in matrix multiplication?

Let’s check if the number of columns of matrix F equals the number of rows of matrix [latex]E[/latex].

**Matrix F (left)**

number of columns = 2

**Matrix E (right)**

number of rows = 3

Obviously, the number of columns of Matrix [latex]F[/latex] **does not equal** the number of rows of Matrix [latex]E[/latex]. The implication is that the product of [latex]FE[/latex] cannot be calculated, and therefore undefined!

In general, matrix multiplication is not commutative.

**Example 4**: Calculate, if possible, the product of [latex]AE[/latex].

The standard way to describe the size or dimension of a matrix is to…

(state number of rows) **x** (state number of columns)

…read as “the number of rows by the number of columns”.

3 **x **3 (three by three matrix)

3 **x **2 (three by two matrix)

Since the **number of columns of matrix A** equals the **number of rows of matrix E** then we conclude that the product of [latex]AE[/latex] is defined.

Let’s work it out. See the animated solution below.

**Example 5**: Calculate, if possible, the product of [latex]E[/latex] and [latex]A[/latex].

3 **x **2 (three by two matrix)

3 **x **3 (three by three matrix)

Obviously, the number of columns of matrix E **does not equal** the number of columns of matrix A. Therefore, the product of [latex]EA[/latex] cannot be calculated, or undefined.

**Example 6**: Calculate, if possible, the product of [latex]D[/latex] and [latex]F[/latex].

Since the number of columns of matrix [latex]D[/latex] **equals** the number of rows of matrix [latex]F[/latex], the product of [latex]DF[/latex] is defined.

**Example 7**: What is the product of **matrix C** when multiplied by itself?

This is rather simple. We will simply multiply matrix [latex]C[/latex] by matrix [latex]C[/latex] which can be written as [latex]CC[/latex] or [latex]{C^2}[/latex]. In other words, we are squaring matrix [latex]C[/latex].

We need to be cautious here. Notice that only a square matrix can be squared. Just to remind you, a square matrix is a matrix where the number of its row is equal to the number of its column.

I will leave it to you to verify that the solution below is correct. For math problems such as this, although tedious, I always recommend doing it by hand using a pencil and paper.

**You may also be interested in these related math lessons or tutorials:**