Matrix game (LP for game theory)

From optimization
Revision as of 18:57, 25 May 2014 by Mkweon (Talk | contribs)

Jump to: navigation, search

Authors: Nick Dotzenrod and Matt Kweon (ChE 345 Spring 2014)

Steward: Dajun Yue, Fengqi You

Date Presented: Apr. 10, 2014

Linear programming (LP) is a simple yet powerful tool that can be used as an aid in decision making under certainty - that is, the objective, constraints, and any other relevant information about the problem are known. A highly practical application of LP lies in its use in game theory. This page specifically explores how LP can be used to solve a finite two-person zero-sum game, also known as the matrix game, which is one of the simplest form of decision making games.


Game Theory


The objective of game theory is to analyze the relationship between decision-making situations in order to achieve a desirable outcome. The theory can be applied to a wide range of applications, including, but not limited to, economics, politics and even the biological sciences. In essence, game theory serves as means to create a model to represent certain scenarios that have a variety of variables and potential outcomes. With these models developed from game theory, one can determine if assumptions made for a certain scenario are valid or whether additional models should be created that could more accurately assess the current problem. Game theory can be broken into a variety of different "games," each analyzing different situations in which a decision is to be made by one player with other players potentially affecting the process.


Many mathematicians would agree that John von Neumann can be considered the Father of Game Theory. John was born in Hungary in 1903 and grew up having a love for math and the sciences. In college, he received degree a degree in chemical engineering and later, a Ph.D. in mathematics from the University of Budapest. In 1928, Neumann proved the minimax theorem, which describes how two players can minimize their losses against each other. In 1930, he then went on to be a professor at Princeton in the mathematics department and later in 1944, wrote Theory of Games and Economic Behavior. After this publication, game theory became a mainstream topic in mathematical discourse. Since its spawn in the 1940's, game theory has continued to be studied by mathematicians worldwide with many new discoveries being made. Starting as a way to model economics, game theory progressed to analyzing biological systems in the 1970's to later having a role in the development in computer science. Today, game theory has evolved into many type of "games," each describing various scenarios with players making decisions.

Game Types

As aforementioned, there are many types of "games" that have been developed due to game theory. These games model various scenarios and differ from each other depending on how the players in the game cooperate with each other

Strategic Games A strategic game that models a set of players, each with a set of actions with preferences for performing each of their corresponding actions.

Extensive Games A game that consists of players that choose a terminal history that results in a player function depending on the chosen terminal history. Much like the strategic game, players have preferences over their set of terminal histories.

Coalitional Game

Matrix Game

A matrix game, which is short for finite two-person zero-sum game, allows a game to be represented in matrix form as its name implies. This is a direct consequence of the fact that two opponents with exactly opposite interests play a game under a finite number of strategies, independently of his or her opponent’s action. Once both players each make an action, their decisions are disclosed. A payment is made from one player to the other based on the outcome, such that the gain of one player equals the loss of the other, resulting in a net payoff summing to zero.

Payoff Matrix

From the definition of the finite two-person zero-sum game, all payments (p_{ij}) can be represented as a matrix P = [p_{ij}] where i is an action in the finite set of choices that one player makes and j is that of the other for all i \in \{1,2,...,m\} and j \in \{1,2,...,n\}. Here, matrix P is called the payoff matrix. Note that the payments are made in one direction; that is, p_{ij} represents payments made from the first player to the second so that the elements of P can positive, 0, or negative (i.e. P \in \mathbb{R}^{m \times n}).


Consider the game rock-paper-scissors as a simple example. Let the choice of rock, paper, and scissors be denoted as 1, 2, and 3, respectively. This means that the first row of the payoff matrix indicates the first person playing a rock, while the columns represent the second player’s choices. Further, let a “win,” “draw,” and “loss” be respectively assigned the values +1, 0, and -1. Based on the definition of the payoff matrix, a game of rock-paper-scissors then has the payoff matrix

P = \begin{bmatrix} 0 & 1 & -1 \\ -1 & 0 & 1 \\ 1 & -1 & 0 \end{bmatrix}.

It is well known a clear winning strategy does not exist for rock-paper-scissors, as can be seen in the payoff matrix. In other words, each player equally has a \tfrac{1}{3} chance of winning.

Application of LP in Matrix Game

Formulating a matrix game as an LP problem allows for a player to determine the optimal winning strategy. This is true for simple zero-sum games such as Matching Pennies, or even complicated games such as poker or a variation of rock-paper scissors. Consider a non-trivial game of rock-paper-scissors where the payoff matrix is

P = \begin{bmatrix} 0 & 2 & -3 \\ -1 & 0 & 4 \\ 3 & -4 & 0 \end{bmatrix}.

