On this page
You roll a die 120 times and a six turns up 38 times. Bad luck, or a loaded die? The chi-square goodness-of-fit test turns that hunch into a number you can check against a table. Karl Pearson set out the idea in a 1900 paper in the Philosophical Magazine.
What does the chi-square goodness-of-fit test check?
The test asks whether the counts in a set of categories match what a stated model predicts. The NIST/SEMATECH Engineering Statistics Handbook writes the null hypothesis as "the data follow a specified distribution" and the test statistic as χ² = Σ(O − E)²/E, where O is the observed count in a bin and E is the count the model expects there.
For a die, the model is "each face has probability 1/6" and the bins are the six faces. Squaring stops a shortfall on one face cancelling an excess on another. Dividing by E judges each miss against the size of the count: missing by 6 when you expected 20 matters; missing by 6 out of 2,000 does not.
How do you run the test on 120 rolls of a die?
State the model: a fair die, so each face has probability 1/6.
Work out expected counts: E = 120 × 1/6 = 20 for every face.
Record the observed counts for faces 1 to 6: 14, 22, 18, 26, 17, 23. Check they total 120.
Compute (O − E)²/E for each face: 36/20 = 1.8, then 4/20 = 0.2, 4/20 = 0.2, 36/20 = 1.8, 9/20 = 0.45 and 9/20 = 0.45.
Add them: χ² = 4.9.
Find the degrees of freedom. NIST gives them as k − c, where k is the number of non-empty bins and c is the number of parameters estimated from the data plus 1 (NIST handbook). We estimated nothing, because 1/6 comes from the model, so c = 1 and the degrees of freedom are 6 − 1 = 5.
Compare with the 5% critical value for 5 degrees of freedom, 11.070: 4.9 is well below it, so these rolls give no evidence against a fair die.
Why five? Once five counts are known, the sixth is fixed, because all six must add to 120.
How do you read the chi-square critical value table?
NIST's table of upper-tail chi-square critical values labels its columns by the probability of a value less than the critical value. So the 0.95 column is the test at significance level α = 0.05, and the 0.999 column is α = 0.001.
For 5 degrees of freedom, the table gives 11.070 in the 0.95 column and 20.515 in the 0.999 column (NIST table). You reject the model when χ² is larger.
Now the suspicious run. Observed counts for faces 1 to 6 are 12, 15, 16, 18, 21 and 38. The squared gaps are 64, 25, 16, 4, 1 and 324, which add to 434, so χ² = 434/20 = 21.7. That is above 20.515, so by the chi-square approximation a fair die would give a value this large less than 0.1% of the time. Notice that the six alone contributes 324/20 = 16.2 of the 21.7.
For another die question, see why the first player to roll a six wins 6/11 of the time.
What does a large chi-square value prove, and what does it not?
The American Statistical Association's 2016 statement on p-values applies. A p-value can indicate how incompatible the data are with a specified model. It does not measure the probability that the hypothesis is true, and it does not measure the size of an effect or the importance of a result.
So χ² = 21.7 tells you these counts are hard to square with a fair die. It does not tell you:
that there is a 0.1% chance the die is fair;
how strongly the die favours six;
why the counts are off, which could be the die, the throwing surface or a tallying mistake.
A small statistic does not prove fairness either. The NIST handbook describes power as the ability to detect a difference when one actually exists, and notes that the chi-square approximation needs a sufficient sample size and that the statistic depends on how the data are binned (NIST handbook). With 120 rolls, a slightly biased die can easily pass. The honest sentence is "the counts are inconsistent with a fair die at the 5% level", not "the die is proven loaded".
A checklist before you trust your χ²
Fix E from the model before you look at the data.
Check that observed and expected totals match.
Degrees of freedom = bins − 1 − parameters estimated from the data.
Find the bin that contributes most and ask why.
Report the statistic, degrees of freedom and critical value, not just "significant".
If a step trips you up, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. For the ideas underneath, the Fermi Concept Library gives each concept its own lesson.
Next, see how to find the variance of a sum of random variables.



