Bbiochemtools

Genotype Frequency Calculator

Calculate genotype frequency and allele frequency with the Hardy-Weinberg equation, starting either from a known allele frequency or from real genotype counts, and test whether the population is in Hardy-Weinberg equilibrium. Every step shown.

Before you scroll

Six questions on the equation, the five assumptions and the chi-square test, each answer worked out with the same method the calculator uses above.

Which of these is NOT one of the five Hardy-Weinberg assumptions?

Selection favours the dominant allele

All five assumptions say that nothing is shifting allele frequencies, so selection acting on the locus is a violation of equilibrium rather than a condition for it.

Why does the heterozygote term carry a 2 in p squared + 2pq + q squared?

A heterozygote forms two ways, A from either parent

The 2 counts the two parental orders that both give Aa, A from one parent or A from the other, so pq alone would count only half of the heterozygotes.

A recessive disorder affects 1 person in 100. Under Hardy-Weinberg, what fraction of the population are carriers?

0.18, a little under a fifth of people

A carrier is heterozygous, so the carrier fraction is the 2pq term, not q and not q squared.

A sample of 200 is genotyped as 90 AA, 60 Aa, 50 aa. What is p?

0.60, counting alleles over 400 total

Allele frequencies count alleles, not people, so every heterozygote contributes one A to a pool of 2N alleles.

Worked example 2 gets a chi-square of 20.0 from 300 AA, 150 Aa, 50 aa. What does that establish?

The counts depart from equilibrium at df = 1

A chi-square above 3.84 says the genotype counts do not fit Hardy-Weinberg, but it never names which assumption failed.

A population at equilibrium has p = 0.3. What fraction is homozygous dominant?

0.09, just under one in eleven

p is an allele frequency and p squared is a genotype frequency, so the AA share is the square of p, never p itself.

q (recessive allele) = 1 − p is calculated automatically.

p (dominant allele)
,
q (recessive allele)
,

How to calculate genotype frequency

Genotype frequency is the fraction of a population carrying each genotype, and Hardy-Weinberg gives it from a single allele frequency:

p = frequency of the dominant allele q = frequency of the recessive allele (p + q = 1) homozygous dominant (AA) = p² heterozygous (Aa) = 2pq homozygous recessive (aa) = q² p² + 2pq + q² = 1

Worked: if p = 0.6, then q = 0.4, so AA = 0.36, Aa = 2(0.6)(0.4) = 0.48, and aa = 0.16. Those sum to 1.00, which is the built-in check. Going the other way, the recessive phenotype frequency is q², so q = √(aa frequency) and p = 1 − q.

How the Hardy-Weinberg equation works

Hardy-Weinberg describes a population that is not evolving. With two alleles, their frequencies add to one: p + q = 1. The genotype frequencies then follow p² + 2pq + q² = 1, where p² is the homozygous dominant fraction, 2pq is the heterozygous fraction, and q² is the homozygous recessive fraction. A common exam move is to start from the recessive phenotype: if q² is known, then q = √(q²), p = 1 − q, and you can predict every genotype. When you have real counts, calculate the allele frequencies as p = (2 × AA + Aa) / (2N), compare the observed genotype counts to the expected ones, and use a chi-square test (critical value 3.84 for 1 degree of freedom at α = 0.05) to decide whether the population departs from equilibrium.

Related tools: DNA → protein translation · Chi-square genetic ratio · Blood type inheritance · all biochem tools.

Worked example 1: a population in equilibrium

A sample of 500 individuals is genotyped: 320 AA, 160 Aa, 20 aa.

N = 320 + 160 + 20 = 500 p = (2×AA + Aa)/(2N) = (2×320 + 160)/1000 = 800/1000 = 0.800 q = 1 − p = 0.200 Expected counts (p², 2pq, q² × N): AA: 0.800² × 500 = 320.0 Aa: 2×0.8×0.2 × 500 = 160.0 aa: 0.200² × 500 = 20.0 χ² = Σ(O−E)²/E = 0² /320 + 0² /160 + 0² /20 = 0.000 (df=1, critical 3.84) 0.000 < 3.84 → consistent with Hardy-Weinberg equilibrium

The observed counts land exactly on the expected values here, so χ² is zero, a clean textbook case of a population at equilibrium.

Worked example 2: a population that fails the test

Same sample size, different counts: 300 AA, 150 Aa, 50 aa.

N = 300 + 150 + 50 = 500 p = (2×300 + 150)/1000 = 750/1000 = 0.750 q = 1 − p = 0.250 Expected counts: AA: 0.750² × 500 = 281.25 Aa: 2×0.75×0.25 × 500 = 187.5 aa: 0.250² × 500 = 31.25 χ² = (300−281.25)²/281.25 + (150−187.5)²/187.5 + (50−31.25)²/31.25 = 20.0 (df=1, critical 3.84) 20.0 > 3.84 → departs from Hardy-Weinberg equilibrium

Same allele-frequency math, but here there are too many homozygotes and too few heterozygotes relative to what HWE predicts, a pattern consistent with inbreeding, assortative mating, or a Wahlund effect (population substructure), not necessarily selection.

FAQ

What does it mean if a population isn't in equilibrium?
At least one of the five HWE assumptions is violated: no mutation, random mating, no migration, no selection, infinite population size (no drift). A significant χ² says evolution is likely acting, not which assumption broke.

Why is the chi-square critical value 3.84?
That's the critical value for 1 degree of freedom at α = 0.05. Degrees of freedom = (genotype classes − 1) − (parameters estimated from the data) = (3 − 1) − 1 = 1, since p itself is estimated from the same counts being tested.

How do you find allele frequency from only the recessive phenotype?
If the recessive phenotype's frequency in the population is known, that equals q² under HWE. Take the square root to get q, then p = 1 − q. Standard trick when heterozygotes and homozygous dominants look identical.

Does this work with more than two alleles?
Yes, with frequencies p, q, r (summing to 1), genotype frequencies are the terms of (p+q+r)². This calculator covers the standard two-allele case taught in most intro courses.

Practice problems

1. A sample of 300 has 100 AA, 50 Aa, 150 aa. Is this population in Hardy-Weinberg equilibrium?

Show answer
N = 300 p = (2×100+50)/600 = 0.417 q = 1 − p = 0.583 Expected: AA = 52.1, Aa = 145.8, aa = 102.1 Observed: AA = 100, Aa = 50, aa = 150 χ² = Σ(O−E)²/E = 129.55 (critical 3.84) 129.55 > 3.84 → strongly departs from equilibrium (far too many homozygotes, far too few heterozygotes, consistent with strong inbreeding or selection)

2. A sample of 1000 has 360 AA, 480 Aa, 160 aa. Is this population in equilibrium?

Show answer
N = 1000 p = (2×360+480)/2000 = 0.600 q = 1 − p = 0.400 Expected: AA = 360.0, Aa = 480.0, aa = 160.0, exactly matching the observed counts χ² = 0.00 (critical 3.84) 0.00 < 3.84 → consistent with Hardy-Weinberg equilibrium

Working with blood types? Blood type Punnett square calculator handles ABO codominance and Rh, including the fact that type A can be AA or AO.

Not sure how to get p and q? How to calculate allele frequency works it through from genotype counts, and shows why the square root shortcut is often wrong.

Something missing from this tool, or a number that looks wrong? Tell me and it gets read.