Tutorials › Statistical Theory I - Probability and Distribution Theory › When Is a Gaussian Quadratic Form Chi-Square?

Gaussian Quadratic Forms · Tutorial 755 of 994

When Is a Gaussian Quadratic Form Chi-Square?

Use the eigenvalues of a symmetric matrix to decide whether a standard-normal quadratic form is chi-square, a scaled chi-square, or neither.

Advanced 10 min read

What You'll Learn

  • Express a standard-normal quadratic form as a weighted sum of independent squared standard normals.
  • Prove the eigenvalue criterion for an unscaled chi-square distribution.
  • Relate the chi-square degrees of freedom to the number of unit eigenvalues.
  • Characterize when a quadratic form has a scaled chi-square law.
  • Use moments and eigenvalues to diagnose common misclassifications.

Why the Eigenvalues Decide the Distribution

A quadratic form in a Gaussian vector can look like a sum of squares without actually having a chi-square distribution. The key distinction is whether the directions being squared are weighted equally. For a standard normal vector, the eigenvalues of the matrix give exactly those weights. This tutorial establishes the precise criterion for an unscaled chi-square law, then separates it from the more general case of a scaled chi-square law.

Let \(Z\) be a \(p\)-dimensional vector whose entries are independent \(N(0,1)\) random variables, and let \(A\) be a real symmetric \(p\times p\) matrix. We study \(Q=Z^\mathsf{T}AZ\). If a quadratic form is initially written with a nonsymmetric matrix, replacing it by its symmetric part \((A+A^\mathsf{T})/2\) leaves the quadratic form unchanged.

Definition: A chi-square random variable with \(k\) degrees of freedom, written \(\chi^2_k\), is the sum of squares of \(k\) independent \(N(0,1)\) random variables. For \(k=0\), use \(\chi^2_0=0\) as a degenerate convention. A scaled chi-square law \(c\chi^2_k\), for \(c>0\), is the distribution of \(cW\) when \(W\sim\chi^2_k\).

By the spectral theorem, there is an orthogonal matrix \(U\) such that \(A=U\Lambda U^\mathsf{T}\), where \(\Lambda\) is diagonal with eigenvalues \(\lambda_1,\ldots,\lambda_p\). The standard normal density is unchanged by orthogonal transformations, so \(Y=U^\mathsf{T}Z\) again has independent \(N(0,1)\) entries. Consequently,

$$ Q=Z^\mathsf{T}AZ =Y^\mathsf{T}\Lambda Y =\sum_{i=1}^{p}\lambda_iY_i^2. $$

This weighted-sum representation is the starting point. A chi-square law has unit weights on the included squared normals and zero weights on the rest. The main issue is proving that no different set of eigenvalues can produce the same law.

The Exact Criterion

Theorem: Let \(Z\sim N_p(0,I_p)\), and let \(A\) be a real symmetric matrix with eigenvalues \(\lambda_1,\ldots,\lambda_p\). Then \(Z^\mathsf{T}AZ\sim\chi^2_k\) for an integer \(k\geq 0\) if and only if exactly \(k\) eigenvalues of \(A\) equal \(1\) and all remaining eigenvalues equal \(0\). Equivalently, \(A\) is an idempotent matrix, \(A^2=A\), and \(k=\operatorname{rank}(A)\).

We prove both directions. The forward direction uses the moment-generating function (MGF), including when some eigenvalues might be negative; thus nonnegativity of the quadratic form is not assumed in advance.

For \(Q=\sum_i\lambda_iY_i^2\), independence and the one-dimensional normal integral give, for \(t\) in an open interval about zero where each \(1-2t\lambda_i>0\),

$$ M_Q(t)=E[e^{tQ}] =\prod_{i=1}^{p}(1-2t\lambda_i)^{-1/2}. $$

The interval exists because there are finitely many finite eigenvalues. The same formula for a chi-square variable is \(M_{\chi^2_k}(t)=(1-2t)^{-k/2}\), for \(t<1/2\).

Proof of the theorem: If \(A\) has exactly \(k\) eigenvalues equal to \(1\) and all others zero, the weighted-sum representation reduces to \(Q=\sum_{i:\lambda_i=1}Y_i^2\). This is the sum of squares of \(k\) independent standard normals, so \(Q\sim\chi^2_k\).

Conversely, suppose \(Q\sim\chi^2_k\). Their MGFs agree on an open interval about zero. Taking logarithms and differentiating there gives
$$ \sum_{i=1}^{p}\frac{\lambda_i}{1-2t\lambda_i} = \frac{k}{1-2t}. $$

Both sides are rational functions of \(t\). Because they agree on an interval, multiplying by their denominators gives a polynomial that vanishes at infinitely many points; that polynomial is identically zero. The rational functions therefore agree wherever both are defined. Each nonzero eigenvalue \(\lambda_i\) contributes a pole at \(t=1/(2\lambda_i)\) on the left, with residue \(-1/2\). Eigenvalues that are equal contribute the same pole, so their residues add; distinct eigenvalues have distinct poles and cannot cancel one another. The right side has a pole only at \(t=1/2\), with residue \(-k/2\). Thus every nonzero eigenvalue must be \(1\). If there are \(r\) such eigenvalues, the residue at \(1/2\) on the left is \(-r/2\); equality gives \(r=k\). All other eigenvalues are zero. The spectral theorem now gives \(A^2=A\), and its rank is the number of its nonzero eigenvalues, namely \(k\). \(\square\)

The criterion is stronger than checking that \(Q\) is nonnegative or that its mean matches a proposed chi-square mean. It requires the entire spectrum to consist only of zeros and ones.

Worked Example: A Noncoordinate Projection Gives an Unscaled Chi-Square

Take

