AI Wiki中文/EN

Nash equilibrium: guess the supports, solve the indifferences, check the deviations

纳什均衡

Define Nash equilibrium through unilateral deviations, compute every equilibrium of small bimatrix games exactly by support enumeration, and see why degenerate games, many players and worst-case complexity limit the method.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

A profile nobody wants to leave alone

Two drivers head toward each other on a single-lane road. Each can swerve or go straight. If both swerve, each gets 3; if one goes straight and the other swerves, the straight driver gets 4 and the swerver 1; if both go straight, both get 0. (The numbers are a synthetic version of the game usually called Chicken.) There is no action that is best regardless of the other driver, so dominance arguments from game theory fundamentals say nothing. A weaker question still has an answer: which combinations of strategies are self-enforcing, in the sense that no driver can gain by changing only its own behavior?

Those profiles are the Nash equilibria. Chicken has three: one driver swerves and the other goes straight, in either order, and a mixed profile in which each swerves with probability 1/2. A model that lists equilibria does not say which one will occur, but it rules out everything else as unstable under unilateral deviation. This article is about the concept and about computing it: how to find all equilibria of small two-player games exactly, and why no known method does that efficiently in general. Shoham and Leyton-Brown summarize the computational side as a problem whose difficulty depends sharply on the class of games, easy for two-player zero-sum games and believed hard beyond. Computing solution concepts

Equilibrium as a finite set of checks

Consider a bimatrix game: the row player chooses one of mm actions, the column player one of nn; AA and BB are the m×nm\times n payoff matrices of the row and column player. Mixed strategies are probability vectors x∈Δmx\in\Delta_m and y∈Δny\in\Delta_n. The pair (x^,y^)(\hat x,\hat y) is a Nash equilibrium if

x^⊤Ay^≥x⊤Ay^∀x∈Δm,x^⊤By^≥x^⊤By∀y∈Δn.\hat x^{\top}A\hat y\ge x^{\top}A\hat y\quad\forall x\in\Delta_m,\qquad \hat x^{\top}B\hat y\ge \hat x^{\top}By\quad\forall y\in\Delta_n.

These conditions quantify over infinitely many mixed strategies, but expected payoff is linear in a player’s own mixture, so it is enough to check pure deviations: x^\hat x is a best response to y^\hat y exactly when it puts weight only on rows whose payoff against y^\hat y is maximal. Roughgarden uses this observation to show that a claimed equilibrium can be verified efficiently. Pure deviations suffice

That observation gives the computational handle. Suppose we guess the supports: a set S1S_1 of rows played with positive probability and a set S2S_2 of columns. Then every row in S1S_1 must earn the same payoff uu against yy, no row outside may earn more, and the same for columns. For the row player’s indifference this is

∑j∈S2Aij yj=u(i∈S1),∑j∈S2yj=1,yj>0 (j∈S2),∑j∈S2Akj yj≤u(k∉S1).\sum_{j\in S_2}A_{ij}\,y_j=u\quad(i\in S_1),\qquad \sum_{j\in S_2}y_j=1,\qquad y_j>0\ (j\in S_2),\qquad \sum_{j\in S_2}A_{kj}\,y_j\le u\quad(k\notin S_1).

The column player’s conditions are symmetric with BB and xx. Note the cross-over: the column player’s mixture is pinned down by the row player’s payoffs, because its role is to make the row player indifferent. Shoham and Leyton-Brown state this as the feasibility program TGS (“test given supports”): once supports are fixed, finding an equilibrium is a linear feasibility problem, not a complementarity problem. Equations 4.26–4.30

Support enumeration. The support-enumeration method (SEM; the book’s notes credit Porter et al., 2004) loops over support-size profiles, favoring sizes that are balanced and small, instantiates the supports, prunes actions that are conditionally strictly dominated given the opponent’s support, and runs the feasibility test. It is complete because it eventually tries every support pair, and it has exponential worst-case running time because there are exponentially many supports. The book reports that, on games from the literature, this simple search outperformed more sophisticated algorithms, and adds that this says as much about those games (they tend to have small-support equilibria) as about the algorithms. Section 4.2.3 and notes

