0

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

1 Answers1

1

$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$.

J.G.
  • 115,835