proof on trace trick
The first equality is just using the fact that $x^TAx$ is a real number, so when seen as a $1\times 1$ matrix, it's equal to its trace!
The other equalities use the fact that $tr(AB)=tr(BA)$.
The first equality is just using the fact that $x^TAx$ is a real number, so when seen as a $1\times 1$ matrix, it's equal to its trace!
The other equalities use the fact that $tr(AB)=tr(BA)$.