MathLabs

Applied and computational mathematics

Game theory

The mathematics of strategic decisions among rational agents, with concepts like Nash equilibrium.

IntuitionWhen your best move depends on someone else's move

Two food trucks must each choose where to park on a street before seeing where the other parks. Choosing the busy end is best if the other truck picks the quiet end — but worst if both pick the busy end and split the same crowd. Optimization alone cannot solve this: there is no single best choice, only a best choice given what the other player does. Game theory is the mathematics of exactly this kind of interdependent decision.

A 3D saddle surface curving up along one horizontal axis and down along the perpendicular axis, with a flat critical point at the center representing an equilibrium where neither player benefits from unilaterally changing strategy.
z=x2−y2z = x^2 - y^2: a saddle payoff surface. It curves upward in xx (a minimizing player's choice) and downward in yy (a maximizing player's choice); the flat point at the center is where neither player can gain by moving alone — the value of the game.

This shape is not a coincidence. In many two-player competitive games, one player's payoff is exactly the negative of the other's — a zero-sum game — and the payoff, viewed as a function of both players' choices, is convex in the minimizer's strategy and concave in the maximizer's: exactly the saddle shape above. The flat point at the center is a saddle point, and it turns out to correspond precisely to rational play by both sides.

UndergraduateNormal-form games

Definition: Normal-form game

A normal-form game consists of a finite set of players 1,…,n1, \dots, n; for each player ii, a finite set of pure strategies SiS_i; and for each player ii, a payoff function ui:S1×⋯×Sn→Ru_i : S_1 \times \cdots \times S_n \to \mathbb{R} giving player ii's payoff for every combination of strategies chosen by all players simultaneously.

A two-player game is often written as a payoff matrix. In the classic Prisoner's Dilemma, two suspects independently choose to stay Silent or Confess; entries show (row player's years in prison, column player's years in prison) — smaller is better for each:

Prisoner's Dilemma payoff matrix (years in prison; lower is better)
Row \ ColumnColumn: SilentColumn: Confess
Row: Silent(1,1)(1, 1)(5,0)(5, 0)
Row: Confess(0,5)(0, 5)(3,3)(3, 3)

UndergraduateMixed strategies and von Neumann's minimax theorem

Definition: Mixed strategy

A mixed strategy for player ii is a probability distribution xix_i over SiS_i: instead of committing to one pure strategy, the player randomizes. This matters most in games without a stable pure-strategy outcome — like Matching Pennies, where any predictable pure choice can be exploited by the opponent.

ui(x1,…,xn)=∑s1∈S1⋯∑sn∈Sn(∏k=1nxk(sk))ui(s1,…,sn)u_i(x_1, \dots, x_n) = \sum_{s_1 \in S_1} \cdots \sum_{s_n \in S_n} \left(\prod_{k=1}^n x_k(s_k)\right) u_i(s_1, \dots, s_n)

For a two-player zero-sum game, the row player's payoff matrix AA (an m×nm \times n matrix of real numbers) is exactly the negative of the column player's, so the row player wants to maximize x⊤Ayx^\top A y and the column player wants to minimize it, where xx and yy are the players' mixed strategies (probability vectors).

For every m×nm \times n real matrix AA, max⁡x∈Δmmin⁡y∈Δnx⊤Ay=min⁡y∈Δnmax⁡x∈Δmx⊤Ay\max_{x \in \Delta_m} \min_{y \in \Delta_n} x^\top A y = \min_{y \in \Delta_n} \max_{x \in \Delta_m} x^\top A y, where Δm\Delta_m and Δn\Delta_n are the sets of probability vectors of length mm and nn. This common value vv is the value of the game.

Why is it true?

