next up previous
Next: Rules for Matrix Arithmetic Up: Matrix Multiplication, Part II Previous: Matrix Multiplication, Part II

The Definition

The product of two matrices $ A$ and $ B$ is defined whenever $ A$ is an $ m
\times n$ matrix and $ B$ is an $ n \times p$ matrix. That is, the number of columns of $ A$ has to be the same as the number of rows of $ B$. This means that rows of $ A$ and columns of $ B$ have the same number of entries, so the following definition makes sense:

$ AB$ is an $ m \times p$ matrix. Column $ j$ of $ AB$ is the product of $ A$ and column $ j$ of $ B$. In other words, to find $ AB$, we multiply $ A$ times all the columns of $ B$, and those are the columns of the product. Putting this still another way, the entry in row $ i$, column $ j$ of $ AB$ is the product of row $ i$ of $ A$ with column $ j$ of $ B$.

Here are some examples:


Example:

$\displaystyle \left(\begin{array}{cc} 1 & 2 \\  3 & 5
\end{array}\right)
\left...
...right) =
\left(\begin{array}{ccc} 1 & 2 & 12 \\  3 & 5 & 34
\end{array}\right).$

This is the product of a $ 2 \times 2$ matrix with a $ 2 \times 3$ matrix, so the result is a $ 2 \times 3$ matrix. The entry in row 1, column 3 is the product of the first row of the left-hand factor and the third column of the right-hand factor, $ \left(\begin{matrix}1 \cr 2 \cr \end{matrix}\right) (8,2) = 12$. The third column of the product is the left-hand factor times the third column of the right-hand factor:

$\displaystyle \left(\begin{array}{cc} 1 & 2 \\  3 & 5
\end{array}\right)
\left...
...
2
\end{array}\right) =
\left(\begin{array}{c}
12 \\
34
\end{array}\right).$

The product

$\displaystyle \left(\begin{array}{ccc} 1 & 0 & 8 \\  0 & 1 & 2
\end{array}\right)
\left(\begin{array}{cc} 1 & 2 \\  3 & 5
\end{array}\right)
$

is not defined. This is the product of a $ 2 \times 3$ matrix with a $ 2 \times 2$ matrix; the number of columns of the first factor (3) is not the same as the number of rows of the second factor (2), so we cannot carry out the multiplication. You can see that if you try to take the product of a row of the left-hand matrix with a column of the right-hand matrix, the numbers of entries don't match.


Example:

$\displaystyle \left(\begin{matrix}1 & 2 \cr
3 & 4 \cr
\end{matrix}\right)
\left...
...d{matrix}\right)=
\left(\begin{matrix}
0 & 4 \cr
-5 & 10 \cr\end{matrix}\right)$

$\displaystyle \left(\begin{matrix}
1 & 2 \cr
-2 & 1 \cr\end{matrix}\right)
\lef...
...nd{matrix}\right)=
\left(\begin{matrix}
7 & 10 \cr
1 & 0 \cr\end{matrix}\right)$

Example:

$\displaystyle \left(\begin{matrix}
1 & 2 & -3 \cr
2 & 4 & -6 \cr\end{matrix}\ri...
...end{matrix}\right)=
\left(\begin{matrix}
0 & 0 \cr
0 & 0 \cr\end{matrix}\right)$

$\displaystyle \left(\begin{matrix}
1 & 2 & -3 \cr
2 & 4 & -6 \cr\end{matrix}\ri...
...end{matrix}\right)=
\left(\begin{matrix}
0 & 0 \cr
0 & 0 \cr\end{matrix}\right)$


next up previous
Next: Rules for Matrix Arithmetic Up: Matrix Multiplication, Part II Previous: Matrix Multiplication, Part II
Peter Kostelec
2000-05-08