Consider $x^\top A x$, where $A \in \mathbb{R}^{n \times n}$ and $x \in \mathbb{R}^n$.
Suppose $A$ can be factors into $A = BB^T$
Then claim:
$x^T Ax = x^T BB^T x = \text{trace}(B^T xx^TB)$
It is not immediately obvious to me why this is true.
It seems to be using the following equality, $\text{trace}(ab) = \text{trace}(ba)$
Does anyone have a good way to see why it works?
Hint: Let $y=B^T x$ and use $\mathrm{trace}(y^T y) = \mathrm{trace}(y y^T)$.