Automated equilibrium analysis of 2 × 2 × 2 games
Abstract
The set of all Nash equilibria of a non-cooperative game with more than two players is deﬁned by equations and inequalities between nonlinear polynomials, which makes it challenging to compute.
This paper presents an algorithm that computes this set for the simplest game with more than two players with arbitrary (possibly non-generic) payoﬀs, which has not been done before.
We give new elegant formulas for completely mixed equilibria, and compute visual representations of the best-response correspondences and their intersections, which deﬁne the Nash equilibrium set.
These have been implemented in Python and will be part of a public web-based software for automated equilibrium analysis.
For small games, which are often studied in economic models, a complete Nash equilibrium analysis is desirable and should be feasible.
This project demonstrates the complexity of this task and oﬀers pathways for extensions to larger games.
Introduction
Game theory provides mathematical models for multiagent interactions.
The primary solution concept is Nash equilibrium and its reﬁnements (e g., perfect equilibrium, Selten, 1975) or generalizations such as correlated equilibrium (which arises from regret-based learning algorithms).
Already for two-player games, ﬁnding just one Nash equilibrium is PPAD-hard (Chen, Deng, and
Teng, 2009; Daskalakis, Goldberg and Papadimitriou, 2009).
However, this “intractability” of the
Nash equilibrium concept applies to large games.
Many games that are used as economic models are small with less than a few dozen payoﬀ parameters and often given in extensive form as game trees.
It would be desirable to have a complete analysis of all Nash equilibria of such a game, in order to study the implications of the model.
Such a complete analysis is known for two-player games.
Their
Nash equilibria can be represented as unions of “maximal Nash subsets” (Winkels, 1979).
These are maximally “exchangeable” Nash equilibrium sets, that is, products of two polytopes of mixed strategies that are mutual best responses.
Their non-disjoint unions form the topologically connected components of Nash equilibria, and are computed by the lrsnash algorithm of Avis, Rosenberg,
Savani, and von Stengel (2010), which works well for games with up to about twenty strategies per player.
For games with more than two players, the set of all Nash equilibria cannot be described in such a way, because it is determined by equations and inequalities between nonlinear polynomials.
The
Gambit software package (McKelvey, McLennan, and Turocy, 2016) provides access to polynomial solvers in order to compute Nash equilibria for generic games.
“Generic” means that the payoﬀs do not represent edge cases, for example if (11) below reads as “0 = 0” or has solutions 𝑝 = 0 or 𝑝 =that do not require indiﬀerence of player I.
The edge cases can be encoded as the zeros of a suitable polynomial in the game parameters and form a set of measure zero.
Generic games have only ﬁnitely many equilibrium points. Non-generic games can have inﬁnite set of equilibria. However, rather remarkably, there is to our knowledge no algorithm that computes (in some description) the entire set of Nash equilibria for even the simplest game with more than two players if the game is non-generic, which naturally occurs for games in extensive form, such as “Selten’s horse” (Selten, 1975); see Figure 3 below.
This paper describes an algorithm that computes the entire set of Nash equilibria for arbitrary 2 × 2 × 2games, that is, three-player games where every player has two strategies.
These are the simplest games with more than two players that do not have a special structure (such as being a polymatrix game arising from pairwise interactions, see Howson, 1972).
While this seems like a straightforward task, it is already challenging in its complexity.
One contribution of this paper is to reduce this complexity by carefully preserving the symmetry among the players, and a judicious use of intermediate parameters (equation (6) in Section 4) derived from the payoﬀs.
We determine a quadratic equation (see (11)) that has a regular structure using determinants (not known to us before), which also implies that a generic 2 × 2 × 2 game has at most two completely mixed equilibria (shown much more simply than in Chin, Parthasarathy, and Raghavan, 1974, or McKelvey and McLennan, 1997).
The standard approach to manipulating such complicated algebraic expressions is to use a computer algebra system (Datta, 2010).
As a “binary” game with only two pure strategies per player, the equilibria of a 2 × 2 × 2 game can be visualized in a cube, but this needs some 3D graphics to be accessible (our graphics can be “moved in 3D”).
We think that good visualizations of the geometry of equilibrium solutions of a game are important for understanding them, and their possible structure (both for applications of and research in game theory).
We present our algorithm in two parts: Identifying partially mixed equilibria (on the faces or edges of the cube) which arise from two-player equilibria where the third player plays a pure strategy that remains optimal; this part has a straightforward generalization to larger numbers of strategies for the three players, and may be practically very useful, certainly for a preliminary analysis.
The second part is to look for completely mixed equilibria, which is challenging and does not generalize straightforwardly.
A substantial part of the code, which we cannot describe in full, deals systematically with the degenerate cases (which do arise in game trees even when payoﬀs are generic).
General form of the game
The following table describes the general form of a three-player game in which each player has two strategies:
I II 1 − 𝑝 𝑝 1 − 𝑞 𝑞   𝑎  𝐴 𝐵 𝑐 Front: 1 − 𝑟 III
Up:
Down:
Left:
Right:
I
II 1 − 𝑝 𝑝 1 − 𝑞 𝑞   𝑏 𝛼 𝛾 𝐶 𝐷 𝑑 𝛽 𝛿 Back
Left This game is played by player I, II, III choosing (simultaneously) their second strategy with probability 𝑝, 𝑞, 𝑟 , respectively.
Player I chooses a row, either Up or Down (abbreviated U and D), player II chooses a column, either Left or Right (abbreviated L and R), and player III chooses a panel, either
Front or Back (abbreviated F and B).
The strategy names are also chosen to remember the six faces of the three-dimensional unit cube of mixed-strategy proﬁles ( 𝑝, 𝑞, 𝑟 ) , shown in Figure 1. [Figure]
Each of has a payoﬀ triple
𝑇,
The payoﬀs have been normalized so that each player’s ﬁrst pure strategy has payoﬀ zero throughout.
(Zero is the natural “ﬁrst” number, as in 0 and 1 for the two strategies of each player, or for the payoﬀs.)
This normalization is obtained by subtracting a suitable constant from the player’s payoﬀs for each combination of opponent strategies (e.g., each column for player I).
This does not aﬀect best responses (von Stengel, 2022, p. 239f).
With this normalization, the ﬁrst strategy of each player gives always expected payoﬀ zero.
For each player’s second strategy, the expected payoﬀs are as follows:
[Equation]
so the three players can be treated symmetrically.
The cyclic shift among 𝑝, 𝑞, 𝑟 in (2), and corresponding choice of where to put 𝑏 and 𝑐 and 𝛽 and 𝛾 in (1), will lead to more symmetric solutions.
The mixed-strategy proﬁle ( 𝑝, 𝑞, 𝑟 ) is a mixed equilibrium if each player’s mixed strategy is a best response against the other players’ strategies.
That best response is a pure (deterministic) strategy, unless the two pure strategies have equal expected payoﬀs (Nash, 1951).
Hence, 𝑝 is a best response of player I to ( 𝑞, 𝑟 ) if the following conditions hold:
[Equation]
Similarly, 𝑞 is a best response of player II to ( 𝑟, 𝑝 ) and 𝑟 is a best response of player III to ( 𝑝, 𝑞 ) iﬀ
[Equation]
For each player I, II, or III, the triples ( 𝑝, 𝑞, 𝑟 ) that fulﬁll the respective conditions for 𝑝 , 𝑞 , or 𝑟 in (3) or (4) deﬁne the best-response correspondence of that player, a subset of the cube [ 0 , 1 ] 3 .
The set of Nash equilibria is the intersection of these three sets.
The best-response correspondence for player I, for example, has one of the following three forms:
(a) If 𝐴 = 𝐵 = 𝐶 =
𝐷 = 0, then 𝑆 ( 𝑞, 𝑟 ) =
for all 𝑞, 𝑟 ∈ [ 0 , 1 ] and player
I’s best-response correspondence is the entire cube [ 0 , 1 ] 3 .
[Figure] If 𝐴, 𝐵, 𝐶, 𝐷 < 0, then 𝑆 ( 𝑞, 𝑟 ) < 0 for all ( 𝑞, 𝑟 ) ∈ [ 0 , 1 ] 2 and strategy U strictly dominates
D, so that player I will always play U, and the game reduces to a two-player game between players II and III.
The same happens when 𝐴, 𝐵, 𝐶, 𝐷 > 0, in which case D strictly dominates U.
In these two cases the best-response correspondence of player I is the top “U face” or bottom “D face” of the cube in Figure 1, respectively.
[Figure]
In all other cases, the best response of player I to ( 𝑞, 𝑟 ) is sometimes U and sometimes D.
The best-response correspondence of player I is then a surface that consists of subsets of the U or D face according to (3), which are connected by vertical parts in Figure 1 where player I is indiﬀerent between U and D (such a vertical part is usually two-dimensional if the condition 𝑆 ( 𝑞, 𝑟 ) =
deﬁnes a curve or line segment, but may also be a vertical edge of the cube, which is one-dimensional; the red edge in the middle pictures in Figure 3 is an example).
Figure 2 shows a more generic example.
The Nash equilibria of a game can be divided to three categories, based on which strategies are used:
• pure equilibria in which every player plays a pure strategy (0 or 1), • partially mixed equilibria in which one player or two players play a pure strategy, and • completely mixed equilibria in which none of the players plays a pure strategy.
In order to ﬁnd all the equilibria in these games, we can divide the procedure into two parts:
(i) Find the pure and partially mixed equilibria.
(ii) Find the completely mixed equilibria.
We use diﬀerent methods for each part.
The union of the answers will be the set of all equilibria of the game.
Pure and partially mixed equilibria
It is easy to identify pure equilibria directly from (1).
Also, using the following method to ﬁnd partially mixed equilibria, the pure equilibria will be found too.
In an equilibrium, each player’s strategy is a best response to the other players’ strategies.
In a partially mixed equilibrium, at least one player plays a pure strategy.
All partially mixed equilibria are thus identiﬁed via six subgames.
In each subgame we ﬁx one player’s strategy to be 0 or 1.
Fixing one player’s strategy gives a 2 × 2 game for which we compute all equilibria.
Then, for each equilibrium component (which can be a point or a line segment), we check if it is the best response for the ﬁxed player too and if it is, this means it is a partially mixed equilibrium of the game.
Algorithmgives a simpliﬁed pseudo-code.
In certain degenerate cases, only a part of a segment might still be best a response when we involve the ﬁxed player.
However, this is dealt with easily because equilibrium segments of a 2 × 2 game can be only horizontal or vertical.
That is, the strategy of one player is constant through the segment and just one variable changes.
This allows an easy amendment of Algorithm 1. Algorithm
Input: payoﬀ matrix of a 2 × 2 × 2 game
Output: its set of partially mixed Nash equilibria
PartiallyMixedNE ← ∅ for each player 𝑖 do for 𝑠 𝑖 ∈ { 0 , 1 } do
SubGame ← 2 × 2 game when player 𝑖 plays 𝑠 𝑖 candidateSet ← all Nash equilibria of SubGame ⊲ using lrsNash algorithm for each 𝑠 − 𝑖 ∈ candidateSet do
Completely mixed equilibria
In this section, we assume that all the partially mixed equilibria are found using the previous algorithm.
Here, we focus on ﬁnding the completely mixed equilibria.
We address the following questions:
(a) Finding the completely mixed equilibria algebraically.
(b) Displaying each player’s best-response correspondence as a surface.
We focus on player I using (3); the consideration for players II and III is analogous.
We will show that the indiﬀerence equation 𝑆 ( 𝑞, 𝑟 ) = 0, which by (3) is necessary for player I to be able to mix (0 < 𝑝 < 1), deﬁnes either a line or a (possibly degenerated) hyperbola, using possibly both branches.
Generically, the intersection of the three best-response surfaces is a ﬁnite set of points.
However, certain kinds of degeneracy may occur, which leads to inﬁnite components of Nash equilibria.
For our algebraic approach (a), we rewrite (2) as
[Equation]
with
[Equation]
The expressions in (5) are linear in each of 𝑝, 𝑞, 𝑟
[Equation]
and we consider when we set them to zero:
[Equation]
We ﬁrst eliminate 𝑟 by multiplying the ﬁrst equation in (7) with ( 𝑘 + 𝑚𝑝 ) and the second with −( 𝐿 + 𝑀𝑞 ) and adding them
[Equation]
which gives
[Equation]
or, using determinants,
[Equation]
𝑀
[Equation]
In the same way, we eliminate 𝑞 by multiplying the last equation in (7) with (cid:12)(cid:12)(cid:12)(cid:12)
𝐾 𝑀 𝑎 𝑘 (cid:12)(cid:12)(cid:12)(cid:12) + (cid:12)(cid:12)(cid:12)(cid:12)
𝐾 𝑀 𝑙 𝑚 (cid:12)(cid:12)(cid:12)(cid:12) 𝑝 and (9) with −( 𝜆 + 𝜇𝑝 ) and addition, which gives
[Equation]
(10) or (veriﬁed by expanding each 3 × 3 determinant in the last column)
[Equation]
𝐴
[Equation]
+ (cid:169)(cid:173) (cid:171) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 𝐴 𝐿 𝛼 𝐾 𝑀 𝜆 𝑙 𝑚 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) + (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 𝐴 𝐿 𝜅 𝐾 𝑀 𝜇 𝑎 𝑘 0 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:170)(cid:174)(cid:172) 𝑝 + (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 𝐴 𝐿 𝜅 𝐾 𝑀 𝜇 𝑙 𝑚 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12)(cid:12) 𝑝 2 = 0 .
Unless it states 0 = 0, the quadratic equation (11) has at most two solutions for 𝑝 , which have to belong to [ 0 , 1 ] to represent a mixed equilibrium strategy of player
I. Substituted into the linear equation (9) for 𝑞 and the second equation in (7) for 𝑟 , this then determines 𝑞 and 𝑟 uniquely unless they are of the form 0 / 0.
If 𝑞 and 𝑟 belong to [ 0 , 1 ] , these determine mixed equilibria.
They are completely mixed if 𝑝, 𝑞, 𝑟 are all strictly between 0 and 1.
Moreover, a generic 3 × 3 × 3 game has therefore at most two completely mixed equilibria (as proved in much more complicated ways by Chin, Parthasarathy, and Raghavan, 1974, and McKelvey and McLennan, 1997).
The system (5) can be solved in exactly the same manner to derive a quadratic equation for 𝑞 , where we only need to move in (5) the ﬁrst equation into last position and change 𝐴, 𝑎, 𝛼 to 𝑎, 𝛼, 𝐴 respectively, and similarly for the other letters.
Then (11) becomes (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) 𝑎 𝑙 𝐴 𝑘 𝑚 𝐿 𝛼 𝜅 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) + (cid:169)(cid:173) (cid:171) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) 𝑎 𝑙 𝐴 𝑘 𝑚 𝐿 𝜆 𝜇 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) [Equation]
+ [Equation] 𝑎 𝑙 𝐾 𝑘 𝑚 𝑀 𝛼 𝜅 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) (cid:170)(cid:174) (cid:172) 𝑞 + (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) 𝑎 𝑙 𝐾 𝑘 𝑚 𝑀 𝜆 𝜇 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) 𝑞 2 = 0 .
Similarly, the quadratic equation for 𝑟 states (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) 𝛼 𝜆 𝑎 𝜅 𝜇 𝑙 𝐴 𝐾 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) + (cid:169)(cid:173) (cid:171) (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) 𝛼 𝜆 𝑎 𝜅 𝜇 𝑙 𝐿 𝑀 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) + (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) 𝛼 𝜆 𝑘 𝜅 𝜇 𝑚 𝐴 𝐾 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) (cid:170)(cid:174) (cid:172) 𝑟
+ (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12)
𝛼 𝜆 𝑘 𝜅 𝜇 𝑚 𝐿 𝑀 (cid:12)(cid:12)(cid:12)(cid:12)(cid:12) (cid:12) 𝑟 2 = 0 .
As before, in the generic case, any of the up to two solutions 𝑞 to (12) determines 𝑟 and 𝑝 .
Similarly, any of the up to two solutions 𝑟 to (13) determines 𝑝 and 𝑞 .
The conditions (11), (12), (13) are all necessary when each player is required to be indiﬀerent between his pure strategies.
However, they may hold trivially in the form 0 = 0, which may indicate inﬁnite solution sets; an example is (11) for case (a) when 𝐴 =
𝐾 = 𝐿 =
𝑀 = 0.
Furthermore, even if (11) has two real solutions 𝑝 , say, then for one or both choices of 𝑝 the third equation in (7) may state
=
and then 𝑞 is not determined; one would expect that this implies that (12) states 0 = 0 as well.
A further source of inﬁnite solutions may be that some solutions for 𝑝 , 𝑞 , or 𝑟 are 0 or 1, because then the respective player plays a pure strategy and does not have to be indiﬀerent.
This should come up in an analysis of the partially mixed equilibria in the previous section.
Other than these quadratic equations, we can achieve more information about the game by studying the relation between any two variables.
Using (5), we can write each variable as a function of the other one.
So, from 𝑆 ( 𝑞, 𝑟 ) =
we will have:
[Equation]
Similarly, we have four more equations derived from the other two equations.
These equations will help us identify the mixed equilibria when the quadratic equations have inﬁnite solutions and do not give us any information.
To see how the best-response surfaces look like, we focus on player
I’s expected payoﬀ equation; for the other players it is similar.
With (6) and (5), the condition 𝑆 ( 𝑞, 𝑟 ) =
states
[Equation]
First, we exclude the case when ( 𝐴, 𝐵, 𝐶, 𝐷 ) = ( 0 , 0 , 0 , 0 ) because it means the player is completely indiﬀerent between the two strategies in every point.
Then every point in [ 0 , 1 ] × [ 0 , 1 ] × [ 0 , 1 ] will be part of the best-response correspondence.
In the next step we compute the intersection of the best-response correspondences of the other two players, so we do not need to take this ﬁrst player into account.
We continue studying diﬀerent cases for 𝑆 ( 𝑞, 𝑟 )
=
when at least one of 𝐴, 𝐵, 𝐶, 𝐷 is not 0.
(b)
The linear case applies if 𝑀 =
𝐴 − 𝐵 − 𝐶 + 𝐷 = 0, that is, [Equation] [Equation]
If 𝐾 = 𝐿 = 0 then (16) has no solution because 𝐴 ≠ 0, because if 𝐴 = 0 then (a) holds, which we have excluded, so assume ( 𝐾, 𝐿 ) ≠ ( 0 , 0 ) .
If 𝐾 = 0 then the line is deﬁned by a constant for 𝑟 , namely 𝑟 = − 𝐴 / 𝐿 , and if 𝐿 = 0 then the line is deﬁned by a constant for 𝑞 , namely 𝑟 = − 𝐴 / 𝐾 .
Otherwise, (16) expresses a standard linear relationship between 𝑞 and 𝑟 .
Hence, it is a line in the 𝑞 × 𝑟 plane which is extended vertically in the 𝑝 -axis direction.
According to (3), on this hyperplane, Player I is indiﬀerent between ﬁrst and second strategies.
For the points on each side of the hyperplane, (3) will determine that the best response will be 𝑝 = 0 or 𝑝 = 1.
An example is the blue surface in Figure 2.
(c)
Now, suppose 𝑀 ≠ 0.
Then (15) is equivalent to
[Equation]
[Equation] Adding 𝐾𝐿𝑀 2 − 𝐴𝑀 on both sides of this equation and using (6) gives
[Equation]
If 𝐵𝐶 − 𝐴𝐷 = 0, then (18) states that 𝑞 = − 𝐿𝑀 or 𝑟 = − 𝐾𝑀 . This deﬁnes two perpendicular lines, each similar to a line in part (b).
This is a degenerate hyperbola, with a best-response surface like the blue surface in Figure 3.
If 𝐵𝐶 − 𝐴𝐷 ≠ 0, then these two lines are the asymptotes of a hyperbola deﬁned by (18).
Depending on the values of 𝐴, 𝐵, 𝐶, 𝐷 , it is possible that the [ 0 , 1 ]×[ 0 , 1 ] rectangle contains two parts of the arcs of hyperbola or a part of one of the arcs (see the green and red bestresponse surface in Figure 2), or just a point on it, or none at all (but then the game has a dominated strategy).
For the points ( 𝑞, 𝑟 ) that are not located on the hyperbola, player I’s pure best response is determined according to the inequalities 𝑆 ( 𝑞, 𝑟 ) < 0 and 𝑆 ( 𝑞, 𝑟 ) >in (3).
Note that when (15) with “ < ” or “ > ” instead of “ = ” is replaced by the corresponding inequality in (17), its direction is reversed if 𝑀 < 0.