Mathematics & Logic · Games, networks & optimization

Game theory and the prisoner's dilemma

Game theory studies choices whose results depend on what others choose. See how two prisoners acting sensibly both end up worse off, what a Nash equilibrium is, and why repeating the game can make cooperation pay.

4 short lessons · about 16 minutes · 6 sources · updated November 2026

What you will learn

  • Use a payoff table to show that testifying is each prisoner's best move whatever the other does
  • Explain why both prisoners following that reasoning end up worse off than if both stayed silent
  • Test whether a set of choices is a Nash equilibrium by checking if anyone gains by changing alone
  • Explain why a Nash equilibrium can be bad for everyone, using price cutting and arms races

Lesson 1 of 4 · 4 min

Two prisoners and the choice that backfires

Before you readTwo suspects are questioned in separate rooms. Silence from both means 1 year each. Testifying frees you if the other stays silent, or gets you 2 years if both testify. Silent while the other testifies gets you 3. What happens if each simply picks their best option?

Correct.Not quite. The answer is Both get 2 years.

Both testify and both get 2 years, worse than the 1 year silence would have given. The lesson shows why each still picks it.

Two suspects sit in separate rooms. The police can only convict them of a minor charge, worth 1 year each, unless one testifies. Testify while your partner stays silent and you go free while they get 3 years. If both testify, both get 2 years.

This is game theory, the study of choices whose results depend on what someone else chooses. A payoff table lays it out, with your options down the side, your partner's across the top, and a sentence for each of you in every box.

Now think like one prisoner. If your partner stays silent, testifying gets you 0 years instead of 1. If your partner testifies, testifying gets you 2 instead of 3. Either way you do better by testifying. A move that's best whatever the other does is called a dominant strategy.

Check yourselfIn the prisoner's dilemma, why is testifying called a dominant strategy?

Correct.Not quite. The answer is It wins whatever the partner does.

Dominant means it beats the alternative in every case. Testifying gives 0 instead of 1 against silence and 2 instead of 3 against testimony. It doesn't give the best total, which is the whole problem.

Both prisoners reason the same way, so both testify and each serves 2 years. Had both stayed silent, each would have served 1. Each choice is sensible, yet together they produce a result neither wanted. That's the dilemma.

The trouble is that silence isn't safe. If you stay silent and your partner doesn't, you take the worst sentence. Without a way to make a binding promise, neither can risk it.

Merrill Flood and Melvin Dresher devised the game at the RAND Corporation in 1950, and Albert Tucker added the prison story. The model doesn't claim people are selfish. Players who care about each other can still face the same trap if the payoffs line up this way.

Try to recallIn the prisoner's dilemma, why do two sensible prisoners end up with 2 years each instead of 1?

Each prisoner does better by testifying whatever the other does, so both testify. That leads to 2 years each. Both staying silent would give 1 year each, but silence risks the worst sentence if the other talks, and neither can bind the other to a promise.

In the prisoner's dilemma testifying beats silence in every case, so both testify and each serves 2 years, though mutual silence would have meant 1.

Lessons in this topic

  1. Two prisoners and the choice that backfires

    Read a payoff table, find the move that's best whatever the other player does, and see why two sensible players still end up worse off.

    Essentials · 4 min

  2. Nash equilibrium, where nobody wants to move alone

    Learn what makes a set of choices a Nash equilibrium, and why price wars and arms races can settle somewhere everyone dislikes.

    Essentials · 4 min

  3. How playing again can make cooperation pay

    See why repeating the prisoner's dilemma changes the best move, and how a four-line program called tit for tat won Robert Axelrod's tournaments.

    Deeper · 4 min

  4. Chicken, the stag hunt and other kinds of trouble

    Meet two games with a different problem from the prisoners', one where someone must back down and one where the best result needs trust.

    Deeper · 4 min

Three quick stories from this topic

The four-line winner

The winner of Robert Axelrod's famous strategy contest was the shortest program entered

Anatol Rapoport's tit for tat was four lines of BASIC. It cooperates first, then copies the other player's last move. It can never beat its own opponent, yet it topped the total score.

The contest

Game theorists sent in programs to play the repeated prisoner's dilemma, and each played every other for 200 rounds.

Why it won

Tit for tat is never first to defect, hits back at once and then forgives. That drew most opponents into cooperating with it.

A Nobel from a thesis

The idea of the Nash equilibrium came from John Nash's 1950 doctoral thesis

Nash, a young student at Princeton, wrote his dissertation on non-cooperative games, where players can't make binding deals. In 1994 he shared the economics prize for this work with John Harsanyi and Reinhard Selten.

The test

A set of choices is a Nash equilibrium when nobody could do better by changing only their own choice.

Not always good

In the prisoner's dilemma the equilibrium leaves both players worse off than a choice they can't reach.

Throw away the wheel

In the game of chicken, tearing off your own steering wheel can win

Two drivers race toward each other, and whoever swerves loses face. A driver who visibly can't swerve leaves the other only one sensible move, which is to get out of the way.

Two ways to end

Chicken has two stable outcomes, each with one driver swerving. The contest is over which one it'll be.

Fewer options, more power

Giving up a choice changes what the other side should do. The same logic has been applied to nuclear standoffs.

Sources

  • The seven bridges of Königsberg

    Turn a famous walking puzzle into points and lines, then count the bridges at each piece of land to prove the walk impossible without trying a single route.

    4 lessons · 17 min

  • Why the shortest delivery route is so hard to find

    Ask for a route that visits every place once, instead of every road once, and the easy test disappears. The number of possible tours outruns any computer, which is why real route planners settle for good enough.

    4 lessons · 22 min

  • Permutations and combinations

    Count possibilities without listing them. Learn when to multiply choices, when order matters and when it doesn't, and work out why a 6-from-49 lottery ticket has about a 1 in 14 million chance.

    4 lessons · 16 min

  • Solving equations

    An equation is a balance, and solving it means keeping the balance while you isolate the unknown. Learn which moves are allowed, how to check an answer, and how to spot an equation with no solution or with endlessly many.

    4 lessons · 16 min

  • How calculus finds speed at a single instant

    Build a speedometer reading from average speeds over shorter and shorter intervals. See why the method never divides by zero, why a sharp corner breaks it, and how one rate predicts the next moment.

    4 lessons · 17 min

  • Fractions and decimals

    A fraction is a number, a division and a share all at once. See why adding needs a common denominator and multiplying doesn't, and why some fractions become decimals that never end.

    4 lessons · 16 min

All mathematics & logic topics · Take the quiz