# Multiplying matrices

Learn how to multiply a matrix by another matrix.

#### What you should be familiar with before taking this lesson

A

**matrix**is a rectangular arrangement of numbers into rows and columns. Each number in a matrix is referred to as a**matrix element**or**entry**.For example, matrix $A$ has $2$ rows and $3$ columns. The element $a_{\blueD2,\goldD1}$ is the entry in the $\blueD{2\text{nd row}}$ and the $\goldD{1\text{st column}}$ of matrix $A$, or $5$.

If this is new to you, we recommend that you check out our intro to matrices. You should also make sure you know how to multiply a matrix by a scalar.

#### What you will learn in this lesson

How to find the product of two matrices. For example, find

## Scalar multiplication and matrix multiplication

When we work with matrices, we refer to real numbers as

**scalars**.The term

**scalar multiplication**refers to the product of a real number and a matrix. In scalar multiplication, each entry in the matrix is multiplied by the given scalar.In contrast,

**matrix multiplication**refers to the product of two matrices. This is an entirely different operation. It's more complicated, but also more interesting! Let's see how it's done.Understanding how to find the

**dot product**of two ordered lists of numbers can help us tremendously in this quest, so let's learn about that first!## $n$-tuples and the dot product

We are familiar with ordered pairs, for example $(2,5)$, and perhaps even ordered triples, for example $(3,1,8)$.

An $n$-tuple is a generalization of this. It is an ordered list of $n$ numbers.

We can find the

**dot product**of two $n$-tuples of equal length by summing the products of corresponding entries.For example, to find the dot product of two ordered pairs, we multiply the first coordinates and the second coordinates and add the results.

Ordered $n$-tuples are often indicated by a variable with an arrow on top. For example, we can let $\vec{a}=(3,1,8)$ and $\vec{b}=(4,2,3)$. The expression $\vec{a}\cdot \vec{b}$ indicates the dot product of these two ordered triples and can be found as follows:

Notice that the dot product of two $n$-tuples of equal length is always a single real number.

### Check your understanding

## Matrices and $n$-tuples

When multiplying matrices, it's useful to think of each matrix row and column as an $n$-tuple.

In this matrix, row $1$ is denoted $\blueD{\vec{r_1}}=(6,2)$ and row $2$ is denoted $\blueD{\vec{r_2}}=(4,3)$.

Similarly, column $1$ is denoted $\goldD{\vec{c_1}}=(6,4)$ and column $2$ is denoted $\goldD{\vec{c_2}}=(2,3)$.

### Check your understanding

## Matrix multiplication

We are now ready to look at an example of matrix multiplication.

Given $A=\left[\begin{array}{rr}{1} &7
\\ 2& 4
\end{array}\right]$ and $B=\left[\begin{array}{rr}{3} &3
\\ 5& 2
\end{array}\right]$, let's find matrix $C=AB$.

To help our understanding, let's label the rows in matrix $A$ and the columns in matrix $B$. We can define the product matrix, matrix $C$, as shown below.

Notice that each entry in matrix $C$ is the

*of a row in matrix $A$ and a column in matrix $B$. Specifically, the entry $c_{\blueD i,\goldD j}$ is the dot product of $\blueD{\vec{a_i}}$ and $\goldD{\vec{b_j}}$.***dot product**In the image below, we see that $c_{\blueD1,\goldD2}$ is the dot product of $\blueD{\vec{a_1}}$ and $\goldD{\vec{b_2}}$.

We can complete the dot products to find the complete product matrix:

### Check your understanding

**4)**$C=\left[\begin{array}{rr}{2} &1 \\ 5& 2 \end{array}\right]$ and $D=\left[\begin{array}{rr}{1} &4 \\ 3& 6 \end{array}\right]$.

Let $F=C\cdot D$.

**6)**$M=\left[\begin{array}{rrr}{2} &8 &3 \\ 5& 4&1 \end{array}\right]$ and $N=\left[\begin{array}{rr}{4} &1 \\ 6& 3\\2&4 \end{array}\right]$.

Let $P=M\cdot N$.

## Why is matrix multiplication defined this way?

Up until now, you may have found operations with matrices fairly intuitive. For example when you add two matrices, you add the corresponding entries.

But things do not work as you'd expect them to work with multiplication. To multiply two matrices, we

**cannot**simply multiply the corresponding entries.If this troubles you, we recommend that you take a look at the following articles, where you will see matrix multiplication being put to use.