Matrix-Matrix Multiplication

Suppose that $T:\mathbb{F}^n \to \mathbb{F}^m$ and $S:\mathbb{F}^m \to \mathbb{F}^\ell$. Assuming standard basis for everything again, note that

\[S(T(c_1e_1 + \cdots + c_ne_n)) = c_1S(T(e_1)) + \cdots + c_nS(T(e_n)).\]

So if $A$ represents $T$ and $B$ represents $S$ (in the standard basis, of course), then

\[\begin{align*} BA(c_1e_1 + \cdots + c_ne_n) &= c_1BA(e_1) + \cdots + c_nBAe_n \\ &= c_1Ba_1 + \cdots c_nBa_n \\ &= c_1B(a_{1,1}e_1 + \cdots + a_{m,1}e_m) + \cdots + c_nB(a_{1,n}e_1 + \cdots + a_{m,n}e_m) \\ &= c_1(a_{1,1}b_1 + \cdots + a_{m,1}b_m) + \cdots + c_n(a_{1,n}b_1 + \cdots + a_{m,n}b_m) \\ &= (c_1a_{1,1} + \cdots + c_na_{1,n})b_1 + \cdots + (c_ma_{m,1} + \cdots + c_na_{m,n})b_m. \end{align*}\]

So if $D := BA$, then it makes sense to define matrix-matrix multiplication by

\[d_j = Ba_j.\]

Furthermore, this tells us that

\[d_{i,j} = \sum_{k=1}^m b_{i,k} a_{k,j}.\]

Note if we are willing to accept distributivity of matrix multiplication and entry-byas fact, then it is actually easier to derive these rules in the following way. Let

\[A = [a_1 \mid \cdots \mid a_n] \quad\text{ and }\quad B = [b_1 \mid \cdots \mid b_m].\]

Then,

\[BA = B\sum_{j=1}[0 \mid \cdots \mid a_j \mid \cdots \mid 0] = \sum_{j=1}[0 \mid \cdots \mid Ba_j \mid \cdots \mid 0].\]

So it follows immediately that $d_j = Ba_j$.

Example (Outer product). Suppose $u \in \mathbb{F}^m$ and $v \in \mathbb{F}^n$. Then the outer product of $u$ and $v$ is defined as the $m \times n$ matrix

\[uv^* = u[v_1 \; \cdots \; v_n] = [v_1u \; \cdots \; v_nu].\]

Notice that there is a natural way of realizing matrix multiplication in terms of outer products. Namely, note

\[AB = [a_1 \;\; \cdots \;\; a_n]\begin{bmatrix}\tilde{b}_1^T \\ \vdots \\ \tilde{b}_m^T\end{bmatrix}.\]

Then $AB$ is simply a sum of column-by-row outer products.