Our implementation uses a common special case: only pairs with ∣S1∣=∣S2∣=k|S_1|=|S_2|=k, so each indifference system is square. It relies on nondegeneracy. Shoham and Leyton-Brown define a two-player game as degenerate if some mixed strategy of either player has more pure best responses for the other player than the size of its support. Footnote 4 of section 4.2.2 A standard property of nondegenerate games is that every equilibrium has equal-size supports and is determined by its supports. We state that property from the general game-theory literature, not from the pages cited here, which present SEM with arbitrary support sizes and do not prove it. The number of pairs to try is

∑k=1min⁡(m,n)(mk)(nk),\sum_{k=1}^{\min(m,n)}\binom{m}{k}\binom{n}{k},

which is 5 for a 2×2 game, 19 for 3×3 and grows exponentially. Degenerate games can have equilibria with unequal supports and even continua of equilibria; equal-size enumeration then returns only some of them.

Zero-sum games are different. When B=−AB=-A, the minimax theorem turns equilibrium computation into a linear program: the column player minimizes the largest row payoff, the row player solves the dual, and equilibria can be found in polynomial time. All equilibria give the same value. Section 4.1

General-sum games are believed hard. No polynomial-time algorithm is known for a general bimatrix game. Classic NP-hardness is the wrong yardstick because an equilibrium always exists; Roughgarden explains that if computing a mixed equilibrium were FNP-complete then NP would equal coNP. The appropriate class is PPAD, defined by path-following in a huge implicit directed graph, and computing a Nash equilibrium of a bimatrix game is PPAD-complete. Theorem 3.1, Theorem 7.1 Shoham and Leyton-Brown trace the completeness result through Goldberg and Papadimitriou and Daskalakis et al. (2006), tightened to two-player games by Chen and Deng (2006), and note that for three or more players the problem is posed as finding an ε-equilibrium because exact equilibria can involve irrational probabilities. Theorem 4.2.1, footnote 3, notes

Several natural questions are NP-hard even for two players: whether the equilibrium is unique, whether a Pareto-efficient equilibrium exists, whether some equilibrium guarantees a payoff or welfare level, and whether some equilibrium uses or avoids a given action. Listing all equilibria takes exponential time in the worst case for a simple reason: a k×kk\times k coordination game with identity payoff matrices has 2k−12^k-1 equilibria, one for each nonempty set of actions, played uniformly. Theorems 4.2.3–4.2.4

Path-following. The Lemke–Howson algorithm formulates the two-player problem as a linear complementarity problem and follows a path from an artificial starting point to an equilibrium. It gives a constructive proof that an equilibrium exists, but some games force exponentially long paths and the algorithm can miss equilibria that lie in a different component of its path graph. Section 4.2.2 Roughgarden notes that its convergence is argued by parity, much like Sperner’s lemma, which is one way to see why the problem lies in PPAD. Section 7

Exact support enumeration on five synthetic games

The program solves each square indifference system by Gaussian elimination over Python’s fractions.Fraction, so probabilities are exact. A candidate is accepted only if all support probabilities are strictly positive and an independent function, regret, confirms that no pure deviation gains anything. Singular systems are counted and skipped, which is safe only under the nondegeneracy assumption above.

The games are synthetic: Chicken; the 3×3 identity coordination game; a 3×3 cyclic general-sum game in which each action beats one action and loses to another but with unequal stakes; the same row payoffs paired with different column payoffs; and a degenerate game in which row action T strictly dominates B while the column player is indifferent between L and R whenever T is played.

"""Exact support enumeration for small bimatrix games (stdlib only, synthetic games)."""
from fractions import Fraction as F
from itertools import combinations


def solve(matrix, rhs):
    """Gaussian elimination over fractions; returns None if the square system is singular."""
    n = len(matrix)
    m = [[F(v) for v in row] + [F(b)] for row, b in zip(matrix, rhs)]
    for col in range(n):
        pivot = next((r for r in range(col, n) if m[r][col] != 0), None)
        if pivot is None:
            return None
        m[col], m[pivot] = m[pivot], m[col]
        for r in range(n):
            if r != col and m[r][col] != 0:
                factor = m[r][col] / m[col][col]
                m[r] = [a - factor * b for a, b in zip(m[r], m[col])]
    return [m[i][n] / m[i][i] for i in range(n)]


