If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

## Precalculus

### Course: Precalculus>Unit 7

Lesson 10: Multiplying matrices by matrices

# Multiplying matrices

When we multiply a matrix by a scalar (i.e., a single number) we simply multiply all the matrix's terms by that scalar. We can also multiply a matrix by another matrix, but this process is more complicated. Even so, it is very beautiful and interesting. Learn how to do it with this article.

#### 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, start subscript, start color #11accd, 2, end color #11accd, comma, start color #e07d10, 1, end color #e07d10, end subscript is the entry in the start color #11accd, 2, start text, n, d, space, r, o, w, end text, end color #11accd and the start color #e07d10, 1, start text, s, t, space, c, o, l, u, m, n, end text, end color #e07d10 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
$\left[\begin{array}{rr}{1} &7 \\ 2& 4 \end{array}\right]\cdot\left[\begin{array}{rr}{3} &3 \\ 5& 2 \end{array}\right]$

## Scalar multiplication and matrix multiplication

When we work with matrices, we refer to real numbers as scalars.
\begin{aligned} \blueD 2\cdot\left[ \begin{array}{cc} 5 & 2 \\ 3 & 1 \end{array} \right] &=\left[ \begin{array}{cc} \blueD 2\cdot 5 & \blueD 2\cdot 2 \\ \blueD 2\cdot 3 & \blueD 2\cdot 1 \end{array} \right] \\\\ &=\left[ \begin{array}{cc} 10 & 4 \\ 6 & 2 \end{array} \right] \end{aligned}
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$n-tuples and the dot product

We are familiar with ordered pairs, for example left parenthesis, 2, comma, 5, right parenthesis, and perhaps even ordered triples, for example left parenthesis, 3, comma, 1, comma, 8, right parenthesis.
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.
\begin{aligned}(\purpleC2,\greenD5)\cdot (\purpleC3,\greenC1)&=\purpleC2\cdot \purpleC3+\greenD5\cdot \greenD1\\ \\ &=6+5\\ \\&=11 \end{aligned}
Ordered n-tuples are often indicated by a variable with an arrow on top. For example, we can let a, with, vector, on top, equals, left parenthesis, 3, comma, 1, comma, 8, right parenthesis and b, with, vector, on top, equals, left parenthesis, 4, comma, 2, comma, 3, right parenthesis. The expression a, with, vector, on top, dot, b, with, vector, on top indicates the dot product of these two ordered triples and can be found as follows:
\begin{aligned}\vec{a}\cdot \vec{b}&=(\purpleC 3,\greenD1,\maroonC8)\cdot (\purpleC4, \greenD2, \maroonC3 )\\\\&=\purpleC3\cdot \purpleC4+\greenD1\cdot \greenD2+\maroonC8\cdot \maroonC3\\ \\ &=12+2+24\\ \\&=38 \end{aligned}
Notice that the dot product of two n-tuples of equal length is always a single real number.

1) Let c, with, vector, on top, equals, left parenthesis, 4, comma, 3, right parenthesis and d, with, vector, on top, equals, left parenthesis, 3, comma, 5, right parenthesis.
c, with, vector, on top, dot, d, with, vector, on top, equals

2) Let m, with, vector, on top, equals, left parenthesis, 2, comma, 5, comma, minus, 2, right parenthesis and n, with, vector, on top, equals, left parenthesis, 1, comma, 8, comma, minus, 3, right parenthesis.
m, with, vector, on top, dot, n, with, vector, on top, equals

## Matrices and $n$n-tuples

When multiplying matrices, it's useful to think of each matrix row and column as an n-tuple.
$\begin{array}{rccc} &\goldD{\vec{c_1}}&\goldD{\vec{c_2}} \\ &\goldD\downarrow&\goldD\downarrow \\\\ \begin{array}{c}\blueD{\vec{r_1}\rightarrow} \\\blueD{\vec{r_2}\rightarrow}\end{array} &\left[\begin{array}{c}6\\4\end{array}\right. &\left.\begin{array}{c}2\\3\end{array}\right] \end{array}$
In this matrix, row 1 is denoted start color #11accd, r, start subscript, 1, end subscript, with, vector, on top, end color #11accd, equals, left parenthesis, 6, comma, 2, right parenthesis and row 2 is denoted start color #11accd, r, start subscript, 2, end subscript, with, vector, on top, end color #11accd, equals, left parenthesis, 4, comma, 3, right parenthesis.
Similarly, column 1 is denoted start color #e07d10, c, start subscript, 1, end subscript, with, vector, on top, end color #e07d10, equals, left parenthesis, 6, comma, 4, right parenthesis and column 2 is denoted start color #e07d10, c, start subscript, 2, end subscript, with, vector, on top, end color #e07d10, equals, left parenthesis, 2, comma, 3, right parenthesis.

