Chalk−1

Biology · Introductory biology · Concept

Hardy–Weinberg equilibrium: p² + 2pq + q²

Hardy–Weinberg equilibrium is the baseline model of population genetics. For one gene with two alleles at frequencies p and q, where p+q=1, random mating gives the genotypes AA, Aa and aa in the proportions p2, 2⁢p⁢q and q2. Those proportions stay the same every generation while the Hardy–Weinberg conditions hold. A sample that departs from them is evidence that at least one condition fails, such as random mating, or that selection, migration, mutation or drift is at work.

Try one — Chalk checks each line

A concrete case

Counting one gene in 99 people

Most adults lose the ability to digest the milk sugar lactose, but many people of European ancestry keep it. One DNA variant near the lactase gene is strongly linked to keeping it. The 1000 Genomes Project read that variant in 99 people of northern and western European ancestry living in Utah.

Of the 99, 54 carry two copies of the persistence allele, 38 carry one and 7 carry none. The 99 people hold 198 copies of the gene, and 2⁢(54)+38=146 of them are the persistence allele. That is a fraction of about 0.737.

Suppose people paired up with no regard to this gene, and each child took one copy at random from each parent. Two persistence copies would then turn up in a fraction 0.7372 of people, one in 2⁢(0.737)⁢(0.263), and none in 0.2632. For 99 people that predicts about 53.8, 38.3 and 6.8. Rounded to whole people, it is 54, 38 and 7, exactly what was counted.

2⁢(54)+38=146146198≈0.737

The rule

Two alleles, two frequencies

Take one gene with two alleles, A and a. Let p be the fraction of all copies of the gene in the population that are A, and q the fraction that are a. Every copy is one or the other, so p+q=1. These are allele frequencies. They count gene copies, not individuals.

p+q=1

Count gene copies to find p

A diploid individual carries two copies of the gene, so N individuals carry 2⁢N copies. Each AA individual adds two A copies and each Aa adds one. Then p is the number of A copies over all copies, and q=1−p.

p=2NA⁢A+NA⁢a2⁢N

Random mating predicts the genotypes

If gametes combine at random, an offspring receives A from each parent with probability p, so AA has frequency p2 and aa has frequency q2. A heterozygote can form two ways, A from the mother and a from the father or the reverse, so Aa has frequency 2⁢p⁢q. The three add to 1 because (p+q)2=1.

p2+2⁢p⁢q+q2=1

The five conditions

The prediction assumes random mating with respect to this gene, no mutation, no migration, which is also called gene flow, and no natural selection. It also assumes a population large enough that genetic drift, the chance change of allele frequencies, is negligible. No real population meets all five exactly. Hardy–Weinberg equilibrium is a null model. A clear departure from it shows that at least one condition fails, but not which one.

From a recessive trait to carriers

With complete dominance only aa individuals show the recessive phenotype, so their frequency estimates q2. Its square root is q, and 2⁢p⁢q estimates the frequency of carriers, the heterozygotes who carry the allele without showing it. This route assumes the population is in equilibrium, so it cannot also test equilibrium.

q=q2,2⁢p⁢q=2⁢(1−q)⁢q
q=q22⁢p⁢q=2⁢(1−q)⁢q

Testing a sample with chi-square

When all three genotypes can be counted, compare the observed counts with the expected counts Np2, N⋅2⁢p⁢q and Nq2 in a chi-square goodness-of-fit test. Three genotype classes give 3−1=2 degrees of freedom. Estimating p from the same counts uses up one more, which leaves 1.

df=3−1−1=1

Why it works

Why one generation of random mating is enough

Random mating of individuals is the same as drawing gametes at random from one shared pool. A fraction p of the gametes carry A and q carry a. A square of gametes against gametes has four cells, AA with chance p⋅p, Aa twice with chance p⋅q each, and aa with chance q⋅q.

