Skip to content
Tutorials Center
My learning

Topics

Lesson 11 of 37 ยท Nash Equilibrium

Pure Nash Equilibrium

Understand Nash equilibrium as a profile of mutual best responses, check it by testing unilateral deviations, and write Python code that finds pure equilibria in any normal-form game.

If you learn only one idea from game theory, it should be the Nash equilibrium, named after John Nash. It answers the question that dominance could not: in a game where no strategy is always best, what combinations of strategies could possibly be stable?

The answer is simple. A profile of strategies is a Nash equilibrium if every player is playing a best response to what all the others are playing. Nobody has a reason to change their own strategy while the others keep theirs. It is the "no regrets" state: if you could tell me, before we play, what everyone will do, and I agree that I should do my part, that profile is a Nash equilibrium.

The formal statement

A profile s* = (s_1*, ..., s_n*) is a Nash equilibrium if for every player i and every alternative strategy s_i of that player:

u_i(s_i*, s_{-i}*) >= u_i(s_i, s_{-i}*).

Read the inequality aloud: "Given what the others do, player i cannot gain by switching to any other strategy." This is a test with a clear recipe, called the unilateral deviation test:

  1. Take a candidate profile.
  2. For each player, hold the others fixed and try each alternative strategy.
  3. If no player finds an improvement, it is a Nash equilibrium.

The word unilateral is important. Equilibrium only guards against one player changing alone. It says nothing about groups changing together, which is why a Nash equilibrium can be worse for everybody than some other outcome, as in the prisoner's dilemma.

flowchart TD
    P["Candidate profile s*"] --> T1["Player 1: any better deviation?"]
    P --> T2["Player 2: any better deviation?"]
    T1 -->|"none"| OK
    T2 -->|"none"| OK
    T1 -->|"yes"| NO["Not an equilibrium"]
    T2 -->|"yes"| NO
    OK["Nash equilibrium"]

A profile passes only if no single player can gain by switching alone.

Finding equilibria in a bimatrix game

For two players the test is quick. A cell (i, j) is a pure Nash equilibrium if A[i, j] is the largest in column j (Ann cannot improve by changing row) and B[i, j] is the largest in row i (Bob cannot improve by changing column). That is the marking method from the previous lesson as a function.

Python Pure Nash equilibria of a bimatrix game

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The results agree with the classification you saw in Classic 2x2 Games. Notice that matching pennies has no pure equilibrium: whatever pair you propose, somebody wants to switch. Nash's great theorem says every finite game has an equilibrium once mixed strategies are allowed, which is the theme of Chapter 4.

A finder for any number of players

The deviation test generalizes directly. We store the payoffs as an array U with shape (n_players, |S_1|, ..., |S_n|), loop over all profiles with itertools.product, and for each player try every alternative strategy while keeping the others fixed.

Python Pure Nash finder for n players

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Voting games have many equilibria, some quite strange. The output lists three. In (0, 0, 0) and (0, 0, 1) pizza wins; in (1, 1, 1) sushi wins, even though two of the three friends prefer pizza! That profile is stable because neither pizza lover is pivotal: switching their own vote to pizza leaves sushi at two votes, still winning. This is a well-known feature of voting: a vote for the less preferred option can be a "Nash equilibrium" simply because it makes no difference.

Why Nash equilibrium is a sensible prediction

There are several ways to justify the concept.

  • Self-enforcing agreement. If players could meet and agree on a profile, a Nash equilibrium is the kind of agreement nobody would break without being forced.
  • Steady state. If a game is played repeatedly and strategies adjust by trial and error, behavior can settle in an equilibrium. Evolutionary models make this precise.
  • Rational expectations. If each player believes the others will play their equilibrium strategies and acts rationally, the beliefs are confirmed.

It also has limits. A game can have several equilibria (see Multiple Equilibria and Selection), and then the concept alone does not tell you which one will occur. And an equilibrium need not be fair or efficient (see Pareto Efficiency and Social Dilemmas).

How Nash equilibrium relates to dominance

Two facts connect the ideas you have met:

  1. If every player has a strictly dominant strategy, the profile of those strategies is the unique Nash equilibrium.
  2. A Nash equilibrium never uses a strictly dominated strategy. So every Nash equilibrium survives iterated elimination, and if IESDS leaves only one profile, that profile is the only Nash equilibrium.
Python IESDS survivors contain every Nash equilibrium

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Common mistakes

  • Confusing equilibrium with best outcome. Equilibrium means "stable", not "good". (D, D) in the prisoner's dilemma is stable and bad.
  • Checking only one player. Both players must have no profitable deviation. A cell where one player is happy is not enough.
  • Forgetting that ties count as best responses. A player who is indifferent has no strict incentive to move; the profile still counts under the definition with >=.
  • Thinking an equilibrium always exists in pure strategies. It does not (matching pennies).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A profile is a Nash equilibrium if...

    Nash equilibrium is a profile of mutual best responses: no player can gain by changing their own strategy alone.
  2. 2. In the prisoner's dilemma, why is (Defect, Defect) a Nash equilibrium although (Cooperate, Cooperate) pays more to both?

    If the other defects, switching to Cooperate drops you from the punishment payoff to the sucker payoff. Equilibrium ignores joint deviations.
  3. 3. Which of these games has no pure-strategy Nash equilibrium?

    In matching pennies, whichever cell you pick one player wants to switch. Its equilibrium requires mixed strategies.
  4. 4. What is the relationship between Nash equilibria and strictly dominated strategies?

    Playing a strictly dominated strategy is never a best response, so it cannot appear in a Nash equilibrium.

Summary

  • A Nash equilibrium is a strategy profile in which every player's strategy is a best response to the others'.
  • Test it by checking every unilateral deviation; in a bimatrix game, look for cells that are largest in their column for Ann and largest in their row for Bob.
  • Equilibria can be bad (prisoner's dilemma), multiple (coordination games) or absent in pure strategies (matching pennies).
  • Dominant-strategy equilibria are always Nash equilibria, and every Nash equilibrium survives IESDS.
  • Equilibrium means stable, not necessarily good or unique.

Next: Pareto Efficiency and Social Dilemmas