Skip to article frontmatterSkip to article content

Zero-Sum Games

Motivating Example

Consider the standard Rock-Paper-Scissors game The payoff matrix for the row player is:

M=(011101110)M = \begin{pmatrix} 0 & -1 & 1 \\ 1 & 0 & -1\\ -1 & 1 & 0 \end{pmatrix}

We are going to modify the game to reflect the fact that some row player in question enjoys winning and hates losing with Paper more than any other action:

M=(011202110)M = \begin{pmatrix} 0 & -1 & 1 \\ 2 & 0 & -2\\ -1 & 1 & 0 \end{pmatrix}

Is there a way for the row player to choose a strategy that guarantees a certain minimum expected payoff, regardless of how the column player responds?

Theory

This chapter will consider a specific subset of Definition: Normal Form Game.

Definition: Zero Sum Game


A two player normal form game with payoff matrices (Mr,Mc)Rm×n2(M_r, M_c) \in {\mathbb{R}^{m\times n}}^2 is called zero sum if and only if:

Mr+Mc=0M_r + M_c = 0

In the case of a zero sum game we will use the convention of defining it with:

M=MrM=M_r

and implying Mc=MM_c=-M.

Definition: the min-max and max-min strategies

Given a zero-sum game defined by a payoff matrix MRm×nM \in \mathbb{R}^{m \times n} and a strategy yRny \in \mathbb{R}^n for the column player, the row player seeks a best response strategy xRmx \in \mathbb{R}^m that maximises their expected payoff:

maxxA1xMyT\max_{x \in \mathcal{A}_1} x M y^T

This corresponds to choosing the rows of MM that yields the highest expected value under the strategy yy, i.e.,

maxim(MyT)i\max_{i \leq m} (M y^T)_i

The column player, by selecting yy, can influence the upper bound vv of this maximum. Since the game is zero-sum, the column player will aim to choose yy to make this upper bound vv as small as possible.

Hence,

maxxA1xMyT=maxim(MyT)i=min{vR  |  MyT1v}\max_{x \in \mathcal{A}_1} x M y^T = \max_{i \leq m} (M y^T)_i = \min \left\{ v \in \mathbb{R} \;\middle|\; M y^T \leq \mathbb{1} v \right\}

The min-max strategy yy for the column player is the solution to the following optimisation problem (referred to as a linear program):

miny,vvsubject toMyT1vyA2\begin{aligned} \min_{y, v} \quad & v \\ \text{subject to} \quad & M y^T \leq \mathbb{1} v \\ & y \in \mathcal{A}_2 \end{aligned}

In this formulation, vv is the min-max value of the game.

The corresponding max-min strategy xx for the row player solves the following linear program:

maxx,uusubject toxM1uxA1\begin{aligned} \max_{x, u} \quad & u \\ \text{subject to} \quad & x M \geq \mathbb{1} u \\ & x \in \mathcal{A}_1 \end{aligned}

In this case, uu is the max-min value of the game.

Example: Max-min strategy for modified Rock-Paper-Scissors

For the modified Rock-Paper-Scissors game, the max-min strategy xx for the row player satisfies the following linear program:

maxx,uusubject to2x2x3ux1+x3ux12x2ux1+x2+x3=1xi0for all i{1,2,3}\begin{aligned} \max_{x, u} \quad & u \\ \text{subject to} \quad & 2x_2 - x_3 \geq u \\ & -x_1 + x_3 \geq u \\ & x_1 - 2x_2 \geq u \\ & x_1 + x_2 + x_3 = 1 \\ & x_i \geq 0 \quad \text{for all } i \in \{1, 2, 3\} \end{aligned}

Example: Max-min strategy for Matching Pennies

For Example: Matching Pennies with payoff matrix:

M=(1111)M = \begin{pmatrix} 1 & -1 \\ -1& 1 \end{pmatrix}

the max-min strategy xx for the row player satisfies the following linear program:

maxx,uusubject tox1x2ux1+x2ux1+x2=1xi0for all i{1,2}\begin{aligned} \max_{x, u} \quad & u \\ \text{subject to} \quad & x_1 - x_2 \geq u \\ & -x_1 + x_2 \geq u \\ & x_1 + x_2 = 1 \\ & x_i \geq 0 \quad \text{for all } i \in \{1, 2\} \end{aligned}

