Prisoner's Dilemma Calculator
Instructions: Indicate the number of strategies for Prisoner A and Prisoner B, and then type the corresponding payoff matrix.
More about the Prisoner's Dilemma and Game Theory
This calculator analyzes a Prisoner's Dilemma payoff matrix and identifies the Nash Equilibrium for two strategic players. It takes the payoffs a user enters for each combination of strategies and works out which strategy pair is stable, that is, where neither player benefits or has an incentive from switching given the other's choice.
What Is the Prisoner's Dilemma?
A Classic Game Theory Scenario
The Prisoner's Dilemma is a two-player game in which each player picks a strategy without knowing what the other will do, and the resulting payoffs depend on both choices together.
The classic version involves two suspects who can cooperate with each other by staying silent or defect by confessing.
Each one, acting purely in self-interest, finds it better to defect regardless of what the other does, even though both would be better off if they cooperated.
This tension between what is individually smart and what is jointly beneficial is the core of the dilemma, and it shows up in pricing wars, arms races, and many other real-world situations beyond the original story.
Building Your Payoff Matrix
Choosing the Number of Strategies for Each Player
To use the calculator, first set how many strategies Prisoner A and Prisoner B each have available. The classic dilemma uses two strategies per player (cooperate or defect), but the tool also supports larger matrices for players with more options.
Once the strategy counts are set, a grid of payoff pairs appears, one entry for each combination of A's and B's choices. Each cell should hold the payoff to Prisoner A and the payoff to Prisoner B for that particular pairing of strategies.
Consistency matters here: payoffs should reflect a common scale, such as prison sentences, profits, or utility scores, so that comparisons across cells are meaningful.
How the Calculator Finds the Nash Equilibrium: Best Response Reasoning
Once the matrix is filled in, the calculator looks for a Nash Equilibrium by checking best responses. For every strategy Prisoner B might pick, it finds the payoff-maximizing strategy for Prisoner A, and for every strategy Prisoner A might pick, it finds the best response for Prisoner B.
A strategy pair qualifies as a Nash Equilibrium when each player's choice is a best response to the other's, meaning neither has an incentive to switch unilaterally.
- Step 1: For each of B's strategies, identify A's highest-payoff response.
- Step 2: For each of A's strategies, identify B's highest-payoff response.
- Step 3: Mark the cells where both players are simultaneously playing a best response.
- Step 4: Report any such cell as a Nash Equilibrium.
In a matrix with payoffs \((a_{ij}, b_{ij})\), a pair \((i^*, j^*)\) is an equilibrium when
\[a_{i^*j^*} \geq a_{ij^*} \text{ for all } i, \quad \text{and} \quad b_{i^*j^*} \geq b_{i^*j} \text{ for all } j\] This is the same as saying tha a player has no incentive to change assuming the other player's decision as given.Why Does Rational Play Lead to a Worse Outcome?
The defining paradox of the Prisoner's Dilemma is that the Nash Equilibrium is often worse for both players than an alternative outcome they could reach through cooperation.
Each player, reasoning only about their own payoff, ends up choosing the strategy that is individually safest, even though a different pairing would give both players higher payoffs.
This gap between what is rational for one person alone and what is best for the group is why the game is used so widely to explain failures of cooperation, from environmental agreements to competitive business decisions.
Exploring Other Decision Tools
Game theory and decision analysis include several related frameworks worth exploring. For decisions made under uncertainty without probabilities, the Maximin Criterion Calculator and Maximax Criterion Calculator offer contrasting pessimistic and optimistic approaches, while the Hurwiczs Criterion Calculator blends the two using a weighting factor.
If a problem instead calls for counting arrangements of strategies or outcomes, the Combinatorial Coefficient Calculator can help.
Enter your payoff values and strategy counts, then click Calculate to reveal the Nash Equilibrium instantly.