9 min read

Thanos did nothing wrong

Background

I, like so many nerds, watched Avengers: Infinity War, and are eagerly awaiting part 2. I love how the Marvel Cinematic Universe has built in the interest the X-men movies as a kid, via pulpy action and all the feels.

I’m going to look at Infinity War through the lens of one of Thanos’ analysts. What advice might an Operational Researcher for Thanos give?

Since starting this post Infinity War has come out on DVD and I’ve re-watched it. I still like it!

Trolley Problem

Thanos, like so many villains who don’t see themselves as the villain, hits the viewer with the trolley problem. In this case: is it morally good to kill half of the population of the universe, in order to save the other half?

Or, in terms of the trolley problem:

“You see a runaway trolley moving towards the entire population of the universe lying on the tracks. You are standing next to a lever that controls a switch. If you pull the lever, the trolley will be redirected onto a single side track where only half the universe is lying.”

Except in this case the “lever” is the infinity gauntlet, and Thanos wasn’t so much standing next to the lever as cut a bloody path to it.

Anyway.

Health Economics

This is a (massively) scaled up problem of health economics. To illustrate, let’s take the problem at its lowest level.

Triage

A staple of cinema, and the MCU is no exception, is the battlefield triage. For the best of this, see M*A*S*H. In this situation, the medics have limited resources, they can not treat everyone. They need to work out how to spread their resources (doctors, nurses, medicine, tools, etc.) to save the most people.

This is the trolley problem, sometimes with Hawkeye arguing that he be allowed to work a bit longer on a patient that means 2 more patients will expire in the hallway.

(Or maybe an inverse trolley problem, there is a speeding trolley, and two tracks. You have time to remove 10 people from track A, or 5 people from track B.)

Everyone agrees that it would be best if there were enough resources to save everyone who comes into the MASH unit, but that is not happening.

Healthcare

The largest problem, as I see it, in Health Economics is the effective use of limited resources to maximise health in a population.

We do not have unlimited doctors, nurses, medicine, tools, etc.. so we are dealing with limited resources. (Human staff are the easiest to see this for. Even if we put 100% of our population into medical school, we’d have a limited number of medics.)

I will talk in the future about the Quality-Adjusted Life Year (QALY), but today I will only consider life-years. Except, because it’s easier to work with, I’ll consider deaths.

Back to Thanos

Thanos thinks that his policy of grabbing all the infinity stones and wiping out half the universe is choosing the track with less people on it.

Except…

What do the analysts say?

(Honestly, Thanos’ analysts say whatever they need to say to stay alive, like most of his people.)

Enough of the ethics, some analysis

I don’t know/don’t care what the entire population of the MCU is. (Also, I want to work with some other numbers I’m familiar with.)

Ultimately, Thanos has to choose one of the following two options: 1. Do nothing. 2. Get the infinity gauntlet, and wipe out half the universe.

I’m going to do the sums for both options on the UK, and hand-wave “if one policy is better in the UK, then it’s better in the whole MCU.”.

At time of publication, ONS thinks the 2016 UK population is 65,600,000. Which is good enough for my purposes.

Thanos thinks the analysis is easy:

  1. 65,600,000 deaths.
  2. 32,800,000 deaths.

(Any Brits who died while Thanos was getting the gauntlet are a rounding error for these purposes. I’m not falling down the rabbit-hole of who died in Infinity War and where their character is from. From the 2nd viewing I don’t think and Brits died before the big wipe.)

However, that assumes that the universal catastrophe where everyone dies would have happened right now if not averted. Maybe that’s not the case. So let’s consider 2 cases:

  1. Thanos does nothing, and is right. At some point in the near future everyone dies.
  2. Thanos wipes out half the population now, avoiding the death of absolutely everyone in the near future.

Thanos hasn’t told us exactly when the death of everyone due to overpopulation is going to happen, so let’s assume it happens at some point in the next hundred years. Why 100? Because the ONS have foretasted UK births and deaths for the next 100 years. (With increasing uncertainty…) (Also, my base year for this will be 2016, it’s when my data starts.)

So we have two scenarios, one where Thanos snaps his fingers, and one where he doesn’t.

And I can compare the number of life years experienced in both scenarios (under the assumption that the universal catastrophe is in the next 100 years). This is just the number of people alive in a one year in one scenario, minus the number of people alive in one year in the other scenario.

last_year <- forecast %>% pull(1) %>% max() #store the largest year in the forecast, for later use.
first_year <- forecast %>% pull(1) %>% min() # We need the first one as well

life_years <- function(forecast, intervention=FALSE, year_of_catastrophe=Inf){
  if(intervention){ #i.e. Thanos snaps his fingers
    forecast %>%
      mutate(`All Ages` = `All Ages`/2) %>% #half the population              disappears, but no universal catastrophe.
      summarise(total_life_years = sum(`All Ages`))
  }
  else if(year_of_catastrophe<=last_year){
      forecast %>%
        mutate(`All Ages` = if_else(`Projected Year` < year_of_catastrophe + first_year,
                                    `All Ages`,
                                    0)) %>% #Everything progresses as normal, apart from when everyone dies.
      summarise(total_life_years = sum(`All Ages`))
  }
  
}

cost_of_no_intervention <- map_dfr(1:100, function(year) life_years(forecast, FALSE, year) %>%
                             mutate(year_of_catastrophe = year))

intervention <- life_years(forecast, TRUE) %>% pull()