Given that x1+x2=1x_1 + x_2 = 1, this linear program corresponds to:

maxx1,uusubject to2x11u2x1+1u0x11\begin{aligned} \max_{x_1, u} \quad & u \\ \text{subject to} \quad & 2x_1 - 1 \geq u \\ & -2x_1 + 1 \geq u \\ & 0 \leq x_1 \leq 1 \end{aligned}

These constraints can be rewritten as:

x11+u2x11u20x11\begin{aligned} x_1 &\geq \frac{1 + u}{2} \\ x_1 &\leq \frac{1 - u}{2} \\ 0 &\leq x_1 \leq 1 \end{aligned}

This implies:

1+u2x11u2\frac{1 + u}{2} \leq x_1 \leq \frac{1 - u}{2}

which leads to:

1+u21u2uu\frac{1 + u}{2} \leq \frac{1 - u}{2} \quad \Rightarrow \quad u \leq -u

This inequality holds only when u=0u = 0. When u=0u = 0, the constraints reduce to:

12x112\frac{1}{2} \leq x_1 \leq \frac{1}{2}

yielding the unique solution x1=12x_1 = \frac{1}{2}.

Thus, the max-min strategy is:

x=(12,12)x = \left( \frac{1}{2}, \frac{1}{2} \right)

Theorem: The minimax theorem

The minimax theorem Neumann, 1928 states that if there exists optimal values of the:

  1. max-min value uu and the max-min strategy xx.
  2. min-max value vv and the min-max strategy yy.

then u=vu=v.

The proof which uses the linear_program_duality_theorem is omitted from this book but can be found in Vanderbei, 2010.

Note that this answers the question posed at the end of Motivating Example through a choice of strategy the row player can ensure they obtain the value of the game which is equal to the max-min value and the min-max value.

In the next section we will start to introduce practical tools with which to do that.

Definition: Standard Form Linear program

A standard form of the linear program can be written which more readily will allow us to use Integer Pivoting.


In a zero-sum game, given a row player payoff matrix MM with mm rows and nn columns, the following linear program yields the max-min strategy and the value of the game:

minxR(m+1)×1  cx\min_{x \in \mathbb{R}^{(m + 1) \times 1}} \; c x

subject to:

MubxbubMeqx=beqxi0for im\begin{aligned} M_{\text{ub}} x &\leq b_{\text{ub}} \\ M_{\text{eq}} x &= b_{\text{eq}} \\ x_i &\geq 0 \quad \text{for } i \leq m \end{aligned}

The coefficients in this linear program are defined as:

c=(0,,0m,1)where c{0,1}1×(m+1)Mub=((MT)11(MT)1m11(MT)n1(MT)nm1)MubRn×(m+1)bub=(0,,0)TbubRn×1Meq=(1,,1m,0)Meq{0,1}1×(m+1)beq=1\begin{aligned} c &= (\underbrace{0, \dots, 0}_{m}, -1) && \text{where } c \in \{0, 1\}^{1 \times (m + 1)} \\[0.5em] M_{\text{ub}} &= \begin{pmatrix} (-M^T)_{11} & \dots & (-M^T)_{1m} & 1 \\ \vdots & \ddots & \vdots & 1 \\ (-M^T)_{n1} & \dots & (-M^T)_{nm} & 1 \end{pmatrix} && M_{\text{ub}} \in \mathbb{R}^{n \times (m + 1)} \\[0.5em] b_{\text{ub}} &= (0, \dots, 0)^T && b_{\text{ub}} \in \mathbb{R}^{n \times 1} \\[0.5em] M_{\text{eq}} &= (\underbrace{1, \dots, 1}_{m}, 0) && M_{\text{eq}} \in \{0, 1\}^{1 \times (m + 1)} \\[0.5em] b_{\text{eq}} &= 1 \end{aligned}

Example: Standard form for the Modified Rock Paper Scissors Game

For the modified Rock-Paper-Scissors game, the corresponding coefficients are:

