The Prisoner's Dilemma and the Mathematics of Cooperation
Two people each make the choice that's best for them, no matter what the other does. The result? Both end up worse off than if they'd cooperated.
That's the prisoner's dilemma, the most famous game in game theory. It explains price wars, arms races, overfishing and why teams sometimes fall apart. But in 1980, a computer tournament revealed something hopeful: when the game is played repeatedly, a strategy that fits in four lines of code could beat far more sophisticated programs.
Individual Rationality Can Produce Collective Failure
We usually assume that if everyone acts sensibly in their own interest, things work out reasonably well. The prisoner's dilemma is a precise mathematical counterexample.
Each player's best move is to betray, whatever the other does. So two perfectly rational players both betray, and both get a worse outcome than two players who cooperated. Rationality, applied individually, leads to a result that's bad for everyone.
The Setup
Two suspects are arrested and held in separate rooms. Each can cooperate (stay silent) or defect (testify against the other):
| B stays silent | B testifies | |
|---|---|---|
| A stays silent | Both get 1 year | A gets 5 years, B goes free |
| A testifies | A goes free, B gets 5 years | Both get 3 years |
Look at it from A's point of view:
- If B stays silent: testifying means 0 years instead of 1. Better to testify.
- If B testifies: testifying means 3 years instead of 5. Better to testify.
Whatever B does, A does better by testifying. That's called a dominant strategy. B reasons the same way. Both testify, and both get 3 years, even though mutual silence would have given each just 1 year.
The General Structure
The story doesn't matter; the numbers do. Using points (higher is better), label the payoffs:
- T (Temptation): you defect, they cooperate
- R (Reward): both cooperate
- P (Punishment): both defect
- S (Sucker's payoff): you cooperate, they defect
Any game where:
T > R > P > S and 2R > T + S
is a prisoner's dilemma. The classic tournament values are T = 5, R = 3, P = 1, S = 0.
Nash Equilibrium
Mutual defection is a Nash equilibrium: an outcome where no player can do better by changing only their own choice. It's named for John Nash, who proved in 1950 that every finite game has at least one equilibrium (possibly using randomized strategies). You can read more about him in our post on John Forbes Nash Jr..
The dilemma shows that a Nash equilibrium isn't necessarily good. Mutual cooperation is better for both players, but it isn't stable, because each player is tempted to defect.
A Cold War Origin
The game was devised in 1950 by Merrill Flood and Melvin Dresher at the RAND Corporation, where researchers were applying game theory to nuclear strategy. Princeton mathematician Albert W. Tucker gave it the prison story and the name while explaining it to an audience of psychologists.
An arms race fits the structure perfectly: each country is better off building weapons whatever the other does, yet both would be better off if neither did.
An Insider Reference: Axelrod's Tournament
What if the game is played over and over with the same partner? Political scientist Robert Axelrod at the University of Michigan invited experts to submit computer programs to play the iterated prisoner's dilemma against each other.
- In the first tournament (1980), 14 programs competed, each playing 200 rounds against every other.
- The winner was Tit for Tat, submitted by mathematical psychologist Anatol Rapoport. It was the shortest program entered, just four lines of code.
Tit for Tat's rule: cooperate on the first move, then copy whatever the opponent did last time.
Axelrod publicized the results and ran a second tournament with 62 entries. Everyone knew Tit for Tat had won, and many tried to beat it. It won again. Axelrod described the findings in his 1984 book The Evolution of Cooperation.
Why Tit for Tat Works
Axelrod identified four properties of successful strategies:
- Nice: never be the first to defect
- Retaliatory: punish defection immediately
- Forgiving: return to cooperation once the other side does
- Clear: be simple enough for opponents to recognize and adapt to
Notice that Tit for Tat never "wins" a single match. It can at best tie against any one opponent. It won the tournament by earning high totals through many mutually cooperative games.
The Shadow of the Future
Repetition changes the math. If there's a probability w that the game continues for another round, cooperation can be stable when the future matters enough. For Tit for Tat against a would-be defector, cooperation holds up when:
w ≥ (T − R) / (T − P) and w ≥ (T − R) / (R − S)
With T = 5, R = 3, P = 1, S = 0, that means w ≥ 2/3. If there's at least a two-in-three chance of meeting again, cooperating pays. Axelrod called this the shadow of the future.
Two Concepts Worth Knowing
Dominant Strategy
A dominant strategy is best for you regardless of what anyone else does. In a one-shot prisoner's dilemma, defecting dominates.
Expected Value
When the future is uncertain, strategies are compared by expected payoff, weighting each future round by the probability it happens. See statistics formulas for expected value.
Quick Answer: What Is the Prisoner's Dilemma?
The prisoner's dilemma is a game where each player does better by betraying the other, whatever the other does, yet mutual betrayal leaves both worse off than mutual cooperation. In repeated play, strategies like Tit for Tat, which starts cooperating and then copies the opponent's last move, can sustain cooperation.
Try Them Yourself
- John Forbes Nash Jr.: the mathematician behind equilibrium
- Random Number Generator: add random mistakes to a strategy
- Statistics Formulas: expected value for repeated games
- Multiplication Tables: tally payoffs over many rounds
- Algebra Formulas: solve for the shadow-of-the-future threshold
- Winning With Numbers: strategy and math in competition
Play 10 rounds with a friend using the payoff table, then try again with Tit for Tat. Compare your total scores and see how quickly trust (or its absence) takes over.