# Evolutionary game theory - solutions

1. Assume the frequency dependent selection model for a population with two types of individuals: $x=(x_1, x_2)$ such that $x_1 + x_2 = 1$. Obtain all the stable distribution for the sytem defined by the following fitness functions:

   For all of the functions in question, $x=(0, 1)$ and $x=(1, 0)$ are equilibria. There is a 3rd potential equilibria given by $f_1(x) = f_2(x)$. This is bookwork: https://vknight.org/gt/chapters/11/#Frequency-dependent-selection

   1. $f_1(x)=x_1 - x_2\qquad f_2(x)=x_2 - 2 x_1$
      
      $f_1(x)=f_2(x)\Rightarrow x_1 - x_2 = x_2 - 2x_1 \Rightarrow 3x_1 = 2x_2$ which gives (using the fact that $x_1 + x_2=1$ single solution: $(x_1, x_2)=(2/5, 3/5)$


```python
import sympy as sym
x_1 = sym.symbols("x_1")
sym.solveset(3 * x_1 - 2 * (1 - x_1), x_1)
```




    {2/5}



`B`. $f_1(x)=x_1x_2 - x_2\qquad f_2(x)=x_2 - x_1 + 1/2$

$f_1(x)=f_2(x)\Rightarrow x_1x_2 - x_2 = x_2 - x_1 + 1/2$ setting $x=x_1$ so that $1 - x = x_2$ gives: $x - x ^ 2 - 1 + x = 1 - x - x + 1/2$ which corresponds to: 
      
$$-x ^ 2 + 4 x - 5/2=0$$

This has solution $x=2 \pm \sqrt{6}/2$, thus $(x_1, x_2) = (2 - \sqrt{6}/2, -1 + \sqrt{6}/2)$ is the only set of solutions for which $1 \geq x_1 \geq 0$ and $1\geq x_2 \geq 0$.


```python
x = sym.symbols("x", positive=True)
res = sym.solveset(- x ** 2 + 4 * x - sym.S(5) / 2, x)
res
```




    {-sqrt(6)/2 + 2, sqrt(6)/2 + 2}




```python
for sol in list(res):
    print(sol, float(sol), float(1 - sol))
```

    -sqrt(6)/2 + 2 0.775255128608411 0.22474487139158905
    sqrt(6)/2 + 2 3.224744871391589 -2.224744871391589


`C`. $f_1(x)=x_1 ^ 2 \qquad f_2(x)=x_2^2$
   
$f_1(x)=f_2(x)\Rightarrow x_1 = \pm x_2$ which has a single solution $(x_1, x_2)=(1/2, 1/2)$.
      
`2`. For the following games, obtain all the stable distributions for the evolutionary game:

   For bother of these we aim to find $x$ such that $(1, 0)Ax^T=(0, 1)Ax^T$.

   1. $A = \begin{pmatrix}2 & 4 \\ 5 & 3\end{pmatrix}$
          
      $(1, 0)Ax^T=(0, 1)Ax^T\Rightarrow 2x+4(1-x)=5x+3(1-x)\Rightarrow x=1/4$
     
   2. $A = \begin{pmatrix}1 & 0 \\ 0 & 1\end{pmatrix}$
   
      $(1, 0)Ax^T=(0, 1)Ax^T\Rightarrow x=1-x\Rightarrow x=1/2$
   
`3`. Define:
   1. mutated population.
   
      Bookwork: https://vknight.org/gt/chapters/11/#Mutated-population
   
   2. Evolutionary stable strategies
   
      Bookwork: https://vknight.org/gt/chapters/11/#Evolutionary-Stable-Strategies
      
`4`. State and prove the general condition for ESS theorem.

   Bookwork: https://vknight.org/gt/chapters/11/#General-condition-for-ESS
   
`5`. Using the general condition for ESS theorem identify what strategies are evolutionarily stable for the games of question 2.

   For both these games we start by identifying the Nash equilibria:
   
   1. $(A, A^T) = (\begin{pmatrix}2 & \underline{4} \\ \underline{5} & 3\end{pmatrix}, \begin{pmatrix}2 & \underline{5} \\ \underline{4} & 3\end{pmatrix})$
      
      The pure NE are given by $\{((1, 0), (0, 1)), ((0, 1), (1, 0))\}$, these are not symmetric so do not correspond to ESS. The mixed nash equilibrium corresonds to the stationary point calculated previously: $x=1/4$.
      
      For a general $y$, we have $u(x, x)=u(y,x)$ (by the defnining calculation of $x$). Thus, we look at the second condition: 
      
      $$u(x, y)=1/4(2y+4(1-y)) + 3/4(5y+3(1-y))=1/4(4-2y) + 1/4(6y+9)=1/4(4y+13)$$
      
      $$u(y, y)=y(2y+4(1-y)) + (1-y)(5y+3(1-y))=y(4-2y) + (1-y)(2y+3)=-4y^2+3y+3$$
      
      thus:
      
      $$u(x, y) - u(y, y) = 4y^2 - 2y + 1/4=\frac{(4y-1)^2}{4}$$
      
      which is $>0$ for $y\ne 1/4$, thus $x=(1/4, 3/4)$ is an ESS.
      
   2. $(A, A^T) = (\begin{pmatrix}\underline{1} & 0 \\ 0 & \underline{1}\end{pmatrix}, \begin{pmatrix}\underline{1} & 0 \\ 0 & \underline{1}\end{pmatrix})$
      
      The pure NE are given by $\{((1, 0), (1, 0)), ((0, 1), (0, 1))\}$, these are symmetric, for both we have $u(x, x)=1$ which will be $>u(y, x)$ for all $y\ne x$ as $x$ is a best response to itself. Thus, these are both ESS.
      
      We now consider $x=1/2$. For a general $y$, we have $u(x, x)=u(y,x)$ (by the defnining calculation of $x$). Thus, we look at the second condition: 
      
      $$u(x, y)=1/2(y + 1 - y)=1/2$$
      
      $$u(y, y)=y^2 + (1-y)^2=2y^2-2y+1$$
      
      thus:
      
      $$u(x, y) - u(y, y) = -2y^2 + 2 y - 1/2=-\frac{(2y-1)^2}{2}$$
      
      which is $<0$ for $y\ne 1/2$, thus $x=(1/2, 1/2)$ is not an ESS.

7610cf37c1390140993168a0921e3d8aa99458d6
ipynb
Jupyter Notebook
nbs/solutions/11-Evolutionary-game-theory.ipynb
prokolyvakis/gt
e679e5d54d9a98583ad4981411ce505cea31f028
MIT
2017-05-25T08:10:40.000Z
2021-12-07T21:01:51.000Z
nbs/solutions/11-Evolutionary-game-theory.ipynb
prokolyvakis/gt
e679e5d54d9a98583ad4981411ce505cea31f028
MIT
2017-05-23T16:12:03.000Z
2022-03-30T13:42:25.000Z
nbs/solutions/11-Evolutionary-game-theory.ipynb
prokolyvakis/gt
e679e5d54d9a98583ad4981411ce505cea31f028
MIT
2017-06-19T11:04:06.000Z
2020-08-30T11:28:00.000Z
Qwen/Qwen-72B
1. YES
2. YES