Given an $m\times n$-matrix $A$ and an $n\times p$-matrix $B$. Prove that $(AB)^T = B^TA^T$.

Here is my attempt:

Write the matrices $A$ and $B$ as $A = [a_{ij}]$ and $B = [b_{ij}]$, meaning that their $\left(i,j\right)$-th entries are $a_{ij}$ and $b_{ij}$, respectively.

Let $C=AB=[c_{ij}]$, where $c_{ij} = \sum_{k=1}^n a_{ik}b_{kj}$, the standard multiplication definition.

We want $(AB)^T = C^T = [c_{ji}]$. That is the element in position $j,i$ is $\sum_{k=1}^n a_{ik}b_{kj}$. For instance, if $i=2, j=3$, then the element in $2,3$ of $C$ is that sum, but the element in position $3,2$ of the transpose is that sum.

I need to get the same value for the element in position $3,2$ of the right side.

The transpose matrices are $B^T=[b_{ji}], A^T=[a_{ji}]$. They are size $p \times n$ and $n \times m$. That is, they switch rows and columns.

Let $D = B^T A^T = [d_{ji}]$. I write the indices backwards because if I want the element in position $3,2$, that is, $i=2, j=3$ just like on the other side.

So I need the summation for $d_{ji}$. But I get as $d_{ji} = \sum_{k=1}^n b_{jk}a_{ki}$, which does not match.