# Hardy-Weinberg Equilibrium Calculator for 3 Alleles

Hardy-Weinberg equilibrium is the expected frequencies of genotypes if mating is non-assortative and there are no mutations from one allele to another. When there are three alleles for a particular gene--A, B, and C--and their respective population frequencies are p, q, and r, then the expected frequencies for the genotypes AA, AB, BB, BC, CC, and AC are

AA = p²,     AB = 2pq,    BB = q²
BC = 2qr,    CC = r²,      AC = 2pr

### Hardy-Weinberg 3-Allele Calculator

 Genotypes AA AB BB BC CC AC Observed Expected   H-W Freq.
 P-Value =
 Allele Frequencies. A = B = C =

To use the calculator above, enter the observed frequencies of the 6 different genotypes. The calculator will compute the frequency of each allele and the Hardy-Weinberg equilibrium expected frequencies of each genotype. It will also output the chi-square value so you can decide whether to reject or accept the null hypothesis that the population is at H-W equilibrium.

### Explanation of H-W Formula and Example

If there are three alleles for a particular gene (A, B, and C) and their frequencies are p, q, and r, then p + q + r must equal 1. This also implies that

(p + q + r)² = 1

as well. If you expand the terms of (p + q + r)², you get 6 different terms:

p²,  2pq,  q²,  2qr,  r²,  2pr

In non-assortative mating, where individuals do not have a mating preference for certain genotypes, the expected frequencies of the 6 genotypes correspond to the 6 terms of the equation above.

Example 1: Suppose the frequencies of the alleles A, B, and C in a certain population are 0.5, 0.4, and 0.1 respectively. If individuals have no genotype preference when mating and there is no significant level of allele mutation, then the expected frequencies of the genotypes AA, AB, BB, BC, CC, and AC are

AA: (0.5)(0.5) = 0.25
AB: 2(0.5)(0.4) = 0.4
BB: (0.4)(0.4) = 0.16
BC: 2(0.4)(0.1) = 0.08
CC: (0.1)(0.1) = 0.01
AC: 2(0.5)(0.1) = 0.1

Example 2: Suppose you know the genotype frequencies for a 3-allele gene in a certain population that contains 401 individuals:

AA: 101 individuals
AB: 158 individuals
BB: 66 individuals
BC: 30 individuals
CC: 7 individuals
AC: 39 individuals

From this information you can first compute the frequencies of each allele A, B, C:

A: (2*101 + 158 + 39)/(2*401) = 0.4975
B: (2*66 + 158 + 30)/(2*401) = 0.3990
C: (2*7 + 39 + 30)/(2*401) = 0.1035

Now we can compute the expected number of individuals that would have each genotype if the population were at Hardy-Weinberg equilibrium:

AA: (0.4975)(0.4975)401 = 99.25
AB: 2(0.4975)(0.3990)401 = 159.20
BB: (0.3990)(0.3990)401 = 63.84
BC: 2(0.3990)(0.1035)401 = 33.12
CC: (0.1035)(0.1035)401 = 4.30
AC: 2(0.4975)(0.1035)401 = 41.30

We can perform a chi-square test on the observed and expected values to see if the observational data supports the hypothesis that the population is at H-W equilibrium for the gene.

In Hardy-Weinberg chi-square analysis, the number of degrees of freedom is equal to the number of genotypes minus the number of alleles. In this case, 6 - 3 = 3, so we use the chi-square distribution with 3 degrees of freedom.

In general, if the number of alleles is n, then the number of genotypes is n(n+1)/2. Thus, the number of degrees of freedom is

d.f. = n(n+1)/2 = n = n(n-1)/2