Skip to content
Tutorials Center
My learning

Topics

Lesson 31 of 37 ยท Immunity and Disease

Vaccination and Herd Immunity

Learn how vaccines train the immune system, what herd immunity means, and use the formula 1 - 1/R0 and a simple epidemic simulation to see why coverage matters.

Vaccination is one of the most successful public health tools. Smallpox has been eradicated worldwide, and diseases such as polio and measles have been cut dramatically where vaccine coverage is high. This lesson explains how vaccines work, why they protect even people who cannot be vaccinated, and how simple mathematics describes that protection.

How a vaccine works

A vaccine contains a harmless form of an antigen. Depending on the vaccine this may be:

  • a weakened (attenuated) live pathogen,
  • an inactivated (killed) pathogen,
  • a piece of the pathogen (a protein or sugar),
  • or instructions that make your cells produce a harmless antigen for a short time (mRNA vaccines).

Your immune system reacts as if the pathogen were real: B cells make antibodies and memory cells form (see Adaptive Immunity and Antibodies). If you meet the real pathogen later, the secondary response is fast. Some vaccines need booster doses to keep protection high.

Vaccines can have side effects, usually mild, such as a sore arm or a short fever. Serious side effects are very rare, and vaccines are monitored closely for safety.

Herd immunity

Not everybody can be vaccinated: babies, people with some medical conditions, or people whose immune system is weak. If enough other people in the community are immune, the pathogen struggles to find new hosts, and these people are protected indirectly. This is herd immunity (or community immunity).

The reproduction number R0

The basic reproduction number, R0, is the average number of people one infected person infects in a population where nobody is immune. If R0 > 1 the disease spreads; if it is below 1 the outbreak dies out.

The fraction of the population that must be immune to stop sustained spread is approximately:

threshold = 1 - 1/R0

This is a simplified result: it assumes a well-mixed population and a vaccine that fully prevents spread. Real values of R0 depend on the pathogen and population, and published estimates vary. Measles is among the most infectious diseases, with estimates often between about 12 and 18.

Python Herd immunity threshold

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The more infectious the disease, the closer the threshold gets to 100 %.

A simple epidemic simulation

The SIR model divides people into Susceptible, Infected and Recovered. Each day, a fraction of contacts between S and I cause new infections, and a fraction of infected people recover. This is a simplified simulation, not a forecast.

Python SIR model with vaccination (simulation)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

You should see the number infected fall sharply once coverage passes the threshold (75 % when R0 = 4).

The model assumes the vaccine works perfectly and people mix at random. Real communities have clusters of unvaccinated people, where outbreaks can still occur even if national coverage is high.

Why antibiotics are not a substitute

Antibiotics treat bacterial infections after they start; they do nothing against viruses. Vaccines prevent disease and work against many viruses. Bacteria can also become antibiotic resistant, which makes prevention even more valuable.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What do vaccines make the body produce?

    A vaccine triggers an immune response, producing antibodies and memory cells.
  2. 2. What is herd immunity?

    When a high enough fraction is immune, outbreaks cannot spread widely.
  3. 3. What fraction must be immune for R0 = 5, using 1 - 1/R0?

    1 - 1/5 = 0.8, so 80 %.
  4. 4. If R0 is below 1, what happens to an outbreak?

    Each case produces fewer than one new case on average, so the outbreak shrinks.

Summary

  • Vaccines expose the immune system to a safe antigen, producing memory cells.
  • Herd immunity protects people who cannot be vaccinated.
  • Threshold for spread to stop is about 1 - 1/R0, so very infectious diseases need very high coverage.
  • Simple models such as SIR help us understand epidemics but make simplifying assumptions.

Next: The Male Reproductive System