Matrix Multiplication

# Matrix Multiplication

 Definition: Given matrix $A$ of size $m \times r$ and matrix $B$ of size $r \times n$, their product denoted $AB$ is the $m \times n$ matrix whose $ij^{th}$ entries result from taking row $i$ in matrix $A$ and multiplying corresponding entries of column $j$ in matrix $B$ and summing their products.

For example, consider the following matrices:

(1)
\begin{align} A = \begin{bmatrix} 2 & 1\\ -2 & 3 \end{bmatrix} \quad , \quad B = \begin{bmatrix} 3 & 4 & 5 \\ 6 & 7 & 0 \end{bmatrix} \end{align}

We first note that matrix $A$ is of size $2 \times 2$, and matrix $B$ is of size $2 \times 3$, hence the product $AB$ is defined and will be of size $2 \times 3$. To find the first entry of our matrix $AB$, we will take row $1$ of $A$ and multiply corresponding entries of column $1$ of $B$ (and then sum then) to get $2\cdot3 + 1 \cdot 6 = 12$. Therefore, the first entry of our product matrix is $12$, and the rest of the entries are as follows:

(2)
\begin{align} AB = \begin{bmatrix} 12 & 15 & 10\\ 12 & 13 & -10 \end{bmatrix} \end{align}

In general given $A_{m \times r}$ and $B_{r \times n}$:

(3)
\begin{align} A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1r}\\ a_{21} & a_{22} & \cdots & a_{2r}\\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mr} \end{bmatrix} \quad , \quad B = \begin{bmatrix} b_{11} & b_{12} & \cdots & b_{1n}\\ b_{21} & b_{22} & \cdots & b_{2n}\\ \vdots & \vdots & \ddots & \vdots \\ b_{r1} & b_{r2} & \cdots & b_{rn} \end{bmatrix} \end{align}

Furthermore, $ij^{th}$ entry in the product $AB$ can be obtained by the following formula:

(4)
\begin{align} (AB)_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + ... + a_{ir}b_{rj} = \sum_{k=1}^r a_{ik}b_{kj} \end{align}

# The Cancellation Law for Multiplication Does NOT Hold

Suppose we have three matrices $A$, $B$, and $C$ and assume the products $AB$ and $AC$ are defined and $AB = AC$. We may be quick to assume that $B = C$, however this is not true for all cases (though in certain cases it is true). For example, consider the following $2 \times 2$ matrices:

(5)
\begin{align} A = \begin{bmatrix} 0 & 1\\ 0 & 2 \end{bmatrix} \quad , \quad B = \begin{bmatrix} 1 & 1 \\ 3 & 4 \end{bmatrix} \quad , \quad C = \begin{bmatrix} 2 & 5\\ 3 & 4 \end{bmatrix} \end{align}

Note that $AB = AC = \begin{bmatrix} 3 & 4\\ 6 & 8 \end{bmatrix}$. However clearly $B ≠ C$.

## Example 1

Show that if $A$ is a matrix of size $m \times n$ then $AA^T$ is always defined and will be a square matrix.

• Proof: We first note that $A^T$ will be an $n \times m$ sized matrix. The matrix product $A_{m \times n}A^T_{n \times m}$ will always be defined since $A$ has n columns and $A^T$ has n rows. Furthermore, the product will be of size $m \times m$ and will hence be square $\blacksquare$.