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.

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:

In every case the logic is the same: squared deviations, summed, judged against the upper tail of \chi^2.

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: