Solution (source code)

= Solution

For a finite <normal-form game>, a <mixed strategy> $\sigma_i$ is a <probability distribution> over player $i$'s <pure strategies>. Independent randomization by the players defines an <expected payoff> $u_i(\sigma)$. A <strategy profile> $\sigma$ is a <Nash equilibrium> if
$$
u_i(\sigma_i,\sigma_{-i})\geq u_i(\tau_i,\sigma_{-i})
$$
for every player $i$ and every alternative <mixed strategy> $\tau_i$. By linearity in a player's own distribution, it is enough to check all pure deviations. Equivalently, every <pure strategy> in the <support of a mixed strategy> must be a <best response> to the other players' choices.