c=(0,0,0,1)Mub=(021110111201)bub=(000)Meq=(1,1,1,0)beq=1\begin{aligned} c &= (0, 0, 0, -1) \\[0.5em] M_{\text{ub}} &= \begin{pmatrix} 0 & -2 & 1 & 1 \\ 1 & 0 & -1 & 1 \\ -1 & 2 & 0 & 1 \end{pmatrix} \\[0.5em] b_{\text{ub}} &= \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix} \\[0.5em] M_{\text{eq}} &= (1, 1, 1, 0) \\[0.5em] b_{\text{eq}} &= 1 \end{aligned}

Definition: Tableau for Zero-Sum Game


Given a zero-sum game with payoff matrix MRm×nM\in \mathbb{R}{m\times n} the standard form linear program: can be represented by the following initial tableau:

T=(x1xmvs1snb(MT)11(MT)1m11101000(MT)n1(MT)_nm1010110011001000)T = \left( \begin{array}{ccccccc|c} x_1 & \dots & x_m & v & s_1 & \dots & s_n & b\\ \hline (-M^T)^{11} & \dots & (-M^T)_{1m} & 1 & 1 & \dots & 1 & 0\\ \vdots & \ddots & \vdots & 1 & 0 & \ddots & 0 & 0\\ (-M^T)_{n1} & \dots & (-M^T)\_{nm} & 1 & 0 & \dots & 1 & 0\\ 1 & \dots & 1 & 0 & 0 & \dots & 1 & 1\\ \hline 0 & \dots & 0 & -1 & 0 & \dots & 0 & 0 \end{array} \right)

Here, slack variables have been introduced to convert inequalities into equalities. The tableau is arranged with columns for the decision variables x1,,xmx_1, \dots, x_m, the game value variable vv, slack variables s1,,sns_1, \dots, s_n, and the right-hand side.

We proceed by performing integer pivoting to move from one basic feasible solution to another, reducing the objective function at each step until optimality is reached.

Example: Integer Pivoting for Modified Rock-Paper-Scissors

We now solve the modified Rock-Paper-Scissors game using the tableau method. Recall that the standard form coefficients are:

c=(0,0,0,1)Mub=(021110111201)bub=(000)Meq=(1,1,1,1,0)beq=1\begin{aligned} c &= (0, 0, 0, -1) \\ M_{\text{ub}} &= \begin{pmatrix} 0 & -2 & 1 & 1 \\ 1 & 0 & -1 & 1 \\ -1 & 2 & 0 & 1 \end{pmatrix} \\ b_{\text{ub}} &= \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix} \\ M_{\text{eq}} &= (1, 1, 1, 1, 0) \\ b_{\text{eq}} &= 1 \end{aligned}

To construct the tableau, we introduce slack variables s1,s2,s3s_1, s_2, s_3 for the inequality constraints, and denote the game value variable by v=x5v = x_5.

Initial Tableau

The initial tableau is:

x1x2x3vs1s2s3b0211100010110100120100101110000100010000\begin{array}{ccccccc|c} x_1 & x_2 & x_3 & v & s_1 & s_2 & s_3 & b \\ \hline 0& -2& 1& 1& 1& 0& 0& 0&\\ 1& 0& -1&1& 0& 1& 0& 0&\\ -1& 2& 0& 1& 0& 0& 1& 0&\\ 1& 1& 1& 0& 0& 0& 0& 1&\\ \hline 0& 0& 0& -1& 0& 0& 0& 0&\\ \end{array}

The last row is the objective function: minimising vv. We begin by identifying the entering variable with the most negative coefficient in the objective row, which is vv.

Pivot 1: Entering variable vv

To pivot on vv, we look at the positive entries in the vv column (rows 1–3). All are 1, so we apply the ratio test:

Ties are broken arbitrarily. Suppose we choose row 1: we subtract appropriate multiples of this row from all others to eliminate vv from those rows:

After row operations:

x1x2x3vs1s2s3b0211100012201100141010101110000102101000\begin{array}{ccccccc|c} x_1 & x_2 & x_3 & v & s_1 & s_2 & s_3 & b \\ \hline 0& -2& 1& 1& 1& 0& 0& 0\\ 1& 2& -2& 0& -1& 1& 0& 0\\ -1& 4& -1& 0& -1& 0& 1& 0\\ 1& 1& 1& 0& 0& 0& 0& 1\\ \hline 0& -2& 1& 0& 1& 0& 0& 0 \end{array}

Pivot 2: Entering variable x2x_2

