On this page
You have genotype counts, say 50 AA, 80 Aa and 70 aa, and a question: is this population in Hardy-Weinberg equilibrium? It takes four steps: allele frequencies, expected counts, a chi-square statistic, and one value from a table. We work through two samples so you can see one fail and one pass.
What does Hardy-Weinberg equilibrium predict?
The US National Institute of Justice's population genetics course states the principle this way: in a large, randomly breeding population, allele frequencies stay the same from generation to generation if there is no mutation, gene migration, selection or genetic drift. If the allele frequencies are p and q (with p + q = 1), the expected genotype frequencies are p² for AA, 2pq for Aa and q² for aa, and p² + 2pq + q² = 1. The test asks whether your counts are too far from those predictions to put down to chance.
How do you calculate expected genotype counts from p and q?
Take our first sample: N = 200 individuals, so 400 alleles.
Count A alleles. Each AA carries two and each Aa carries one: 2 × 50 + 80 = 180.
p = 180 ÷ 400 = 0.45, so q = 1 − 0.45 = 0.55.
Expected AA = p² × N = 0.2025 × 200 = 40.5.
Expected Aa = 2pq × N = 0.495 × 200 = 99.
Expected aa = q² × N = 0.3025 × 200 = 60.5.
Check that the expected counts add up to N: 40.5 + 99 + 60.5 = 200. To practise counting alleles from genotypes, see our walk-through on calculating allele frequency from MN blood group counts.
How do you run the chi-square test step by step?
For each genotype, work out (observed − expected)² ÷ expected, then add the three numbers:
AA: observed 50, expected 40.5, difference 9.5, squared 90.25, divided by 40.5 gives 2.23
Aa: observed 80, expected 99, difference −19, squared 361, divided by 99 gives 3.65
aa: observed 70, expected 60.5, difference 9.5, squared 90.25, divided by 60.5 gives 1.49
Total: χ² = 2.23 + 3.65 + 1.49 = 7.37
The NIST/SEMATECH table of chi-square critical values gives 3.841 for one degree of freedom at the 0.05 level, and 6.635 at the 0.01 level. Our 7.37 is larger than both, so we reject the idea that this sample fits Hardy-Weinberg proportions. Notice where the gap comes from: there are 19 fewer heterozygotes than expected.
Now a second sample with the same N and the same p = 0.45: 45 AA, 90 Aa, 65 aa. The expected counts are the same 40.5, 99 and 60.5. The contributions are 20.25 ÷ 40.5 = 0.50, 81 ÷ 99 = 0.82 and 20.25 ÷ 60.5 = 0.33, so χ² = 1.65. That is below 3.841, so this sample is consistent with equilibrium.
Why is there only one degree of freedom?
Three classes would normally give two degrees of freedom, but you also estimated p from the data, and p fixes q and all three expected frequencies. The Memorial University notes on the Hardy-Weinberg chi-square explain that the expected values of the three genotype categories are pre-determined by knowing one allele frequency. The University of Maryland's MathBench module makes the same point: only p is free to vary, so there is only one degree of freedom. The general rule is the number of genotype classes minus the number of alleles: 3 − 2 = 1.
If you use 2 degrees of freedom, you read a larger critical value from the table, and you may pass a sample that should fail.
What does a significant result actually tell you?
It tells you that something is pushing the genotypes away from p², 2pq and q². It doesn't tell you what. A paper in the *American Journal of Human Genetics* by Wigginton, Cutler and Abecasis (2005) notes that departures from Hardy-Weinberg can point to inbreeding, population structure or genotyping errors. The same paper warns that the simple chi-square test can give too many false positives, even in samples of about 1,000 people with roughly 100 copies of the rarer allele, and describes exact tests that control this better. For textbook problems, use chi-square; with rare alleles in real data, an exact test is safer.
For where equilibrium comes from, read how one generation of random mating reaches Hardy-Weinberg. For a related calculation, see finding carrier frequency from incidence.
A checklist for your answer sheet
Find p from allele counts: p = (2 × AA + Aa) ÷ 2N.
Expected counts are p²N, 2pqN and q²N, summing to N.
Keep decimals; round only the final χ².
State the degrees of freedom: 3 − 2 = 1.
Compare with 3.841 and conclude in words.
If you get stuck partway, the Fermi Problem Library has a step-by-step solver that explains the reasoning rather than printing an answer. If the gap is allele frequency itself, the Fermi Concept Library covers every concept in biology, each with its own lesson.



