Skip to main content
Pearson+ LogoPearson+ Logo
All Calculators & ConvertersAll calculators

Enter your inputs

What data do you have?

Tip: Use gene-style letters (A/a). Labels only affect display, not the math.

Genotype counts

We assume diploid individuals and a single locus with two alleles.

Chips prefill a scenario and run the calculation.

Options:

Result:

No results yet. Enter values and click Calculate.

How to use this calculator

  • Choose what you have: genotype counts, phenotype counts, or genotype percentages.
  • Enter your values (counts are usually whole numbers; decimals can represent weighted samples).
  • Click Calculate to get allele frequencies p and q.
  • Optionally view Hardy–Weinberg expected genotype frequencies (, 2pq, ).
  • If you entered genotype counts, you can also compare Observed vs Expected under HW (with a χ² teaching check).

How this calculator works

  • From genotypes: count alleles in the sample: p = (2·AA + Aa) / (2·N), q = (2·aa + Aa) / (2·N).
  • From phenotype counts: if recessive phenotype is aa, then q² = aa/N, so q = √(q²) and p = 1 − q (requires Hardy–Weinberg).
  • Hardy–Weinberg expected genotypes: AA = p², Aa = 2pq, aa = q².
  • Observed vs Expected (genotype counts): compare observed counts to expected counts (N·p², N·2pq, N·q²) and compute a χ² statistic (a quick teaching check, not a full population-genetics analysis).

Formula & Equation Used

Allele frequencies from genotype counts: N = AA + Aa + aa

p = (2·AA + Aa) / (2·N), q = (2·aa + Aa) / (2·N)

Hardy–Weinberg expected genotype frequencies: , 2pq,

Expected counts (if sample size is N): E(AA)=N·p², E(Aa)=N·2pq, E(aa)=N·q²

Chi-square (quick check): χ² = Σ (O − E)² / E

Phenotype method (HW): q² = (recessive)/N, q = √(q²), p = 1 − q

Example Problems & Step-by-Step Solutions

Example 1 — Genotype counts → allele frequencies

A sample has AA=25, Aa=50, aa=25. Find p and q.

  1. Compute sample size: N = 25 + 50 + 25 = 100.
  2. Total alleles: 2N = 200.
  3. Count A alleles: 2·AA + Aa = 2·25 + 50 = 100.
  4. So p = 100/200 = 0.50 and q = 1 − p = 0.50.

Example 2 — Phenotype counts (HW estimate)

In a class survey, 16 out of 100 individuals show the recessive phenotype. Estimate allele frequencies (assume Hardy–Weinberg).

  1. Recessive phenotype corresponds to aa, so q² = 16/100 = 0.16.
  2. q = √0.16 = 0.40.
  3. p = 1 − q = 0.60.

Example 3 — Hardy–Weinberg expected genotypes

If p = 0.70 and q = 0.30, what are the expected genotype frequencies?

  1. AA = p² = 0.49
  2. Aa = 2pq = 2·0.70·0.30 = 0.42
  3. aa = q² = 0.09
  4. Check: 0.49 + 0.42 + 0.09 = 1.00

Frequently Asked Questions

Q: Why do p and q always add up to 1?

Because p and q represent the fractions of the two alleles in the gene pool. If there are only two alleles, their frequencies must sum to the whole: p + q = 1.

Q: Can I use decimals for genotype counts?

Yes. Whole numbers are standard for real individuals, but decimals are useful for weighted data (for example, when combining samples or using normalized counts). The math still works the same.

Q: When is the phenotype method valid?

Only when the recessive phenotype corresponds to aa and you assume Hardy–Weinberg, so equals the recessive phenotype fraction. Without HW (or without knowing genotype proportions), phenotype counts alone usually can’t uniquely determine p and q.

Q: What does the χ² value mean in Observed vs Expected?

It’s a quick teaching check showing how far observed counts are from HW-expected counts. Small expected counts can make χ² unreliable, and real HW testing depends on study design and assumptions.

Q: Why does the calculator say df ≈ 1?

In many intro courses, df is treated as ~1 when allele frequency is estimated from the sample. The calculator uses that common teaching choice to provide a simple p-value estimate.