The ground is dark, so dark beetles are camouflaged and pale beetles are easy for the predator to spot. Each generation, conspicuous beetles are more likely to be eaten before they reproduce, so the dark allele spreads.
Picture a patch of dark forest floor covered in beetles. Some beetles are dark and blend in; some are light and stand out like a coin on a doormat. A bird hunts by sight, so it spots and eats the light ones more easily. The survivors breed, and their offspring inherit their parents’ color. Do this for a few generations and the field slowly fills with dark beetles — nobody decided to change, the population simply shifted. That shift is evolution.
Color here is set by one gene with two versions, called alleles: $A$ (dark, dominant) and $a$ (light, recessive). Write the fraction of $A$ copies in the whole gene pool as $p$ and the fraction of $a$ copies as $q$, so that $p+q=1$. With random mating, the three genotypes appear in the famous Hardy-Weinberg proportions $p^2$ for $AA$, $2pq$ for $Aa$, and $q^2$ for $aa$. Because $A$ is dominant, both $AA$ and $Aa$ beetles look dark, and only $aa$ beetles look light. Evolution is just these frequencies changing over time.
Give each genotype a relative fitness $w$ — its reproductive success compared with the best type. On the dark floor the dark beetles have $w=1$ and the conspicuous light beetles have $w=1-s$, where $s$ is the selection pressure. The population’s mean fitness is $\bar w = p^2 w_{AA} + 2pq\,w_{Aa} + q^2 w_{aa}$, and the next generation’s dark-allele frequency is $p' = \dfrac{p^2 w_{AA} + pq\,w_{Aa}}{\bar w}$. The Selection pressure slider sets $s$, the environment buttons decide which color has $w=1$, and turning on genetic drift replaces this smooth formula with a random draw from a finite population.
Set Dark forest, push Selection pressure high, and press Play: watch the light allele crash and the field go dark. Now switch to Pale meadow and reset — the same gene, opposite outcome, because fitness is relative to the environment. Notice that selection against the recessive light beetle slows down as $a$ gets rare (it hides in $Aa$ carriers), but selection against the dominant dark beetle is fast. Finally turn on Genetic drift and drop Population size to about $20$: now chance jiggles the lines and can even lose a favored allele.
| Step | What happens |
|---|---|
| 1. Variation | The population contains both alleles, giving dark ($AA$, $Aa$) and light ($aa$) beetles in Hardy-Weinberg proportions $p^2$, $2pq$, $q^2$. |
| 2. Selection | The predator eats the conspicuous color more often. The disfavored genotype’s fitness drops to $1-s$, so it leaves proportionally fewer offspring. |
| 3. Inheritance | Survivors pass their alleles to the next generation. The new allele frequency is $p' = (p^2 w_{AA} + pq\,w_{Aa})/\bar w$. |
| 4. Iteration | Random mating reshuffles the surviving alleles into a fresh batch of zygotes, and the cycle repeats. Small shifts each generation add up to large change. |
| 5. Drift (chance) | In a finite population the next generation is a random sample of $2N$ alleles, so frequencies also wander by luck — strongly when $N$ is small. |
When the disfavored allele is recessive, it is invisible to selection whenever it is paired with a dominant allele. As the recessive allele $a$ becomes rare, almost every remaining copy sits hidden inside a healthy-looking heterozygote $Aa$, where the predator never sees it. Selection can only act on the few $aa$ beetles, so the last copies of a harmful recessive allele are removed extremely slowly and can persist for thousands of generations. Selection against a dominant allele is the opposite: every carrier shows the trait, so a harmful dominant allele is exposed and purged quickly.
This sim shows directional selection, where one extreme is favored and the population shifts toward it. Two other patterns matter in nature: stabilizing selection favors the average and trims the extremes (human birth weight is the classic case), while disruptive selection favors both extremes over the middle and can split a population. All three are natural selection; they differ only in which individuals leave the most offspring.
The most famous real example mirrors this model exactly. Before industrial Britain, pale Biston betularia moths were camouflaged on lichen-covered bark; a rare dark (melanic) form stood out. As soot from coal blackened the trees in the 1800s, the dark form became camouflaged and the pale form conspicuous, and dark moths shot up to over 90% near industrial cities. After clean-air laws cleaned the bark in the late 1900s, the pale form rebounded — the allele frequency reversed, just like flipping the environment button here.
Natural selection is the process by which individuals whose inherited traits make them better suited to their environment tend to survive and reproduce more than others, so the helpful versions of genes become more common over generations. It needs three things: variation in a trait, that variation being heritable, and the trait affecting how many offspring an individual leaves. When a predator more easily spots beetles that stand out against the ground, the camouflaged beetles leave more offspring and the camouflaging allele spreads. Darwin and Wallace proposed this mechanism in 1858.
Key takeaway: natural selection is differential survival and reproduction of heritable variation, which over generations shifts a population toward traits that fit the environment.Evolution is the outcome — a change in the allele frequencies of a population over generations. Natural selection is one mechanism that can cause it. They are not the same: allele frequencies can also change through genetic drift (random change, strong in small populations), gene flow (migration between populations), mutation (new alleles), and non-random mating. A population is evolving whenever its allele frequencies are shifting, whatever the cause.
Key takeaway: evolution is the change in a population over time, while natural selection is just one of several forces — alongside drift, gene flow, and mutation — that can drive it.Fitness does not mean being strongest, fastest, or healthiest. It means reproductive success: how many surviving, fertile offspring an individual leaves relative to others. An organism that lives long but never reproduces has zero fitness; a short-lived one with many offspring has high fitness. The phrase “survival of the fittest” is misleading because reproduction, not mere survival, is what counts, and fitness is always relative to a particular environment — dark color helps on dark bark but hurts on pale lichen.
Key takeaway: fitness is relative reproductive success in a given environment, not physical strength, and the fittest are simply those who leave the most offspring.It is the null model of population genetics: in a large, randomly mating population with no selection, mutation, migration, or drift, allele frequencies stay constant. If allele A has frequency p and allele a has frequency q (with p + q = 1), the genotype frequencies are p² for AA, 2pq for Aa, and q² for aa. The principle is useful because real populations often depart from it — when observed genotype frequencies do not match the prediction, some evolutionary force must be acting. It is the baseline against which evolution is detected.
Key takeaway: Hardy-Weinberg gives the genotype frequencies expected when nothing is changing allele frequencies, so it is the baseline against which real evolutionary change is measured.Natural selection acts on individuals, because individual organisms survive or die and reproduce or fail based on their traits. But individuals do not evolve — their genes are fixed from birth. What evolves is the population, since evolution is defined as a change in allele frequencies across the whole group between generations. The gene’s-eye view adds that, because alleles are what get copied, selection can also be described as successful alleles becoming more common. These views are compatible.
Key takeaway: selection screens individuals, but it is populations that evolve, while alleles are the heritable units whose frequencies actually change.Genetic drift is random change in allele frequencies caused by chance, because each generation is a finite sample of the previous one and which individuals reproduce is partly luck. Drift is not driven by fitness, so it can make a neutral or even harmful allele more common, or lose a beneficial one. Its strength depends on population size: weak in large populations where fluctuations average out, powerful in small ones where it can overwhelm selection. Selection, by contrast, is directional and predictable. Both can cause evolution and usually act together.
Key takeaway: drift is random change strongest in small populations, while selection is directional change driven by fitness — the smaller the population, the more chance outweighs selection.Several things can stop fixation. When a harmful allele is recessive it hides in heterozygous carriers, so as it gets rare selection removes it ever more slowly and it lingers a very long time. Heterozygote advantage — as with the sickle-cell allele that protects against malaria — actively keeps both alleles because Aa is fittest. In small populations drift can randomly remove a beneficial allele before selection fixes it. And recurrent mutation keeps reintroducing the disfavored allele, balancing selection.
Key takeaway: dominance hiding recessives, heterozygote advantage, genetic drift, and ongoing mutation can all keep a population from ever reaching 100% of even a beneficial allele.