HomeArticlesGenetics & Evolution

Population Genetics: When Hardy-Weinberg Breaks Down

The Hardy-Weinberg equilibrium as a null model, how selection tilts allele frequencies, and why genetic drift matters more in small populations.

mysimulator teamUpdated June 2026≈ 7 min read▶ Open the simulation

A population that does not change — the null model

Before you can say a population is evolving, you need a precise statement of what not evolving looks like. The Hardy-Weinberg principle (1908) gives it: for a gene with two alleles A and a at frequencies p and q = 1-p, if mating is random and there is no selection, mutation, migration or drift, the genotype frequencies settle immediately into a fixed ratio and stay there generation after generation:

p + q = 1                       (allele frequencies)
p² + 2pq + q² = 1               (genotype frequencies)

p²  = frequency of AA
2pq = frequency of Aa
q²  = frequency of aa
live demo · allele frequency drifting and shifting under selection● LIVE

That equilibrium is the yardstick. Any deviation from p²:2pq:q² in a real population is evidence that one of the assumptions is being violated — and population genetics is largely the study of which one, and by how much.

Selection tilts the equilibrium

Give genotype AA a fitness advantage — a higher chance of surviving to reproduce — and the allele frequency shifts every generation instead of staying put. With relative fitnesses wAA, wAa, waa, the frequency of A after one generation of selection is:

mean fitness:  w̄ = p²·wAA + 2pq·wAa + q²·waa

p' = ( p²·wAA + p·q·wAa ) / w̄

Iterate this and a favourable allele climbs toward fixation (p → 1), an unfavourable one gets driven toward loss (p → 0), and — in the special case where the heterozygote Aa is fitter than either homozygote (heterozygote advantage) — the population settles at a stable intermediate frequency instead, the textbook example being the sickle-cell allele persisting at meaningful frequency in malaria-endemic regions because heterozygous carriers resist malaria while avoiding the homozygous disease.

Drift: selection's random cousin

In a finite population, allele frequencies also wander from generation to generation purely by chance — which parents happened to have more offspring, independent of any fitness difference — a process called genetic drift. Its strength scales inversely with population size N: each generation's random change in frequency has variance roughly p(1-p)/(2N) for a diploid population, so a small population can fix or lose an allele through pure chance in a handful of generations, while in a very large population the same random fluctuations average out and drift is negligible next to selection.

Drift and selection are not mutually exclusive; they compete. The rule of thumb from population genetics theory is that selection dominates when N·s ≫ 1 (population size times the selection coefficient), and drift dominates when N·s ≪ 1 — a mildly beneficial mutation in a small population can still be lost by bad luck before selection ever gets a chance to favour it, which is a large part of why beneficial mutations mostly arise and vanish without ever fixing, even in a population under selection.

What the simulation is tracking

Running many replicate populations forward under the same selection coefficient and mutation rate but different population sizes shows the qualitative split directly: large-N runs converge tightly on the deterministic selection trajectory predicted by the fitness equation above, while small-N runs scatter widely, sometimes fixing the disfavoured allele purely by chance. Mutation, entering at rate μ per generation, continually reintroduces variation that selection and drift are simultaneously trying to remove — the long-run balance between mutation input and selection or drift removal is what population genetics calls mutation-selection or mutation-drift balance, and it is the reason genetic variation persists in real populations at all instead of every locus eventually fixing on one allele.

Frequently asked questions

What does it mean for a population to be in Hardy-Weinberg equilibrium?

It means genotype frequencies follow p squared, 2pq, and q squared exactly, with no change generation to generation, which happens only when mating is random and there is no selection, mutation, migration or genetic drift. It is a null model — real populations deviate from it, and the size and pattern of the deviation is what reveals which evolutionary force is acting.

How is genetic drift different from natural selection?

Selection changes allele frequency because certain genotypes are more likely to survive and reproduce — it has a consistent direction set by fitness. Drift changes allele frequency through pure sampling chance in a finite population, with no consistent direction; it can push a beneficial allele down or a harmful one up, and its effect gets weaker as population size grows.

Why can a beneficial mutation still be lost from a small population?

Because in a small population, random chance in who reproduces can outweigh even a real fitness advantage. The rule of thumb is that selection dominates drift when population size times the selection coefficient is much greater than one; in small populations that product can be small even for a genuinely beneficial mutation, so it is lost before selection has enough generations to reliably favour it.

Try it live

Everything above runs in your browser — open Population Genetics and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Population Genetics simulation

What did you find?

Add reproduction steps (optional)