Next, inspect the objective row. The most negative coefficient is -2 for x2x_2.

Apply ratio test on rows with positive x2x_2 entries:

Choose Row 2 (arbitrary tie-break).

Pivot on entry in row 2, column x2x_2 and eliminate x2x_2 from other rows. After computations, we get:

x1x2x3vs1s2s3b2022020012201100606024201040110220200200\begin{array}{ccccccc|c} x_1 & x_2 & x_3 & v & s_1 & s_2 & s_3 & b \\ \hline 2& 0& -2& 2& 0& 2& 0& 0\\ 1& 2& -2& 0& -1& 1& 0& 0\\ -6& 0& 6& 0& 2& -4& 2& 0\\ 1& 0& 4& 0& 1& -1& 0& 2\\ \hline 2& 0& -2& 0& 0& 2& 0& 0 \end{array}

Pivot 3: Entering variable x3x_3

Continue inspecting the objective row. The most negative is now -2 for x3x_3, so it enters. Apply ratio test among positive entries in column x3x_3.

There is a single candidate: pivot on row 3. Eliminate x3x_3 from other rows. After computations we get:

x1x2x3vs1s2s3b000124440612002240606024203000021081200004440\begin{array}{ccccccc|c} x_1 & x_2 & x_3 & v & s_1 & s_2 & s_3 & b \\ \hline 0& 0& 0& 12& 4& 4& 4& 0\\ -6& 12& 0& 0& -2& -2& 4& 0\\ -6& 0& 6& 0& 2& -4& 2& 0\\ 30& 0& 0& 0& -2& 10& -8& 12\\ \hline 0& 0& 0& 0& 4& 4& 4& 0 \end{array}

We now set the basic variables to 0 and read the equations for the non-basic variables:

s1=0s2=0s3=012v=06x1+12x2=06x1+6x3=030x1=12\begin{align*} s_1 &=0\\ s_2 &=0 \\ s_3 &=0 \\ 12 v &= 0\\ -6x_1 + 12x_2&=0\\ -6x_1 + 6 x_3&=0\\ 30x_1 &= 12 \end{align*}

This gives:

x=(12/30,6/30,12/30)v=0x = (12/30, 6/30, 12/30)\qquad v=0

Thus, the max-min strategy is:

x=(25,15,25)x = \left( \frac{2}{5}, \frac{1}{5}, \frac{2}{5} \right)

Exercises

Exercise: Coefficients for standard form LP

Obtain the coefficients of the standard form linear system for the zero-sum games with the following payoff matrices:

  1. M=(31 12)M = \begin{pmatrix} 3 & -1\ -1 & 2 \end{pmatrix}
  2. M=(11 13)M = \begin{pmatrix} -1 & -1\ -1 & 3 \end{pmatrix}
  3. M=(213 313)M = \begin{pmatrix} 2 & 1 & -3\ -3 & -1 & 3 \end{pmatrix}
  4. M=(320 303 025)M = \begin{pmatrix} 3 & -2 & 0\ -3 & 0 & 3 \ 0 & 2 & -5 \end{pmatrix}

Exercise: Max-min strategy for Matching Pennies

For Example: Max-min strategy for Matching Pennies:

  1. Use integer pivoting to confirm that the max-min strategy is x=(1/2,1/2)x = (1/2, 1/2).
  2. By letting M=MTM = -M^T, or otherwise, obtain the min-max strategy for the column player.
  3. Use the Best Response Condition to confirm your calculations.

Exercise: Max-min strategy for Rock Paper Scissors

Obtain the max-min strategy for the standard game of Rock Paper Scissors defined by:

M=(011101110)M = \begin{pmatrix} 0 & -1 & 1 \\ 1 & 0 & -1\\ -1 & 1 & 0 \end{pmatrix}

Exercise: Modified Rock Paper Scissors

For Example: Integer pivoting for modified Rock Paper Scissors:

  1. By letting M=MTM = -M^T, or otherwise, obtain the min-max strategy for the column player.
  2. Use the Best Response Condition to confirm your calculations.

Programming

Solve linear programs using Scipy

The scipy library provides functionality to solve a linear program in standard form.

We begin by creating the various matrices and vectors: MubM_{ub}, MeqM_{eq}, bubb_{ub}, beqb_{eq}, and cc:

