Calculating the correlated equilibrium of a $3\times 3$ normal form game using MatLab

Apologies if there is anything wrong with my formatting, this is my first post.

I'm trying to use the linprog function in MatLab to calculate the correlated equilibrium in a normal form game represented by this $3\times 3$ matrix:

$$ \begin{array}{|c|c|c|c|} \hline & \mathrm{A} & \mathrm{B} & \mathrm{C} \\ \hline \mathrm{X} & 10,5 & 0,6 & 0,0 \\ \hline \mathrm{Y} & 7,7 & 0,0 & 6,0 \\ \hline \mathrm{Z} & 0,0 & 7,7 & 5,10 \\ \hline \end{array} $$

I know how to do this in a $2\times 2$ game, however in a $3\times 3$ I'm stumped. In a $2\times 2$ the number of coefficients match the inequalities used for the linprog function, whereas when calculating inequalities for a $3\times 3$ (unless I'm doing it wrong) you end up with $12$ inequalities ($2$ for each row/column) but $9$ coefficients.

Apologies if this is a silly question, I'm new to game theory and MatLab and I'm struggling to wrap my head around some of the concepts. I'd really appreciate some help.


Solution 1:

For a simpler notation lets number the strategies. Let for Player 1 $X=s^1_1$, $Y=s^1_2$, and $Z=s^1_3$. Similarly for Player 2 $A=s^2_1$, $B=s^2_2$, and $C=s^2_3$. So you are looking for vector $\mu=(\mu(s^1_1,s^2_1),\ldots, \mu(s^1_3,s^1_3))$, such that $\sum_{i=1}^3\sum_{j=1}^3\mu(s^1_i,s^2_j)=1$, $\mu(s^1_i,s^2_j)\geq0$ for all $i,j$, and $A\mu\geq0$, for a 12x9 Matrix given by the incentive constraints. Or equivalently, you solve the linear problem $$\max \sum_{i=1}^3\sum_{j=1}^3\mu(s^1_i,s^2_j)$$ $$\text{s.t. }A\mu\geq0$$ $$\sum_{i=1}^3\sum_{j=1}^3\mu(s^1_i,s^2_j)\leq1$$ $$\mu(s^1_i,s^2_j)\geq0 \text{ for all } i,j\in\{1,2,3\}$$. Why is this equivalent? As any finite game has a mixed strategy equilibrium, we know that there exists a solution of the program with $\sum_{i=1}^3\sum_{j=1}^3\mu(s^1_i,s^2_j)=1$. So any solution has the value 1. I suppose your problem is with coming up with the matrix $A$. However, it is easy once you write down the incentive constraints, subtract the right-hand side from the left-hand side, and organize them by the variables $\mu(s^1_i,s^2_j)$. This should give you the following matrix. $$A= \begin{bmatrix} 3 & 0 & -6 & 0 & 0 & 0 & 0 & 0 & 0 \\ 10 & -7 & -5 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & -3 & 0 & 6 & 0 & 0 & 0 \\ 0 & 0 & 0 & 7 & -7 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & -10 & 7 & 5 \\ 0 & 0 & 0 & 0 & 0 & 0 & -7 & 7 & -1 \\ -1 & 0 & 0 & 7 & 0 & 0 & -7 & 0 & 0 \\ 5 & 0 & 0 & 7 & 0 & 0 & -10 & 0 & 0 \\ 0 & 1 & 0 & 0 & -7 & 0 & 0 & 7 & 0 \\ 0 & 6 & 0 & 0 & 0 & 0 & 0 & -3 & 0 \\ 0 & 0 & -5 & 0 & 0 & -7 & 0 & 0 & 10 \\ 0 & 0 & -6 & 0 & 0 & 0 & 0 & 0 & 3 \end{bmatrix}. $$