- Hardy–Weinberg equilibrium is a fundamental principle in population genetics that describes the relationship between allele frequencies and genotype frequencies in an idealized population. It provides a mathematical model for understanding how genetic variation is distributed within populations and serves as a baseline for investigating evolutionary processes. The principle was independently developed by mathematician Godfrey Harold Hardy and physician Wilhelm Weinberg in 1908. It states that, under specific assumptions, allele and genotype frequencies remain constant from one generation to the next.
- The Hardy–Weinberg principle applies to a population in which individuals reproduce sexually and mating occurs randomly with respect to the genetic locus being considered. For a gene with two alleles, conventionally represented as A and a, the frequency of allele A is denoted by p, while the frequency of allele a is denoted by q. Because these are the only two alleles considered at the locus, their frequencies must sum to one: p + q = 1
- In a diploid organism, individuals carry two copies of each autosomal gene, one inherited from each parent. The possible genotypes are AA, Aa, and aa. Under Hardy–Weinberg equilibrium, their expected frequencies are determined by the allele frequencies. The frequency of the homozygous dominant genotype AA is p², the frequency of the heterozygous genotype Aa is 2pq, and the frequency of the homozygous recessive genotype aa is q². These genotype frequencies follow from the random combination of alleles during fertilization.
- The Hardy–Weinberg equation is: p² + 2pq + q² = 1
- This equation represents the expected genotype-frequency distribution for a biallelic autosomal locus in a population at equilibrium. The term p² represents individuals carrying two copies of allele A, 2pq represents individuals carrying one copy of each allele, and q² represents individuals carrying two copies of allele a. The sum of these genotype frequencies equals one because they account for all possible genotypes at the locus.
- For example, consider a population in which the frequency of allele A is 0.6 and the frequency of allele a is 0.4. The expected genotype frequencies under Hardy–Weinberg equilibrium are calculated as follows:
p = 0.6
q = 0.4
AA = p² = 0.6 × 0.6 = 0.36
Aa = 2pq = 2 × 0.6 × 0.4 = 0.48
aa = q² = 0.4 × 0.4 = 0.16
- The expected population therefore consists of 36% AA individuals, 48% Aa individuals, and 16% aa individuals. In a population of 1,000 individuals, the corresponding expected numbers would be 360 AA, 480 Aa, and 160 aa individuals, assuming the population meets the conditions of the model.
- Allele frequencies can also be calculated from observed genotype counts. If a sample contains (N) diploid individuals, with (N_{AA}) individuals having genotype AA, (N_{Aa}) having genotype Aa, and (N_{aa}) having genotype aa, the frequency of allele A is calculated by counting two copies for each AA individual and one copy for each heterozygous individual. Similarly, the frequency of allele a is calculated from the number of copies of that allele:
p = (2N_AA + N_Aa) / (2N)
q = (2N_aa + N_Aa) / (2N)
- For example, suppose a sample contains 100 individuals with 40 AA, 40 Aa, and 20 aa genotypes. The total number of allele copies is 200. The frequency of allele A is (2 × 40 + 40) / 200 = 0.6, while the frequency of allele a is (2 × 20 + 40) / 200 = 0.4. These allele frequencies can then be used to calculate the genotype frequencies expected under Hardy–Weinberg equilibrium. The observed and expected genotype distributions can be compared to assess whether the population is consistent with the model.
- Hardy–Weinberg equilibrium depends on several assumptions. The population is assumed to be very large, so random genetic drift has a negligible effect on allele frequencies. Mating is assumed to be random with respect to the locus under consideration, meaning that individuals do not preferentially mate based on their genotypes at that locus. The model also assumes that there is no natural selection favoring or disadvantaging particular genotypes, no mutation introducing or changing alleles, and no migration or gene flow that alters the population’s allele frequencies. Under these conditions, allele frequencies remain constant across generations, and genotype frequencies follow the Hardy–Weinberg proportions after random mating.
- These assumptions describe an idealized population rather than the conditions found in most natural populations. Real populations may experience selection, genetic drift, mutation, migration, non-random mating, population subdivision, and changes in population size. Hardy–Weinberg equilibrium is therefore mainly used as a reference model. Deviations from expected genotype frequencies may indicate that one or more evolutionary, demographic, biological, or technical factors are influencing the population.
- A Hardy–Weinberg equilibrium test compares observed genotype counts with the counts expected from the allele frequencies estimated in the sample. One commonly used method is the chi-square goodness-of-fit test. The expected count for each genotype is calculated by multiplying its expected frequency by the total number of individuals. The chi-square statistic is then calculated by summing the squared differences between observed and expected counts divided by the expected counts:
Expected AA = p² × N
Expected Aa = 2pq × N
Expected aa = q² × N
χ² = Σ [(Observed − Expected)² / Expected]
- For a biallelic autosomal locus with allele frequencies estimated from the same sample, the conventional chi-square test commonly has one degree of freedom. The calculated statistic can be compared with a chi-square distribution to obtain a p-value. A small p-value provides evidence that the observed genotype counts differ from Hardy–Weinberg expectations. However, failure to reject the equilibrium hypothesis does not prove that the population is in equilibrium; it means that the available data do not provide sufficient evidence of a departure under the chosen test. Exact tests are often preferable when sample sizes are small or expected genotype counts are low.
- The following Python example calculates allele frequencies, expected genotype counts, and a chi-square statistic from observed genotype counts:
from scipy.stats import chi2
# Observed genotype counts
AA = 40
Aa = 40
aa = 20
N = AA + Aa + aa
total_alleles = 2 * N
# Calculate allele frequencies
p = (2 * AA + Aa) / total_alleles
q = (2 * aa + Aa) / total_alleles
# Calculate expected genotype counts
expected_AA = p**2 * N
expected_Aa = 2 * p * q * N
expected_aa = q**2 * N
# Calculate chi-square statistic
observed = [AA, Aa, aa]
expected = [expected_AA, expected_Aa, expected_aa]
chi_square = sum(
(obs – exp)**2 / exp
for obs, exp in zip(observed, expected)
)
# Conventional degrees of freedom for a
# biallelic autosomal HWE test with estimated p
degrees_of_freedom = 1
p_value = chi2.sf(chi_square, degrees_of_freedom)
print(“Allele frequency A:”, p)
print(“Allele frequency a:”, q)
print(“Expected AA:”, expected_AA)
print(“Expected Aa:”, expected_Aa)
print(“Expected aa:”, expected_aa)
print(“Chi-square:”, chi_square)
print(“P-value:”, p_value)
- This example demonstrates the basic calculation for a biallelic autosomal locus. It is intended for situations in which the expected counts are suitable for a chi-square approximation. For small samples, rare variants, or complex genotype distributions, an exact Hardy–Weinberg test or an appropriate simulation-based method may be more reliable.
- Hardy–Weinberg equilibrium is particularly useful for studying genetic variation and evolutionary processes. Natural selection can change allele frequencies when individuals with particular genotypes have different survival or reproductive success. Genetic drift can cause random changes in allele frequencies, especially in small populations. Mutation introduces new genetic variants, while migration and gene flow can introduce alleles from other populations. Non-random mating, including inbreeding and assortative mating, can alter genotype frequencies even when allele frequencies remain unchanged. These processes help explain why observed populations may depart from Hardy–Weinberg expectations.
- Inbreeding is an important cause of deviation from Hardy–Weinberg genotype proportions. When closely related individuals mate, offspring have an increased probability of inheriting identical alleles from a common ancestor. This generally increases homozygosity and reduces heterozygosity relative to Hardy–Weinberg expectations at the same allele frequencies. Positive assortative mating, in which individuals with similar characteristics preferentially mate, can also increase homozygosity at associated loci. Disassortative mating may increase heterozygosity. These mating patterns do not necessarily change allele frequencies directly, but they can change how alleles are combined into genotypes.
- Population subdivision can also produce deviations through the Wahlund effect. When genetically differentiated subpopulations are combined and analyzed as one population, the pooled sample may show a deficit of heterozygotes compared with the Hardy–Weinberg expectation calculated from the pooled allele frequencies. This occurs because allele frequencies differ among the underlying subpopulations. Consequently, a departure from equilibrium does not necessarily indicate selection or inbreeding; it may reflect unrecognized population structure or differences in ancestry.
- The principle is widely applied in human population genetics and medical genetics. It helps estimate genotype frequencies from allele frequencies, assess genetic variation, and identify potential departures associated with population structure, selection, or non-random mating. For a rare recessive disease allele with frequency q, the expected frequency of affected homozygous individuals under Hardy–Weinberg equilibrium is q², while the expected frequency of heterozygous carriers is 2pq. When q is small and p is close to one, carrier frequency is approximately 2q. These estimates can support preliminary population-level calculations, but they should not replace direct genetic testing or clinical assessment. Their accuracy depends on assumptions such as random mating, correct allele-frequency estimates, and appropriate definition of the population.
- Hardy–Weinberg calculations are also relevant to genetic screening and disease-variant research. Researchers can use genotype frequencies to examine whether a variant’s distribution is consistent with equilibrium expectations and to identify possible issues requiring further investigation. However, deviations may arise from population stratification, consanguinity, natural selection, sampling bias, genotyping errors, or incorrect variant representation. A Hardy–Weinberg test alone cannot establish the cause of a deviation or determine whether a genetic variant is pathogenic.
- In genome-wide association studies and other large-scale genetic analyses, Hardy–Weinberg testing is commonly used as part of genotype quality control. A substantial deviation in control samples may indicate genotyping problems, allele-calling errors, population structure, or other sources of bias. Researchers sometimes apply filters based on Hardy–Weinberg test results to identify questionable variants. Such filtering requires care because genuine biological selection, disease ascertainment, and population structure can also produce departures. In case-control studies, deviations among cases may be biologically meaningful, particularly when a genotype is associated with disease risk. Therefore, quality-control decisions should consider whether the test was performed in cases, controls, or an appropriately defined reference population.
- The principle is also important in animal and plant breeding. It provides a baseline for evaluating genotype distributions, estimating carrier frequencies for inherited disorders, and monitoring genetic variation in breeding populations. In livestock, it can help identify possible inbreeding, population subdivision, or non-random mating. In plant populations, it is useful for studying mating systems, self-fertilization, cross-pollination, and the genetic structure of cultivated and wild populations. Breeding programs can use this information alongside pedigree records, genomic relationships, and performance data to monitor genetic diversity and manage the frequency of undesirable alleles.
- Hardy–Weinberg equilibrium is not limited to human or agricultural genetics. It is widely used in conservation genetics, wildlife population studies, microbial population research, and evolutionary biology. In conservation, genotype-frequency deviations may provide clues about small population size, fragmentation, inbreeding, or population mixing. In microbial studies, the assumptions of the classical diploid model may not apply directly to organisms with haploid, clonal, or complex reproductive systems. Researchers must therefore adapt population-genetic methods to the organism’s ploidy and reproductive biology rather than applying the diploid equation without consideration.
- Several bioinformatics tools support Hardy–Weinberg analysis. PLINK and PLINK 2 are widely used for genotype quality control and population-genetic analyses, including Hardy–Weinberg tests. VCFtools and bcftools provide functions for working with variant data, while R packages such as HardyWeinberg, genetics, and related population-genetics libraries support statistical testing and visualization. Python libraries such as scikit-allel can be used to process population-genetic data and calculate genotype statistics. The choice of tool depends on the size of the dataset, genotype representation, organism, and analysis objective.
- For example, PLINK can perform a Hardy–Weinberg test on genotype data stored in a supported binary dataset:
plink2 \
–bfile population_data \
–hardy \
–out hwe_results
- The output reports Hardy–Weinberg test statistics for eligible variants. Researchers should consult the documentation for their installed PLINK version to confirm the precise options and output fields. Before interpreting the results, they should check sample quality, variant quality, missing genotypes, population structure, relatedness, allele frequency, and whether the sample represents an appropriate population for the test.
- Despite its broad usefulness, the Hardy–Weinberg principle has several limitations. It describes an idealized population and does not account for all biological complexities. Its predictions may be unreliable when populations contain multiple ancestry groups, when mating is non-random, or when strong selection acts on the locus. Small sample sizes can also make equilibrium tests underpowered, while rare alleles may produce very low expected genotype counts. In addition, genotyping errors, missing data, sample contamination, and incorrect variant annotation can create apparent departures that are technical rather than biological.
- The standard equation assumes a diploid organism and a biallelic autosomal locus. Sex-linked loci, mitochondrial DNA, polyploid organisms, multiallelic loci, and organisms with unusual reproductive systems require modified calculations or different models. For a multiallelic autosomal locus with allele frequencies (p_1, p_2, \ldots, p_k), expected homozygote frequencies are (p_i^2), while the expected frequency of a heterozygote carrying alleles i and j is (2p_ip_j). The sum of all expected genotype frequencies remains one when all possible unordered diploid genotypes are included.
- For reproducible population-genetic research, investigators should document the population and sampling strategy, sample size, genotype-calling procedures, variant filters, allele-frequency estimates, statistical test, degrees of freedom, and software versions. They should also report whether the analysis was conducted in cases, controls, or reference samples and explain how population structure and relatedness were addressed. A statistically significant departure should be treated as a signal for further investigation rather than proof of a particular evolutionary mechanism.
- Hardy–Weinberg equilibrium remains one of the most important foundations of population genetics. It connects allele frequencies with genotype frequencies and provides a reference model for identifying departures caused by evolutionary processes, mating patterns, population structure, or technical problems. Its applications extend across human genetics, medical research, animal and plant breeding, conservation, and genome-wide association studies. Understanding the principle, its assumptions, statistical tests, and limitations is essential for interpreting genetic variation and conducting reliable population-genetic analyses.