21 is a 2008 gambling thriller where a team of MIT students take on the casino at Blackjack by card counting. There’s a lot of mathematics behind the science of card counting and this is one of the movies which gets it reasonably correct, in contrast to films like The Rainman and The Hangover. The infamous Monty Hall problem also pops up in the movie. The film is based on real-life events: the MIT Blackjack team did this for decades at casinos.
Here’s the trailer for the film:
Math Scenario 1 – The Basics of Card Counting
Card counting is often depicted in movies as a highly complex activity that requires a genius levels of mathematics and that results in fortunes being made overnight.
Both are incorrect: card counting does require some basic math skills but is not mathematically difficult, and if done properly, results in a very small edge over the casino, meaning it takes a long time (and a lot of money to start with) to earn significant amounts of money.
Blackjack is a card game where cards are dealt to both the dealer and the players, and the aim is to get a total of 21 (called “Blackjack”) with your hand.
An experienced player (who doesn’t card count) can use a playing guide called “Basic Strategy”: using this approach, the player will lose about 1% of the money they bet on average. So on an average night, a player who bets $10,000 throughout the night (in lots of smaller bets), they would lose about $100.
Since the casino has such a slim advantage over the player, any advantage system that gives the player an extra advantage will tip the balance in favour of the player, and they may be able to actually make money at the casino. Card counting is one such advantage system.
The Hi-Lo System
There are many card counting systems; the Hi-Lo system is relatively simple, so we’ll use it to show how it’s done. The system revolves around watching the cards as they come out, and keeping a “running count” going – a single number that starts at zero and goes up or down depending on what cards go out. Here’s the system rules:
The Hi-Lo System
Start your count at zero (0)
If a 2, 3, 4, 5 or 6 is removed from the deck: Count +1
If a 10, Jack, Queen, King or Ace is removed: Count – 1
Let’s see the system in action – you can see the count being maintained at the bottom right of the video as the cards come out:
When to Bet
Without getting into too many details, the way the system is used is to decide whether to bet big or not bet / bet small.
If the count is very high, it means the dealer has lots of high value cards left in the pack. These are generally helpful for the player – so a high positive count means the player should bet.
If the count is very negative, it means the dealer has lots of low value cards left in the pack. These are generally helpful for the dealer – so the player is best off not betting or betting a minimal amount.
There’s one more important detail – the number of card decks left to be dealt at the table (often the dealer starts with as many as eight shuffled decks). The “running count” is divided by this number of decks left to get the “true count”.
There are 5 decks left to deal. The running count is at +14.
True count = running count / number of decks left
True count = 14 / 5
True count = 2.8
Math Scenario 2 – Bankroll Management and Bet Sizes
At least two factors affect the size of the bets that the card counter makes – how high the count is, and what the player’s total bankroll is.
Bankroll management is already covered in a related tutorial – in summary, because Blackjack is a game of chance with random variation, even though the card counting player has an advantage over the casino, they must only ever bet a small percentage of their total money so they can ride out long periods of random variation that goes against them (what others would call “bad luck”).
Bet sizing should also be affected by the size of the player’s advantage. Typically, a very high true count would mean the player would bet as much as they are allowed to do, as per the rules of the casino’s version of Blackjack. A sophisticated analysis called the Kelly Criterion is used by advanced players to work out how to optimally size their bets.
Math Scenario 3 – The Monty Hall Problem
The Monty Hall problem comes up during the movie when the MIT professor uses it to see how clever his students are. Here’s how it goes:
You’re on a gameshow trying to win a car. There are 3 doors, behind which are two goats and a car. You pick a door (let’s say you pick door A).
The game show host examines the other doors (B & C) and always opens one hiding a goat (they know what’s behind the doors).
You then get the choice to change your choice before the host opens your door, revealing whether you have won the car or not. Should you stick with door A, or switch to an unopened door?
This is a notorious problem, partly because the wording of the problem is often mucked up. It’s particularly important that you know that the gameshow host always opens a door hiding a goat. The gameshow host does not just “happen” to open a door that is hiding a goat.
The correct answer is that you should switch doors. There are several ways to reason why this is so. We’re going to go through the probability tree version:
This tree reads from left to right. The first fork shows the three possible doors the car starts of being behind, each having an equal one third probability.
The second set of forks show which choice you initially make, once again each choice having an equal one third chance.
The last set of forks shows what the gameshow host does when revealing a door. If you happen to pick the door with the car behind it, then the gameshow host has two equally likely outcomes opening one of the other two doors (since they both hide goats). If you happen to pick the door with a goat behind it, then the gameshow only has one other door they can reveal with probability 1.
The last two columns multiply out the probabilities for each tree path for both the switch door strategy and the stay with initial choice strategy. The bottom shows the total win chance using each strategy. The switch strategy is twice as likely to yield a win – with a 66% win rate, versus a 33% win rate for staying with your initial choice.
Real Life Example – Card Counters versus Casinos
Although the fortune-making lifestyles of card counters in Hollywood films may look impressive, it’s a lot harder for non-mathematical reasons to make a living, let alone get rich doing it.
Casinos make it harder for card counters by introducing new Blackjack game rules that reduce the player’s edge. They can use large numbers of decks and shuffle them more regularly, all things which reduce the profitability of card counters.
They can also position staff around the counter to distract them – card counting isn’t particularly mathematically challenging but it does require constant concentration.
The casino can also tell you to take your business elsewhere – as a private company free to do this as long as they’re not discriminating illegally.
Finally, even if the casino doesn’t catch you for a while, bad bankroll management or “going on tilt” – a period where you don’t play rationally but instead play emotionally can destroy your profits.
For many people, the appeal of card counting isn’t to earn large amounts of money but instead the idea that you can use some mathematical knowledge to give yourself an advantage at a game of chance.