Motivating Example¶
Consider the standard Rock-Paper-Scissors game The payoff matrix for the row player is:
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:
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 is called zero sum if and only if:
In the case of a zero sum game we will use the convention of defining it with:
and implying .
Definition: the min-max and max-min strategies¶
Given a zero-sum game defined by a payoff matrix and a strategy for the column player, the row player seeks a best response strategy that maximises their expected payoff:
This corresponds to choosing the rows of that yields the highest expected value under the strategy , i.e.,
The column player, by selecting , can influence the upper bound of this maximum. Since the game is zero-sum, the column player will aim to choose to make this upper bound as small as possible.
Hence,
The min-max strategy for the column player is the solution to the following optimisation problem (referred to as a linear program):
In this formulation, is the min-max value of the game.
The corresponding max-min strategy for the row player solves the following linear program:
In this case, 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 for the row player satisfies the following linear program:
Example: Max-min strategy for Matching Pennies¶
For Example: Matching Pennies with payoff matrix:
the max-min strategy for the row player satisfies the following linear program:
Given that , this linear program corresponds to:
These constraints can be rewritten as:
This implies:
which leads to:
This inequality holds only when . When , the constraints reduce to:
yielding the unique solution .
Thus, the max-min strategy is:
Theorem: The minimax theorem¶
The minimax theorem Neumann, 1928 states that if there exists optimal values of the:
- max-min value and the max-min strategy .
- min-max value and the min-max strategy .
then .
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 with rows and columns, the following linear program yields the max-min strategy and the value of the game:
subject to:
The coefficients in this linear program are defined as:
Example: Standard form for the Modified Rock Paper Scissors Game¶
For the modified Rock-Paper-Scissors game, the corresponding coefficients are:
Definition: Tableau for Zero-Sum Game¶
Given a zero-sum game with payoff matrix the standard form linear program: can be represented by the following initial tableau:
Here, slack variables have been introduced to convert inequalities into equalities. The tableau is arranged with columns for the decision variables , the game value variable , slack variables , 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:
To construct the tableau, we introduce slack variables for the inequality constraints, and denote the game value variable by .
Initial Tableau¶
The initial tableau is:
The last row is the objective function: minimising . We begin by identifying the entering variable with the most negative coefficient in the objective row, which is .
Pivot 1: Entering variable ¶
To pivot on , we look at the positive entries in the column (rows 1–3). All are 1, so we apply the ratio test:
- Row 1:
- Row 2:
- Row 3:
Ties are broken arbitrarily. Suppose we choose row 1: we subtract appropriate multiples of this row from all others to eliminate from those rows:
- Row 2 Row 2 - Row 1
- Row 3 Row 3 - Row 1
- Objective row = Objective + Row 1
After row operations:
Pivot 2: Entering variable ¶
Next, inspect the objective row. The most negative coefficient is -2 for .
Apply ratio test on rows with positive entries:
- Row 2:
- Row 3:
- Row 4:
Choose Row 2 (arbitrary tie-break).
Pivot on entry in row 2, column and eliminate from other rows. After computations, we get:
Pivot 3: Entering variable ¶
Continue inspecting the objective row. The most negative is now -2 for , so it enters. Apply ratio test among positive entries in column .
- Row 3:
There is a single candidate: pivot on row 3. Eliminate from other rows. After computations we get:
We now set the basic variables to 0 and read the equations for the non-basic variables:
This gives:
Thus, the max-min strategy is:
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:
Exercise: Max-min strategy for Matching Pennies¶
For Example: Max-min strategy for Matching Pennies:
- Use integer pivoting to confirm that the max-min strategy is .
- By letting , or otherwise, obtain the min-max strategy for the column player.
- 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:
Exercise: Modified Rock Paper Scissors¶
For Example: Integer pivoting for modified Rock Paper Scissors:
- By letting , or otherwise, obtain the min-max strategy for the column player.
- 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: , , , , and :
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 for some constant . 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
Problem | Player | Objective | Constraints |
---|---|---|---|
Max-min LP | Row player | Maximise | , |
Min-max LP | Column player | Minimise | , |
- v. Neumann, J. (1928). Zur theorie der gesellschaftsspiele. Mathematische Annalen, 100(1), 295–320.
- Vanderbei, R. J. (2010). Linear Programming: Foundations and Extensions (Softcover reprint of hardcover 3rd Edition 2008). Springer Science+Business Media.
- von Neumann, J. (1928). Zur Theorie der Gesellschaftsspiele. Mathematische Annalen, 100(1), 295–320.
- von Neumann, J., & Morgenstern, O. (1944). Theory of Games and Economic Behavior. Princeton University Press.
- 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.
- Nash Jr, J. F. (1950). Equilibrium points in n-person games. Proceedings of the National Academy of Sciences, 36(1), 48–49.