import numpy as np

M = np.array(
    [
        [0, -1, 1],
        [2, 0, -2],
        [-1, 1, 0],
    ]
)
M_ub = np.hstack((-M.T, [[1], [1], [1]]))
M_eq = np.array(([[1, 1, 1, 0]]))
b_ub = np.array(
    [
        [0],
        [0],
        [0],
    ]
)
b_eq = 1
c = np.array([0, 0, 0, -1])

Now we can pass these to scipy.optimize.linprog:

import scipy.optimize

res = scipy.optimize.linprog(
    c=c,
    A_ub=M_ub,
    b_ub=b_ub,
    A_eq=M_eq,
    b_eq=b_eq,
)
res

This returns the full output of the optimisation. The min-max strategy is contained in all but the last entry of res.x:

res.x[:-1]

The last entry of res.x gives the value of the game:

res.x[-1]

Obtain min-max and max-min strategies using Nashpy

nashpy can be used to directly obtain the min-max and max-min strategies:

import nashpy as nash

game = nash.Game(M, -M)
game.linear_program()

Obtain min-max and max-min strategies using Gambit

Gambit can be used to directly obtain the min-max and max-min strategies. We start by creating a pygambit game from arrays:

import pygambit as gbt

game = gbt.Game.from_arrays(M, -M)
game

Now we can solve the underlying linear program:

gbt.nash.lp_solve(game)

Notable Research

The foundations of zero-sum game theory and its connection to linear programming emerged from a convergence of ideas in mathematics, economics, and operations research during the mid-20th century.

The minimax theorem was first proven by John von Neumann in 1928 Neumann, 1928. This landmark result, stating that every finite, two-player zero-sum game has a value and optimal strategies, was later generalised in 1944 Neumann & Morgenstern, 1944.

The minimax theorem does not necessarily only apply to zero-sum games but in fact applies to any constant sum game where Mr+Mc=KM_r + M_c = K for some constant KK. An example of this is shown in Chiappori et al., 2002 where penalty kicks are modelled and the payoff matrices correspond to the probability of scoring (or for the column player saving) a penalty.

Until the work of Nash Jr, 1950 the minimax theorem was the main solution concept in game theory. For his foundational work on equilibrium in non-cooperative games, John Nash was awarded the Nobel Prize in Economic Sciences in 1994, shared with John Harsanyi and Reinhard Selten. His contributions form the cornerstone of non-cooperative game theory.

Conclusion

This chapter introduced zero-sum games, where one player’s gain is precisely balanced by the other’s loss. We explored the foundational minimax theorem, the max-min and min-max strategies, and showed how linear programming provides a practical and elegant way to compute optimal strategies.

The central insight of this chapter is the equivalence between solving a zero-sum game and solving a pair of dual linear programs. This connection allows us to apply tools from optimisation—such as tableau methods and integer pivoting—to find equilibrium strategies.

Table 1 summarises the two central linear programs seen in this chapter.

Table 1:The main linear programs for Zero Sum Game

ProblemPlayerObjectiveConstraints
Max-min LPRow playerMaximise uuxM1ux M \geq \mathbb{1} u, xA1x \in \mathcal{A}_1
Min-max LPColumn playerMinimise vvMyT1vM y^T \leq \mathbb{1} v, yA2y \in \mathcal{A}_2

References
  1. v. Neumann, J. (1928). Zur theorie der gesellschaftsspiele. Mathematische Annalen, 100(1), 295–320.
  2. Vanderbei, R. J. (2010). Linear Programming: Foundations and Extensions (Softcover reprint of hardcover 3rd Edition 2008). Springer Science+Business Media.
  3. von Neumann, J. (1928). Zur Theorie der Gesellschaftsspiele. Mathematische Annalen, 100(1), 295–320.
  4. von Neumann, J., & Morgenstern, O. (1944). Theory of Games and Economic Behavior. Princeton University Press.
  5. Chiappori, P.-A., Levitt, S., & Groseclose, T. (2002). Testing mixed-strategy equilibria when players are heterogeneous: The case of penalty kicks in soccer. American Economic Review, 92(4), 1138–1151.
  6. Nash Jr, J. F. (1950). Equilibrium points in n-person games. Proceedings of the National Academy of Sciences, 36(1), 48–49.