Hardy-Weinberg Equilibrium: How to Calculate Genotype Frequencies
If a gene comes in two versions, what share of a population carries one copy, two copies, or none? In 1908 the mathematician G. H. Hardy and the physician Wilhelm Weinberg independently showed that, in the absence of evolutionary forces, allele and genotype frequencies stay constant from one generation to the next, and that the genotype frequencies follow p² + 2pq + q² = 1. This guide shows how to calculate them, how to estimate hidden carriers from a visible recessive trait, and how geneticists use departures from the prediction.
What Hardy-Weinberg Equilibrium Is and Why It Matters
Consider a single gene with two alleles, conventionally written p (the dominant allele frequency) and q (the recessive allele frequency). Because every individual carries two copies of the gene, and those two copies are drawn from the population's allele pool, the population's genotypes distribute according to p² + 2pq + q² = 1. Here p² is the fraction of homozygous dominant individuals, 2pq is the heterozygotes, and q² is the homozygous recessive.
It matters because it is the null hypothesis of population genetics — the baseline of "nothing is happening." The principle holds only when five conditions are met: no mutation, no migration, no natural selection, random mating, and an infinitely large population (so no genetic drift). Real populations never perfectly satisfy all five, which is exactly the point. When observed frequencies deviate from what Hardy-Weinberg predicts, that deviation is a signal that one of those evolutionary forces is at work. The equation gives biologists a precise expectation to measure reality against.
How to Calculate Hardy-Weinberg Frequencies
The two governing equations are:
Allele frequencies: p + q = 1
Genotype frequencies: p² + 2pq + q² = 1
The first says the two allele frequencies must account for the whole gene pool. The second distributes those alleles across the three possible genotypes. The most common task is working backward from the visible recessive phenotype: since only the homozygous recessive genotype (q²) shows the recessive trait, you can find q by taking its square root, then derive everything else.
Worked example. Suppose a flower species has red flowers (dominant) and white flowers (recessive), and you count 16% of the plants in a field as white.
1. The white plants are homozygous recessive, so q² = 0.16
2. Solve for q: q = √0.16 = 0.4
3. Find p: p = 1 − q = 1 − 0.4 = 0.6
4. Homozygous dominant: p² = 0.6² = 0.36 (36%)
5. Heterozygous carriers: 2pq = 2 × 0.6 × 0.4 = 0.48 (48%)
6. Verify the identity: 0.36 + 0.48 + 0.16 = 1.00 ✓
So 36% of the plants are homozygous red, 48% are heterozygous red carriers, and 16% are white. The three genotype frequencies always sum to exactly 1, which is the built-in check: a total other than 1.0 means the two allele frequencies you started from do not add up to 1. The Hardy-Weinberg Calculator runs these steps from one known value (q², q or p) and returns p, q, p², 2pq or q²; enter 0.16 as the recessive phenotype frequency to reproduce the 0.48 carrier share above. If you are starting from genotype counts rather than frequencies, the Allele Frequency Calculator computes p from the numbers of AA, Aa and aa individuals.
Even though only 16% of plants show the white trait, nearly half the population carries the white allele as heterozygotes. This is why recessive traits persist even when they are visibly rare.
Using Hardy-Weinberg in Real Research
The principle's everyday value is in estimating carrier frequencies for recessive conditions. Cystic fibrosis affects roughly 1 in 2,500 births in populations of European descent, so q² = 0.0004, q = 0.02, p = 0.98, and the carrier frequency 2pq = 2 × 0.98 × 0.02 = 0.0392, about 1 in 25 people. For a rarer disorder affecting 1 in 10,000 births, q = 0.01 and 2pq = 0.0198, about 1 in 50. Estimating carrier rates from disease incidence this way is a standard tool in genetic counseling, though it assumes the population meets the equilibrium conditions.
Population geneticists also use the equation as a quality-control test. In genome-wide association studies, every marker is tested for departure from Hardy-Weinberg proportions before analysis, and variants that depart strongly (an excess of heterozygotes in particular) are flagged as likely genotyping errors and excluded; common thresholds are a test p-value below 10⁻⁶ in controls.
Finally, deviations reveal biology. An excess of homozygotes can indicate inbreeding or population structure; a shortage of one genotype can point to selection against it. Compute p², 2pq and q² from your allele frequencies, multiply by the sample size to get expected counts, and compare them with observed counts using a chi-square test.
Common Mistakes and How to Avoid Them
Confusing alleles with genotypes. p and q are allele frequencies; p², 2pq, and q² are genotype frequencies. Mixing the two is the most frequent beginner error.
Forgetting the heterozygote factor of 2. The middle term is 2pq, not pq. There are two ways to inherit one dominant and one recessive allele, which is why it is doubled.
Taking the square root of the wrong value. Only the homozygous recessive proportion (q²) maps directly to the visible recessive phenotype. Do not square-root the dominant phenotype frequency, which lumps together both p² and 2pq.
Assuming equilibrium proves nothing is evolving. A population can sit close to Hardy-Weinberg proportions even while forces partly offset one another. Matching the prediction is consistent with equilibrium, not definitive proof of it.
Applying it to tiny populations. The model assumes a large population so that random drift is negligible. In small populations, frequencies wander by chance and the prediction breaks down.
Key takeaways
• Know both equations: Allele frequencies satisfy p + q = 1, and genotype frequencies satisfy p² + 2pq + q² = 1, which always sums to exactly one
• Work from the recessive phenotype: Only homozygous recessives (q²) show the recessive trait, so take its square root to find q, then derive p and the rest
• Don't forget the 2: Heterozygotes are 2pq, not pq, because there are two ways to inherit one of each allele
• Use deviations as a signal: Departures from expected proportions hint at selection, inbreeding, population structure or genotyping error