def opponent_mix(payoff, own_support, other_support):
    """Mix over other_support that makes every action in own_support equally good.

    payoff[i][j] is the payoff of the player choosing i when the opponent chooses j.
    Unknowns: probabilities on other_support, then the common value.
    """
    k = len(other_support)
    rows = [[payoff[i][j] for j in other_support] + [-1] for i in own_support]
    rows.append([1] * k + [0])
    rhs = [0] * len(own_support) + [1]
    sol = solve(rows, rhs)
    if sol is None:
        return None
    return sol[:k], sol[k]


def transpose(m):
    return [list(col) for col in zip(*m)]


def regret(A, B, x, y):
    """Largest gain any player gets from a pure deviation (0 means Nash equilibrium)."""
    row_vals = [sum(A[i][j] * y[j] for j in range(len(y))) for i in range(len(x))]
    col_vals = [sum(B[i][j] * x[i] for i in range(len(x))) for j in range(len(y))]
    current_row = sum(x[i] * row_vals[i] for i in range(len(x)))
    current_col = sum(y[j] * col_vals[j] for j in range(len(y)))
    return max(max(row_vals) - current_row, max(col_vals) - current_col)


def support_enumeration(A, B):
    A = [[F(v) for v in row] for row in A]
    B = [[F(v) for v in row] for row in B]
    m, n = len(A), len(A[0])
    Bt = transpose(B)
    found, stats = [], {'support_pairs': 0, 'singular_systems': 0}
    for k in range(1, min(m, n) + 1):
        for S1 in combinations(range(m), k):
            for S2 in combinations(range(n), k):
                stats['support_pairs'] += 1
                ys = opponent_mix(A, S1, S2)    # column mix making the row player indifferent on S1
                xs = opponent_mix(Bt, S2, S1)   # row mix making the column player indifferent on S2
                if ys is None or xs is None:
                    stats['singular_systems'] += 1
                    continue
                (yS, u), (xS, v) = ys, xs
                if min(yS) <= 0 or min(xS) <= 0:
                    continue
                y = [F(0)] * n
                x = [F(0)] * m
                for j, p in zip(S2, yS):
                    y[j] = p
                for i, p in zip(S1, xS):
                    x[i] = p
                if regret(A, B, x, y) == 0:
                    found.append((x, y, u, v))
    return found, stats


def show(name, A, B, labels_row, labels_col):
    found, stats = support_enumeration(A, B)
    print(name, '| support pairs checked:', stats['support_pairs'],
          '| singular systems:', stats['singular_systems'], '| equilibria found:', len(found))
    for x, y, u, v in found:
        xs = ', '.join(f'{a}={p}' for a, p in zip(labels_row, x) if p)
        ys = ', '.join(f'{a}={p}' for a, p in zip(labels_col, y) if p)
        print(f'  row[{xs}] col[{ys}] payoffs ({u}, {v})')
    return found


chicken_A = [[3, 1], [4, 0]]
chicken_B = [[3, 4], [1, 0]]
show('Chicken (Swerve/Straight)', chicken_A, chicken_B, 'SW ST'.split(), 'SW ST'.split())

I3 = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
show('3x3 identity coordination', I3, I3, 'abc', 'abc')

cyc_A = [[0, -1, 3], [1, 0, -1], [-1, 2, 0]]
cyc_B = [[0, 2, -1], [-1, 0, 3], [1, -2, 0]]
show('3x3 cyclic general-sum', cyc_A, cyc_B, 'RPS', 'RPS')
cyc_B2 = [[1, 3, 0], [0, 1, 3], [3, 0, 1]]
show('Same row payoffs, new column payoffs', cyc_A, cyc_B2, 'RPS', 'RPS')

deg_A = [[1, 1], [0, 0]]
deg_B = [[0, 0], [1, 0]]
show('Degenerate game (row T strictly dominant, column indifferent)', deg_A, deg_B, 'TB', 'LR')
for y_left in (F(1, 4), F(1, 2), F(3, 4)):
    r = regret([[F(v) for v in row] for row in deg_A], [[F(v) for v in row] for row in deg_B],
               [F(1), F(0)], [y_left, 1 - y_left])
    print(f'  check (T, L={y_left}): max deviation gain = {r}')

