How to find $\operatorname{tr}(Dvw^T)$?

55 Views Asked by At

Let $D \in \mathbb{R}^{n\times n}$ be a read-valued diagonal matrix and $v, w \in \mathbb{R}^{n}$ be two vectors. Is there some nice way to compute trace of $Dvw^T$?

I am asking this question because of some Frobenius norm optimization problem. could you help me please?

2

There are 2 best solutions below

0
On BEST ANSWER

Let $v=( v_{1},v_{2},...,v_{n})$ and $w=(w_{1},w_{2},...,w_{n})$ then diagonal entries of $v w^{T}$ is $v_{1}w_{1},v_{2}w_{2},...,v_{n}w_{n}$. Hence diagonal entries in $D v w^{T}$ is the product of respective diagonal entries in the two matrices (as $D$ is a diagonal matrix) i.e. diagonal entries of $D v w^{T}$ are $a_{1}v_{1}w_{1},a_{2}v_{2}w_{2},...,a_{n}v_{n}w_{n}$ where $ a_{1},a_{2},...,a_{n}$ are the diagonal entries in $D$. Hence the trace is $a_{1}v_{1}w_{1}+a_{2}v_{2}w_{2}+...+a_{n}v_{n}w_{n}$.

0
On

It's a useful fact that $\text{Tr}(AB) = \text{Tr}(BA)$, when both products $AB$ and $BA$ are defined. With $D, u ,v$ as given in the question, this fact implies that $$ \text{Tr}(Dvw^T) = \text{Tr}(w^T Dv) = w^T Dv. $$ (The last equality follows because $w^T Dv$ is a scalar.)