The next generation’s gametes come from those genotypes. AA individuals give only A, and half the copies in Aa individuals are A. The share of A is p2+p⁢q=p⁢(p+q)=p, the same as before, because p+q=1. The allele frequencies do not move, so the genotype proportions they predict do not move either.

That is why the proportions are reached after a single generation of random mating from any starting mix of genotypes. This holds for a gene that is not on a sex chromosome, with the same allele frequencies in both sexes. When the sexes start with different frequencies, the proportions take a second generation. A rare allele stays rare. Nothing in the model pulls frequencies toward one half.

p2+p⁢q=p⁢(p+q)=p

The method

Test a sample against Hardy–Weinberg

The table follows the first two worked examples, starting from the genotype counts of 200 fish.

From genotype counts to a test
StepWhat to doFor 90 AA, 80 Aa and 30 aa
1Count the copies of A, twice each AA plus each Aa.2⁢(90)+80 =260 of 400 copies
2Divide by 2⁢N for p, and find q =1−p.p=0.65, q=0.35
3Find p2, 2⁢p⁢q and q2.0.4225, 0.455 and 0.1225
4Multiply each by N for the expected counts.84.5, 91 and 24.5
5Add (observed−expected)2/⁢expected and use 1 degree of freedom.χ2 ≈2.92, p-value ≈0.087

Where it breaks

Where it breaks

Inbreeding breaks random mating. Relatives share alleles, so their children are more often homozygous, and a sample shows fewer heterozygotes than 2⁢p⁢q predicts.

Pooling separate groups does the same. Two groups can each be in equilibrium with different allele frequencies, but a sample that mixes them shows a heterozygote deficit, because few matings cross between the groups.

A good fit in one sample does not show that a gene is free of selection. Selection acts on survival and reproduction over many generations, and one round of random mating restores the proportions. The lactase persistence allele fits the proportions almost exactly in the 99 people above. Genetic evidence still shows it rose under strong selection within the last 5,000 to 10,000 years.

The square-root route to carriers only works for a recessive trait in a population assumed to be in equilibrium. It cannot test that assumption, because AA and Aa individuals look alike. Genes on the X chromosome follow different proportions in males, who carry one copy.

Check your answer

Check your answer

A Hardy–Weinberg answer can be tested against itself in several ways.

Add the frequencies. p+q must be 1, and p2, 2⁢p⁢q and q2 must add to 1. The expected counts must add to the sample size.

Recount the copies. With p from the genotypes, the a copies, twice each aa plus each Aa, must give q.

Check the heterozygotes. Under the model 2⁢p⁢q is never more than 0.5, its value when p=q=0.5. An expected heterozygote fraction above one half has a slip in it.

Every frequency here is arithmetic that Chalk checks. Put each step on its own row of a Math box with the numbers in, such as (2⁢(90)+80)⁢/400=0.65 or 2⁢(0.65)⁢(0.35)=0.455, and a slip reads ✗. Chalk does not decide which genotype is the recessive one. The Hardy–Weinberg tool, in Biology, finds p, q and the expected counts and sends them to a chi-square test in Statistics.

Two harmful alleles each have a frequency of 0.01. One is dominant and the other recessive, and everyone who shows either trait has no children. Which allele falls faster?

The dominant one. Every carrier of a dominant allele shows the trait, so one generation of selection removes nearly all its copies. The recessive allele hides in carriers, 2⁢p⁢q≈0.0198 of people against q2=0.0001 affected, so q falls only to about 0.0099. Selection acts on phenotypes, and a rare recessive allele is almost never seen.

Hardy’s letter, and inbreeding measured

In 1908 the mathematician G. H. Hardy answered a puzzle in a one-page letter. Some biologists expected a dominant trait to spread until three people in four showed it, the 3 to 1 of a Mendelian cross. Hardy showed by “a little mathematics of the multiplication-table type” that the proportions stay put.

Inbreeding can be measured by how far heterozygotes fall short. The inbreeding coefficient F is defined so that the heterozygote frequency is 2⁢p⁢q⁢(1−F). For the fish in the first worked example, 2⁢p⁢q=0.455, while 80 of 200, or 0.4, were heterozygous. That gives F≈0.121, a deficit of about 12⁢%.

