# Matrix quadratic form expansion question

I'm trying to do a question and within it, I need to expand a matrix quadratic form:

$$\frac{1}{2}(\vec{y} - \vec{x})^{T} \Sigma (\vec{y} - \vec{x})$$

In my working out, I think that the following is correct:

\begin{align} \frac{1}{2}(\vec{y} - \vec{x})^{T} \Sigma (\vec{y} - \vec{x}) & = \frac{1}{2}(\vec{y}^{T} - \vec{x}^{T}) \Sigma (\vec{y} - \vec{x}) \\ & = \frac{1}{2} \vec{y}^{T}\Sigma\vec{y} - \frac{1}{2} \vec{y}^{T}\Sigma\vec{x} - \frac{1}{2} \vec{x}^{T}\Sigma\vec{y} + \frac{1}{2}\vec{x}^{T}\Sigma\vec{x} \end{align}

$$\frac{1}{2}(\vec{y} - \vec{x})^{T} \Sigma (\vec{y} - \vec{x}) = \frac{1}{2} \vec{y}^{T}\Sigma\vec{y} - \vec{y}^{T}\Sigma\vec{x} - \vec{x}^{T}\Sigma\vec{y} + \frac{1}{2}\vec{x}^{T}\Sigma\vec{x}$$

so the middle two cross product terms do not have a half multiplied to them. Can anyone explain this? Or are the answers wrong?

• It looks like whoever wrote that answer had in mind combining the cross terms, which one can do when $\Sigma$ is symmetric, but wrote something else.
– amd
Jan 8, 2019 at 19:35

Your answer is correct. Also if $$\Sigma$$ is a symmetric matrix you can simplify the expression as $$\frac{1}{2}(\vec{y} - \vec{x})^{T} \Sigma (\vec{y} - \vec{x}) = \frac{1}{2} \vec{y}^{T}\Sigma\vec{y} - \vec{y}^{T}\Sigma\vec{x} + \frac{1}{2}\vec{x}^{T}\Sigma\vec{x}$$since $$\vec{x}^{T}\Sigma\vec{y}=\vec{y}^{T}\Sigma\vec{x}$$
A good way to do a sanity check for such results is to look at the one-dimensional case. If you then further set $$\Sigma = 1$$, the expression you are trying to expand is $$\frac12(y - x)(y-x) = \frac12(y^2 - 2 x y + x^2) = \frac12 y^2 - \frac12 y x - \frac12 x y + \frac12 x^2$$, as you calculated. Note that this is not equal to $$\frac12y^2 - 2 x y + \frac12 x^2$$ (for example, set $$x = y = 1$$), the result you Book (?) implies.