# Hardy-Weinberg Equilibrium Calculator

The relationship between allele frequencies and genotype frequencies in populations at Hardy-Weinberg Equilibrium is usually described using a trait for which there are two alleles present at the locus of interest.

This calculator demonstrates the application of the Hardy-Weinberg equations to loci with more that two alleles. Visit the genetic drift and selection illustration for more on the Hardy-Weinberg Equilibrium.

**Allele Frequencies Equation**-

**Genotype Frequencies Equation**-

^{2}+ q

^{2}+ 2(p)(q) = 1

Update the values by changing the the allele frequency in the blue box below the graph. The calculator has a check that prevents the allele frequences from summing to any value other than 1. To avoid having your values changed, make sure your values sum to one and enter them from top to bottoms (p then q then r ...)

**Number of genotypes for a given number of alleles**
Given n alleles at a locus, the number genotypes possible is the sum of the integers between 1 and n:

- With 2 alleles, the number of genotypes is 1 + 2 = 3
- 3 alleles there are 1 + 2 + 3 = 6 genotypes
- 4 alleles there are 1 + 2 + 3 + 4 = 10 genotypes.

The general formula for finding the sum of a set of integers from 1 to n is:

Genotypes = n * n+1 / 2

The calculator does not go beyond 5 alleles and 15 possible genotypes. However, The equation above can be used to calculate the number of genotypes for a locus with any number alleles.

If a population has 10 alleles for a specific gene, the combined, total number of homozygous and heterozygous genotypes present in the population will be:

(10 * 11) / 2 = 55

This breaks down to 10 homozygous genotypes and 45 heterozygous genotypes. The sum of the allele frequencies would still need to equal 1 :

p + q + r + s + t + u + v + w + x + y = 1

As would the sum of the genotype frequencies:

p^{2} + 2pq + 2pr + 2ps + 2pt + 2pu + 2pv + 2pw + 2px + 2py + q^{2} + 2qr + 2qs + 2qt +2qu + 2qv + 2qw + 2qx + 2qy + r^{2} + 2rs + 2rt + 2ru + 2rv + 2rw + 2rx + 2ry + s^{2} + 2st+ 2su + 2sv + 2sw + 2sx + 2sy + t^{2} + 2tu + 2tv + 2tw + 2tx + 2ty + u^{2} + 2uv + 2uw +2ux + 2uy + v^{2} + 2vw + 2vx + 2vy + w^{2} + 2wx + 2wy + x^{2} + 2xy + y^{2} = 1

**Related Content**

- Illustrations
- Problem Sets