Without randomization, whoever moves "second" (choosing after learning the opponent's strategy) has an advantage, so maximin (row commits first) is generally at most minimax (column commits first). The surprising content of the theorem is that with mixed strategies this gap closes completely: randomizing removes any advantage from acting second, because the opponent can no longer predict — and exploit — a fixed choice.

Proof

Weak duality. For any fixed x0∈Δmx_0 \in \Delta_m and y0∈Δny_0 \in \Delta_n: min⁡yx0⊤Ay≤x0⊤Ay0≤max⁡xx⊤Ay0\min_y x_0^\top A y \le x_0^\top A y_0 \le \max_x x^\top A y_0. Taking max⁡x0\max_{x_0} of the left side and min⁡y0\min_{y_0} of the right side preserves the inequality: max⁡xmin⁡yx⊤Ay≤min⁡ymax⁡xx⊤Ay\max_x \min_y x^\top A y \le \min_y \max_x x^\top A y. This direction needs no randomization argument at all.

Reduction to a linear program. Since y↦x⊤Ayy \mapsto x^\top A y is linear, its minimum over the simplex Δn\Delta_n is attained at a vertex, i.e. at some pure strategy jj: min⁡yx⊤Ay=min⁡j∑i=1mxiAij\min_y x^\top A y = \min_{j} \sum_{i=1}^m x_i A_{ij}. So the row player's problem max⁡xmin⁡yx⊤Ay\max_x \min_y x^\top A y is the linear program: maximize vv subject to ∑i=1mAijxi≥v\sum_{i=1}^m A_{ij} x_i \ge v for every j=1,…,nj = 1, \dots, n, and x∈Δmx \in \Delta_m.

The dual program. By the standard theory of linear programming duality, the dual of this LP is: minimize ww subject to ∑j=1nAijyj≤w\sum_{j=1}^n A_{ij} y_j \le w for every i=1,…,mi = 1, \dots, m, and y∈Δny \in \Delta_n — which is exactly the linear-programming formulation of the column player's problem min⁡ymax⁡xx⊤Ay\min_y \max_x x^\top A y.

Strong duality. Both the primal and dual feasible regions (Δm\Delta_m and Δn\Delta_n) are nonempty and compact, so the linear program is feasible and bounded; the strong duality theorem for linear programming then guarantees the primal and dual optimal values coincide: max⁡xmin⁡yx⊤Ay=min⁡ymax⁡xx⊤Ay\max_x \min_y x^\top A y = \min_y \max_x x^\top A y. Combined with weak duality, which already gave ≤\le in this direction, equality holds, proving the theorem.

UndergraduateNash equilibrium and its existence

Definition: Nash equilibrium

A strategy profile x⋆=(x1⋆,…,xn⋆)x^\star = (x_1^\star, \dots, x_n^\star) is a Nash equilibrium if no player can improve their payoff by unilaterally switching to a different strategy while every other player's strategy stays fixed: for every player ii and every pure strategy si∈Sis_i \in S_i, ui(xi⋆,x−i⋆)≥ui(si,x−i⋆)u_i(x_i^\star, x_{-i}^\star) \ge u_i(s_i, x_{-i}^\star), where x−i⋆x_{-i}^\star denotes the strategies of all players other than ii.

ui(xi⋆,x−i⋆)≥ui(si,x−i⋆)for every i and every si∈Siu_i(x_i^\star, x_{-i}^\star) \ge u_i(s_i, x_{-i}^\star) \quad \text{for every } i \text{ and every } s_i \in S_i

In the Prisoner's Dilemma above, (Confess, Confess) is the unique Nash equilibrium: Confess strictly beats Silent no matter what the other suspect does, so neither has any incentive to deviate — even though (Silent, Silent) gives both suspects a strictly better outcome. This gap between equilibrium and the best joint outcome is the heart of the "dilemma," and shows equilibria need not be efficient.

Every finite normal-form game (any number of players nn, each with a finite pure-strategy set SiS_i) has at least one Nash equilibrium in mixed strategies.

Why is it true?

The proof builds a continuous "improve your strategy a little" map on the space of all strategy profiles: nudge probability toward any pure strategy currently doing better than average. Since the space of strategy profiles is compact and convex, Brouwer's fixed-point theorem guarantees this map has a fixed point — a profile that the map does not want to change. The proof's remaining work shows a fixed point is exactly a profile with no profitable deviation, i.e. a Nash equilibrium.

Proof

Let Δ=Δ1×⋯×Δn\Delta = \Delta_1 \times \cdots \times \Delta_n, the product of the players' mixed-strategy simplices — a compact, convex subset of Euclidean space. For x∈Δx \in \Delta, player ii, and pure strategy j∈Sij \in S_i, define the gain function gij(x)=max⁡(0, ui(sij,x−i)−ui(x))g_{ij}(x) = \max\big(0,\, u_i(s_{ij}, x_{-i}) - u_i(x)\big), the payoff player ii would gain by switching entirely to pure strategy jj, or 00 if that switch would not help. Define f:Δ→Δf : \Delta \to \Delta by fi(x)j=xij+gij(x)1+∑k∈Sigik(x)f_i(x)_j = \dfrac{x_{ij} + g_{ij}(x)}{1 + \sum_{k \in S_i} g_{ik}(x)}; since uiu_i is continuous (indeed multilinear) in xx, gijg_{ij} is continuous, so ff is continuous, and each fi(x)f_i(x) is again a probability vector by construction.

By Brouwer's fixed-point theorem, the continuous map ff on the compact convex set Δ\Delta has a fixed point x⋆x^\star with f(x⋆)=x⋆f(x^\star) = x^\star. Write Si:=∑k∈Sigik(x⋆)S_i := \sum_{k \in S_i} g_{ik}(x^\star); the fixed-point equation for each (i,j)(i,j) reads xij⋆(1+Si)=xij⋆+gij(x⋆)x_{ij}^\star (1 + S_i) = x_{ij}^\star + g_{ij}(x^\star), i.e. xij⋆Si=gij(x⋆)x_{ij}^\star S_i = g_{ij}(x^\star).

Fix a player ii and let dij:=ui(sij,x−i⋆)−ui(x⋆)d_{ij} := u_i(s_{ij}, x_{-i}^\star) - u_i(x^\star), so gij(x⋆)=max⁡(0,dij)g_{ij}(x^\star) = \max(0, d_{ij}). Multiply the fixed-point equation by dijd_{ij} and sum over j∈Sij \in S_i: on the left, Si∑jxij⋆dij=Si(∑jxij⋆ui(sij,x−i⋆)−ui(x⋆)∑jxij⋆)=Si(ui(x⋆)−ui(x⋆))=0S_i \sum_j x_{ij}^\star d_{ij} = S_i\left(\sum_j x_{ij}^\star u_i(s_{ij}, x_{-i}^\star) - u_i(x^\star)\sum_j x_{ij}^\star\right) = S_i(u_i(x^\star) - u_i(x^\star)) = 0, using ∑jxij⋆ui(sij,x−i⋆)=ui(x⋆)\sum_j x_{ij}^\star u_i(s_{ij}, x_{-i}^\star) = u_i(x^\star) and ∑jxij⋆=1\sum_j x_{ij}^\star = 1.

On the right, ∑jgij(x⋆) dij=∑jmax⁡(0,dij) dij=∑j: dij>0dij2≥0\sum_j g_{ij}(x^\star)\, d_{ij} = \sum_j \max(0,d_{ij})\, d_{ij} = \sum_{j:\, d_{ij} > 0} d_{ij}^2 \ge 0. Equating both sides, ∑j: dij>0dij2=0\sum_{j:\, d_{ij}>0} d_{ij}^2 = 0, a sum of squares equal to zero, so every term vanishes: there is no jj with dij>0d_{ij} > 0. Since ii was arbitrary, ui(sij,x−i⋆)≤ui(x⋆)u_i(s_{ij}, x_{-i}^\star) \le u_i(x^\star) for every player ii and every pure strategy jj — precisely the Nash equilibrium condition. Hence x⋆x^\star is a Nash equilibrium.

UndergraduateReal-World Applications and Worked Examples

Game theory shapes how economists model competition and pricing, how security engineers reason about attackers and defenders, how biologists explain animal behavior through evolutionary stable strategies, and how auction designers (including for online ad markets) construct mechanisms where truthful bidding is each participant's best response.

Example: Mixed-strategy equilibrium in a network-defense game

An attacker chooses to attack Server A or Server B; a defender chooses which one to monitor. If the attacker targets the monitored server, the attack is caught (attacker payoff −4-4); if it targets the unmonitored one, it succeeds, earning 22 against Server A or 66 against Server B (more valuable). This is zero-sum with attacker payoff matrix (rows: attack A, attack B; columns: monitor A, monitor B) A=(−426−4)A = \begin{pmatrix} -4 & 2 \\ 6 & -4 \end{pmatrix}. Find the attacker's optimal mixed strategy and the value of the game.

Solution

Check for a pure saddle point first: row minima are min⁡(−4,2)=−4\min(-4,2)=-4 and min⁡(6,−4)=−4\min(6,-4)=-4, so maximin =−4=-4; column maxima are max⁡(−4,6)=6\max(-4,6)=6 and max⁡(2,−4)=2\max(2,-4)=2, so minimax =2=2. Since −4≠2-4 \ne 2, there is no pure-strategy saddle, so a mixed strategy is required.

Let the attacker attack A with probability pp (and B with probability 1−p1-p). The expected payoff if the defender monitors A is −4p+6(1−p)=6−10p-4p + 6(1-p) = 6 - 10p; if the defender monitors B, it is 2p−4(1−p)=6p−42p - 4(1-p) = 6p - 4. An optimal pp must make these equal — otherwise the defender would always pick whichever is smaller for the attacker, and the attacker could do better by adjusting pp.

Solving 6−10p=6p−46 - 10p = 6p - 4: 10=16p10 = 16p, so p=10/16=5/8p = 10/16 = 5/8. The attacker should attack Server A with probability 5/85/8 and Server B with probability 3/83/8.

The value of the game is v=6−10(5/8)=6−6.25=−0.25v = 6 - 10(5/8) = 6 - 6.25 = -0.25: even playing optimally, the attacker's expected payoff is slightly negative, meaning the defender's monitoring strategy holds a slight edge overall.

Example: Multiple pure Nash equilibria in a standards-adoption game

Two smartphone makers must each choose charging Standard A or Standard B; profits are highest when both choose the same standard, thanks to network effects and shared accessories. Payoffs (Firm 1, Firm 2) are: (A,A)=(8,8)(A,A){=}(8,8), (A,B)=(2,3)(A,B){=}(2,3), (B,A)=(3,2)(B,A){=}(3,2), (B,B)=(6,6)(B,B){=}(6,6). Find all pure-strategy Nash equilibria.

Solution

Check each of the four cells for a profitable unilateral deviation. At (A,A)(A,A): Firm 1 switching to B (with Firm 2 fixed at A) gives 3<83 < 8, no gain; by symmetry Firm 2 has no gain either. So (A,A)(A,A) is a Nash equilibrium.

At (B,B)(B,B): Firm 1 switching to A (Firm 2 fixed at B) gives 2<62 < 6, no gain; symmetric for Firm 2. So (B,B)(B,B) is also a Nash equilibrium.

At (A,B)(A,B): Firm 1 gets 22; switching to B (Firm 2 stays at B) gives 6>26 > 2, a strict improvement, so Firm 1 deviates — (A,B)(A,B) is not an equilibrium. By the same logic (B,A)(B,A) is not an equilibrium either.

So this game has two pure Nash equilibria, (A,A)(A,A) and (B,B)(B,B) — both stable in the sense that neither firm wants to deviate alone, yet the theory alone does not say which one the market will settle on; this equilibrium selection problem (matching the historical VHS-versus-Betamax standards battle) is a genuine subtlety beyond existence.

A zero-sum game has payoff matrix (to the row player) A=(4123)A = \begin{pmatrix} 4 & 1 \\ 2 & 3 \end{pmatrix}. There is no pure-strategy saddle point. What is the value of the game?

Which condition correctly defines a Nash equilibrium x⋆x^\star?

Two suspects each choose Silent or Confess. Both Silent: 1 year each. Both Confess: 3 years each. One Confesses while the other stays Silent: the confessor goes free (0 years), the silent one gets 5 years. Confessing gives a strictly better outcome than Silent no matter what the other suspect does. What is the Nash equilibrium of this game?

A tennis server can aim Left or Right; the returner guesses Left or Right. The server wins the point with probability 80%80\% when the returner guesses the wrong direction, and only 50%50\% when the returner guesses correctly — symmetric for both directions. At the mixed-strategy Nash equilibrium, what probability should the server assign to aiming Left?

References

  1. John von Neumann, Oskar Morgenstern (1944). Theory of Games and Economic Behavior
  2. John F. Nash Jr. (1950). Equilibrium points in n-person games · DOI:10.1073/pnas.36.1.48
  3. John F. Nash Jr. (1951). Non-Cooperative Games · DOI:10.2307/1969529
  4. Constantinos Daskalakis, Paul W. Goldberg, Christos H. Papadimitriou (2009). The Complexity of Computing a Nash Equilibrium · DOI:10.1137/070699652