What is the Hardy-Weinberg Equilibrium?
The Hardy-Weinberg principle describes a population that is not evolving — where allele and genotype frequencies stay constant from generation to generation. For a gene with two alleles, the dominant allele has frequency p and the recessive allele has frequency q. Since these are the only two alleles, they must add up to one: \(p + q = 1\). The equilibrium holds only when there is no selection, mutation, migration, genetic drift, and mating is random.
How to use this calculator
Choose whether you know the dominant allele frequency (\(p\)) or the recessive allele frequency (\(q\)), then enter a value between 0 and 1. The calculator finds the missing allele frequency and the three expected genotype frequencies: homozygous dominant (\(p^2\)), heterozygous (\(2pq\)), and homozygous recessive (\(q^2\)), each shown as a proportion and a percentage of the population.
The formula explained
Expand the binomial \((p + q)^2 = 1\) to get $$p^2 + 2pq + q^2 = 1$$ Each term is a genotype frequency: \(p^2\) is the fraction of individuals carrying two dominant alleles, \(q^2\) is the fraction carrying two recessive alleles, and \(2pq\) is the fraction of heterozygotes. Often you measure \(q^2\) (the visible recessive phenotype, e.g. an affected individual) and back-calculate \(q = \sqrt{q^2}\), then \(p = 1 - q\).
Worked example
Suppose the recessive allele frequency \(q = 0.3\). Then \(p = 1 - 0.3 = 0.7\). The genotype frequencies are \(p^2 = 0.49\) (49% homozygous dominant), $$2pq = 2 \times 0.7 \times 0.3 = 0.42$$ (42% heterozygous), and \(q^2 = 0.09\) (9% homozygous recessive). These sum to $$0.49 + 0.42 + 0.09 = 1.00,$$ confirming the population is in equilibrium.
Genotype Frequencies at Different Allele Frequencies
Under Hardy-Weinberg equilibrium, with q the frequency of the recessive allele and p = 1 − q, the expected genotype frequencies are \(p^2\) (homozygous dominant), \(2pq\) (heterozygous) and \(q^2\) (homozygous recessive). The table shows six cases.
| q | p | p² (AA) | 2pq (Aa) | q² (aa) | Sum |
|---|---|---|---|---|---|
| 0.01 | 0.99 | 0.9801 (98.01%) | 0.0198 (1.98%) | 0.0001 (0.01%) | 1 |
| 0.1 | 0.9 | 0.81 (81%) | 0.18 (18%) | 0.01 (1%) | 1 |
| 0.3 | 0.7 | 0.49 (49%) | 0.42 (42%) | 0.09 (9%) | 1 |
| 0.5 | 0.5 | 0.25 (25%) | 0.50 (50%) | 0.25 (25%) | 1 |
| 0.7 | 0.3 | 0.09 (9%) | 0.42 (42%) | 0.49 (49%) | 1 |
| 0.9 | 0.1 | 0.01 (1%) | 0.18 (18%) | 0.81 (81%) | 1 |
- The heterozygote frequency \(2pq\) reaches its maximum of 0.5 when p = q = 0.5. It is symmetric: the values at q = 0.3 and q = 0.7 are identical.
- Rare recessive alleles are carried mostly by heterozygotes. At q = 0.01, \(q^2 = 0.0001\) (1 in 10,000), but \(2pq = 2 × 0.99 × 0.01 = 0.0198\), about 198 times more common than the homozygous recessive genotype.
Key Terms and Symbols
- Allele
- One of the alternative forms of a gene at a given locus.
- Dominant / recessive
- A dominant allele determines the phenotype when at least one copy is present. A recessive allele shows its phenotype only when two copies are present (assuming complete dominance).
- Homozygous
- Having two identical alleles at a locus (AA or aa).
- Heterozygous
- Having two different alleles at a locus (Aa).
- Genotype vs phenotype
- The genotype is the allele combination an individual carries. The phenotype is the observable trait that results from the genotype and, often, the environment.
- Allele frequency
- The proportion of all copies of a gene in a population that are a particular allele (a value from 0 to 1).
- Genotype frequency
- The proportion of individuals in a population that have a particular genotype.
- Carrier
- A heterozygous individual who has one copy of a recessive allele and usually does not show the recessive phenotype.
- Gene pool
- The total set of alleles at all loci in a breeding population.
- p
- Frequency of the dominant allele (A); p = 1 − q.
- q
- Frequency of the recessive allele (a); q = 1 − p.
- p²
- Expected frequency of homozygous dominant (AA) individuals.
- 2pq
- Expected frequency of heterozygous (Aa) individuals.
- q²
- Expected frequency of homozygous recessive (aa) individuals.
Interpreting Your Results
The calculator outputs the expected genotype frequencies if the population is in Hardy-Weinberg equilibrium for the allele frequency you entered. They are predictions from the model, not measurements. Because \(p^2 + 2pq + q^2 = (p+q)^2 = 1\), the three values always sum to 1.
Comparing with observed data
To test whether a real population fits the model, multiply each expected frequency by the sample size N to get expected counts, then compare them with observed counts. A chi-square goodness-of-fit test is commonly used:
$$\chi^2 = \sum \frac{(O - E)^2}{E}$$
With three genotype classes and one allele frequency estimated from the data, there is 1 degree of freedom (3 − 1 − 1). A χ² value above 3.84 corresponds to p < 0.05, which suggests a significant departure from equilibrium.
What can cause deviations
- Selection: genotypes differ in survival or reproduction.
- Mutation: new alleles arise or alleles change form, shifting frequencies.
- Migration (gene flow): individuals bring in alleles from populations with different frequencies.
- Genetic drift: random changes in allele frequency, strongest in small populations.
- Non-random mating: inbreeding or assortative mating changes genotype frequencies, typically increasing homozygotes, without necessarily changing allele frequencies.
Model limits
The basic model describes a single locus with two alleles in a large, randomly mating population. It assumes no selection, mutation or migration. Starting from any genotype frequencies, equilibrium genotype proportions are reached after one generation of random mating. Allele frequencies stay constant from one generation to the next if the assumptions hold. Note that the calculator gives expected values only and does not test a real dataset itself.
FAQ
What if I only know the number of affected individuals? The recessive phenotype corresponds to \(q^2\). Divide affected individuals by total population to get \(q^2\), then take its square root to find \(q\) and enter that value.
Why do the genotype frequencies sum to 1? Because they represent all possible genotype combinations in the population, so their proportions must cover 100% of individuals.
Are carriers the heterozygotes? Yes — for a recessive trait, carriers have one dominant and one recessive allele, the \(2pq\) group.