The Chi-Square Distribution
Take a plain standard
normal — the reference bell centred at 0, one unit wide.
Square it. Grab another independent standard normal, square that too. Keep going for a handful of
them, then add all the squares together. The pile of numbers you get has a
distribution of its very own — and it turns out to be one of the most useful curves in all of
statistics. It is the chi-square distribution, written
\chi^2.
Formally: if Z_1, Z_2, \dots, Z_k are independent standard normals, then
X = Z_1^2 + Z_2^2 + \cdots + Z_k^2 \;\sim\; \chi^2_k.
The single number k — how many squared normals we added up — is called
the degrees of freedom. It is the only knob this distribution has, and it
controls everything about the shape. That deceptively simple "square-and-add" recipe is the engine
behind almost every test that asks "does my data actually fit what I expected?"
Three facts that fall straight out of the recipe
You can read most of the chi-square's personality directly off the definition, before touching any
formula.
-
It can never be negative. Every term is a square, and squares are
\ge 0. So the whole sum lives on [0, \infty)
— there is no left tail at all. A chi-square value of -3 is impossible.
-
Its mean is k. A single squared standard normal
Z^2 averages out to exactly 1 (that's just
the variance of a standard normal, \operatorname{Var}(Z)=1). Add
k of them and the averages add:
\mathbb{E}[X] = k. The mean of a chi-square is its degrees of
freedom.
-
Its variance is 2k. Each
Z^2 contributes a variance of 2, and for
independent terms variances also add, giving
\operatorname{Var}(X) = 2k. So the spread grows with
k, but the standard deviation
\sqrt{2k} grows only like \sqrt{k} — slower
than the mean.
Because the mean climbs like k while the spread climbs only like
\sqrt{2k}, a large-k chi-square is a hump
sitting a long way from zero, comfortably clear of the wall at 0 — which
is exactly why it stops looking lopsided and starts looking like a bell (more on that below).
Watch the shape change with k
Drag the degrees of freedom slider and watch the curve transform. At
k = 1 and k = 2 the density is jammed up
against zero — it's spiked near the origin and slides down a long right tail. As
you raise k, the hump peels away from the wall, drifts to the right
(remember, the mean sits at k), and grows steadily
more symmetric: by k = 8 or so it already looks a lot
like a gently lopsided bell.
The shaded band on the right is the upper tail beyond a cutoff
c. That region is the whole point of a chi-square test: a big
chi-square value lands out there, and "how much area is past c" is the
probability of seeing a mismatch at least this large by chance. Notice how, for tiny
k, almost nothing reaches past c, while for
large k the whole hump has marched out to meet it.
Worked example 1 — one squared normal is \chi^2_1
Start at the very smallest case, k = 1. Here
X = Z^2: take a single standard normal and square it. What should this
distribution look like, and what is its mean?
Reason it through. A standard normal Z is usually close to
0 (values near the peak), so Z^2 is usually a
very small positive number — that is the tall spike at the origin. Occasionally
Z is out near \pm 2 or
\pm 3, and squaring sends those to 4 or
9 — that's the long thin right tail. And because both
+2 and -2 square to the same
4, the sign information is thrown away entirely.
For the mean, use the identity \mathbb{E}[Z^2] = \operatorname{Var}(Z) + (\mathbb{E}[Z])^2
= 1 + 0^2 = 1. So the average of a \chi^2_1 is exactly
1 — matching our rule "mean = k." If you
simulated a million squared standard normals and averaged them, you'd get a number hugging
1, even though the typical (most likely) value is much nearer
0. That gap between the crowded-near-zero mode and the mean of
1 is the right-skew in a nutshell.
Worked example 2 — adding three of them, and reading the tail
Now let k = 3: three independent standard normals, each squared, all
added up,
X = Z_1^2 + Z_2^2 + Z_3^2 \sim \chi^2_3.
By our rules the mean is k = 3 and the variance is
2k = 6 (so standard deviation \sqrt{6}\approx 2.45).
The curve still starts at the origin and is still right-skewed, but the hump has lifted off the wall
and now peaks around x = 1, trailing off toward the right.
Here's how a test uses it. Suppose a calculation on some real data gives a chi-square
statistic of X = 9.0. Is that "surprisingly large" for
\chi^2_3? We look up the upper-tail critical value: for
3 degrees of freedom, only 5\% of the
distribution lies beyond c = 7.81. Our
9.0 > 7.81 sits out in that 5\% tail — a result
this extreme happens under "everything's fine" less than 5\% of
the time — so at the 5\% level we'd flag the data as a poor fit. Every
chi-square test is exactly this move: compute a statistic, compare it to an
upper-tail cutoff.
What is it actually used for?
The chi-square distribution is the reference distribution — the yardstick you
compare your statistic against — for a whole family of everyday tests:
-
Goodness-of-fit. Does a die (or a genetics ratio, or a survey) match the counts
you expected? You form \sum \frac{(\text{observed} - \text{expected})^2}{\text{expected}}
— a sum of squared, scaled deviations — and it follows a chi-square. See the
chi-square goodness-of-fit test.
-
Independence / association. In a two-way table of counts (e.g. treatment vs.
outcome), are the two variables related, or independent? The same observed-minus-expected machinery
gives a chi-square statistic.
-
Inference about a variance. Because sample variances are built from squared
deviations from a mean, the sampling distribution of a (scaled) sample variance is chi-square — so
it's the tool for testing or building intervals for a population variance
\sigma^2.
In every case the logic is the same: squared deviations, summed, judged against the upper tail
of \chi^2.
-
\chi^2_k is the distribution of
Z_1^2 + \cdots + Z_k^2, a sum of k
independent squared standard normals.
-
Its one parameter is the degrees of freedom k; its
support is [0, \infty) — it is never negative.
-
Mean = k and variance
= 2k.
-
It is right-skewed for small k and grows more
symmetric as k increases.
-
It is the reference distribution for goodness-of-fit,
independence, and variance tests — all judged on the
upper tail.
It really is that simple: square up a few bell curves, add them, and out pops the distribution behind
every "does the data fit?" test. Karl Pearson introduced it in 1900 precisely to measure the
total squared discrepancy between what you observed and what a theory predicted — one number
that bundles up all the little mismatches. Squaring is the crucial trick: it makes every deviation
positive (so overshoots and undershoots can't cancel out) and it punishes big misses far
more than small ones. Sum those squared misses, and the maths guarantees the result rides on a
chi-square curve — which is why a distribution born from pure normal noise ended up as the referee for
dice, genetics, medical trials, and A/B tests alike.
The chi-square looks friendly but trips people up in three predictable ways. Keep these straight:
-
It is NOT symmetric. It's right-skewed and lives on
[0,\infty) — no negative values, no mirror-image left tail. Don't reach
for it as if it were another bell.
-
Chi-square tests use the UPPER tail. A poor fit produces a large
statistic (big squared deviations), so the "reject" region is way out on the right — not split
across two tails like a symmetric test. A tiny chi-square, by contrast, means the fit was
suspiciously good.
-
Its mean is k, not 0. People
borrow the "centred at zero" habit from the standard normal — but chi-square is built from
squared normals, so it measures squared deviations and centres at its degrees of freedom
k. Getting a statistic near k is
unremarkable; getting one far above k is the news.