# Finding the distribution of $5X_{1}^2+2X_{1}X_{2}+X_{2}^2$

Suppose $X=[X_{1},X_{2}]$ and $X$~$N_2(μ,Σ)$. I wish to find the distribution of $5X_{1}^2+2X_{1}X_{2}+X_{2}^2$. Since this is of a quadratic form I do not know a way of solving this. However I kind of feel like its chi-squared distributed with parameter 2. Any answers will be welcomed. Thanks

• This answer might be useful. – QuantIbex May 12 '14 at 7:08

This looks like the sum of two scaled non-central chi-squares with different non-centrality parameters, which I don't think leads to a single distribution. We have

$$Y = 5X_{1}^2+2X_{1}X_{2}+X_{2}^2 =(2X_1)^2 + (X_1+X_2)^2$$

$$2X_1 \sim N(2\mu_1, 4\sigma^2_1) = N(m_1, s^2_1) \\ X_1+X_2 \sim N(\mu_1+\mu_2, \sigma^2_1+\sigma^2_2+2\rho\sigma_1\sigma_2) = N(m_2,s_2^2)$$

We then have
$$\tilde Z_1 = \left(\frac {2X_1}{s_1}\right)^2\sim \mathcal \chi^2_{(1)}(\lambda_1=m_1^2/s_1^2)$$

$$\tilde Z_2 = \left(\frac {X_1+X_2}{s_2}\right)^2\sim \mathcal \chi^2_{(1)}(\lambda_2=m_2^2/s_2^2)$$ i.e. chi-squares with non-centrality parameters $\lambda_1$ and $\lambda_2$ respectively.

$$Y = s_1^2\tilde Z_1 + s_2^2\tilde Z_2$$ i.e. the sum of two scaled non-central chi-squares, possibly dependent.

As far as I know, a scaled non-central chi-square does not also follow a non-central chi-square, so you can only proceed further if you look for approximations. If the means of the original variables are zero, and $X_1,\, X_2$ are independent, then matters fully simplify (in such a case $Y$ will follow a Gamma distribution).

• Variables $2X_1$ and $X_1 + X_2$ are not independent in general since they are both normal and $\mbox{cov}(2X_1,X_1 + X_2) = 2(\sigma_1^2 + \rho \sigma_1\sigma_2) \neq 0$ unless $\rho = -\sigma_1 / \sigma_2$. Does your conclusion hold for dependent variables? – QuantIbex May 12 '14 at 11:13
• Thank you. The expression of $Y$ as a sum of scaled non-central chi-squares is not affected by whether $X_1, X_2$ are independent or not. But in general independence or dependence plays a critical role, so I adjusted my answer to reflect this. – Alecos Papadopoulos May 12 '14 at 12:04
• You can find more detail here: math.stackexchange.com/questions/442472/… An R implementation is is CRAN package CompQuadForm – kjetil b halvorsen May 12 '14 at 13:20
• As @kjetil's answer at math.stackexchange.com/a/442916/86468 points out, the distribution can be expressed as a linear combination of independent non-central $\chi^2$ variables provided $\Sigma$ is suitably analyzed: you don't have to settle for a combination of dependent distributions. I suspect a generalization of the approximation by Moschopoulos (for sums of independent central $\chi^2$ variables) referenced at stats.stackexchange.com/questions/72479 might provide a practical way to work with such linear combinations. – whuber May 12 '14 at 13:27

As Alecos and nivag pointed out, there is no closed form distribution. Only approximations are available. The latest such approximation is by Liu, Tang and Zhang: "A new chi-square approximation to the distribution of non-negative definite quadratic forms in non-central normal variables", CSDA 2008. See in the references there for other approximations.

You could create a numerical estimate of your distribution by a Monte Carlo type approach. i.e. take a large number of random samples from $X_1$ and $X_2$ and calculate the function. As long as you take enough samples the probabilities given by the output should be a good estimate of the true distribution.

As far as I am aware there is no simple, analytical way to calculate the distribution for complicated functions such as this. Although it may be possible in your case as the function is fairly simple (only quadratic).