Determine $A$ such that $Q=X'AX$ has chi-squared distribution. Let $\boldsymbol X\sim N_n(\boldsymbol\mu,\boldsymbol\Sigma)$, where $\boldsymbol\Sigma$ positive-definite. I am trying to determine, in general, what form $\boldsymbol A$ (one example is $\boldsymbol\Sigma^{-1}$) must take so that $$Q=\boldsymbol X'\boldsymbol A\boldsymbol X\sim\chi_\nu(\delta)$$ for some $\nu,\delta$. One way I can think of is to equate mgfs of $\chi_\nu(\delta)$ and $Q$: suppose $Q=\boldsymbol X'\boldsymbol A\boldsymbol X\sim\chi_\nu(\delta)$, then $$M_Q(t)=\frac{e^{\delta t/(1-2t)}}{(1-2t)^{\nu/2}}.$$ On the other hand 
\begin{align*}
M_{Q}(t)&=E\left(e^{tQ}\right)\\
&=\int_{\Bbb R^n}\frac{\exp\left(t\boldsymbol x'\boldsymbol A\boldsymbol x\right)}{|\boldsymbol\Sigma|^{1/2}(2\pi)^{n/2}}\exp\left(-\frac{1}{2}(\boldsymbol x-\boldsymbol\mu)'\Sigma^{-1}(\boldsymbol x-\boldsymbol\mu)\right)\,d\boldsymbol x\\
&=...
\end{align*}
Then I am stucked, I know some ways (spectral decomposition, Cholesky decomposition, etc.) to do the trick given some restrictions on $\boldsymbol X$, such as $\boldsymbol X\sim N_n(0, \boldsymbol I)$, etc. But they do not seem easily applicable in general case. What should be done next? Any thought helps.
 A: You can reduce it to the case $X \sim N_n(\mu,I)$ as follows. Given $X \sim N_n(\mu,\Sigma)$, let $P$ be positive definite with $P^2=\Sigma$, and set $Y=P^{-1}X$, so $Y \sim N_n(P^{-1}\mu, I)$. Now, given a matrix $A$, we have the following equivalences:
\begin{align*}
X'AX \sim \chi_\nu^2(\delta) &\iff Y'P^{-1}APY \sim \chi_\nu^2(\delta) \\
&\iff Y'BY \sim \chi_\nu^2(\delta)\text{ where }B=P^{-1}AP
\end{align*}
From here, you can determine the positive definite matrices $B$ satisfying $Y'BY \sim \chi_\nu^2(\delta)$ (the spectral theorem should work nicely), and then the corresponding matrices $A$ will be $A=PBP^{-1}$.
A: By completing the square, the solution of the Gaussian integral
$$
\frac{1}{\vert\Sigma\vert^{\frac{1}{2}}(2\pi)^{\frac{n}{2}}}\int_{\mathbb R^n} e^{t{\bf x}^TA{\bf x}}e^{-\frac{1}{2}({\bf x}-{\bf \mu})^T\Sigma^{-1}({\bf x}-{\bf \mu})}~\mathrm d{\bf x}
$$
is
$$
\frac{e^{t{\bf\mu}^TA(I-2tA\Sigma)^{-T}{\bf\mu}}}{\vert I-2tA\Sigma\vert^{\frac{1}{2}}}\,,\tag{1}
$$
as long as the matrix, $I-2tA\Sigma$, is positive definite. In particular, for symmetric $A\Sigma$, this means that $I-2t\Lambda$ is required to be positive definite, where $\Lambda$ is the diagonal matrix representation of $A\Sigma$ guaranteed by the spectral theorem. Therefore, to match the form of the moment generating function for the chi-square distribution with $\nu$-degrees of freedom, the denominator in $(1)$ should satisfy (for some integer $0<\nu\leqslant n$)
$$
\vert I-2t\Lambda\vert^{1/2} = \prod_{i=1}^{n}(1-2\lambda_it)^{1/2} = (1-2t)^{\nu/2}\,.
$$
This suggests, as a sufficient condition, that we require 3 things: 1) $\lambda_i = 1$ for "$\nu$" eigenvalues, 2) $\lambda_i = 0$ for the remaining "$n-\nu$" eigenvalues (where $i = 1, \ldots, n$), and 3) $t<\frac{1}{2}$. Consequently, any matrix $A$
 such that $A\Sigma$ is symmetric and idempotent (with rank $\nu$) will suffice.
