As you may well know, Star Trek was a science fiction TV show in the late 1960s. It featured futuristic technology and science fiction ideas such as warp drives, transporters, strange new worlds, time travel, and green alien space babes. And the possibility of all these things has, in the past, been discussed by experts, and nerds, in great detail. Especially that last one about green space babes.

But dammit, I’m a mathematician, not a physicist. So, instead of talking about the science of Star Trek yet again, what about the maths of Star Trek? After all, Star Trek is science fiction, but there is no such thing as maths fiction – so any mathematics featured on the show is sure to be on firmer ground. Right? Or as Spock himself says in ‘The Conscience of the King’;

SPOCK: Even in this corner of the galaxy, Captain, two plus two equals four.

Should we even expect much maths to feature on a simple space adventure show? In fact, many interesting mathematical ideas were raised during the show’s short run of 79 episodes, including; the probability we are alone in universe; a paradox that upset 20th century mathematicians as well as 23rd century androids; the mathematics of alien and Earth biology; and the most important question of all – when on a dangerous away mission, does the colour of your shirt really affect your chances of survival?



In this article we will focus purely on Star Trek: The Original Series. No movies, no animated series, no Next Generation, no JJ Abrams reboots, and definitely no lens flares.

So let’s begin by answering one of the most fundamental mathematical questions about Star Trek: The Original Series:

The Probability of Survival – The Red Shirt Question

Being in Starfleet and visiting strange new worlds is dangerous work. The safety of his crew is a top priority for Captain Kirk, especially if it affects the running of his ship.

For example, in ‘The Devil in the Dark’, the crew of the Enterprise are hunting a mysterious creature that has already killed several of the local miners. Kirk, Spock and a team of Enterprise security officers search for the creature in the maze of tunnels under the planet’s surface.

KIRK: Mister Spock, you are second in command. This will be a dangerous hunt. Either one of us by himself is expendable. Both of us are not. SPOCK: Captain, there are approximately one hundred of us engaged in this search, against one creature. The odds against you and I both being killed are 2,228.7 to 1. KIRK: 2,228.7 to 1? Those are pretty good odds, Mister Spock. SPOCK: And they are of course accurate, Captain. KIRK: Of course. Well, I hate to use the word, but logically, with those kind of odds, you might as well stay. But please stay out of trouble, Mister Spock. SPOCK: That is always my intention, Captain.

To work out the odds that both Kirk and Spock die, we can begin by considering what would happen if there were exactly two deaths. Then the probability that this is both Kirk and Spock (in either order) is $2 \left( \frac{1}{100} \times \frac{1}{99} \right) = \frac{1}{4950}$. In the form of odds that’s 4,949 to 1.

This turns out to be a very good approximation. My own calculation showed that if $x$ people die, then the probability that this includes both Kirk and Spock is $^{98}C_{x-2}$ ($98$ choose $x-2$) in $^{100}C_x$ ($100$ choose $x$). If each scenario becomes increasingly less likely by a factor of a half, then the final odds that Kirk and Spock both die works out again to be 4,949 to 1.

Spock’s odds are not quite as favourable and, although Spock doesn’t reveal his methodology, he must be correct because he gives his answer to one decimal place – and that’s despite his not knowing exactly how many men are taking part in the search.

However, we know Kirk and Spock are never in any real danger – they are the stars of the show after all. And so here we address one of the classic tropes of the original Star Trek. That the red shirt always dies – usually followed by Doctor McCoy’s diagnosis, “he’s dead, Jim!”

But is the trope really true? Is a crewmember in a red shirt (security, engineering and operations) genuinely more likely to die than a blue shirt (science and medical) or a gold shirt (command, helm)?

Analysis of this problem has been tried before, but has been flawed. So let me present my own analysis of the problem.

Looking at the figures, there were a total of 59 crew deaths during the 79 episodes of Star Trek the original series. Now, 16 of those deaths were off-screen, due to space plague or some other reason. So of the 43 deaths we saw, 25 of them were of red shirts – that’s about 58% $\left( \frac{25}{43} \right)$.

For comparison, 10 deaths were gold shirts making 23% $\left( \frac{10}{43} \right)$ and 8 were blue shirts making 19% $\left( \frac{8}{43} \right)$.

We can also use this to work out the unknown deaths. If everything is fair, then the number of unknown red shirt deaths should be 58% of 16, which is about 9 additional deaths.

So by those figures alone, it appears that red shirts are the ones most at risk – even Joan Collins had a 50-50 chance of survival.

But this is wrong. You see, what we have calculated here is not the probability that you will die. No, instead this is the probability you are a red shirt if you die. This is known as a conditional probability and is written $P(\text{red shirt} \mid \text{die})$.

What we want to know is the probability you die if you are a red shirt – written $P(\text{die} \mid \text{red shirt})$. And that’s a different question.

To calculate the real answer we need to know the total population of red shirts. After all, you expect more red shirts to die if there are more red shirts to begin with. And that turns out to be the case:

Uniform Colour Known Fatalities Unknown Estimate Total Population Fatalities as percentage of population Gold 10 4 55 25% Blue 8 3 136 8% Red 25 9 239 14% Total 43 16 430 14%

There are 430 people on the Starship Enterprise. If 59 died then we may estimate the probability of dying to be around 14% $\left( \frac{59}{430} \right)$. Now let’s calculate the probability of dying if you are a red shirt.

There are 239 red shirts on the ship. We saw 25 of them die so, by ignoring the unknown deaths, we may approximate the probability of dying if you are a red shirt to be around 10% $\left( \frac{25}{239} \right)$.

For a more accurate answer, we must also estimate how many deaths happened off-screen. As we saw before, if everything is fair this should be around 9 additional deaths, making 34 deaths in total. So now we may calculate the probability of dying if you are a red shirt to be 14% $\left( \frac{34}{239} \right)$.

This last calculation is equivalent to using Bayes’ Theorem, an important result in the theory of probability that connects the conditional probabilities of two events A and B as follows:

\[ P(A \mid B) = P(B \mid A) \cdot \frac{P(A)}{P(B)} \]

We can then calculate $P(\text{die} \mid \text{red shirt})$ using Bayes’ Theorem as follows:

\[ P(\text{die} \mid \text{red shirt}) = P(\text{red shirt} \mid \text{die}) \cdot \frac{P(\text{die})}{P(\text{red shirt})} \]

If we estimate $P(\text{red shirt} \mid \text{die})$ to be $\frac{25}{43}$, and use $P(\text{die}) = \frac{59}{430}$ and $P(\text{red shirt}) = \frac{239}{430}$, then Bayes’ Theorem confirms that the probability of dying if you are a red shirt is 14%.

For comparison, a similar calculation shows 14 out of 55 gold shirts died, that’s a massive 25%!

Whichever way you calculate it, we must conclude that the myth is not true, and that it is more dangerous to be a gold shirt than a red shirt.

However, there is some truth to the cliché. If you look at security, there are 90 security officers on the Starship Enterprise. We saw 18 security officers die, and can estimate another 7, so the probability you die if you are a security officer is around 28%!

So, the moral of the story? If you are on the Starship Enterprise, and you want to live, be a scientist.

Post updated on 08/11/13 to include calculations for off-screen deaths.

This is the first in a series of three posts about The Maths of Star Trek. The series continues in Part II, which discusses the mathematics of alien biology, and Part III will follow on Friday.