# Correlation between two quadratic forms of Gaussian random vectors

I want to calculate the correlation between two quadratic forms of two Gaussian random vectors (of course these are in fact non-Gaussian densities). Does anyone know the derivation of this case?

More precisely:

$$\vec{x} \sim \mathcal{N}(\mu_{x}, \Sigma_{x}), \\ \vec{y} \sim \mathcal{N}(\mu_{y}, \Sigma_{y}),$$

Furthermore, assume the following variance-covariance (correct term?):

$$\mathbb{E}((\vec{x} - \mathbb{E}(\vec{x})(\vec{y} - \mathbb{E}(y))^{T}) = \Sigma_{xy}$$

Asumme $$\vec{A}$$ is symmetric (for simplicity) and hence one can define quadratic forms

$$z_{1} = \vec{x}^{T}\vec{A}\vec{x}, \ z_{2} = \vec{y}^{T}\vec{A}\vec{y}$$

$$\mathbb{E}(z_{1}) = \mathbb{E}(tr(\vec{x}^{T}\vec{A}\vec{x})) \\ = \mathbb{E}(tr(\vec{A}\vec{x}\vec{x}^{T})) \\ = tr(\vec{A}(\Sigma_x + \mu_{x}\mu_{x}^{T})) \\ = tr(\vec{A}\Sigma_x) + \mu_{x}^{T}\vec{A}\mu_{x}$$

With similar "tricks" one can derive $$var(\vec{x}^{T}\vec{A}\vec{x})$$ (see also Wikipedia or the Matrix cookbook).

However, I am totally stuck at finding $$cov(\vec{x}^{T}\vec{A}\vec{x}, \vec{y}^{T}\vec{A}\vec{y})$$

That is

$$\mathbb{E}((\vec{x}^{T}\vec{A}\vec{x} - \mathbb{E}(z_{1})(\vec{y}^{T}\vec{A}\vec{y} - \mathbb{E}(z_{2})) \\ = \mathbb{E}[\vec{x}^{T}\vec{A}\vec{x} \vec{y}^{T}\vec{A}\vec{y}] - \mathbb{E}(z_{1})\mathbb{E}(z_{2})$$

For the second term, see above. However, the first part seems to be tricky. The problem is, when I derive the variance, e.g. of $$z_1$$ then a similar term appears with all $$\vec{x}$$ instead of both variables. One can then apply a result on the expected value of a quartic (!) form (see: http://www.ee.ic.ac.uk/hp/staff/dmb/matrix/intro.html).

Unfortunately I find neither a derivation of the above nor a result on what I am looking for.

Wikipedia only lists the case where both quadratic forms are in the same random variable ($$x$$) but with different matrix ($$A$$ and $$B$$).

Has anyone seen this derivation or knows what I have to do?

EDIT: Not a complete solution but a hint for everyone who has the same problem. It turned out that even with the given moment generating functions in the Provost book, this is a tough issue. Frustrated by finding the derivatives, it turned out that is in fact easier to reformulate my specific problem to the one listed at wikipedia, i.e. two quadratic forms in the same random vector but with different Matrices. In fact, the solution I obtained is quite simple and totally agrees with the previous result where I had the variance only (not the correlation). But this might be a peculiarity of my specific problem and not a general result.

• You could have a look at the references given in the answer to: math.stackexchange.com/questions/442472/… Commented Apr 13, 2015 at 20:02
• Note that you do not need to assume the matrix $A$ is symmetric, a quadratic form is determined by only the symmetric part of $A$, the antisymmetric part is zeroed. Commented Apr 13, 2015 at 20:03
• Thanks but I did not find any references that deal with this question :(
– user73465
Commented Apr 14, 2015 at 12:34
• Have a look at Mathai & Provost: "Quadratic forms in random variables". Commented Apr 14, 2015 at 13:26
• Thanks for the Provost hint! However, I've just flipped through it and apparently, my problem is contained under "Generalised Quadratic Forms". Which makes perfectly sense, as I am in fact looking for the covariance matrix of a vector $X$ of quadratic forms $X_i = x_i^T A x_i$ where the $x_i$ are correlated Gaussians. Unfortunately, I do find lengthy expressions for the moment generating function but no word on the moments themselves. Only special cases where the correlation $cov(x_i, x_j)$ has a special form.Is that really that hard?
– user73465
Commented Apr 14, 2015 at 19:15

For $$Q_1 = X^T A_1 X$$ and $$Q_2 = X^T A_2 X$$ with $$X \sim N(\mu, \Sigma)$$:
$$Cov(Q_1, Q_2) = 2 tr (A_1 \Sigma A_2 \Sigma) + 4 \mu^T A_1 \Sigma A_2 \mu$$.
You can adjust this formula (for a single random variable) to your problem (where you have two different random variables $$x$$ and $$y$$). For this, you just need to set the random variable $$X$$ above to be the concatenation of $$x$$ and $$y$$ from your problem. The mean of $$X$$ will be the concatenation of $$\mu_x$$ and $$\mu_y$$. The covariance $$\Sigma$$ would be a matrix composed of $$\Sigma_x$$, $$\Sigma_y$$ and $$\Sigma_{xy}$$ you mention in the different quadrants.
Finally, you can define $$A_1$$ and $$A_2$$ in the formulas above to just contain the matrix $$A$$ of your question, located in the upper left quadrant of the matrix for $$Q_1$$ and the lower right quadrant for $$Q_2$$, which would give you your desired quadratic forms. Now we have all the elements of your problem reparametrized in a way that is suitable to use the formula from the Matahn & Provost book above.