Skip to content
AI360XpertBeta

Nash Equilibrium

A stable profile where nobody gains by moving alone, which predicts where strategic play settles even when the result disappoints everyone.

Two players best-respond to each other in a 2 by 2 game with payoffs 2,1 and 1,2 on the diagonal, and the mixed profile at p equals 2 thirds and q equals 1 third is where neither wants to move alone
Two players best-respond to each other in a 2 by 2 game with payoffs 2,1 and 1,2 on the diagonal, and the mixed profile at p equals 2 thirds and q equals 1 third is where neither wants to move alone

Why Does This Exist?

Two pricing bots, two bidders, or two agents trained together break the single-player question of what is optimal. The best price depends on the rival price, the best bid depends on the rival bid, and the best route depends on who else picked it. Optimizing in isolation gives an answer that stops being true the moment the other side moves.

Nash equilibrium cuts that knot. A strategy profile is an equilibrium when each player's choice is a best response to the others, so nobody gains by deviating alone. It predicts rest points of strategic play and anchors what follows: zero-sum games refine it for pure conflict, the minimax theorem gives its value in that setting, and learning dynamics try to compute it. This page covers the definition, the indifference method for mixed strategies, and one fully worked 2 by 2 game.

The one idea you need first

A best response maximizes your payoff while everyone else stays fixed. Write BR1(s2)BR_1(s_2) for player 1's best reply to player 2's strategy s2s_2, where s2s_2 names the other's plan and BR1BR_1 names the set of payoffs maximizers. Equilibrium is mutual best response: s1s_1 sits in BR1(s2)BR_1(s_2) while s2s_2 sits in BR2(s1)BR_2(s_1) at the same time. Randomizing needs probability foundations.

Think of It Like This

Two food trucks picking sides of the park

Two trucks pick the east side or the west side. Visitors walk to the nearer truck and split evenly when both pick the same side. If both sit east, either truck gains by moving west and taking that side alone. If they split, neither gains by moving, because joining the other halves your share.

The split is the equilibrium. Each location best-responds to the other. It need not be cozy, since both might earn more by coordinating hours, and it need not be unique, since east-west and west-east both hold. Stability is the claim. Shared happiness is a separate question.

How It Actually Works

For a finite game, test each cell: would either player gain by moving alone while the other stays put. Cells that survive both checks are pure-strategy equilibria. John Nash proved every finite game has at least one equilibrium once mixed strategies are allowed, meaning probability distributions over actions rather than single picks.

Mixed equilibrium comes from indifference. When you randomize, you mix only over actions that pay the same against the other's mix, and your mix is chosen to make the other indifferent in return. That gives linear equations, plus a feasibility check that every probability lands in [0,1][0, 1].

Worked example

Row picks Up or Down, column picks Left or Right. Payoffs list row first, then column:

  • Up with Left pays (2,1)(2, 1).
  • Up with Right pays (0,0)(0, 0).
  • Down with Left pays (0,0)(0, 0).
  • Down with Right pays (1,2)(1, 2).

Pure checks pass on the diagonal only. At Up-Left, row gets 22 versus 00 by deviating and column gets 11 versus 00, so both stay. At Down-Right, row gets 11 versus 00 and column gets 22 versus 00, so both stay. Both off-diagonal cells fail, since one player always gains by switching toward the diagonal.

For the mixed profile, let row play Up with probability pp and column play Left with probability qq. Column is indifferent when Left and Right pay the same:

1⋅p+0⋅(1−p)=0⋅p+2⋅(1−p)1 \cdot p + 0 \cdot (1 - p) = 0 \cdot p + 2 \cdot (1 - p)

so p=2−2pp = 2 - 2p, 3p=23p = 2, and p=2/3p = 2/3. Row is indifferent when Up and Down pay the same:

2⋅q+0⋅(1−q)=0⋅q+1⋅(1−q)2 \cdot q + 0 \cdot (1 - q) = 0 \cdot q + 1 \cdot (1 - q)

so 2q=1−q2q = 1 - q, 3q=13q = 1, and q=1/3q = 1/3. Both sit inside [0,1][0, 1], so the fully mixed profile is feasible.

Expected payoffs at the mix are 2/32/3 each. Row gets 2⋅(2/3)⋅(1/3)+1⋅(1/3)⋅(2/3)=4/9+2/9=6/9=2/32 \cdot (2/3) \cdot (1/3) + 1 \cdot (1/3) \cdot (2/3) = 4/9 + 2/9 = 6/9 = 2/3. Column gets 1⋅(2/3)⋅(1/3)+2⋅(1/3)⋅(2/3)=2/9+4/9=6/9=2/31 \cdot (2/3) \cdot (1/3) + 2 \cdot (1/3) \cdot (2/3) = 2/9 + 4/9 = 6/9 = 2/3. Nobody gains by moving alone, yet both earn less than the 22 and 11 they could share at Up-Left. That gap is why stability never promises shared welfare.

Code

The snippet below checks every cell for solo deviations. It is the same test done by hand above, written so you can reuse it on any 2 by 2 payoff pair.

def pure_nash(row: list[list[float]], col: list[list[float]]) -> list[tuple[int, int]]:    out: list[tuple[int, int]] = []    n_rows, n_cols = len(row), len(row[0])    for r in range(n_rows):        for c in range(n_cols):            # hold column fixed: row must already take its max in column c            if all(row[r][c] >= row[rr][c] for rr in range(n_rows)):                # hold row fixed: column must already take its max in row r                if all(col[r][c] >= col[r][cc] for cc in range(n_cols)):                    out.append((r, c))    return out

row = [[2, 0], [0, 1]]col = [[1, 0], [0, 2]]print(pure_nash(row, col))  # -> [(0, 0), (1, 1)]

Both diagonal cells survive and both off-diagonal cells fail one player's check, matching the hand calculation.

Watch Out For

Playing a fragile equilibrium against a noisy rival

Up-Left pays (2,1)(2, 1) but row earns 00 there the moment column trembles toward Right, while Down-Right always guarantees row at least a mix near 11. Equilibrium math assumes exact play. Learned opponents, estimated payoffs, and execution slips are never exact.

Symptom: a high-payoff cell collapses in testing while a lower-payoff cell holds. Fix: compare worst nearby payoffs, not just the cell itself, and prefer the risk-dominant profile when the other side is noisy.

Assuming one equilibrium that play will find

This game has three equilibria, and simple best-response play can also cycle forever on other games such as rock-paper-scissors instead of settling. Game theory alone does not pick among them, and myopic updates do not always converge.

Symptom: analysis stops at the first equilibrium found while deployment lands on another. Fix: list all equilibria, name the selection story of history, communication, or learning rule, and test the dynamics rather than assuming they settle.

The Quick Version

  • Nash means mutual best response: no profitable solo deviation.
  • Every finite game has a mixed-strategy equilibrium, while pure ones may number zero, one, or several.
  • Mixed strategies come from indifference equations, with a feasibility check that probabilities sit in [0,1][0, 1].
  • The worked game has pure equilibria at Up-Left paying (2,1)(2, 1) and Down-Right paying (1,2)(1, 2), plus a mixed profile at p=2/3p = 2/3 and q=1/3q = 1/3 paying 2/32/3 each.
  • Stability never implies shared welfare or uniqueness, so selection needs its own story.
  • Noisy opponents favor risk-dominant profiles over fragile high-payoff cells.