A Mathematical Model of the Covid-19 Curve

3 minute read

GitHub RepoWeb Application

We hear the phrase "flatten the curve" a lot, but what does that really mean? Inspired by the YouTube channel Numberphile, this article explores a method of modelling the Covid-19 virus. In the video, differential equations are plugged into a free statistical software to visualize and understand what this curve is all about. You can watch the video below or read through the article (or both!).

Disclaimer: I am not an epidemiologist; this article is for informational purposes only.


It is common in epidemiology for the SIR model to be used. The acronym represents three variables:

  • S = the number of people susceptible to the disease
  • I = the number of people infected
  • R = the number of recovered people
It is important to note that a "recovered" person in this context means that the person is no longer contagious, and deaths do fall under this category. You can think of R standing for "removed" instead. From here we define three more variables, each of which represents the initial values of the SIR variables (SStart, IStart, and RStart). We assume that at time = 0, 1% of the population is infected, leaving the remaining 99% susceptible. The number of recovered patients would start at 0 for obvious reasons. So we have,
  • SStart = 0.99
  • IStart = 0.01
  • RStart = 0
  • time t as the independent variable
We then define two adjustable constants that will aid in the derivation of the equations. The first one of which is transm, which represents the transmission rate of the disease. The equation S'(t, S, I, R) denotes the rate of change of S with respect to time which is dependent on the variables t, S, I, and R. A reasonable way to express this rate would be to multiply the transmission rate with the number of susceptible and infected people. The rate would also be negative because the number of susceptible people is expected to decrease as more of them become infected. The second constant we introduce is recov, which represents the recovery rate of infected patients. Naturally, the rate of change of R with respect to time would be the number of infected people multiplied by the rate of recovery. The last equation, the rate of change of I with respect to time, would be the rate at which people are getting infected minus the rate at which people are recovering. Summarizing the equations, we have,
  • S'(t, S, I, R) = -(transm)(S)(I)
  • I'(t, S, I, R) = (transm)(S)(I) - (recov)(I)
  • R'(t, S, I, R) = (recov)(I)
Solving these three differential equations gives the curves shown below. Just for the purpose of visualization, the transmission rate was arbitrarily set to 3.2, the recovery rate was set to 0.23, and time ranged from 0 to 20. Note that the units of these values do not matter as we are only concerned with the shape of the model. t = 20 could represent days, weeks, or years and the same curves would be produced.



Notice that the y values range from 0 to 1. This is representative of the percentage of the human population in decimal form. The red curve (percentage of infected individuals) is what we are currently concerned about. It can be seen in the curve that the peak almost hits 0.8, meaning that nearly 80% of the world's population is expected to be infected at once. If the transmission rate were to decrease then the peak of the red curve decreases along with it, as illustrated below.



This is what the media means by "flattening the curve"! Here's what we can do collectively to lower the transmission rate:
  • Practicing social distancing
  • Washing your hands properly (i.e. using soap and water)
  • Covering your mouth and nose if you cough or sneeze
  • Avoid touching your face
I encourage you to learn more about Covid-19 on reliable sites such as the World Health Organization or the  Centers for Disease Control

Stay informed and stay healthy!

GitHub RepoWeb Application