Are the entries of diag($xx^T$) given by $x^Tx$?

352 Views Asked by At

If $x$ is a $n \times 1$ vector, are the entries of diag($xx^T$) given by $x^Tx$?

1

There are 1 best solutions below

0
On BEST ANSWER

$x^Tx$ is a $1\times1$ matrix. It can't contain the $n$ diagonal values you seek. Instead, their sum is $(x^Tx)_{11}$. Using Einstein notation,$$(x^Tx)_{11}=x_ix^i=\operatorname{diag}(xx^T)_i^i=\operatorname{Trace}(xx^T),$$because $\operatorname{diag}(xx^T)_i^j=x_ix^j$.