In this game, an equal chance of 1/3 is no longer optimal, and the first player has a total payoff of 9 while the second player has that of 8. It appears that the first player has an advantage, but this may not necessarily be true. For example, it may be possible for the second player to make a profit if for each game played, the second player were to make a payment to the first player that is less than the expected gain.

Formulation of LP

The solution to any matrix game can be obtained by solving the equivalent LP. It is assumed that players choose random strategies and the probability distributions that the players follow are known. Let x_i be defined as a vector that consists of all probabilities that the first player follows, such that x_i \ge 0 and  \sum x_i = 1 . Similarly, a vector y_j can be defined as the probabilities that describe the second player’s actions. Then, the expected payoff from the first player to the second can be expressed as  \sum {x_i}{p_{ij}}{y_j} = {x^T}Py.

Noting that this is a zero-sum game, the optimal strategy for the first player to employ is to minimize the payoff {x^T}Py to the second player. Therefore, a generalized optimal strategy for the first player can be represented as the following LP:

\text{min} & ~~ \sum_{i=1}^m {x^T}Py\\
\text{s.t.} & ~~ \sum_{i=1}^m x_i = 1\\
& ~~ x \ge 0 \\ 

Note that, on the other hand, the optimal strategy of the second player is to maximize the payoff from the first player. Given the objective of the first player, the objective of the second player can be expressed as  \max_y \min_x {x^T}Py . Based on this LP formulation, an optimal strategy can be determined by solving the problem using the Minimax Theorem developed by John von Neumann.

Minimax Theorem

As its name implies, the Minimax Theorem is used in a matrix game minimize the maximum payoff to the opposing player. The theorem states that for a zero-sum game, if the first and second player have optimal strategies x^* and y^* respectively, then  \max_y {{x^*}^T}Py = \min_x {x^T}P{y^*}. In other words, for a finite two-person zero-sum game, there is an optimal payoff value w for one player given the other player’s strategy, for which the other player’s payoff value will be -w. This guarantees that the optimal strategies employed by both players are consistent with each other due to symmetry of the problem.


The Minimax Theorem can be proved within the context of the matrix game. Note that the optimal solution for the first player can be obtained from rewriting the objective as  \min_x {x^T}Py = \min_i {{a_i}^T}Py, where a_i is a vector that consists of zeroes except at i, which holds the value 1. This equality holds true because deciding on an optimal probability distribution that would minimize the payoff is equivalent to selecting the minimal payoff to the other player.

Introducing a new variable u along with this substitution allows the original maximin LP problem (optimal strategy for the second player) to be reformulated as a simple maximization problem:

\text{max} & ~~ u\\
\text{s.t.} & ~~ u \le {{a_i}^T}Py,~~\forall~i  \in \{1,2,...,m\} \\
& ~~ \sum_{j=1}^n y_j = 1\\
& ~~ y_j \ge 0,~~\forall~i \in \{1,2,...,m\} \\ 

or in vector notation,

\text{max} & ~~ u\\
\text{s.t.} & ~~ ua - Py \le 0 \\
& ~~ {a^T}y = 1\\
& ~~ y \ge 0\\ 

Since the problem is a finite two-person zero-sum game, by symmetry the optimal solution for the first player can be determined from

\text{min} & ~~ v\\
\text{s.t.} & ~~ va - {P^T}x \ge 0 \\
& ~~ {a^T}x = 1\\
& ~~ x \ge 0\\ 

By the duality theorem, it is evident that the two LPs are primal-dual pairs, such that the strong duality suggests that u^* = v^*.

By definition, recall that  v = \min_i {{a_i}^T}Py and u = \max_j {{a_j}^T}{P^T}x, such that for optimal solutions x^* and y^*,  v = \min_i {{a_i}^T}P{y^*} = \min_x {x^T}P{y^*} and u = \max_j {{a_j}^T}{P^T}{x^*} = \max_y {y^T}{P^T}{x^*}. Since {y^T}{P^T}{x^*} = {{x^*}^T}Py due to symmetry, u = \max_y {y^T}{P^T}{x^*} = \max_y {{x^*}^T}Py. Based on strong duality, u^* = v^*, so this prove the Minimax Theorem  \min_x {x^T}P{y^*} = \max_y {{x^*}^T}Py


example coming soon!


1. S. Tadelis, Game Theory: an Introduction, Princeton University Press, 2013.

2. R. J. Vanderbei, Linear Programming: Foundations and Extensions, Springer, 2008.

3. M. J. Osborne, An Introduction to Game Theory, Oxford University Press, 2004.