Writing Game Theory in L A TEX Thiago Silva First Version: November 22, 2015 This Version: November 13, 2017 List of Figures and Tables 1 2x2 Matrix: Prisoner s ilemma Normal-Form Game............. 3 2 Two Matrices: Generalization of Prisoner s ilemma............. 4 3 Finding the Nash Equilibrium of Prisoner s ilemma (Underlining Players Best Responses)................................. 4 4 Prisoner s ilemma in Extensive-form..................... 5 5 Finding the Subgame Perfect Nash Equilibrium in Prisoner s ilemma (Using ouble Lines).................................. 5 6 Finding the Nash Equilibrium (Using ots).................. 6 7 3x3 Matrix: A Game with Three Actions................... 6 8 2x4 Matrix: A Game with Two Actions for and Four Actions for... 7 9 Bach or Stravinsky?............................... 7 10 The Game of hicken (The Hawk-ove Game)................. 7 11 Matching Pennies................................ 7 12 Game with Mixed Strategies (Example 1)................... 7 13 Game with Mixed Strategies (Example 2)................... 8 14 entipede Game................................. 8 15 Three Players Game: ombining Extensive Form with Matrix Form..... 8 16 Alternative Three Players Game: ombining Extensive Form with Matrix Form 8 17 Veto Game in Extensive-Form (One Node for and Three Nodes for ).. 9 18 Extensive-Form Game with Imperfect Information (Highlighting a Subgame) 9 19 Extensive-Form Game with Imperfect Information and a Large Information Set 10 20 Game Tree with urved Information Set.................... 10 21 Long Game Tree with Three Information Sets................. 11 22 Game in Horizontal Extensive-Form....................... 12 23 A More omplex Horizontal ecision Tree................... 13 24 Signaling Game.................................. 13 Ph andidate, epartment of Political Science, Texas A&M University, ollege Station, TX, 77843-4348, USA. E-mail: nsthiago@tamu.edu
In order to present how to write game theory in L A TEX, I will use the most popular game in game theory called the Prisoner s ilemma (P) as an example. The P shows why two rational individuals might not cooperate even if cooperation is in their best interest, thus resulting in a sub-optimal outcome. The game was formalized and named by Albert Tucker. 1 The Prisoner s ilemma (in static or normal-form game) consist of: A set of players N, and N = {1, 2}, where 1 stands for Player 1 and 2 stands for Player 2. For each i N, a set of actions S i that is, a set of actions or a set of strategies S i = {, }, where stands for ooperate and stands for efect. In P S 1 = S 2 = {, }. For each i N, a preference relation i over S 1 S 2 (i.e., the artesian product). Instead of outcome, we usually use the term action profiles (or strategy profiles), i.e., a combination of actions such as (), (), and so on. Players care about their actions, because their actions lead to action profiles that have payoff utilities assigned to them. Each player has a utility function v i : S 1 S 2 R. For any collection of sets S 1, S 2,..., S n, we define S 1 S 2 S n = {(s 1, s 2,..., s n ) s 1 S 1,..., s n S n }. We call (s 1, s 2,..., s n ) the ordered n-tuples ordered pairs (s 1, s 2 ). This is important to show that (1, 2) (2, 1). For P game S 1 S 2 = {,,, }. The ordering of the action profiles, from best to worst where the first action in parentheses represents player 1 s action and the second action represents player 2 s action is (, ), where player 1 defects and player 2 cooperates; (, ), where both 1 and 2 cooperate; (, ), where both 1 and 2 defect, and; (, ), where 1 cooperates and 2 defects. The players preferences can be represented according to payoff functions. First, we assign a utility function u, such as u 1 for player 1, and u 2 for player 2. We can express the order of 1 See Poundstone, William. 1992 Prisoner s ilemma. New York ity: Anchor Books. 2
players preferences as, For player 1: u 1 (, ) > u 1 (, ) > u 1 (, ) > u 1 (, ) (1) For player 2: u 2 (, ) > u 2 (, ) > u 2 (, ) > u 1 (, ) Then, we can assign the respective payoffs, For : u 1 (, ) = 3 > u 1 (, ) = 2 > u 1 (, ) = 1 > u 1 (, ) = 0 (2) For : u 2 (, ) = 3 > u 2 (, ) = 2 > u 2 (, ) = 1 > u 2 (, ) = 0 We can represent the game in a payoff matrix, also called normal-form game : Table 1: 2x2 Matrix: Prisoner s ilemma Normal-Form Game Player 2 Player 1 2, 2 0, 3 3, 0 1, 1 The traditional Prisoners s ilemma can be generalized from its original setting (see the right matrix below): If both players cooperate, they both receive the reward payoff R for cooperating. If both players defect, they both receive the punishment payoff P. If 1 defects while 2 cooperates, then 1 receives the temptation payoff T, while 2 receives the sucker s payoff, S. Symmetrically, if 1 cooperates while 2 defects, then 1 receives the sucker s payoff S, while 2 receives the temptation payoff T. 3
Figure 2: Two Matrices: Generalization of Prisoner s ilemma ooperate efect ooperate 2, 2 0, 3 efect 3, 0 1, 1 ooperate efect ooperate R, R S, T efect T, S P, P Finding the Nash equilibrium (NE) of the Prisoner s ilemma (P) game: The action profile a in a strategic game with ordinal preferences is a Nash equilibrium if, for every player i and every action a i of player i, a is at least as good according to player i s preferences as the action profile (a i, a i) in which player i chooses a i while every other player i, with i i, chooses a i. Therefore, for every player i u i (a ) u i (a i, a i) a i A i (3) where A i is the set of actions for player i, and u i is a payoff function that represents player i s preferences. Table 3: Finding the Nash Equilibrium of Prisoner s ilemma (Underlining Players Best Responses) Player 2 Player 1 2, 2 0, 3 3, 0 1, 1 Each underlined action indicates the best response of each player according to the other player s action. Therefore, NE = (, ). The P can also be depicted in a game of extensive-form (or decision tree), such as: 4
Figure 4: Prisoner s ilemma in Extensive-form 2, 2 0, 3 3, 0 1, 1 Figure 5: Finding the Subgame Perfect Nash Equilibrium in Prisoner s ilemma (Using ouble Lines) 2, 2 0, 3 3, 0 1, 1 5
Other Examples and Game Forms Table 6: Finding the Nash Equilibrium (Using ots) Player 2 Player 1 2, 2 0, 3 3, 0 1, 1 The small dot on top of each payoff indicates the best response of each player according to the other player s action. Note: Be careful to not confuse strategy profiles (or outputs) with payoff utilities (i.e., (, ) (1, 1)). The equilibrium (or equilibria) of a game refers to the strategy profile(s). Therefore, NE = (, ). An alternative depiction of players strategy profiles and their respective payoff utilities (e.g., P in normal-form game): For all a i A i, ν i (a i, a i ) = 3 if (, ) 2 if (, ) 1 if (, ) 0 if (, ) Table 7: 3x3 Matrix: A Game with Three Actions Player 1 Player 2 ooperate efect Neither ooperate R, R S, T T, S efect T, S P, P R, S Neither T, S P, P S, S 6
Table 8: 2x4 Matrix: A Game with Two Actions for and Four Actions for Unconditionally Unconditionally Imitation Move Opposite Move R, R S, T R, R S, T T, S P, P P, P T, S Table 9: Bach or Stravinsky? Player 2 Bach Stravinsky Player 1 Bach 3, 2 0, 0 Stravinsky 0, 0 2, 3 Figure 10: The Game of hicken (The Hawk-ove Game) Swerve Straight Swerve 0, 0 1, 1 Straight 1, 1 10, 10 Swerve Straight Swerve Tie, Tie Lose, Win Straight Win, Lose rash, rash Table 11: Matching Pennies Player 1 Player 2 Heads Tails Heads 1, 1 1, 1 Tails 1, 1 1, 1 Table 12: Game with Mixed Strategies (Example 1) (q) A (1 q) B (p) A α, β ɛ, ζ (1 p) B γ, δ η, θ 7
Table 13: Game with Mixed Strategies (Example 2) (q) (1 q) E (x) A ι, κ o, π (y) B λ, µ ρ, σ (1 x y) ν, ξ τ, υ Figure 14: entipede Game 1 2 1 2 1 2 Φ, Ψ φ, χ ψ, ω Γ, Θ, Λ Ξ, Π Σ, Υ Figure 15: Three Players Game: ombining Extensive Form with Matrix Form X Y X 1, 1, 1 2, 0, 2 Y 0, 2, 0 2, 2, 2 X Y X 3, 1, 3 2, 2, 2 Y 1, 1, 1 1, 3, 1 X Y P 3 Figure 16: Alternative Three Players Game: ombining Extensive Form with Matrix Form P3 X Y X Y X 1, 1, 1 2, 0, 2 Y 0, 2, 0 2, 2, 2 X Y X 3, 1, 3 2, 2, 2 Y 1, 1, 1 1, 3, 1 8
Figure 17: Veto Game in Extensive-Form (One Node for and Three Nodes for ) X Y Z Y Z X Z X Y 0, 2 (Z) 1, 1 (Y) 0, 2 (Z) 2, 0 (X) 1, 1 (Y) 2, 0 (X) Based on exercise 163.2 of Osborne s book: Osborne, Martin J. 2004. An Introduction to Game Theory. Oxford: Oxford University Press. Figure 18: Extensive-Form Game with Imperfect Information (Highlighting a Subgame) Nature A (p) (p 1) B (σ 1, γ 2) (ρ + 1, τ + 2) E F E F (0, 0) ( 10, 10) (0, 0) (10, 10) 9
Figure 19: Extensive-Form Game with Imperfect Information and a Large Information Set Player 2 a b c d Player 1 L R L R L R L R ( ) P1 s Payoff s Payoff ( ) 1 ( ) +1 ( ) 1 ( ) 1 ( ) +1 ( ) +1 ( ) +1 ( ) 1 +1 1 +1 +1 1 1 1 +1 Note: This is Figure 7..2 in Mas-olell, Whinston, and Green s book on microeconomic theory (1995), as replicated by Haiyun hen (Simon Fraser University). Figure 20: Game Tree with urved Information Set 1 L R 2 2 a b c d m n s 1 t m 1 n s t 1, 0 2, 3 0, 1 1, 0 1, 0 2, 3 0, 1 1, 0 Note: This is Figure 6 in Osborne s Manual for egameps.sty. 10
Figure 21: Long Game Tree with Three Information Sets ( 1 2 < p < 1) Nature (1 p) V A V B I 1 x P1 P1 (1 x) a b a b I 2 y P2 P2 (1 y) a b a b 0, 2 1, 1 z b P2 b P2 (1 z) I 3 2, 0 1, 1 a b a b 1, 1 2, 0 1, 1 0, 2 Note: This game tree was drew by Austin Mitchell (Texas A&M University). 11
We can also depict a game drawing a horizontal decision tree (horizontal extensive-form): Figure 22: Game in Horizontal Extensive-Form (p) 12 Player orinthians Palmeiras N (0.5) (0.5 p) (p) 6 2 10 N (0.5) 8 (0.5 p) 4 Expected utilities (EU) of the soccer player based on Figure 22: v(orinthians) = (p)(12) + ( 1 2 )(6) + ( 1 2 p)(2) = 12p + 3 + 1 2p = 10p + 4 and v(palmeiras) = (p)(10) + ( 1 2 )(8) + ( 1 2 p)(4) = 10p + 4 + 2 4p = 4p + 6 So, the soccer player should play in orinthians if : 10p + 4 > 4p + 6 ( 4p) 6p + 4 > 6 ( 4) 6p > 2 ( 6) p > 2 6 ( 2) p > 1 3 12
Figure 23: A More omplex Horizontal ecision Tree orinthians Palmeiras N N Wins (.7) Loses (.3) Wins (.1) 10 + Ω 5 Ψ Γ Brazil Loses (.9) 1 λ P on t play 0 Argentina Boca Juniors River Plate N N Wins (.7) Loses (.3) Wins (.1) 4 φ ψ 5 α Loses (.9) 2 ω Figure 24: Signaling Game (1, 1) u L Sender t = t 1 R u (2, 2) (2, 0) d [p] 0.4 [q] d (0, 0) Receiver Nature Receiver (0, 0) u [1 p] L 0.6 R [1 q] u (1, 0) (0, 1) d Sender t = t 2 d (1, 1) Note: This game was drew by hiu Yu Ko (National University of Singapore). 13
One-shot deviation principle (OS) V 1 nr nr... stick V 2 r nr... ( K) + δr = ( K) + δr + δ2 R 1 δ 1 δ V 1 nr nr nr... OS V 2 nr r nr... + δ(p K) + δ2 R 1 δ Sticking is optimal if, ( K) + δr + δ(p K) δ(k + R P ) K δ K K + R P (0, 1) 14