The Chi-Squared Distribution
Statement
Let Z1, …, Zk be independent standard-normal variables, Zi ~ N(0, 1), and define Q = Σi=1k Zi2. Then Q follows the chi-squared distribution with k degrees of freedom, with probability density fQ(x) = xk/2 − 1 e−x/2 ⁄ [2k/2 Γ(k/2)] for x > 0, mean E[Q] = k, and variance Var(Q) = 2k.
Why it matters
The chi-squared distribution is the exact sampling distribution of a sum of squared Gaussian fluctuations. It governs the estimated variance of any normally distributed measurement, underlies every least-squares goodness-of-fit test, and is the reference distribution against which experimental χ2 statistics are compared to accept or reject a model.
It also appears directly in physics: the kinetic energy of a classical particle in a heat bath is a sum of squared Gaussian velocity components, so the chi-squared distribution with k = 3 is the equilibrium energy distribution, and its mean k is exactly the equipartition theorem in disguise.
Assumptions
Derivation
Result
Reading. A sum of k independent squared standard-normals is right-skewed, supported on the positive axis, and peaks near x = k − 2. Its centre of mass sits at k and its spread grows as √(2k); each extra degree of freedom adds one unit of expected value and two units of variance. The xk/2−1 factor controls the behaviour near the origin and the e−x/2 factor the exponential tail.
Units check. Each Zi is dimensionless (a value divided by its own standard deviation), so Q and x are dimensionless. A density in x must carry dimension 1⁄x, and indeed fQ integrates to a pure number: ∫0∞ xk/2−1e−x/2dx = 2k/2Γ(k/2), which cancels the normalisation exactly.
Limiting cases
- k = 1: f(x) = (2πx)−1/2e−x/2, which diverges as x−1/2 at the origin (integrably) — the density of a single squared Gaussian.
- k = 2: f(x) = ½e−x/2, an exponential with mean 2; equivalently the distribution of twice a Rayleigh-squared radius.
- k = 3: f(x) = (x/2π)1/2e−x/2 — the Maxwell–Boltzmann energy distribution with mean (3/2), the equipartition value.
- k → ∞: by the central limit theorem the standardised variable (Q − k)⁄√(2k) → N(0, 1); the skewness √(8/k) vanishes and the shape becomes symmetric.
Breaks when
- Correlated components. If the Zi are dependent, MQ no longer factors as a product; the quadratic form ∑Zi2 then follows a weighted sum of independent chi-squares (eigenvalues of the covariance), not a single chi-squared.
- Non-zero means. If Zi ~ N(μi, 1) with μi ≠ 0, the result is the noncentral chi-squared with noncentrality λ = ∑μi2; the mean becomes k + λ and variance 2k + 4λ.
- Estimated parameters. When the squared terms are residuals about p parameters fitted from the same data, the true degrees of freedom are k − p, not k; using the naive count biases every goodness-of-fit inference.
- Non-Gaussian heavy tails. If the underlying variables are not normal (e.g. Student-t with few degrees of freedom), the sum of squares has heavier tails than chi-squared and the density above is only an approximation that worsens in the tail.
Failure modes
- Confusing k with sample size. Treating the degrees of freedom as the number of data points and forgetting the −1 (or −p) reduction when the mean or other parameters are estimated.
- Assuming symmetry. Reading off a two-sided confidence interval as if chi-squared were symmetric about its mean; the density is right-skewed and the upper and lower tails differ.
- Dropping the Jacobian. In the k = 1 transformation, writing fY(y) = φ(√y) and forgetting the 1⁄(2√y) factor, which loses the crucial y−1/2 singularity.
- Using variance = k. Copying the mean as the variance; the correct variance is 2k because Var(Z2) = 2, not 1.
- Squaring correlated residuals. Applying the result to fit residuals that share a fitted baseline and are therefore not independent, inflating the apparent number of degrees of freedom.
Discussion
The chi-squared law is the special case Gamma(k/2, 2) of the Gamma family, and this identification is more than bookkeeping: it means that a sum of two independent chi-squares with k1 and k2 degrees of freedom is again chi-squared with k1 + k2, exactly the additivity we exploited through the MGF product in step 7. Degrees of freedom add like independent squared coordinates — a purely geometric statement about orthogonal directions in a Gaussian cloud.
That geometric picture is the deepest reading. A k-dimensional isotropic Gaussian has spherically symmetric density ∝ e−r2/2, so the squared radius r2 = ∑Zi2 carries all the distributional content; chi-squared is simply the law of that squared radius. The xk/2−1 prefactor is the surface area of a shell of radius √x, and the exponential is the Gaussian weight on that shell. This is why the mode sits at k − 2 rather than the origin even though the Gaussian peaks at the centre: there is far more volume at large radius.
The result seeds a whole family. Ratios of independent chi-squares (each over its degrees of freedom) define the F distribution used in analysis of variance; a standard normal divided by √(Q/k) is Student's t; and the sample variance obeys (n − 1)s2/σ2 ~ χ2n−1, which is the engine of every confidence interval for a variance.
The clean subtraction of degrees of freedom when parameters are fitted is the content of Cochran's theorem: if a Gaussian vector is decomposed by orthogonal projections onto subspaces of dimensions d1, d2, …, the squared norms in each subspace are independent chi-squares with those dimensions as their degrees of freedom. Fitting p parameters projects out a p-dimensional subspace, leaving k − p in the residual — the abstract reason the naive count is wrong, and the same idea that partitions total variance into orthogonal, independently chi-squared pieces in ANOVA.
Common misconceptions. Chi-squared is not symmetric and its mean is not its mode; a small observed χ2 is not automatically "good," since a value far below the mean can signal overfitting or overestimated errors just as a large value signals a poor model.
Worked examples
Reading. The variance estimate is centred on the true value 4 but scatters by nearly ±50% with only ten readings — a quantitative warning about trusting variances from small samples.
Units check. s2 has units of σ2 (the measurement squared); its standard deviation likewise, as required.
Reading. The chi-squared mean reproduces equipartition exactly, and its variance quantifies the thermal energy fluctuation of a single molecule, of order kBT itself — relative fluctuation √(2/3) ≈ 0.82, large because one molecule is far from the thermodynamic limit.
Units check. Q is dimensionless, kBT is an energy, so E[E] is an energy and Var(E) an energy squared, as required.
Problems
- Show that the χ2 distribution with 2 degrees of freedom is an exponential, and compute P(Q > 3).
Solution
Set k = 2 in the density: f(x) = x0e−x/2⁄[21Γ(1)] = ½e−x/2, an exponential with mean 2. Then P(Q > 3) = ∫3∞½e−x/2dx = e−3/2 = 0.223. - State the mean, variance, and standard deviation of χ25.
Solution
Mean = k = 5; variance = 2k = 10; standard deviation = √10 = 3.16. - A sample of n = 25 readings comes from N(μ, σ2) with σ2 = 9. Give the degrees of freedom of (n−1)s2/σ2 and the standard deviation of s2.
Solution
df = n − 1 = 24. Var(s2) = (σ2/24)2·Var(χ224) = (σ4/576)(48) = σ4/12 = 81/12 = 6.75, so SD(s2) = √6.75 = 2.60. - Find the mode of the χ2 density with k degrees of freedom (k ≥ 2), and evaluate the density at the mode for k = 6.
Solution
Maximise ln f = (k/2 − 1)ln x − x/2; setting the derivative (k/2 − 1)/x − ½ = 0 gives mode x = k − 2. For k = 6 the mode is at x = 4; f(4) = 42e−2⁄[23Γ(3)] = 16·0.1353⁄(8·2) = 2.165/16 = 0.135. - Using the central-limit approximation, estimate P(χ250 > 70) and comment on its accuracy.
Solution
For k = 50, mean = 50 and SD = √(2·50) = 10. Approximating Q ~ N(50, 100): P(Q > 70) ≈ P(Z > (70−50)/10) = P(Z > 2) = 0.023. The true value is about 0.021, so the plain normal approximation is close but slightly overestimates the right tail because the distribution is still right-skewed at k = 50; a Wilson–Hilferty cube-root transform sharpens the estimate.