Introduction to Game Theory in AI & Nash Equilibrium
Game theory is the mathematical study of strategic interaction between multiple rational decision-makers, where each agent's outcome depends not just on its own action but on the actions of others. This is fundamentally different from single-agent search - there is no single "optimal path," only optimal strategies in light of an opponent's strategy.
An AI game is formally defined by: a set of players, an initial state, an ACTIONS(s) function listing legal moves, a RESULT(s,a) transition model, a TERMINAL-TEST(s), and a UTILITY(s,p) function giving the numeric outcome for player p at terminal state s.
Classifying Games
| Dimension | Categories | Example |
|---|---|---|
| Number of players | Two-player vs. multi-player | Chess (2) vs. Poker (multi) |
| Sum type | Zero-sum (one's gain is exactly the other's loss) vs. General-sum | Chess (zero-sum) vs. economic negotiation (general-sum) |
| Information | Perfect information (fully observable) vs. imperfect information | Chess (perfect) vs. Poker (imperfect) |
| Determinism | Deterministic vs. stochastic (chance elements) | Chess (deterministic) vs. Backgammon (dice, stochastic) |
Nash Equilibrium
A Nash Equilibrium is a set of strategies (one per player) such that no player can improve their own outcome by unilaterally changing only their own strategy, assuming all other players keep their strategies fixed. Every finite game has at least one Nash equilibrium (possibly in mixed/randomized strategies) - proven by John Nash (1950).
Worked Example - Prisoner's Dilemma
| B: Cooperate | B: Defect | |
|---|---|---|
| A: Cooperate | A: −1, B: −1 | A: −3, B: 0 |
| A: Defect | A: 0, B: −3 | A: −2, B: −2 (Nash Equilibrium) |
(Defect, Defect) is the unique Nash equilibrium: given that B defects, A's best response is to also defect (−2 beats −3); symmetric for B. Notably, (Cooperate, Cooperate) would give both players a better outcome (−1,−1) - but it isn't stable, since either player could unilaterally improve by switching to Defect. This famous tension (individually rational ≠ collectively optimal) is a cornerstone result of game theory.
Pure vs. Mixed Strategy Equilibria
| Type | Description |
|---|---|
| Pure Strategy | Each player deterministically commits to one specific action |
| Mixed Strategy | A player randomizes over actions according to a probability distribution - necessary in games (like Rock-Paper-Scissors) with no pure-strategy equilibrium |
Two competing companies deciding whether to cut prices mirrors the Prisoner's Dilemma: both cutting prices (a "price war") is often the Nash equilibrium even though both companies would profit more if both held prices steady - neither can unilaterally hold prices without losing market share to the other.
Game Theory vs. Classical Adversarial Search
This course's later topics (Minimax, Alpha-Beta) focus specifically on zero-sum, two-player, perfect-information, deterministic games - the simplest, most tractable game-theoretic setting, where Nash equilibrium for one player reduces exactly to the Minimax strategy.
- Games are classified by player count, sum type, information, and determinism.
- Nash Equilibrium: no player benefits from unilaterally deviating.
- In two-player zero-sum games with perfect information, Nash equilibrium ≡ the Minimax solution.
Interview Questions
Nash Equilibrium only requires stability against unilateral deviation, not collective optimality. At (Cooperate, Cooperate), either player can improve their own payoff by unilaterally switching to Defect (going from −1 to 0), so it fails the no-incentive-to-deviate test, despite being Pareto-superior to (Defect, Defect) for both players jointly.