$\begin{array}{rccc} &\goldD{\vec{c_1}}&\goldD{\vec{c_2}}&\goldD{\vec{c_3}} \\ &\goldD\downarrow&\goldD\downarrow&\goldD\downarrow \\\\ \begin{array}{c}\blueD{\vec{r_1}\rightarrow} \\\blueD{\vec{r_2}\rightarrow} \\\blueD{\vec{r_3}\rightarrow}\end{array} &\left[\begin{array}{c}1\\6\\2\end{array}\right. &\begin{array}{c}3\\3\\1\end{array} &\left.\begin{array}{c}5\\7\\4\end{array}\right] \end{array}$
3) Which of the following ordered triples is c, start subscript, 2, end subscript, with, vector, on top?

## 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, equals, A, B.
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.
$\begin{array}{ccccccccc} &&&&\goldD{\vec{b_1}}&\goldD{\vec{b_2}} \\ &&&&\goldD\downarrow&\goldD\downarrow \\\\ \begin{array}{c}\blueD{\vec{a_1}\rightarrow} \\\blueD{\vec{a_2}\rightarrow}\end{array} &\left[\begin{array}{c}1\\2\end{array}\right. &\left.\begin{array}{c}7\\4\end{array}\right] &\cdot &\left[\begin{array}{c}3\\5\end{array}\right. &\left.\begin{array}{c}3\\2\end{array}\right] &= &\left[\begin{array}{c}\blueD{\vec{a_1}}\cdot\goldD{\vec{b_1}}\\\blueD{\vec{a_2}}\cdot\goldD{\vec{b_1}}\end{array}\right. &\left.\begin{array}{c}\blueD{\vec{a_1}}\cdot\goldD{\vec{b_2}}\\\blueD{\vec{a_2}}\cdot\goldD{\vec{b_2}}\end{array}\right] \\\\ &A&&&B&&&C \end{array}$
Notice that each entry in matrix C is the dot product of a row in matrix A and a column in matrix B. Specifically, the entry c, start subscript, start color #11accd, i, end color #11accd, comma, start color #e07d10, j, end color #e07d10, end subscript is the dot product of start color #11accd, a, start subscript, i, end subscript, with, vector, on top, end color #11accd and start color #e07d10, b, start subscript, j, end subscript, with, vector, on top, end color #e07d10.
For example, start color #1fab54, c, start subscript, 1, comma, 2, end subscript, end color #1fab54 is the dot product of start color #11accd, a, start subscript, 1, end subscript, with, vector, on top, end color #11accd and start color #e07d10, b, start subscript, 2, end subscript, with, vector, on top, end color #e07d10.
$\begin{array}{ccccc} \left[\begin{array}{c}\bold\blueD 1\\2\end{array}\right. &\left.\begin{array}{c}\bold\blueD 7\\4\end{array}\right] &\cdot &\left[\begin{array}{c}3\\5\end{array}\right. &\left.\begin{array}{c}\bold\goldD 3\\\bold\goldD 2\end{array}\right] &= &\left[\begin{array}{c}\vec{a_1}\cdot\vec{b_1}\\\vec{a_2}\cdot\vec{b_1}\end{array}\right. &\left.\begin{array}{c}\bold\greenD{17}\\\vec{a_2}\cdot\vec{b_2}\end{array}\right] \end{array}$
We can complete the dot products to find the complete product matrix:
$C=\left[\begin{array}{rr}{38} &17 \\ 26& 14 \end{array}\right]$

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, equals, C, dot, D.
a) Which of the following is f, start subscript, 2, comma, 1, end subscript?

b) Find F.
F, equals

5) $X=\left[\begin{array}{rr}{4} &1 \\ 2& 3 \end{array}\right]$ and $Y=\left[\begin{array}{rrr}{2} &8 \\ 5& 4 \end{array}\right]$.
Find Z, equals, X, dot, Y.
Z, equals

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, equals, M, dot, N.
a) Which of the following is p, start subscript, 1, comma, 2, end subscript?