Game Theory

Hal Varian
January 1992

Computing Nash equilibria

Computing Nash equilibria in a two-person game  is a straightforward but tedious task.  This is the kind of thing computers were made for.   Luckily John Dickhaut and Todd Kaplan of the University of Minnesota have written a Mathematica package to solve for Nash equilibrium in two-person games.  Let's load it into Mathematica and try it on a few examples from the text.

<<~/Mathematica/MicroAn/Nash.m

?Nash

Nash[{{{2,1},{0,0}},{{0,0},{1,2}}}]

Dominated strategies example

Nash[{{{3,3},{0,3},{0,0}},
      {{3,0},{2,2},{0,2}},
      {{0,0},{2,0},{1,1}}}]

Chicken

Nash[{{{-3,-3},{2,0}},
      {{0,2  },{1,1}}}]

Coordination game

Nash[{{{2,2},{-1,-1}},
      {{-1,-1},{1,1}}}]

Solving for Bayes-Nash equilibria

We can use Mathematica to solve the differential equation that arises in the text.

DSolve[V'[b]*(V[b]-b) == V[b],V[b],b]

We can use the same analysis to solve the symmetric game for other prior probability distribution on v.  Let P[v] = probability that other player's valuation is less than v.  The payoff to the first player if he bids b is (v-b)P[V[b]]; b must maximize this expression which yields the first-order condition (v-b)P'[V[b]]*V'[b] - P[V[b]] = 0.   We can use Mathematica to solve this differential equation, just as above.   Suppose, for example, that P[v] is the exponential CDF

P[v_] := 1-E^(-v)

The equation we want to solve is then

DSolve[(V[b]-b)*P'[V[b]]*V'[b] -P[V[b]]==0,V[b],b]

Mathematica doesn't know how to solve this ODE, so we try a numerical solution.

solution=NDSolve[{(V[b]-b)*P'[V[b]]*V'[b] -P[V[b]]==0,
          V[0]==.001},V[b],
          {b,.001,.9}]

Plot[Evaluate[V[b]/.solution],{b,.001,.9}]

[Note: their appears to be a singularity at b=1.  I'm not quite sure why, but I suspect that there is something funny about this solution.  I should look at it in more detail, and probably choose a better behaved example.]