# What is the distribution of $x'Cx$ when $x$ is a standard gaussian vector

When $x$ is an '$n$' dimensional standard Gaussian, we have $x'x \sim \chi^2$ with $n$ degrees of freedom.

Now if I have a symmetric matrix $C$, what will be the distribution of $x'Cx$ ?

$C$ is the inverse of a positive definite matrix, like an inverse covariance matrix for example.

-
Are your "*" meant to denote matrix multiplication? That is usually written without any sign; using a star as you do in this context will make many readers think of adjoint matrices instead. (Also, does the apostrophe denote transposition?) –  Henning Makholm Jan 30 '12 at 21:44
yea sorry ... '*' is matrix multiplication and apostrophe is transpose. So x'Cx is what I'm asking about. –  NSR Jan 31 '12 at 0:48
A real symmetric matrix can be diagonalized by an orthogonal matrix. I'm assuming by "standard Gaussian" you mean in particular that the variance is the identity matrix (and the expected value is the zero vector). If you multiply an $n$-dimensional standard Gaussian vector by an orthogonal matrix, you don't change its probability distribution. So the problem reduces to the case where $C$ is a diagonal matrix. –  Michael Hardy Jan 31 '12 at 1:57

For $C$ idempotent, the distribution is chi-square with degrees of freedom the rank of $C$.

-

You may look at

http://en.wikipedia.org/wiki/Wishart_distribution

for $n=1$ (or $p=1$ depending on your taste).

-
thanks, but that just gives me the $\Chi^2$ distribution. I want there to be a (known) symmetric matrix in the inner product. So if x is a gaussian vector with identity covariance, I'm looking for $y = x^TCx$ –  NSR Jan 31 '12 at 6:11

$\def\E{\mathbf{E}}\def\V{\mathbf{Var}}\def\T{\mathbf{Tr}}$This may not be particularly helpful, but what you have is called simply the Generalized chi-square distribution.

You can calculate some of its moments without too much difficulty (you should check the calculations, though...)

$$\E(x'Cx) = \E(C_{ij}x_ix_j) = C_{ij}\delta_{ij} = \T(C)$$

\begin{align} \V(x'Cx) & = \E(C_{ij}C_{mn}x_ix_jx_mx_n) - \E(x'Cx)^2\\ & = C_{ij}C_{mn}\E(x_ix_jx_mx_n) - \T(C)^2 \\ & = C_{ij}C_{mn} (\delta_{ij}\delta_{mn} + \delta_{im}\delta_{jn} + \delta_{in}\delta_{jm}) - \T(C)^2 \\ & = \T(C\,'C) + \T(C^2) \end{align}

If you substitute $C=I$ then you recover $\E(x'x)=n$ and $\V(x'x)=2n$, as you'd expected for a regular chi-square distribution.

The Wikipedia article implies that the distribution is equivalent to a sum of independent chi-square distributed random variables, but this is not obvious to me from the definition.

-