Trace of a matrix times outer product

$\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$?

-

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.

-
Thanks for your answer so far. Is there an intuitive explanation of why someone would prefer to write the first expression? Does it reveal some mathematical structure? The second one seems clearer to me. – Neil G Feb 2 '13 at 21:33
It depends on the circumstance. The former is sometimes used when you're treating matrices as a vector space. $\trace(A^\top B)$ is a "dot product" for matrices, and it can be clearer in context to use the first. – John Moeller Feb 2 '13 at 21:42