# Hardy-Weinberg: The Null Model of Evolution

> When nothing acts on a population, random mating reshuffles alleles into new pairs without changing how common each allele is, so genotype shares settle and hold steady generation after generation. This lesson works the Hardy-Weinberg equations on the AP® Biology formula sheet, counts alleles directly from genotype data, estimates carrier frequency when equilibrium is assumed, tests rock pocket mouse counts from the Pinacate lava flow with chi-square, and breaks each of the five equilibrium conditions in a simulated population. Afterwards you can calculate allele and genotype frequencies, run a Hardy-Weinberg chi-square test, and link each broken condition to its evolutionary mechanism.

Course: AP® Biology exam preparation (Unit 7 Natural Selection). Level: grades 7–12. About 26 minutes.
Lesson page (link this one when citing): https://stemhop.com/lessons/ap-hardy-weinberg/
Note: parts of this lesson are still being checked ("Under review").

## What you'll learn

- Explain why random mating reshuffles alleles without changing allele frequencies, and why dominance alone does not make an allele more common.
- Calculate allele frequencies by counting allele copies, and use p² + 2pq + q² = 1 and p + q = 1 to calculate expected genotype and carrier frequencies when equilibrium is assumed.
- Test observed genotype counts against Hardy-Weinberg expectations using the five-step chi-square routine, and explain what rejecting or failing to reject the null hypothesis shows.
- State the five conditions for Hardy-Weinberg equilibrium and predict how breaking each condition changes allele frequencies, genotype frequencies or both.

**On the Pinacate lava flow, researchers caught 29 rock pocket mice across dark lava and nearby light rock. Dark coat colour is dominant to light coat colour, yet 12 of the 29 mice had light coats.**

A dominant trait shows whenever an individual carries one copy of its gene version, so it seems bound to spread. Does dominance push a gene version upward over time? Hold that question. The Hardy-Weinberg equations on the AP® Biology formula sheet settle it, then show whether something is acting on the Pinacate mice.

> **The one idea.** Take a **population** (interbreeding individuals of one species) that nothing acts on. Random mating reshuffles its **alleles** (versions of a gene) into new pairs without changing how common each allele is. **Genotype** (allele-pair) shares settle and hold steady every generation. Real populations always break at least one of the five conditions this needs. So a departure from the expected genotype shares, or a change in allele shares over time, is evidence that something is acting.
>
> *Scope:* two alleles at one non-sex-chromosome gene in a large population, with equal allele shares in eggs and sperm. Multiple alleles, sex-linked genes, and inbreeding or selection-rate algebra are not tested.

