Matrix product via trace

133 Views Asked by At

Consider the matrix $A=[a_1,....,a_n]^T$ and $B=[b_1,....,b_n]^T$, where $a_j,b_j \in \mathbb{R}^p$

How can I see that I can write the following quadratic form with the trace operator:

$$\sum_{i=1}^n a_i^T M b_i = tr (AMB^T) $$

Why does equality hold here?

1

There are 1 best solutions below

6
On BEST ANSWER

Let $(e_i)$ be the canonical basis, so that $A^Te_i = a_i$, $B^Te_i = b_i$ and : $$I_n = \sum_{i=1}^n e_i e_i^T$$

Therefore : \begin{align} \operatorname{Tr}(AMB^T) &= \sum_{i=1}^n \operatorname{Tr}(AMB^T e_i e_i^T) \\ &= \sum_{i=1}^n \operatorname{Tr}( e_i^TAMB^T e_i) \\ &= \sum_{i=1}^n e_i^TAMB^T e_i \\ &= \sum_{i=1}^n a_i^TMb_i \\ \end{align}