$$ A=\frac12 \begin{pmatrix} 1&1\\ 1&1 \end{pmatrix}, \qquad Z= \begin{pmatrix} Z_1\\Z_2 \end{pmatrix}, $$

where \(Z_1,Z_2\) are independent \(N(0,1)\) variables. The vector \((1,1)^\mathsf{T}\) is an eigenvector with eigenvalue \(1\), and \((1,-1)^\mathsf{T}\) is an eigenvector with eigenvalue \(0\). There is exactly one unit eigenvalue and one zero eigenvalue, so the theorem gives \(Q\sim\chi^2_1\). Directly,

$$ Q=Z^\mathsf{T}AZ =\frac{(Z_1+Z_2)^2}{2} =\left(\frac{Z_1+Z_2}{\sqrt{2}}\right)^2. $$

The variable \((Z_1+Z_2)/\sqrt{2}\) is \(N(0,1)\), confirming the result. The example also shows that the matrix need not be diagonal in the original coordinates.

Scaled Chi-Square Laws Are Different

Equal positive eigenvalues produce a scaled chi-square law, not necessarily an unscaled one. The distinction can be characterized just as sharply.

Theorem: For \(c>0\) and integer \(k\geq 1\), \(Z^\mathsf{T}AZ\sim c\chi^2_k\) if and only if exactly \(k\) eigenvalues of \(A\) equal \(c\) and all the others equal \(0\).

To see the necessity, the MGF of \(c\chi^2_k\) is \((1-2ct)^{-k/2}\). Equating it to the MGF of \(Q\), taking logarithms, and differentiating gives

$$ \sum_{i=1}^{p}\frac{\lambda_i}{1-2t\lambda_i} = \frac{kc}{1-2ct}. $$

The rational-function argument used in the preceding proof applies again. The right side has its only pole at \(1/(2c)\); each nonzero eigenvalue on the left contributes a pole at \(1/(2\lambda_i)\), with residue \(-1/2\). Equality forces every nonzero eigenvalue to be \(c\), and matching residues forces exactly \(k\) such eigenvalues. Conversely, those eigenvalues give \(Q=c\sum_{i=1}^{k}Y_i^2\), which has the stated law.

Worked Example: Equal Weights Give a Scaled Chi-Square

Let \(A=\operatorname{diag}(3,3,0)\), where \(\operatorname{diag}\) denotes a diagonal matrix with the listed entries. Then

$$ Q=3Y_1^2+3Y_2^2=3(Y_1^2+Y_2^2)\sim 3\chi^2_2. $$

This is not an unscaled chi-square law: the two nonzero eigenvalues are \(3\), not \(1\). As a check, \(E[Q]=3+3=6\) and \(\operatorname{Var}(Q)=2(3^2+3^2)=36\). A chi-square law with mean \(6\) would have \(6\) degrees of freedom and variance \(12\), not \(36\).

Worked Example: Unequal Positive Weights Do Not Give a Scaled Chi-Square

Let \(A=\operatorname{diag}(1,1/4,0)\). Then \(Q=Y_1^2+\frac14Y_2^2\), a positively weighted sum of independent squared standard normals. Its nonzero eigenvalues are unequal, so the scaled-law criterion rules out both an unscaled and any scaled chi-square distribution.

The first two moments provide a useful numerical check. Since \(E[Y_i^2]=1\) and \(\operatorname{Var}(Y_i^2)=2\),

$$ E[Q]=1+\frac14=\frac54, \qquad \operatorname{Var}(Q)=2\left(1^2+\left(\frac14\right)^2\right)=\frac{17}{8}. $$

If \(Q\) had law \(c\chi^2_k\), its mean and variance would be \(ck\) and \(2c^2k\). Matching these two moments would require \(c=\operatorname{Var}(Q)/(2E[Q])=17/20\) and \(k=E[Q]/c=25/17\). These moment matches do not establish a scaled chi-square law; the unequal eigenvalues show that no such law is possible.

What the Criterion Rules Out

A negative eigenvalue is an immediate warning sign: along its eigendirection, the weighted sum contains a negative multiple of a squared normal. The exact theorem already rules out a chi-square law, whose values are nonnegative, because the required spectrum contains only zeros and ones. But even positive eigenvalues do not suffice. They must also all equal \(1\) for an unscaled chi-square, or all equal the same \(c>0\) for a scaled chi-square.

A common mistake is to see a sum of squared normal coordinates and conclude that it is chi-square. For example, \(3Y_1^2+3Y_2^2\) is indeed a constant times a sum of two squared standard normals, but its law is \(3\chi^2_2\), not \(\chi^2_2\). Another tempting shortcut is to match means: many different eigenvalue lists can have the same sum and hence the same mean. Matching a mean, or even a few moments, is not a substitute for the eigenvalue criterion.

Key takeaway: For a standard-normal quadratic form, count the eigenvalues rather than just the squared terms. Exactly \(k\) unit eigenvalues and all other eigenvalues zero give \(\chi^2_k\); exactly \(k\) equal positive eigenvalues \(c\) and all others zero give \(c\chi^2_k\). Other spectra do not produce either of these laws.

Check Your Understanding

Use the eigenvalue criteria to answer these questions.

  1. A symmetric matrix has eigenvalues \(1,1,0,0\). What is the distribution of its quadratic form in a standard normal vector, and what is its rank?
  2. A matrix has eigenvalues \(2,2,0\). Is the resulting quadratic form unscaled chi-square, scaled chi-square, or neither? State its law.
  3. Why does a rational-function identity in the proof rule out a negative eigenvalue when the target is chi-square?
  4. A quadratic form has nonzero eigenvalues \(1\) and \(1/2\). Can it have a scaled chi-square law? Explain using the criterion.
  5. Why does matching the mean of a quadratic form to the mean of a chi-square variable fail to establish equality in distribution?