With three alleles at frequencies p, q and r, the genotype proportions are the terms of (p+q+r)2, and the same reasoning holds.

1−0.40.455≈0.121

Common mistakes

  • Taking the frequency of aa individuals as q. It estimates q2, so q is its square root, and 4⁢% aa means q=0.2.
  • Counting individuals instead of gene copies when finding p. Each heterozygote carries one copy of each allele, and each homozygote two copies of one.
  • Using 2 degrees of freedom in a three-genotype test when p comes from the same counts. Estimating p uses up one, so the answer is 1.
  • Reading a good fit as proof that every condition holds. A test can only fail to detect a departure, and selection over many generations can leave one sample in the proportions.
  • Writing the heterozygote frequency as p⁢q. A heterozygote forms two ways, A from either parent, so its frequency is 2⁢p⁢q.
  • Rounding p hard before computing expected counts. Keep p at full precision, because 99⁢(0.737)2≈53.77 while the exact expected count is about 53.83.

Key terms

Hardy–Weinberg equilibrium
The pattern of genotypes expected in a population that isn’t evolving: random mating, and no selection, mutation, migration or drift. With two alleles A and a at frequencies p and q (p+q=1), the genotype frequencies are p2 for AA, 2⁢p⁢q for Aa and q2 for aa.
Allele frequency
The share of all copies of a gene in a population that are one particular allele: p=(copies of allele ⁢A) ÷(total allele copies). Count allele copies, two per diploid individual, not individuals.
Genotype frequency
The share of individuals in a population with a particular genotype, such as AA: individuals with that genotype ÷all individuals. It differs from allele frequency, because each individual carries two allele copies.
Heterozygous
Having two different alleles at a locus in a diploid organism, as in Aa. What the organism looks like depends on how the two alleles interact: dominance, incomplete dominance or codominance.
Homozygous
Having two identical alleles at a locus in a diploid organism, as in AA or aa. It describes one gene only, not the whole genome.
Genetic carrier
Someone with one copy of the allele for a recessive condition who does not have the condition, such as Aa. A carrier can pass the allele to their children.
Inbreeding
Mating between relatives. It does not change allele frequencies by itself, but it raises the share of homozygotes, so rare recessive conditions appear more often.
Inbreeding coefficient
F, the probability that the two alleles a person carries at a gene are identical by descent, both copied from one allele in a shared ancestor. F=0 for unrelated parents.
Genetic drift
Random changes in allele frequencies from one generation to the next, purely by chance in which individuals reproduce. Its effect is strongest in small populations.
Gene flow
Movement of alleles between populations when individuals or their gametes migrate. It changes allele frequencies whether or not selection favors those alleles, and it makes populations more alike.
Natural selection
Individuals with heritable traits that suit their environment tend to survive and reproduce more, so those traits become more common. Which traits help depends on the environment, and evolution has no goal.
Chi-square goodness-of-fit test
A test of whether observed counts in categories match the counts a model expects, using χ2=Σ⁢(observed−expected)2/expected. It needs expected counts that aren’t too small, usually at least 5 each.

Work through an example

A DNA test of 200 fish at one gene finds 90 AA, 80 Aa and 30 aa. Find the allele frequencies p and q, and the genotype counts Hardy–Weinberg equilibrium predicts for a sample of this size.

Find allele frequencies from genotype counts →

Test Hardy–Weinberg equilibrium with chi-square →

Find the carrier frequency of a recessive allele →

Sources and scope

Authored study material. Tool results depend on the stated inputs and model assumptions.

After reading

Try it, then study it

Open the example in its tool to check steps or change values, then review the key terms as flashcards.

Open the Hardy–Weinberg tool Check the counts in Math Study the 12 key terms Open worked example on a board Hardy–Weinberg equation in Biology Reference

Your existing work stays on this device. Examples open as editable copies.