show('Perturbed degenerate game (column payoff R gets +1/1000 against T)',
     deg_A, [[0, F(1, 1000)], [1, 0]], 'TB', 'LR')

Recorded output:

Chicken (Swerve/Straight) | support pairs checked: 5 | singular systems: 0 | equilibria found: 3
  row[SW=1] col[ST=1] payoffs (1, 4)
  row[ST=1] col[SW=1] payoffs (4, 1)
  row[SW=1/2, ST=1/2] col[SW=1/2, ST=1/2] payoffs (2, 2)
3x3 identity coordination | support pairs checked: 19 | singular systems: 0 | equilibria found: 7
  row[a=1] col[a=1] payoffs (1, 1)
  row[b=1] col[b=1] payoffs (1, 1)
  row[c=1] col[c=1] payoffs (1, 1)
  row[a=1/2, b=1/2] col[a=1/2, b=1/2] payoffs (1/2, 1/2)
  row[a=1/2, c=1/2] col[a=1/2, c=1/2] payoffs (1/2, 1/2)
  row[b=1/2, c=1/2] col[b=1/2, c=1/2] payoffs (1/2, 1/2)
  row[a=1/3, b=1/3, c=1/3] col[a=1/3, b=1/3, c=1/3] payoffs (1/3, 1/3)
3x3 cyclic general-sum | support pairs checked: 19 | singular systems: 2 | equilibria found: 1
  row[R=11/25, P=1/5, S=9/25] col[R=9/20, P=7/20, S=1/5] payoffs (1/4, 4/25)
Same row payoffs, new column payoffs | support pairs checked: 19 | singular systems: 1 | equilibria found: 1
  row[R=1/3, P=1/3, S=1/3] col[R=9/20, P=7/20, S=1/5] payoffs (1/4, 4/3)
Degenerate game (row T strictly dominant, column indifferent) | support pairs checked: 5 | singular systems: 1 | equilibria found: 2
  row[T=1] col[L=1] payoffs (1, 0)
  row[T=1] col[R=1] payoffs (1, 0)
  check (T, L=1/4): max deviation gain = 0
  check (T, L=1/2): max deviation gain = 0
  check (T, L=3/4): max deviation gain = 0
Perturbed degenerate game (column payoff R gets +1/1000 against T) | support pairs checked: 5 | singular systems: 1 | equilibria found: 1
  row[T=1] col[R=1] payoffs (1, 1/1000)

Reading the output. Chicken needs five support pairs and yields the three equilibria from the introduction. In the mixed one both drivers earn 2, which is less than the 3 each gets when both swerve, but (swerve, swerve) is not an equilibrium: either driver would rather go straight.

The identity coordination game yields exactly 23−1=72^3-1=7 equilibria from 19 support pairs, matching the counting argument above: three pure, three that mix uniformly over two actions, one uniform over all three. Their payoffs fall from 1 to 1/2 to 1/3 as the support grows.

The cyclic game has one equilibrium among the equal-size supports, row (11/25, 1/5, 9/25) and column (9/20, 7/20, 1/5). Both cyclic games are nondegenerate: a separate exact check, not part of the program above, tried every support of size kk for either player and every set of k+1k+1 opponent actions and found no mixed strategy on that support that makes all k+1k+1 actions best responses. Under the property above, the equilibrium found is therefore the only one in each cyclic game. You can check the row player’s indifference by hand: against the column mixture, rows R, P and S each earn 1/4. Replacing the column player’s payoffs changes the row mixture, to uniform, and the column player’s equilibrium payoff, from 4/25 to 4/3, but leaves the column mixture exactly where it was. That is the cross-over in the indifference equations: a player’s own payoffs do not enter the equations that determine its own equilibrium mixture.

The degenerate game exposes the method’s assumption. Equal-size enumeration finds (T, L) and (T, R), but the regret check shows that T against any column mixture, here L with probability 1/4, 1/2 or 3/4, is also an equilibrium: a continuum that requires a support of size one for the row player and size two for the column player. Adding 1/1000 to the column player’s payoff for R against T breaks the tie and leaves a single equilibrium. Small perturbations remove such degeneracy, but they also change the game; if the original payoffs are the real ones, the continuum is part of the answer.

