# Transpose of product of matrices [duplicate]

This question already has an answer here:

How do you prove the following fact about the transpose of a product of matrices? Also can you give some intuition as to why it is so.

$$(AB)^T = B^TA^T$$

## marked as duplicate by darij grinberg, воитель, Xander Henderson, José Carlos Santos linear-algebra StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jun 12 at 20:45

• While I have seen this asked many time before on Math.SE, I have not been able to find a link to a duplicate. For now, you may find this article helpful. – Brian May 1 at 0:58
• We need a good answer to this question, and in this case Ted Shifrin has answered, so I hope this question is not closed. – littleO May 1 at 1:06
• Note: the same fact holds for matrix inverses – J. W. Tanner May 1 at 1:31

Here's an alternative argument. The main importance of the transpose (and this in fact defines it) is the formula $$Ax\cdot y = x\cdot A^\top y.$$ (If $$A$$ is $$m\times n$$, then $$x\in \Bbb R^n$$, $$y\in\Bbb R^m$$, the left dot product is in $$\Bbb R^m$$ and the right dot product is in $$\Bbb R^n$$.)

Now note that $$(AB)x\cdot y = A(Bx)\cdot y = Bx\cdot A^\top y = x\cdot B^\top(A^\top y) = x\cdot (B^\top A^\top)y.$$ Thus, $$(AB)^\top = B^\top A^\top$$.

When you multiply $$A$$ and $$B$$, you are taking the dot product of each ROW of $$A$$ and each COLUMN of $$B$$.

The resulting dimension is $$A_{\#col}\times B_{\#row}$$, and after transposing, you have $$B_{\#row}\times A_{\#col}$$.

When you multiply $$B^T$$ and $$A^T$$, you take the dot product of each row of $$B^T$$ (column of B) and column of $$A^T$$, or row of $$A$$.

Your resulting dimension is $$B^T_{\#col}\times A^T_{\#row}$$ which is just $$B_{\#row}\times A_{\#col}$$

This formula ensures that each entry is correct, and that the dimensions are identical.

• Just to make up some notation to express your first + third sentence: let $\operatorname{row}_i(M)$ and $\operatorname{col}_j(M)$ denote the $i^{\text{th}}$ row and $j^{\text{th}}$ column of $M$, respectively. Then $(AB)_{ij} = \operatorname{row}_i(A) \cdot \operatorname{col}_j(B)$, and $(B^T A^T)_{ji} = \operatorname{row}_j(B^T) \cdot \operatorname{col}_i(A^T) = \operatorname{col}_j(B) \cdot \operatorname{row}_i(A)$, so $(AB)_{ij} = (B^T A^T)_{ji}$. – Misha Lavrov May 1 at 1:15

If you know about dual spaces and maps, a conceptual proof can be obtained by observing that $$A^T$$ corresponds to the dual map of $$A$$ and that taking the dual is contravariant with respect to composition. That is, $$(T \circ S)^* = S^* \circ T^*$$.

• But then you're just delaying the actual argument until you prove that taking duals is a contravariant functor – FreeSalad May 31 at 23:26
• Actually, my bad, the fact that $(-)^* = \mathrm{Hom}(-, k)$ is enough. But it still is a lot of work (the term "corresponds" actually hiding equivalences of categories). – FreeSalad May 31 at 23:29
• Well, proving that taking the dual corresponds to transposing a matrix only takes 3--4 lines. Let $T : V \rightarrow W$ be a linear map and $(v_i)$ and $(w_i)$ be basis for $V$ and $W$ respectively. Let $A$ be the matrix for $T$ and $A'$ be the matrix for $T^*$. It is enough to show that $A_{ij} = A'_{ji}$. Well $A_{ij} = w_i^*(T(v_j))$ and similarly $A'_{ji} = v_j^{**}(w_j^* \circ T)$ so it is enough to show that $v_j^{**}(w_j^* \circ T) =w_i^*(T(v_j))$. But this calculation is very simple. – Aniruddh Agarwal Jun 2 at 20:32

I marked this as community wiki since it so close to Saketh Malyala's answer.

We will now prove the assertion.

For any matrix $$C$$ let $$\text{Row}(C,i)$$ denote the $$i^\text{th}$$ row of $$C$$ represented in a natural way as vector.

For any matrix $$C$$ let $$\text{Col}(C,j)$$ denote the $$j^\text{th}$$ column of $$C$$ represented in a natural way as vector.

The $$(i,j)^\text{th}$$ entry of $$AB$$ is equal to $$\langle \text{Row}(A,i), \text{Col}(B,j)\rangle$$

The $$(j,i)^\text{th}$$ entry of $$B^tA^t$$ is equal to $$\langle \text{Row}(B^t,j), \text{Col}(A^t,i)\rangle$$

But $$\text{Row}(B^t,j) = \text{Col}(B,j)$$ and $$\text{Col}(A^t,i) = \text{Row}(A,i)$$, so indeed,

$${(AB)}^t = B^t A^t$$