**Where this sits.** [Variation and Survival](https://stemhop.com/lessons/variation-and-survival/) and [Natural Selection and New Species](https://stemhop.com/lessons/natural-selection-and-speciation/) introduce the gene pool without equations. [Population Genetics: Hardy-Weinberg and Evolutionary Forces](https://stemhop.com/lessons/population-genetics/) derives the college equations.

## Does a dominant allele take over?

A **locus** is a gene’s site on a chromosome. All alleles in a population form its **gene pool**. Diploid individuals carry two alleles per locus: a **homozygote** has two matching alleles (`AA` or `aa`), and a **heterozygote** has two different ones (`Aa`). A **phenotype** is the visible trait. A **dominant** allele masks a **recessive** allele in `Aa`, so `AA` and `Aa` share the dominant phenotype while only `aa` shows the recessive phenotype.

An **allele frequency** is the share of all allele copies that are one version. The formula sheet writes **p** (read “p”) for allele 1 (`A`) and **q** (read “q”) for allele 2 (`a`), with `p + q = 1`. A **genotype frequency** is the share of individuals that are `AA`, `Aa` or `aa`. **Evolution** is genetic change in a population over time; a change in allele frequencies across generations is evidence of it.

**Predict.** A dominant allele has frequency `p = 0.10` in a large, randomly mating population with no selection, mutation or migration. After 20 generations, will `p` rise toward 0.75, fall toward 0, or stay at 0.10?

> **Check your prediction.** It stays at 0.10. Dominance does not change which allele ends up in eggs and sperm. With nothing else acting, a rare dominant allele stays rare.

**Misconception check.** “Dominant alleles become more common over time.” “Dominant” sounds like “winning”, but dominance only decides which phenotype a heterozygote shows.

Test this with numbers. Take a large gene pool with `p = 0.60` (`A`) and `q = 0.40` (`a`), equal in eggs and sperm. Random mating pairs one random egg with one random sperm:

|  | Sperm `A` (0.60) | Sperm `a` (0.40) |
| --- | --- | --- |
| **Egg `A` (0.60)** | `AA`: 0.36 | `Aa`: 0.24 |
| **Egg `a` (0.40)** | `Aa`: 0.24 | `aa`: 0.16 |

Adding both heterozygote cells gives `0.36 AA`, `0.48 Aa` and `0.16 aa` (sum `1.00`). Recounting allele `A` gives `0.36 + ½(0.48) = 0.60`. Nothing moved. Now start from parents that are not at these shares: `0.50 AA`, `0.20 Aa`, `0.30 aa`. Their `p` is also `0.50 + ½(0.20) = 0.60`, so one generation of random mating gives the same `0.36`, `0.48` and `0.16`.

For any `p` and `q`:

1. Next `A` frequency = `p² + ½(2pq) = p² + pq`.
2. Factor out `p`: `p(p + q)`.
3. Since `p + q = 1`, this equals `p`.

This steady state is **Hardy-Weinberg equilibrium**: fixed allele frequencies with genotypes at `p²`, `2pq` and `q²`. Used as a test, it is a **null hypothesis** (a baseline that assumes nothing is causing evolution). See the scientist profiles for G. H. Hardy and Wilhelm Weinberg.

## Count alleles, not people

Calculating allele and genotype frequencies is AP science practice 5.A, mathematical calculations. When genotype counts are given, find `p` and `q` by counting allele copies directly. Never take a square root first. Counting copies (**gene counting**) works even away from equilibrium.

Take an invented sample of 200 wildflowers at a petal-colour locus: **80 `RR`**, **100 `Rr`** and **20 `rr`**.

1. **Genotype frequencies:** divide by `200`, giving `0.40 RR`, `0.50 Rr` and `0.10 rr`.
2. **Total allele copies:** diploid plants hold `2 × 200 = 400` copies.
3. **Allele counts:** `R` copies = `(2 × 80) + 100 = 260`. Copies of `r` = `(2 × 20) + 100 = 140`.
4. **Allele frequencies:** `p = 260 / 400 = 0.65` and `q = 140 / 400 = 0.35` (sum `1.00`).

Only `0.40` of plants are `RR`, yet `0.65` of alleles are `R` because heterozygotes carry `100` copies of `R`.

*Figure (AI-generated illustration).* Counting allele copies directly across diploid genotypes finds p and q without assuming equilibrium: here 0.40 of wildflowers are RR, yet p reaches 0.65 because 100 Rr heterozygotes also carry R. Image: a left-to-right diagram unpacking 200 diploid wildflowers (80 RR, 100 Rr, 20 rr) into 400 allele copies across two pools, with a larger gold tray of R tiles (260 copies, p = 0.65) and a smaller slate tray of r tiles (140 copies, q = 0.35), highlighting how 100 Rr heterozygotes split copies into both pools, paired with a right-hand inset showing one R and one r allele on a matching chromosome pair inside a single Rr plant.

## From allele frequencies to genotypes

Counting alleles needs no assumptions. Going from `p` and `q` to expected genotypes requires assuming Hardy-Weinberg equilibrium. The formula sheet gives the equations:

> **Equation card: Predict genotype frequencies from allele frequencies in a non-evolving population.**
>
>     p² + 2pq + q² = 1, with p + q = 1
>
> In words: p squared plus two p q plus q squared equals one, with p plus q equal to one.
>
> - p²: expected AA frequency (p multiplied by p)
> - 2pq: expected Aa frequency (pq plus qp)
> - q²: expected aa frequency (q multiplied by q)
> - p: frequency of allele 1 (A)
> - q: frequency of allele 2 (a); q = 1 − p
>
> Sanity check: At q = 0, p² = 1 (all AA). At p = q = 0.50, heterozygotes peak at 2pq = 0.50.
> Try one number Take q = 0.20, so p = 0.80. AA: 0.80 × 0.80 = 0.64. Aa: 2 × 0.80 × 0.20 = 0.32. aa: 0.20 × 0.20 = 0.04. Check: 0.64 + 0.32 + 0.04 = 1.00.

**Misconception check.** “`p²` is the dominant phenotype, so take its square root for `p`.” No. The dominant phenotype combines `p² + 2pq`. Only the recessive phenotype matches one genotype (`aa = q²`). Always start there.

A **carrier** is a heterozygote (`Aa`) carrying one hidden recessive allele.

**Predict 2.** In a large population assumed at equilibrium, 16% show a recessive phenotype. Predict whether carriers make up less than 16%, about 16%, or nearly half of the population.

> **Check your prediction.** Nearly half: 48%. Most copies of a recessive allele sit inside heterozygotes.

Work it out in four lines:

1. Recessive phenotype (`aa`): `q² = 0.16`.
2. Recessive allele: `q = √0.16 = 0.40`.
3. Dominant allele: `p = 1 − 0.40 = 0.60`.
4. Carriers (`Aa`): `2pq = 2 × 0.60 × 0.40 = 0.48` (**48%**). Check: `p² = 0.36`, total `1.00`.

This shortcut (`q = √(q²)`) holds **only** when equilibrium is assumed. Away from equilibrium, `aa` need not equal `q²`.

*Figure (AI-generated illustration).* When Hardy-Weinberg equilibrium is assumed, only the recessive phenotype matches a single genotype (q²), so starting at q² = 0.16 reveals that 48% of the population are hidden Aa carriers. Image: a side-by-side comparison of the same population under equilibrium showing two visible phenotypes on the left (a wide slate dominant-phenotype region concealing AA and Aa, and a narrow sand recessive-phenotype region for aa) unpacked on the right into three genotype regions (slate AA at 0.36, gold Aa carriers at 0.48, and sand aa at 0.16), above a four-step strip joined by dashed arrows converting q² = 0.16 to q = 0.40, p = 0.60, and 2pq = 0.48.

## Five conditions for the null model

Equilibrium means no evolution. For `p` and `q` to stay constant and genotypes to stay at `p²`, `2pq` and `q²`, five conditions must all hold:

1. **Very large population** (no chance sampling swings).
2. **No migration** into or out of the population.
3. **No new mutations** making or changing alleles.
4. **Random mating** regardless of genotype or relatedness.
5. **No natural selection** (equal **fitness**, meaning equal average surviving, reproducing offspring across genotypes).

No real population meets all five conditions at once. Still, the null hypothesis is a useful yardstick, like a frictionless track in physics. Its limit: a departure shows *that* a condition broke, not *which* one. Other evidence has to name it.

*Figure (AI-generated illustration).* Holding allele and genotype frequencies steady requires all five Hardy-Weinberg conditions at once—something no real population meets—so a departure from the null model signals that a condition broke without naming which one. Image: a radial diagram showing a gold equilibrium gene-pool ring holding steady p, q and p², 2pq, q² surrounded by five schematic condition medallions (large population, no migration, no new mutations, random mating, and no natural selection), paired with a right-hand inset showing a cracked dashed ring with a question mark to illustrate that a departure flags a broken condition without naming which one.

**Film transcript: Is This Population Evolving?**

### Film transcript: Is This Population Evolving?

Dark mice scurry over black lava, and light mice over pale rock. Dark coat colour is dominant. Yet many mice caught here still have light coats. Can a table of genotypes show something is acting? On the Pinacate lava flow, researchers genotyped mice from both habitats at one coat-colour gene. Every mouse carrying the dominant dark allele had a dark coat. Counting allele copies directly shows that the dominant allele is actually under half. Treat Hardy-Weinberg equilibrium as the null hypothesis: assume nothing is acting. Selection by predators favours dark coats on lava and light coats on pale rock. Will the combined sample hold too many heterozygotes, or too few?

Fewer. Observed heterozygotes fall below the null expectation. A chi-square test turns those gaps into one number. On the formula sheet, the value clears the cutoff, rejecting the null hypothesis of equilibrium. Read that verdict carefully. The authors reported a smaller chi-square and called the shortfall slight, so the verdict is not firm. They judged it consistent with opposite selection across the habitats.

Mitochondrial DNA showed no evidence of separate breeding groups. Hardy-Weinberg equilibrium is a yardstick, not a verdict on its own. Even failing to reject never proves nothing is acting. To see what each force does, open the five locks one by one. Unlock population size first, shrinking to a tiny group of breeders. Chance sampling of eggs and sperm swings p up and down unpredictably across separate runs. That random wandering is genetic drift, and alleles can vanish completely. Shut size again and unlock migration. Every generation, newcomers arrive from a neighbouring population richer in the dominant allele. That gene flow pulls p smoothly toward the newcomers' share without erratic jumps.

Now unlock mutation, where random copying errors convert one allele into another. Even with a boosted rate built to show on screen, p nudges downward slowly. Real mutation rates are far smaller. Now unlock random mating, letting individuals pair more often with matching genotypes. Watch the line: p stays flat. Non-random mating is the odd lock out. It lowers heterozygotes and raises homozygotes without adding or removing any allele copies. Finally, unlock natural selection, giving homozygous recessives lower survival and reproduction. At first, p climbs rapidly. Then the climb slows to crawl. Once the recessive allele becomes rare, most remaining copies hide inside heterozygotes, where selection spares them.

That is why biologists keep Hardy-Weinberg close. Equilibrium is the quiet baseline where nothing changes. Departures point to forces at work, and tracking allele shares across generations tests for evolution directly.

From the film

- Counting allele copies in 29 Pinacate rock pocket mice gives p ≈ 0.483 for the dominant dark allele D, so a dominant allele can still be under half of all copies.
- The sample held 11, 6 and 12 mice against Hardy-Weinberg expectations of 6.76, 14.48 and 7.76: fewer heterozygotes than expected.
- The formula-sheet chi-square, 9.95, clears the 5.99 cutoff at df = 2, but the authors reported 4.89 (probability 0.087), so the verdict is not firm; failing to reject would never prove nothing is acting.
- Breaking one condition at a time from p = 0.50: 20 breeders make p wander at random (genetic drift), 10% migrants from p = 0.90 pull p toward 0.90 (gene flow), mutation at an exaggerated 0.001 per copy nudges p down slowly, and selection against aa raises p fast, then slowly once most a copies hide in Aa.
- Non-random mating is the odd one out: heterozygotes fall and homozygotes rise while p stays at 0.50.

## Is this population evolving?

Return to the opening puzzle. In 2003, Nachman, Hoekstra and D’Agostino studied 29 rock pocket mice at the Pinacate lava flow. Eighteen were caught on dark lava (16 dark) and 11 on light rock (10 light). Dark coats help protect mice from predators on dark lava. At one coat-colour gene (*Mc1r*), the dark allele (`D`) is dominant to light (`d`):

| Genotype | Light coat | Dark coat | Observed (`o`) |
| --- | --- | --- | --- |
| `DD` | 0 | 11 | **11** |
| `Dd` | 0 | 6 | **6** |
| `dd` | 12 | 0 | **12** |
| **Total** | **12** | **17** | **29** |

Source: Nachman, Hoekstra and D’Agostino (2003), *PNAS* 100:5268-5273, Table 2.

Every `DD` and `Dd` mouse was dark; every `dd` mouse was light. Test this combined sample for equilibrium.

**Predict 3.** These mice came from dark lava favouring dark coats and light rock favouring light coats. Before calculating, predict whether the combined sample has more or fewer `Dd` heterozygotes than Hardy-Weinberg expects.

> **Check your prediction.** Fewer: 6 observed against about 14.5 expected. The authors judged the shortfall consistent with selection pulling in opposite directions in the two habitats.

Run AP science practice 5.C, chi-square hypothesis testing, with the five-step routine from [The Chi-Square Test](https://stemhop.com/lessons/ap-chi-square/). This test compares one sample with expected genotype counts, not a treated group with a control, so the pooling step from that lesson does not apply.

1. **State the null hypothesis.** The Pinacate rock pocket mouse population is in Hardy-Weinberg equilibrium at this locus, and any gap between observed and expected counts is due to chance.
2. **Calculate expected counts.** Count alleles first. Across `58` copies (`2 × 29`), `D` copies = `(2 × 11) + 6 = 28` (`p = 28/58 ≈ 0.483`) and `d` copies = `(2 × 12) + 6 = 30` (`q = 30/58 ≈ 0.517`). The dominant `D` is under half of all copies. Multiplying `29` by `p²`, `2pq` and `q²` (using unrounded `p` and `q`) gives `6.76`, `14.48` and `7.76` (sum `29.00`).
3. **Calculate chi-square** using `χ² = Σ (o − e)² / e` (read “chi-square equals the sum of observed minus expected, squared, divided by expected”), computed here from the published counts:

| Genotype | `o` | `e` | `(o − e)² / e` |
| --- | --- | --- | --- |
| `DD` | 11 | 6.76 | 2.66 |
| `Dd` | 6 | 14.48 | 4.97 |
| `dd` | 12 | 7.76 | 2.32 |
| **Total** | **29** | **29.00** | **χ² = 9.95** |

1. **Find degrees of freedom.** On the formula sheet, degrees of freedom (`df`, read “d f”) equal outcomes minus one: `3 − 1 = 2`. (Statisticians subtract one more because the allele frequency `p` comes from the same sample; see Going deeper.)
2. **Compare with the critical value.** Here the table’s p is a probability, not the allele frequency, so it is written “probability”. At `df = 2`, the **critical value** (the χ² value chance alone reaches only 5% of the time if the null is true) is `5.99` at probability `0.05` and `9.21` at probability `0.01`. Since `9.95` is above `5.99` and also above `9.21`, the probability is below `0.01`: **reject the null hypothesis**.

The biggest term (`4.97`) is the heterozygote shortfall (`6` versus `14.48`). This `9.95` is computed here from the paper’s Table 2. The authors reported a smaller value (`χ² = 4.89`, probability `0.087`), below the cutoff, and called the shortfall slight, so the verdict is not firm. Their mitochondrial DNA found no evidence of a hidden split into separate breeding groups.

**Misconception check.** “A population that fits Hardy-Weinberg is not evolving.” Not necessarily. Failing to reject means only that the counts show no statistical departure. Weak or offsetting forces can hide in one snapshot. Tracking `p` across generations tests evolution directly.

## Break one condition

The model below breaks one condition at a time from a flat baseline. It supports a mathematical modelling lab on Hardy-Weinberg and does not replace hands-on lab time.

All simulated runs below (fixed seed) track alleles `A` and `a` from `p = 0.50` for `30` generations. Baseline holds `10,000` breeders, random mating, no migration, no mutation and no selection.

**Predict 4.** Shrink population size to `20` breeders, holding the other four conditions. Over 30 generations, will `p` stay flat, rise steadily, or change in an unpredictable direction?

> **Check your prediction.** It changes unpredictably. Sampling 40 allele copies each generation pushes replicate populations both up and down by chance.

Across five 20-breeder runs, generation 30 scatters from `0.000` (`A` lost) to `0.875`. This chance shift is **genetic drift** (more in [Genetic Drift, Gene Flow and Diversity](https://stemhop.com/lessons/ap-drift-gene-flow/)).

Next, back at `10,000` breeders, let `10%` of each generation’s breeders be immigrants from a population at `p = 0.90`. This **gene flow** (allele movement between populations) pulls `p` toward `0.90`.

Switching on **mutation** (random DNA changes that make new alleles) at `0.001` per copy per generation (`A → a`, exaggerated so it shows) nudges `p` down very slowly. Real mutation rates are far lower (see the mutations lesson).

**Predict 5.** Return to `10,000` breeders at `p = 0.50` with no selection, mutation or migration. Switch on **non-random mating** so half of matings pair like genotypes and half are random. Over 30 generations, what happens to `Aa` heterozygotes, and to `p`?

> **Check your prediction.** Heterozygotes fall while `p` stays at `0.50`. Pairing like genotypes rearranges existing allele copies into more homozygotes without adding or removing `A` or `a`.

Non-random mating covers **inbreeding** (mating among relatives) and **assortative mating** (partners sharing a trait).

*Figure (AI-generated illustration).* Inbreeding and assortative mating pair the same allele copies differently: homozygotes become more common and heterozygotes rarer, so genotype frequencies change while p and q stay where they were. Image: two panels each showing four people holding two allele blocks apiece. With random mating there are one AA, two Aa and one aa person. With inbreeding or assortative mating there are two AA and two aa people. Both panels use the same four A and four a blocks, re-paired by a broad arrow between them.

Finally, switch on **natural selection** (unequal survival and reproduction across heritable traits): `aa` gets a **relative fitness** of `0.70` (`70%` as many offspring as `AA` and `Aa`). Now `p` climbs fastest early (`+0.259` in the first 10 generations), then slows (`+0.043` from generation 20 to 30). Once `a` is rare, most of its copies sit in `Aa` heterozygotes, which selection spares.

The table collects the baseline and the five broken conditions (start `p = 0.500`):

| Broken condition (mechanism) | `p`, gen 10 | `p`, gen 30 | Gen 30 newborns (`AA/Aa/aa`) | Changes `p`? |
| --- | --- | --- | --- | --- |
| None (baseline) | 0.500 | 0.500 | 0.250 / 0.500 / 0.250 | No |
| 20 breeders (**genetic drift**) | 0.075 to 0.675 | 0.000 to 0.875 | varies by run | Yes (random) |
| 10% at 0.90 (**gene flow**) | 0.761 | 0.883 | 0.780 / 0.207 / 0.014 | Yes (to 0.90) |
| `A→a` 0.001 (**mutation**) | 0.495 | 0.485 | 0.235 / 0.500 / 0.265 | Yes (slowly) |
| 50% like (**non-random mating**) | 0.500 | 0.500 | **0.333 / 0.333 / 0.333** | **No** |
| `aa` fitness 0.70 (**selection**) | 0.759 | 0.894 | 0.799 / 0.189 / 0.011 | Yes (to `A`) |

The simulator below covers two conditions, size and selection. The breeders slider (labelled `Ne`) sets population size. The cost slider (`s`, read “s”) sets how much less `aa` reproduces (`s = 0.30` matches fitness `0.70`). At `p = 0.50`, try `1000` breeders at `s = 0`, then `16` breeders, then `1000` breeders at `s = 0.30`.

*Interactive on the lesson page:* Drift and selection: replicate populations

## Before the exam

- **Opening puzzle.** Dominance sets phenotype, not allele frequency. At Pinacate the dominant dark allele is under half of all copies (`p = 0.483`). The formula-sheet routine rejects equilibrium (`χ² = 9.95`), but the authors’ own test did not.
- **Count first; use roots only under equilibrium.** Given genotypes, count alleles directly. Given phenotypes under equilibrium, start at `q²`, take `q = √(q²)`, then find `p` and `2pq`. Never treat `p²` as the dominant phenotype.
- **Read chi-square verdicts.** Compare `χ²` with `5.99` (`df = 2`, probability `0.05`). Rejecting flags a broken condition without naming it; failing to reject never proves no evolution.
- **Five conditions, one odd one out.** Drift, gene flow, mutation and selection change `p` and `q`. Non-random mating alone lowers heterozygotes while leaving `p` and `q` fixed.

## Going deeper

*Beyond the AP® exam.*

### One degree of freedom or two?

The formula sheet uses outcomes minus one (`df = 2`, cutoff `5.99` at probability `0.05`). College statistics subtracts one more because the allele frequency `p` is estimated from the same sample (`df = 1`, cutoff `3.84`). At Pinacate, `χ² = 9.95` exceeds both, and both cutoffs at probability `0.01` (`9.21` and `6.63`).

### Sampling at birth versus adulthood

Newborns from random mating can fit `p²`, `2pq` and `q²` while adults depart if selection acts before maturity.

### Independent routes to dark coats

Nachman, Hoekstra and D’Agostino (2003) found that dark mice on another lava flow showed no link to the same coat-colour gene. This suggests dark coats arose independently there through changes at a different gene or genes, not yet identified.

### The college next step

[Population Genetics: Hardy-Weinberg and Evolutionary Forces](https://stemhop.com/lessons/population-genetics/) adds selection, migration and drift-variance equations plus heterozygote advantage.

---

From STEMhop (https://stemhop.com), free lessons by Christopher Deppmann. Lesson text © the authors. Practice questions: https://stemhop.com/lessons/ap-hardy-weinberg/