Each 2×2 or 3×3 game finishes in milliseconds. The cost per support pair is a Gaussian elimination of size k+1k+1, i.e. O(k3)O(k^3) fraction operations whose bit lengths can grow, and the number of pairs is exponential in min⁡(m,n)\min(m,n). This is a teaching implementation, not a solver for large games.

What an equilibrium computation does and does not tell you

The enumeration is complete only for nondegenerate games, and the program does not test nondegeneracy; it reports singular systems (two in the first cyclic game) and relies on the assumption when it skips them. For the two cyclic games the assumption was checked separately, as described above; for the degenerate game it fails, as intended. A production solver should either verify nondegeneracy, handle unequal supports with a linear program, or use a library that implements Lemke–Howson or polyhedral enumeration with exact arithmetic. Floating-point versions of the same code need tolerances for “probability > 0” and “no deviation gains”, and those tolerances change which candidates pass.

With three or more players the indifference conditions become polynomial rather than linear, and equilibria can have irrational probabilities, so exact rational enumeration no longer applies. Footnote 3

An equilibrium list is not a prediction of play. Multiple equilibria need a selection argument; mixed equilibria can be payoff-dominated by pure ones (Chicken’s mixed profile gives 2 each, below what either player gets in the pure equilibrium it prefers); and the PPAD-completeness result has been read, with acknowledged controversy, as a reason to doubt that players in large games reach a Nash equilibrium at all. Discussion section Roughgarden’s 2013 notes list the complexity of computing ε-approximate equilibria for small constant ε as open; we did not check later developments.

Supports, counts and counterexamples

  1. Why is it enough to check pure-strategy deviations when verifying an equilibrium, even though a player could deviate to any mixture?

    Answer: A player’s expected payoff is linear in its own mixture, so any mixture earns a weighted average of the pure actions’ payoffs. If no pure action beats the current strategy, no average of pure actions can either.

  2. In the Chicken game (swerve/straight payoffs 3, 1, 4, 0 for the row player), compute the column player’s swerve probability qq that makes the row player indifferent, and the resulting payoff.

    Answer: Swerve earns 3q+1(1−q)=2q+13q+1(1-q)=2q+1; straight earns 4q4q. Setting them equal gives q=1/2q=1/2 and payoff 2, matching the program.

  3. A colleague runs equal-size support enumeration on a game and finds exactly two pure equilibria. They conclude “the game has two equilibria”. Under what condition can this be wrong? Give the example from this article.

    Answer: If the game is degenerate, equilibria with unequal supports, including continua, can be missed. In the degenerate game, enumeration finds (T,L) and (T,R), but T against every column mixture is an equilibrium, so there are infinitely many.

  4. You need equilibria of a 2-player game with 40 actions each, for a security patrol model, and a guarantee of finding one. Which approach do you choose, and what would change your choice?

    Answer: If the game is zero-sum (the defender’s gain is the attacker’s loss), solve the minimax linear program, which runs in polynomial time and gives the unique value. For a general-sum model, full support enumeration has about ∑k(40k)2\sum_k\binom{40}{k}^2 pairs, astronomically many; use Lemke–Howson or a solver that searches small, balanced supports first, accept that worst-case time is exponential, and verify every returned profile with an exact regret check. If the model is really leader–follower (the defender commits first), the relevant concept is different and Nash computation may be the wrong target.

Further reading and open edges

Shoham and Leyton-Brown’s chapter 4 covers zero-sum linear programs, the Lemke–Howson algorithm with a worked example, support enumeration, n-player methods and the computation of other solution concepts, with references to the original algorithm papers. Chapter 4 Roughgarden’s lecture explains the complexity classes FNP, TFNP and PPAD from first principles, connects Nash’s existence proof to Sperner’s lemma and Brouwer’s fixed-point theorem, and discusses what intractability means for equilibrium as a behavioral prediction. PPAD lecture

When an equilibrium matters for a decision, report the full set you found, the method and whether it is complete for your game class, and the regret of every reported profile computed in exact or carefully bounded arithmetic.

Make a prediction, then check