cost_of_no_intervention <- cost_of_no_intervention %>%
  mutate(`Years of life lost if Thanos does nothing` = intervention - total_life_years)

plot_ly(cost_of_no_intervention, x=~year_of_catastrophe) %>%
  add_lines(y=~`Years of life lost if Thanos does nothing`)

So, if the universal catastrophe was going to happen tomorrow, then Thanos would have saved approximately 4 billion years of life in the UK over the next 100 years.

(If the catastrophe were to happen more than 53 years in the future, then over the next 100 years Thanos has caused more loss of life than he has saved.)

Serious Economics

Discounting. The real reason I wanted to work with UK numbers.

Imagine two scenarios: 1. You develop a migraine today, it lasts a year, and then you recover. 2. You develop a migraine 20 years in the future, it lasts for a year, and then you recover.

Enough people prefer (2) that we apply a discount factor to future (good/ill) health, detailed in the Green Book.

So, let’s apply these discount factors.


forecast <- forecast %>%
  mutate(Year = `Projected Year` - 2016) %>%
  left_join(health_discount) %>%
  select(-Year)

discounted_life_years <- function(forecast, intervention=FALSE, year_of_catastrophe=Inf){
  if(intervention){ #i.e. Thanos snaps his fingers
    forecast %>%
      mutate(`All Ages` = `All Ages`/2) %>% #half the population              disappears, but no universal catastrophe.
      summarise(total_life_years = sum(`All Ages` * `Discount Factor`))
  }
  else if(year_of_catastrophe<=last_year){
      forecast %>%
        mutate(`All Ages` = if_else(`Projected Year` < year_of_catastrophe + first_year,
                                    `All Ages`,
                                    0)) %>% #Everything progresses as normal, apart from when everyone dies.
      summarise(total_life_years = sum(`All Ages` * `Discount Factor`))
  }
  
}

intervention <- discounted_life_years(forecast, TRUE) %>% pull()

cost_of_no_intervention <- map_dfr(1:100, function(year) discounted_life_years(forecast, FALSE, year) %>%
                             mutate(year_of_catastrophe = year))

cost_of_no_intervention <- cost_of_no_intervention %>%
  mutate(`Years of life lost if Thanos does nothing` = intervention - total_life_years)

plot_ly(cost_of_no_intervention, x=~year_of_catastrophe) %>%
  add_lines(y=~`Years of life lost if Thanos does nothing`)

I’ve just halved the best and worst case scenarios from Thanos’ point of view. Also, the point where Thanos stops being right is now 38 years from now…

But…

I deliberately left out the else condition in the function that generates the total life years experienced in a scenario. The remaining scenario is

The universal catastrophe does not happen

The final case, not considered, is that the universe is not overpopulated and about to collapse. My final function is then:


discounted_life_years <- function(forecast, intervention=FALSE, year_of_catastrophe=Inf){
  if(intervention){ #i.e. Thanos snaps his fingers
    forecast %>%
      mutate(`All Ages` = `All Ages`/2) %>% #half the population              disappears, but no universal catastrophe.
      summarise(total_life_years = sum(`All Ages` * `Discount Factor`))
  }
  else if(year_of_catastrophe<=last_year){
      forecast %>%
        mutate(`All Ages` = if_else(`Projected Year` < year_of_catastrophe + first_year,
                                    `All Ages`,
                                    0)) %>% #Everything progresses as normal, apart from when everyone dies.
      summarise(total_life_years = sum(`All Ages` * `Discount Factor`))
  }
  else{ #Scenario where Thanos is wrong.
    forecast %>%
      summarise(total_life_years = sum(`All Ages` * `Discount Factor`))
  }
}

(discounted_life_years(forecast, FALSE, Inf) -
  discounted_life_years(forecast, TRUE)) %>%
  pull() %>%
  printing_large_num()
## [1] "2,050,000,000"

Of course, this comes out the same as the case when the catastrophe happens at the end of the 100 year appraisal, but it’s satisfying to write code that suggests Thanos might not be right on this.

Overpopulation (MCU)

Many people have written at length about how our earth isn’t actually overpopulated. Mostly because the exponential growth seems to slow into a sigmoid curve as areas become more economically developed.

Maybe this doesn’t apply in the MCU, maybe the human superpower is that we can control our fertility.

But, an overpopulation catastrophe must be because there are more people (and Groots are people) than the universe can support.

  1. The MCU shows no sign of lack of resources. Like this universe, it seems that energy is convertible into any resource you need. The dwarf uses the energy of a dying neutron star to make an awesome axe, and there’s no shortage of neutron stars.
  2. Our laws of thermodynamics don’t seem to apply in the MCU. Or at least, the MCU isn’t a closed system. Dr Strange interacted with a universe where time didn’t exist. Strange could open a portal to a universe where entropy flows the opposite direction, and we have unlimited energy.1

The history of the overpopulation idea has been one that supports restrictions on breeding, as otherwise: (Graph illustrative, ignore the numbers.)

Really, Thanos has a policy where he’s going to have to use the gauntlet every so often because the universe will keep getting overpopulated.

Except he’s wrong, because there’s no resource crisis.

And he doesn’t care. He has the Time Stone, he could have performed a much better analysis than me, and chose not to.


  1. I briefly looked into how much energy we could get out of Cyclops, but the X-men are Marvel, but not MCU. Maybe a later post.