# How do you multiply ((-2, -5, 3), (3, -1, 2), (1, 4, -2)) with ((1, 4, 3), (-3, -3, 2), (-2, -1, -2))?

Dec 26, 2016

The formal definition of matrix multiplication is:

${c}_{i k} = {\sum}_{i , j , k} {a}_{i j} {b}_{j k}$

where $a , b , c$ are entries in the matrices $A , B , C$, respectively, and $A B = C$. That means if $A$ is $I \times J$ and $B$ is $J \times K$, then $C$ is $I \times K$.

Let the first and second indices indicate the row and column, respectively, for matrices $A$ and $B$ (i.e., we are in row major).

If you take the sum of the dot products of a GIVEN row $\boldsymbol{i}$ in $\boldsymbol{A}$ with each column in $\boldsymbol{B}$, for EACH $i$, that's matrix multiplication.

That means:

1. Multiply row 1 in $A$ with column 1 in $B$. This entry goes in ${c}_{11}$.
2. Multiply row 1 in $A$ with column 2 in $B$. This entry goes in ${c}_{12}$.
3. Multiply row 1 in $A$ with column 3 in $B$. This entry goes in ${c}_{13}$.
4. Multiply row 2 in $A$ with column 1 in $B$. This entry goes in ${c}_{21}$.
5. Multiply row 2 in $A$ with column 2 in $B$. This entry goes in ${c}_{22}$.
6. Multiply row 2 in $A$ with column 3 in $B$. This entry goes in ${c}_{23}$.
7. Multiply row 3 in $A$ with column 1 in $B$. This entry goes in ${c}_{31}$.
8. Multiply row 3 in $A$ with column 2 in $B$. This entry goes in ${c}_{32}$.
9. Multiply row 3 in $A$ with column 3 in $B$. This entry goes in ${c}_{33}$.

This gives another $3 \times 3$ matrix $C$:

$\textcolor{b l u e}{C} = A B$

$= \left[\begin{matrix}- 2 & - 5 & 3 \\ 3 & - 1 & 2 \\ 1 & 4 & - 2\end{matrix}\right] \times \left[\begin{matrix}1 & 4 & 3 \\ - 3 & - 3 & 2 \\ - 2 & - 1 & - 2\end{matrix}\right]$

$\left[\begin{matrix}{\sum}_{j} {a}_{1 j} {b}_{j 1} & {\sum}_{j} {a}_{1 j} {b}_{j 2} & {\sum}_{j} {a}_{1 j} {b}_{j 3} \\ {\sum}_{j} {a}_{2 j} {b}_{j 1} & {\sum}_{j} {a}_{2 j} {b}_{j 2} & {\sum}_{j} {a}_{2 j} {b}_{j 3} \\ {\sum}_{j} {a}_{3 j} {b}_{j 1} & {\sum}_{j} {a}_{3 j} {b}_{j 2} & {\sum}_{j} {a}_{3 j} {b}_{j 3}\end{matrix}\right]$

$\left[\begin{matrix}- 2 \cdot 1 - 5 \cdot - 3 - 3 \cdot 2 & - 2 \cdot 4 - 5 \cdot - 3 - 1 \cdot 3 & - 2 \cdot 3 - 5 \cdot 2 - 3 \cdot 2 \\ 3 \cdot 1 - 1 \cdot - 3 - 2 \cdot 2 & 3 \cdot 4 - 1 \cdot - 3 - 1 \cdot 2 & 3 \cdot 3 - 1 \cdot 2 - 2 \cdot 2 \\ 1 \cdot 1 - 4 \cdot 3 - 2 \cdot - 2 & 1 \cdot 4 - 3 \cdot 4 - 1 \cdot - 2 & 1 \cdot 3 + 2 \cdot 4 - 2 \cdot - 2\end{matrix}\right]$

$\left[\begin{matrix}- 2 + 15 - 6 & - 8 + 15 - 3 & - 6 - 10 - 6 \\ 3 + 3 - 4 & 12 + 3 - 2 & 9 - 2 - 4 \\ 1 - 12 + 4 & 4 - 12 + 2 & 3 + 8 + 4\end{matrix}\right]$

$\textcolor{b l u e}{\left[\begin{matrix}7 & 4 & - 22 \\ 2 & 13 & 3 \\ - 7 & - 6 & 15\end{matrix}\right]}$