An epidemic, in three letters. Split a population into the Susceptible, the Infected, and the Recovered, write down how people flow between those buckets, and a single number — R₀ — decides whether the disease explodes or fizzles. Scroll through to integrate the equations, watch the curve peak and burn out, and see why "flattening the curve" matters.
Everyone starts Susceptible. A few are Infected and pass it on at rate β (beta) on contact; the infected Recover at rate γ (gamma). That's the whole model: dS/dt = −βSI, dI/dt = βSI − γI, dR/dt = γI. The infection curve grows, hits an epidemic peak, then burns out as susceptibles run low — leaving a slice never infected. The verdict is R₀ = β/γ: above 1 you get an outbreak, below 1 it dies away.
The same maths, played out by moving dots that collide and infect — an agent-based mirror of the equations. The graph below tracks the live counts against a hospital-capacity line. Toggle social distancing to slow contacts: it lowers the effective β, so the peak gets lower and later — flattened under capacity. The vaccination slider starts a fraction already immune (in R): once you clear the herd-immunity threshold = 1 − 1/R₀, the outbreak can't take off at all.
Compartments & flows. Every person sits in exactly one box and moves one way only:
The S→I flow is βSI: new infections need a susceptible and an infected to meet, so it scales with both populations. The I→R flow is γI: a fixed fraction of the infected recover each day, so 1/γ is the average days spent infectious. Because nobody is created or destroyed, S + I + R stays constant.
R₀, the basic reproduction number. R₀ = β/γ is the average number of people one infected person passes the disease to in a fully susceptible population.
Herd immunity. If a fraction 1 − 1/R₀ is already immune (recovered or vaccinated), each new case meets too few susceptibles to spread, and the disease can't gain a foothold — protecting even the unvaccinated. With R₀ = 3 that threshold is 1 − 1/3 ≈ 67%; the more contagious the disease, the higher the bar.
Why flatten, not just shrink? Slowing transmission (distancing, masks) lowers β. That pushes the peak lower and later without necessarily changing how many get infected overall — but a lower, slower peak keeps simultaneous cases under hospital capacity, so the sick get care and fewer die. The area under the curve can be similar; the height is what overwhelms a health system.
Limitations. This bare SIR model assumes one well-mixed population where everyone contacts everyone equally, fixed β and γ, permanent immunity, and no births, deaths, travel, or latent (exposed) period. Real diseases need extensions — SEIR (an exposed stage), age/contact structure, waning immunity, spatial networks — but the simple version already captures the essential shape: grow, peak, burn out.