In a fully mixed two-player Nash equilibrium, what determines the column player's mixing probabilities?

Choose one answer

Learning objectives

  • Verify Nash equilibria through pure deviations and compute small bimatrix-game equilibria exactly from indifference equations on supports.
  • Explain the nondegeneracy assumption of support enumeration, why zero-sum games are LP-solvable, and how PPAD-completeness and NP-hard variants limit general computation.

Prerequisites & connections

Explore related knowledge →

References

  1. Multiagent Systems: Algorithmic, Game-Theoretic, and Logical Foundations — Revision 1.1 PDF, chapter 4 (computing solution concepts), scoped
    Yoav Shoham; Kevin Leyton-Brown · 2010
  2. CS364A Lecture #20: Mixed Nash Equilibria and PPAD-Completeness — scoped lecture notes
    Tim Roughgarden · 2013

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Claude · 2026-12-02 · Independent AI check (Claude subagent, not the author; not a human or expert review). Ran example.py with python3 and diffed against example.stdout.txt (identical); confirmed byte-identical python blocks in en.mdx and zh.mdx and that quoted numbers match output. Re-derived the Chicken mixed equilibrium, support-pair counts 5 and 19, the 2^3-1 identity-game count, and checked with exact fractions that rows R, P, S earn 1/4 against the cyclic column mixture, columns earn 4/25 and 4/3 in the two cyclic games. Wrote a separate exact script testing nondegeneracy (every support of size k against every set of k+1 opponent actions, both players): both cyclic games, Chicken and the identity game are nondegenerate, and the degenerate example is correctly flagged; so the cyclic equilibria are unique. Re-read in Shoham and Leyton-Brown Revision 1.1 printed pages 89 (chapter intro), 91-92 (Theorem 4.2.1 and footnote 3), 97 footnote 4 (degeneracy definition), 101-105 (Lemke-Howson limitations, SEM, Theorems 4.2.3-4.2.4) and 115 (history notes); re-read Roughgarden Lecture 20 pages 1-3 and 9-10. The equal-support property of nondegenerate games remains stated from general literature, not checked against a source. Did not read the Lemke-Howson worked example or check post-2013 results on approximate equilibria. Did not render the MDX.

  • Output matches the record; the cyclic-game indifference payoffs 1/4, 4/25 and 4/3 were re-checked with exact fractions.
  • A separate exact script confirmed both cyclic games are nondegenerate, so equal-size support enumeration is complete for them and the equilibrium found is unique.
  • PPAD, FNP, NP-hardness, the 2^k−1 count and the Porter et al. and Chen–Deng attributions were checked against the pages; zh and en match section by section.

Source locations checked:

  • Multiagent Systems: Algorithmic, Game-Theoretic, and Logical Foundations — Revision 1.1 PDF, chapter 4 (computing solution concepts), scoped · Printed pages 89–93, 101–105 and the first half of 115 of the Revision 1.1 PDF. Checked: zero-sum LP (4.1–4.13), Theorem 4.2.1 and footnote 3 (ε-equilibria, irrational probabilities for n≥3), LCP (4.14–4.19), Lemke–Howson limitations (disconnected graph, exponential paths), TGS (4.26–4.30) and footnote 10, SEM pseudocode and empirical remark, Theorems 4.2.3–4.2.4 (identity game has 2^k−1 equilibria), start of 4.3, history notes naming Porter et al. 2004a, Goldberg–Papadimitriou, Daskalakis et al. 2006b, Chen–Deng 2006, Savani–von Stengel. Not read: Lemke–Howson example (94–100), 106–114. Added by the independent check: footnote 4 on printed page 97 (degenerate-game definition), cited in the theory section.
  • CS364A Lecture #20: Mixed Nash Equilibria and PPAD-Completeness — scoped lecture notes · Pages 1–4 and 9–10 of the 12-page 2013-12-04 notes. Checked: bimatrix MNE definition (1)-(2), pure-deviation verification, footnote on polynomial-size MNE via supports, Theorem 3.1 (FNP-complete ⇒ NP=coNP) and proof, Lemke–Howson parity remark, Theorem 7.1 (PPAD-complete), section 8 discussion and 2013 open question on ε-approximate MNE. Pages 5–8 seen only as headings.

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.