$\DeclareMathOperator{\trace}{tr}$Is there any relationship between $\trace(Sxx^T)$ and $x^TSx$? Is there a nice way to write the set of quadratic functions of the components of a vector $x$ given coefficients in some matrix $S$?
$\endgroup$1 Answer
$\begingroup$$\DeclareMathOperator{\trace}{tr}$Yes. Assuming $S$ is square, $\trace(Sxx^\top)=x^\top Sx$. You have $(Sx)_i = \sum_k s_{ik}x_k$, so $x^\top Sx = \sum_{i,j}x_i s_{ij}x_j$.
$(Sxx^\top)_{ij} = (Sx)_i x_j = \sum_{k}s_{ik}x_k x_j$. But then all we do when we compute trace is to sum the terms where $i=j$, so $\trace(Sxx^\top) = \sum_{i,k}s_{ik}x_k x_i$, but this is the same as $x^\top Sx$.
Additionally, yes, you can also put a quadratic expression in terms of matrices and vectors. To see this just look at the sum form, and assume that you're forming a symmetric $S$ (you'd also have to divide the coefficients of your cross terms by 2).
You can incorporate linear terms simply by adding a $1$ to the end of $x$ and extending $S$ with $1\over 2$ of the linear coefficents in the bottom left and top right blocks. The constant term would just go in the bottom right block.
So you'd end up with $$ \begin{pmatrix}x^\top & 1 \end{pmatrix} \begin{pmatrix}A & b \\ b^\top & c\end{pmatrix} \begin{pmatrix}x \\ 1 \end{pmatrix} $$as your quadratic form.
$\endgroup$ 2