Transpose of Matrix Product

Theorem
Let $$\mathbf{A}$$ and $$\mathbf{B}$$ be matrices such that $$\mathbf{A} \mathbf{B}$$ is defined.

Then $$\left({\mathbf{A} \mathbf{B}}\right)^t = \mathbf{B}^t \mathbf{A}^t$$.

Proof
Let $$\mathbf{A} = a_{m n}$$, $$\mathbf{B} = a_{n p}$$

Let $$\mathbf{A} \mathbf{B} = \left[{c}\right]_{m p}$$.

Then from the definition of matrix product, $$\forall i \in \left[{1 \,. \, . \, m}\right], j \in \left[{1 \,. \, . \, p}\right]: c_{i j} = \sum_{k=1}^n a_{i k} \circ b_{k j}$$.

So, let $$\left({\mathbf{A} \mathbf{B}}\right)^t = \left[{r}\right]_{p m}$$.

The dimensions are correct, because $$\mathbf{A} \mathbf{B}$$ is an $$m \times p$$ matrix, thus making $$\left({\mathbf{A} \mathbf{B}}\right)^t$$ a $$p \times m$$ matrix.

Thus $$\forall j \in \left[{1 \,. \, . \, p}\right], i \in \left[{1 \,. \, . \, m}\right]: r_{j i} = \sum_{k=1}^n a_{i k} \circ b_{k j}$$.

Now, let $$\mathbf{B}^t \mathbf{A}^t = \left[{s}\right]_{m p}$$

Again, the dimensions are correct because $$\mathbf{B}^t$$ is a $$p \times n$$ matrix and $$\mathbf{A}^t$$ is an $$n \times m$$ matrix.

Thus $$\forall j \in \left[{1 \,. \, . \, p}\right], i \in \left[{1 \,. \, . \, m}\right]: s_{j i} = \sum_{k=1}^n b_{k j} \circ a_{i k}$$.

Note the order of the indices in the term in the summation sign on the RHS of the above. They are reverse what they would normally be because we are multiplying the transposes together.