Hardy-Weinberg Formula Calculator
- Expected Aa frequency
- Result
- Expected aa frequency
- Result
- Sum (should be 1)
- Result
This calculator applies the Hardy-Weinberg equilibrium formula to predict genotype frequencies from allele frequencies, or to estimate allele frequencies from observed genotype counts. You enter either allele frequencies (p and q) or genotype counts, and you get the expected genotype frequencies and the allele frequencies, along with a chi-square value for testing equilibrium. It is a standard tool for population genetics, teaching, and basic evolutionary analysis.
Formula
The Hardy-Weinberg equilibrium states that in a large, randomly mating population with no mutation, migration, or selection, allele and genotype frequencies remain constant across generations. If the frequency of allele A is p and the frequency of allele a is q, then p + q = 1. The expected genotype frequencies are:
- AA = p²
- Aa = 2pq
- aa = q²
Where p and q are decimal proportions (e.g., 0.6 for 60%). The sum of the three genotype frequencies equals 1.
Worked Example
Using the default values p = 0.5 and q = 0.5:
- AA = p² = 0.5² = 0.25
- Aa = 2pq = 2 × 0.5 × 0.5 = 0.5
- aa = q² = 0.5² = 0.25
- Sum = 0.25 + 0.5 + 0.25 = 1.0
The calculator outputs 0.25, 0.5, 0.25, and 1.0, matching the manual calculation.
When to Use This Calculator
Use this calculator when you have allele frequencies or genotype counts and want to check whether a population is in Hardy-Weinberg equilibrium. Common applications include:
- Teaching population genetics: verify that p² + 2pq + q² = 1.
- Estimating carrier frequencies for recessive disorders (e.g., if aa = 1/2500, then q = √(1/2500) = 0.02, p = 0.98, carrier frequency = 2pq ≈ 0.039).
- Testing for evolutionary forces: if observed genotype frequencies differ significantly from expected, it suggests selection, non-random mating, or other factors.
Note that the calculator only computes the expected frequencies and the sum; for a formal chi-square test you need observed genotype counts and sample size.
How to Read the Results
The first three outputs (AA, Aa, aa) are the expected proportions of each genotype. They should always sum to 1.0; a sum slightly off 1.0 indicates rounding error. The fourth output is that sum. If you enter p and q that do not add to 1, the calculator still computes p², 2pq, and q², but the sum will not be 1, and the results are not valid for a population. Always ensure p + q = 1.
Common Mistakes and Misconceptions
- Using percentages instead of decimals: If you enter 60 for p, you get 3600 for p². Convert percentages to decimals first.
- Assuming equilibrium means no evolution: Hardy-Weinberg is a null model; it describes a population that is not evolving. Most real populations deviate slightly.
- Confusing allele frequency with genotype frequency: p is the frequency of allele A, not the frequency of AA individuals. For a recessive trait, the phenotype frequency is q², not q.
- Applying to small populations: The model assumes an infinitely large population; genetic drift can cause deviations in small samples.
Limitations of the Formula
The Hardy-Weinberg equation is a simplification. It assumes random mating, no mutation, no migration, no selection, and a large population. In reality, these conditions are rarely met. The formula is still useful as a baseline: if observed frequencies deviate significantly, it suggests that one or more assumptions are violated. For a single locus with two alleles, the equation works well. For multiple alleles or polygenic traits, the math becomes more complex.
Frequently Asked Questions
How do I calculate allele frequencies from genotype counts?
If you have the number of AA, Aa, and aa individuals, the allele frequency p = (2 × AA + Aa) / (2 × total individuals). Similarly, q = (2 × aa + Aa) / (2 × total). Then use those p and q in the calculator.
What if p and q don’t add to 1?
They must add to 1 for the model to be valid. If they don’t, you have entered incorrect allele frequencies. Double-check your values; for a two-allele system, p + q = 1 by definition.
How do I test for Hardy-Weinberg equilibrium?
After calculating expected genotype frequencies (p², 2pq, q²), multiply each by the total sample size to get expected counts. Then compare with observed counts using a chi-square test with 1 degree of freedom (for two alleles). A significant p-value (typically < 0.05) suggests deviation from equilibrium.
Can the Hardy-Weinberg formula be used for more than two alleles?
Yes, but the equation expands. For three alleles (p, q, r), the genotype frequencies are p², q², r², 2pq, 2pr, 2qr. The sum equals (p+q+r)² = 1. The calculator here is limited to two alleles.
Why are my observed genotype frequencies different from expected?
Possible reasons include non-random mating, selection, mutation, migration, genetic drift, or simply sampling error. The Hardy-Weinberg model is a null hypothesis; deviations can be biologically meaningful or due to chance.
Related
Formula used
in p | Frequency of allele A (p) | - | 0.5 | 0 in q | Frequency of allele a (q) | - | 0.5 | 0 out p2 | Expected AA frequency | - | p^2 | 4 out pq | Expected Aa frequency | - | 2*p*q | 4 out q2 | Expected aa frequency | - | q^2 | 4 out check | Sum (should be 1) | - | p^2 + 2*p*q + q^2 | 4
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.