The equilibrium of a small matrix game

Strategy and games

Rock, paper and scissors against an opponent who also holds lizard and Spock. Each triangle is every mix of three moves, hatched by what the mix guarantees: the player above, the opponent's three useful replies below. Plum marks the best mix on each side.

A zero-sum matrix, or two matrices of the same shape, is searched over equal supports up to 4 by 4. A singular support is skipped. The smallest strict support is the one shown, and the count of others is reported. Payoffs are integers with no currency. This is not a wager and it is not advice.

A zero-sum game up to 5 by 5 is also solved by an exact simplex. It returns the value and an optimal mixed strategy for each player as fractions, with two small tables that prove the value: the row strategy earns at least the value against every column, and the column strategy holds every row to at most the value.

Two bars, one per player, each split into two equal halves.
The default game, matching pennies. The top bar is the row player's equilibrium strategy and the bottom bar the column player's; each splits one unit of probability into 1/2 and 1/2. The value of the game is 0.

Rows are separated by semicolons and entries by commas. A zero-sum game takes one to five rows and columns; two matrices take one to four. Entries are integers from -9 to 9. Leave the column field empty for a zero-sum game. The default is matching pennies.

The result appears here when the page script runs.

How it is computed

Method

For each equal support from size 1 to the smaller dimension, the desk solves the indifferent mixed strategy with rational Gaussian elimination. A zero pivot skips that support. Unused rows must not gain, and unused columns must not gain for their player. Zero-sum uses one matrix and requires the two values to match. A bimatrix uses two matrices and lets the values differ.

Simplex

For a zero-sum game the desk adds 1 minus the smallest entry to every payoff, so each entry is at least 1 and the value is positive. It then maximises the sum of y subject to the shifted matrix times y at most 1 and y at least 0, in exact fractions. The entering column is the first with a negative reduced cost and a tie for the leaving row goes to the lowest basic index, which is Bland's rule, so the simplex cannot cycle. The optimum is 1 over the shifted value. The column strategy is y times the shifted value, and the row strategy comes from the slack columns of the final objective row. A separate check takes only the matrix and the two lists of fractions and recomputes every payoff in the two tables.

Assumptions

The reported profile is the smallest support with every listed probability positive, then the lexicographic key. Other equilibria are counted and not listed. A game with only a singular continuum can abstain. The value of a zero-sum game is unique; when several optimal strategies exist, the simplex reports the one at the vertex where Bland's rule stops. Two matrices use the support search only.

Limits

Entries are not money. The page does not recommend a move outside the matrix.

Reproducibility

The inputs are kept in the address bar, so the same link reruns the same calculation.