1 Introduction

1.1 The replicator–mutator equation

The replicator–mutator equation is a set of differential equations describing the evolution of frequencies of different strategies in a population that takes into account both selection and mutation mechanisms. It is a powerful and important tool given that in many social and, more generally, biological settings mutation is non-negligible [1, 23, 30, 37, 38, 40]. It has been employed in the study of, among other applications, population genetics [12], autocatalytic reaction networks [34], language evolution [25], the evolution of cooperation [17, 24] and dynamics of behavior in social networks [26].

Suppose that in an infinite population there are n types/strategies \(S_1,\ldots , S_n\) whose frequencies are, respectively, \(x_1,\ldots , x_n\). These types undergo selection; that is, the reproduction rate of each type, \(S_i\), is determined by its fitness or average payoff, \(f_i\), which is obtained from interacting with other individuals in the population. The interaction of the individuals in the population is carried out within randomly selected groups of d participants (for some integer d). That is, they play and obtain their payoffs from a d-player game, defined by a payoff matrix. We consider here symmetric games where the payoffs do not depend on the ordering of the players in a group. Mutation is included by adding the possibility that individuals spontaneously change from one strategy to another, which is modeled via a mutation matrix, \(Q=(q_{ji}), j,i\in \{1,\ldots ,n\}\). The entry \(q_{ji}\) denotes the probability that a player of type \(S_j\) changes its type or strategy to \(S_i\). The mutation matrix Q is a row-stochastic matrix, i.e.,

$$\begin{aligned} \sum _{j=1}^n q_{ji}=1, \quad 1\le i\le n. \end{aligned}$$

The replicator–mutator is then given by, see e.g. [18,19,20, 28]

$$\begin{aligned}&{\dot{x}}_i=\sum _{j=1}^n x_j f_j(\mathbf{x} )q_{ji}- x_i {\bar{f}}(\mathbf{x} )=:g_i(x),\nonumber \\&i=1,\ldots , n, \end{aligned}$$
(1)

where \(\mathbf{x} = (x_1, x_2, \dots , x_n)\) and \({\bar{f}}(\mathbf{x} )=\sum _{i=1}^n x_i f_i(\mathbf{x} )\) denotes the average fitness of the whole population. The replicator dynamics is a special instance of (1) when the mutation matrix is the identity matrix.

1.2 The replicator–mutator equation for two-player two-strategy games

In particular, for two-player two-strategy games with a payoff matrix

where \(a_{ij}\), \(i,j\in \{1,2\}\) is the payoff that a player using strategy \(S_i\) obtains when interacting with another player using strategy \(S_j\), the replicator–mutator equation is given by

$$\begin{aligned} {\dot{x}}= & {} q_{11}a_{11}x^2+q_{11}x(1-x)a_{12}\nonumber \\&+q_{21}x(1-x)a_{21}+q_{21}a_{22}(1-x)^2\nonumber \\&-x\Big (a_{11}x^2+(a_{12}\nonumber \\&+a_{21})x(1-x)+a_{22}(1-x)^2\Big ). \end{aligned}$$
(2)

Here x is the frequency of the first strategy and \(1-x\) is the frequency of the second one. Using the identities \(q_{11}=q_{22}=1-q, \quad q_{12}=q_{21}=q\), Eq. (2) becomes

$$\begin{aligned} {\dot{x}}&=\Big (a_{12}+a_{21}-a_{11}-a_{22}\Big )x^3\nonumber \\&\quad +\Big (a_{11}-a_{21}-2(a_{12}-a_{22})\nonumber \\&\quad +q(a_{22}+a_{12}-a_{11}-a_{21})\Big )x^2\nonumber \\&\quad +\Big (a_{12}-a_{22}+q(a_{21}-a_{12}-2a_{22})\Big )x\nonumber \\&\quad +q a_{22}. \end{aligned}$$
(3)

Two-player social dilemma games. In this paper, we focus on two-player (i.e. pairwise) social dilemma games. They have provided a main framework to study several important issues such as the evolution of cooperative behavior and its supporting mechanisms [13, 24, 29, 31]. We adopt the following parameterized payoff matrix to study the full space of two-player social dilemma games where the first strategy is cooperator and second is defector [31, 36, 39], \(a_{11} = 1; \ a_{22} = 0; \) \(0 \le a_{21} = T \le 2\) and \(-1 \le a_{12} = S \le 1\), that covers the following games

  1. (i)

    the Prisoner’s Dilemma (PD): \(2\ge T> 1> 0 > S\ge -1\),

  2. (ii)

    the Snow-Drift (SD) game: \(2\ge T> 1> S > 0\),

  3. (iii)

    the Stag Hunt (SH) game: \(1> T> 0 > S\ge -1\),

  4. (iv)

    the Harmony (H) game: \(1> T\ge 0, 1\ge S > 0\).

In this paper, we are interested in random social dilemma games where T and S are uniform random variables in the corresponding intervals, namely

  • In PD games: \(T\sim U(1,2)\), \(S\sim U(-1,0)\),

  • In SD games: \(T\sim U(1,2)\), \(S\sim U(0,1)\),

  • In SH games: \(T\sim U(0,1)\), \(S\sim U(-1,0)\),

  • In H games: \(T\sim U(0,1)\), \(S\sim U(0,1)\).

Random evolutionary games, in which the payoff entries are random variables, have been employed extensively to model social and biological systems in which very limited information is available, or where the environment changes so rapidly and frequently that one cannot describe the payoffs of their inhabitants’ interactions [4,5,6,7, 9, 11, 15, 22]. Equilibrium points of such evolutionary system are the compositions of strategy frequencies where all the strategies have the same average fitness. Biologically, they predict the co-existence of different types in a population and the maintenance of polymorphism.

In this paper, we are interested in computing the probability distributions of the number of equilibria, which is a random variable, in the above random social dilemmas. Answering this question is of great importance in the context of social dilemmas since one might know the nature of the game, i.e. the payoff entries ranking in the game, but it might be difficult to predict or measure the exact values of these entries. When the mutation is absent (\(q = 0\)), the answer is trivial because there is always a fixed number of equilibria depending on the nature of the social dilemmas [8, 24, 32]. As shown in our analysis below, this is however not the case any longer when mutation is non-negligible, and this number highly depends on the nature of the social dilemma too.

The following result obtained in [8] provides explicit formulas for the probabilities \(p_i^G\) that a game \(G\in \{{\text {SD, H, SH, PD}}\}\) has \(i\in \{1,2,3\}\) equilibria.

Theorem 1

Suppose that S and T are uniformly distributed in the corresponding intervals as above. Then

  • \(p_1^\mathrm{SD}=p_3^\mathrm{SD}=0, \quad p_2^\mathrm{SD}=1\).

  • \(p_1^\mathrm{H}=p_3^\mathrm{H}=0,\quad p_2^\mathrm{H}=1\).

  • \(p_2^\mathrm{SH}=\frac{q}{2(1-q)}\).

  • \(p_2^\mathrm{PD}={\left\{ \begin{array}{ll} \frac{3 q}{2(1-q)}\quad \text {if}\quad 0<q\le 1/3,\\ 3-\frac{1}{2q(1-q)}\quad \text {if}\quad 1/3\le q\le 1/2. \end{array}\right. }\)

According to the above theorem, SD games and H games are simple and complete. However, the probabilities of having 3 equilibria (or alternatively 1 equilibrium) in SH and PD games are left open in [8]. The key challenge is that the conditions for these games to have 3 equilibria (or alternatively 1 equilibrium) are much more complicated than those of 2 equilibria. The aim of this paper is to complete the above theorem, providing explicit formulas for these probabilities. As such, it will also allow us to derive other statistical quantities (such as average and variance), which are important to understand the overall distribution and complexity of equilibrium points in pairwise social dilemmas (with mutation). To this goal, we employ suitable changes of variables, which transform the problem of computing the probabilities to calculating areas, and perform delicate analysis.

1.3 Main results

The main result of this paper is the following.

Theorem 2

The probability that SH and PD games have 3 equilibria is given by, respectively

$$\begin{aligned}&p_3^\mathrm{SH}= {\left\{ \begin{array}{ll} 1-\frac{q}{2(1-q)}-\frac{1}{1-2q}\Big [\frac{(3\sqrt{q}+2)^2\sqrt{q}(5q^{3/2}+3q^2-9q-3\sqrt{q}+4)}{12(\sqrt{q}+1)^3} \\ {\qquad } +~\frac{-27 q^3-18q^2-32\sqrt{1-2q}q+48q+16\sqrt{1-2q}-16}{12q}\Big ],\quad 0<q\le 4/9,\\ 1-\frac{q}{2(1-q)}-\frac{8\sqrt{q}(1-2q)^2}{3(1-q)^3},\quad 4/9<q<0.5; \end{array}\right. } \\&p_3^\mathrm{PD}={\left\{ \begin{array}{ll} \frac{1}{1-2q}\Big [-\frac{2(q^3+3q^2+(4\sqrt{1-2q}-6)q-2\sqrt{1-2q}+2)}{3q}-\frac{1}{2}\frac{q^3}{(1-q)}\Big ],\quad 0\le q\le \frac{3-\sqrt{5}}{2},\\ \frac{-16 \left( \sqrt{1-2 q}-1\right) q^{3/2}+2 q^{5/2}+15 q^3+\left( 8 \sqrt{1-2 q}-25\right) q^2+q-8 \sqrt{1-2 q}+2 \sqrt{q} \left( 8 \sqrt{1-2 q}-5\right) +5}{6 \left( \sqrt{q}-1\right) ^3 \left( q^{3/2}+q\right) },~\frac{3-\sqrt{5}}{2}<q\le 4/9,\\ \frac{1}{2}\frac{(1-2q)^2}{q(1-q)},\quad 4/9<q<0.5. \end{array}\right. } \end{aligned}$$

The above theorem combines Theorem 3 (for SH-games) and Theorem 4 (for PD games), see Sect. 2. Theorems 1 and 2 provides explicitly the probability distributions of the number of equilibria for all the above-mentioned pairwise social dilemmas. In SH-games and PD-games, these distributions are much more complicated and significantly depend on the mutation strength. We summarize these results in the following summary box.

figure b
Fig. 1
figure 1

Non-trivial effect of non-negligible mutations on the number of equilibria in a pairwise social dilemma. We show its statistics as a function of the mutation probability q: probability of having k (\(k = 1, \ 2, \ 3\)) equilibria (top row), average and variance (bottom row). We look at all the four pairwise games, from left to right: SH, PD, SH and H. The probability of having the maximal possible number of equilibria, i.e. \(p_3\), is highest for SH. It is very small for PD and always equals 0 for SD and H games. The probability of having two equilibria, \(p_2\), is highest for SD and H. As a result, SH has the highest average number of equilibria across all games, for all \(0< q < 0.5\) (it is minimum when \(q = 0.285\)). For most q, PD has the lowest number of equilibria (it is maximum when \(q = 0.438\)). All the figures are generated using analytical formulas derived in Box 1 (for \(p_k\)) and Eq. (4) for the average and variance. These analytical results are also in accordance with numerical simulation results provided in [8], obtained through samplings of the random payoff entries T and S

As a consequence, we can now derive other statistical quantities such as the mean value, \(\mathrm {ENoE}\), and the variance, \(\mathrm {VarNoE}\) of the number of equilibria using the following formulas

$$\begin{aligned} \mathrm {ENoE}= & {} \sum _{i=1}^3 i\, p_i,\nonumber \\ \mathrm {VarNoE}= & {} \sum _{i=1}^3 p_i (i-\mathrm {ENoE})^2. \end{aligned}$$
(4)

We depict these quantities in Fig. 1 below. Our delicate analysis clearly shows the influence of the mutation on the probability distributions, thus on the complexity and bio-diversity of the underlying evolutionary systems. We believe that our analysis may be used as exemplary material for teaching foundational courses in evolutionary game theory, computational/quantitative biology and applied probability.

The rest of the paper is organized as follows. In Sect. 2, after recalling some preliminary details, we present the proof of the main theorem 2, which we split into Theorem 3 for SH games in Sect. 2.3 and Theorem 4 for PD games in Sect. 2.4. Finally, in Sect. 3 we provide further discussion.

2 Probability of having three equilibria in SH and PD games

2.1 Joint probability density via change of variable

The following lemma is a well-known result to compute the probability density of random variables using change of variables. We state here for two random variables that are directly applicable to our analysis, but the result is true in higher dimensional spaces.

Lemma 1

(Joint probability density via change of variable, [10, Section 3.3]) Suppose \((X_1, X_2)\) has joint density \(f(x_1,x_2)\). Let \((Y_1,Y_2)\) be defined by \(Y_1=u_1(X_1,X_2)\) and \(Y_2=u_2(X_1, X_2)\). Suppose that the map \((X_1, X_2)\rightarrow (Y_1, Y_2)\) is invertible with \(X_1=v_1(Y_1, Y_2)\) and \(X_2=v_2(Y_1, Y_2)\). Then the joint probability distribution of \(Y_1\) and \(Y_2\) is

$$\begin{aligned} g(y_1, y_2)=|J| f(v_1(y_1,y_2), v_2(y_1, y_2)), \end{aligned}$$

where the Jacobian J is given by

$$\begin{aligned} J=\begin{vmatrix}\frac{\partial v_1(y_1, y_2)}{\partial y_1}&\frac{\partial v_1(y_1, y_2)}{\partial y_2}\\ \frac{\partial v_2(y_1,y_2)}{\partial y_1}&\frac{\partial v_2(y_1, y_2)}{\partial y_2}\end{vmatrix}. \end{aligned}$$

2.2 Equilibria in social dilemmas

By simplifying the right hand side of (3), equilibria of a social dilemma game are roots in the interval [0, 1] of the following cubic equation

$$\begin{aligned}&\Big (T+S-1\Big )x^3+\Big (1-T-2S+q(S-1-T)\Big )x^2\nonumber \\&\quad +\Big (S+q(T-S)\Big )x = 0. \end{aligned}$$
(5)

It follows that \(x = 0\) is always an equilibrium. If \(q=0\), (5) reduces to

$$\begin{aligned} (T+S-1)x^3+(1-T-2S)x^2+Sx=0, \end{aligned}$$

which has solutions

$$\begin{aligned} x=0, \quad x=1, \quad x^*=\frac{S}{S+T-1}. \end{aligned}$$

Note that for SH-games and SH-games \(x^*\in (0,1)\), thus it is always an equilibrium. On the other hand, for PD-games and H-games, \(x^* \not \in (0,1)\), thus it is not an equilibrium

If \(q=\frac{1}{2}\) then the above equation has two solutions \(x_1=\frac{1}{2}\) and \(x_2=\frac{T+S}{T+S-1}\). In PD, SD and H games, \(x_2\not \in (0,1)\), thus they have two equilibria \(x_0=0\) and \(x_1=\frac{1}{2}\). In the SH game: if \(T+S<0\) then the game has three equilibria \(x_0=0, x_1=\frac{1}{2}\) and \(0<x_2<1\); if \(T+S\ge 0\) then the game has only two equilibria \(x_0=0, x_1=\frac{1}{2}\).

Now we consider the case \(0<q<\frac{1}{2}\). For non-zero equilibrium points we solve the following quadratic equation

$$\begin{aligned} h(x):= & {} (T+S-1)x^2+(1-T-2S+q(S-1-T))x\nonumber \\&+S+q(T-S)\nonumber \\=: & {} ax^2+bx+c=0. \end{aligned}$$
(6)

Set \(t:=\frac{x}{1-x}\), then we have

$$\begin{aligned} \frac{h(x)}{(1-x)^2}= & {} (a+b+c) t^2+(b+2c)t+c\nonumber \\= & {} -qt^2+(-q-a+c)t+c\nonumber \\:= & {} g(t) \end{aligned}$$

Therefore, a social dilemma has three equilibria iff h has two distinct roots in (0, 1), which is equivalent to g having two distinct positive roots, or the following conditions must hold

$$\begin{aligned} \varDelta= & {} (q+a-c)^2+4qc>0,\nonumber \\&q+a-c<0,\quad c<0. \end{aligned}$$
(7)

Let \({\hat{T}}:=T-1\) and

$$\begin{aligned} X({\hat{T}}, S)&:=q+a-c=(1-q)(T-1)+qS\\&=(1-q){\hat{T}}+qS,\\ Y({\hat{T}},S)&:=c-q=q(T-1)+(1-q)\\&=q{\hat{T}}+(1-q)S. \end{aligned}$$

The inverse transformation \((X,Y)\rightarrow ({\hat{T}},S)\) is given by

$$\begin{aligned} {\hat{T}}(X,Y)= & {} \frac{(1-q)X-qY}{1-2q},\nonumber \\ S(X,Y)= & {} \frac{(1-q)Y-qX}{1-2q}. \end{aligned}$$
(8)

Condition (7) is given by

$$\begin{aligned} D= & {} \{(X,Y): X^2+4qY>-4q^2,\quad X<0, \quad Y<-q\}\\= & {} \{(X,Y): X<0, -\frac{X^2}{4q}-q<Y<-q\}. \end{aligned}$$

The domain D is illustrated in Fig. 2.

Fig. 2
figure 2

Region D are shown for different values of q, namely, \(q = 0.1, \ 0.2, \ 0.3\) and 0.4, for illustration (see Sect. 2.2)

We apply Lemma 1 to find the joint distribution of X and Y. We compute the Jacobian of the transform \((X,Y)\rightarrow ({\hat{T}},S)\), which is given by

$$\begin{aligned} J= & {} \begin{pmatrix} \frac{\partial {\hat{T}}(X,Y)}{\partial X}&{}\frac{\partial S(X,Y)}{\partial Y}\\ \frac{\partial {\hat{T}}(X,Y)}{\partial X}&{}\frac{\partial S(X,Y)}{\partial Y} \end{pmatrix}\nonumber \\= & {} \begin{pmatrix} \frac{1-q}{1-2q}&{} \frac{-q}{1-2q}\\ \frac{-q}{1-2q}&{}\frac{1-q}{1-2q} \end{pmatrix}\nonumber \\= & {} \frac{1}{1-2q}. \end{aligned}$$
(9)

Hence if \(({\hat{T}}, S)\) has a probability density f(ts) then (XY) has a probability density

$$\begin{aligned} g(x,y)=|J|f({\hat{T}}(x,y),S(x,y)). \end{aligned}$$
(10)

We now apply this approach to SH and PD games.

2.3 The Stag Hunt (SH)

Proposition 1

The probability that SH games have 3 equilibria is given by

$$\begin{aligned} p^\mathrm{SH}_3=\frac{1}{(1-2q)}\mathrm {Area}(D\cap D_1), \end{aligned}$$
(11)

where D is the subset of \({\mathbb {R}}^2\) determined by

$$\begin{aligned} D=\Bigg \{(x,y): -1<x<0, -\frac{x^2}{4q}-q<y<-q\Bigg \}, \end{aligned}$$

and \(D_1\) is the quadrilateral ABOC with vertices

$$\begin{aligned} A= & {} (-1,-1), \quad B=(-(1-q), -q), \\ C= & {} (-q,-(1-q))\quad O=(0,0). \end{aligned}$$

The domain \(D_1\) and the intersection \(D\cap D_1\) is illustrated in Fig. 3.

Fig. 3
figure 3

SH game: regions \(D_1\) and \(D \cap D_1\) are shown for different values of q, namely, \(q = 0.1, \ 0.2, \ 0.3\) and 0.4, for illustration (see Proposition 1)

Proof

In the SH game: \(1>T>0>S>-1\), \(T\sim U(0,1)\), \(S\sim U(-1,0)\). Let \({\hat{T}}:=T-1\sim U(-1,0)\). The joint distribution of \(({\hat{T}},S)\) is

$$\begin{aligned} f(t,s)={\left\{ \begin{array}{ll} 1\quad (t,s)\in (-1,0)\times (-1,0),\\ 0\quad \text {otherwise}. \end{array}\right. } \end{aligned}$$

According to (10), the joint probability distribution of (XY) is

$$\begin{aligned} g(x,y)= & {} |J|f({\hat{T}}(x,y),S(x,y))\\= & {} \frac{1}{(1-2q)}1_{(x,y)\in D_1}, \end{aligned}$$

where

$$\begin{aligned} D_1&=({\hat{T}}(x,y),S(x,y)\in (-1,0)\times (-1,0) \\&=((x,y)\in (-1,0)^2:~(1-q)x-qy,(1-q)y-qx)\\&\quad \in (-(1-2q),0)\times (-(1-2q),0) \\&=\{(x,y)\in (-1,0)^2:~-(1-2q)\\&<(1-q)x-qy<0,\\&\quad -(1-2q)<(1-q)y-qx<0 \} \\&=\Bigg \{(x,y)\in (-1,0)^2:~\frac{(1-q)x}{q}\\&<y<\frac{(1-q)x+(1-2q)}{q},\\&\quad \frac{qx-(1-2q)}{1-q}<y<\frac{qx}{1-q} \Bigg \}. \end{aligned}$$

We can characterise \(D_1\) further by explicitly ordering the lower and upper bounds in the above formula. We have

$$\begin{aligned}&\frac{(1-q)x}{q}-\frac{qx}{1-q}=\frac{(1-2q)x}{q(1-q)}<0\\&\frac{(1-q)x}{q}-\frac{qx-(1-2q)}{1-q}=\frac{(1-2q)(x+q)}{q(1-q)}, \\&\frac{(1-q)x+(1-2q)}{q}-\frac{qx}{1-q}=\frac{(1-2q)(x+1-q)}{q(1-q)}. \end{aligned}$$

It follows that:

  1. (i)

    for \(-1<x<-(1-q)<-q\):

    $$\begin{aligned} \frac{(1-q)x}{q}< & {} \frac{qx-(1-2q)}{1-q}\\< & {} \frac{(1-q)x+(1-2q)}{q}\\< & {} \frac{qx}{1-q} \end{aligned}$$
  2. (ii)

    For \(-(1-q)<x<-q\)

    $$\begin{aligned} \frac{(1-q)x}{q}< & {} \frac{qx-(1-2q)}{1-q}\\< & {} \frac{qx}{1-q}\\< & {} \frac{(1-q)x+(1-2q)}{q}. \end{aligned}$$
  3. (iii)

    for \(-q<x<0\)

    $$\begin{aligned} \frac{qx-(1-2q)}{1-q}< & {} \frac{(1-q)x}{q}\\< & {} \frac{qx}{1-q}\\< & {} \frac{(1-q)x+(1-2q)}{q}. \end{aligned}$$

Hence

$$\begin{aligned} D_1&=\Bigg \{-1<x<-(1-q),~ \frac{qx-(1-2q)}{1-q}<y\\&<\frac{(1-q)x+(1-2q)}{q}\Bigg \}\\&~\cup ~ \Bigg \{-(1-q)<x<-q,\\&\quad \frac{qx-(1-2q)}{1-q}<y<\frac{qx}{1-q}\Bigg \}\\&~\cup ~\Bigg \{-q<x<-0,\\&\qquad \quad \frac{(1-q)x}{q}<y<\frac{qx}{1-q}\Bigg \}. \end{aligned}$$

Thus, \(D_1\) is the quadrilateral ABOC with vertices

$$\begin{aligned} A= & {} (-1,-1), \quad B=(-(1-q), -q), \\ C= & {} (-q,-(1-q))\quad O=(0,0). \end{aligned}$$

\(\square \)

Theorem 3

The probability that SH games have 3 equilibria is given by

$$\begin{aligned} p_3^\mathrm{SH}= {\left\{ \begin{array}{ll} 1-\frac{q}{2(1-q)}-\frac{1}{1-2q}\Big [\frac{(3\sqrt{q}+2)^2\sqrt{q}(5q^{3/2}+3q^2-9q-3\sqrt{q}+4)}{12(\sqrt{q}+1)^3} \\ {\qquad }+\frac{-27 q^3-18q^2-32\sqrt{1-2q}q+48q+16\sqrt{1-2q}-16}{12q}\Big ],\quad 0<q\le 4/9,\\ \\ 1-\frac{q}{2(1-q)}-\frac{8\sqrt{q}(1-2q)^2}{3(1-q)^3},\quad 4/9<q<0.5. \end{array}\right. } \end{aligned}$$

Proof

According to Proposition 1, in order to compute \(p_3^\mathrm{SH}\) we need to compute the area of \(D\cap D_1\). To this end we need to understand the intersections of the parabola \(y=-\frac{x^2}{4q}-q\) with the lines \(y=\frac{(1-q)x}{q}\) and \(y=\frac{qx-(1-2q)}{1-q}\). The parabola \(y=-\frac{x^2}{4q}-q\) always intersects with the line \(y=\frac{(1-q)x}{q}\) inside the domain \((-1,0)^2\) at the point

$$\begin{aligned} F=(2(q+\sqrt{1-2q}-1), 2(1-q)(q+\sqrt{1-2q}-1)/q). \end{aligned}$$

By comparing \(2(q+\sqrt{1-2q}-1)\) with \(-q\), it follows that the point F is inside the edge OC if \(0\le q\le 4/9\) and is outside OC whenever \(4/9<q<0.5\). On the other hand, the parabola \(y=-\frac{x^2}{4q}-q\) meets the line \(y=\frac{qx-(1-2q)}{1-q}\) at two points \(G_1=(x_1, -\frac{x_1^2}{4q}-q)\) and \(G_2=(x_2, -\frac{x_2^2}{4q}-q)\) with

$$\begin{aligned} x_1= & {} 2q \Big (-\frac{q}{1-q}-\frac{2q-1}{(q-1)\sqrt{q}}\Big ),\\ x_2= & {} 2q\Big (\frac{2q-1}{(q-1)\sqrt{q}}-\frac{q}{1-q}\Big ). \end{aligned}$$

By comparing \(x_1\) and \(x_2\) with \(-q\) we have \(G_1\) is always in the edge AC, while \(G_2\) is outside AC if \(0< q\le 4/9\) and is inside AC if \(4/9<q<0.5\).

In conclusion

  1. 1.

    for \(0<q\le 4/9\): the intersection \(D\cap D_1\) is the domain formed by vertices A, B, E, F, and \(G_1\) where \(E=(-\frac{q^2}{1-q}, -q)\) (which is the intersection of \(y=-q\) with \(y=\frac{(1-q)x}{q}\)) and

    • A and B are connected by the line \(y=\frac{(1-q)x+(1-2q)}{q}\),

    • B and E are connected by the line \(y=-q\),

    • E and F are connected by the line \(y=\frac{(1-q)x}{q}\),

    • F and \(G_1\) are connected by the parabola \(y=-\frac{x^2}{4q}-q\),

    • \(G_1\) and A are connected by the line \(y=\frac{qx-(1-2q)}{1-q}\).

  2. 2.

    for \(4/9<q<0.5\): the intersection \(D\cap D_1\) is the domain formed by the vertices \(A, B, E, C, G_1, G_2\) where

    • A and B are connected by the line \(y=\frac{(1-q)x+(1-2q)}{q}\),

    • B and E are connected by the line \(y=-q\),

    • E and C are connected by the line \(y=\frac{(1-q)x}{q}\),

    • C and \(G_1\) are connected by the line \(y=\frac{qx-(1-2q)}{1-q}\),

    • \(G_1\) and \(G_2\) are connected by the parabola \(y=-\frac{x^2}{4q}-q\),

    • \(G_2\) and A are connected by the line \(y=\frac{qx-(1-2q)}{1-q}\).

See Fig. 4 for illustrations of the two cases above, with \(q=0.3\) and \(q=0.45\) respectively.

We are now ready to compute the probability that the SH game has three equilibria.

For \(0<q\le 4/9\): The probability that the SH game has three equilibria is

$$\begin{aligned} p^\mathrm{SH}_3&=\frac{1}{(1-2q)}\mathrm {Area}(D\cap D_1)\nonumber \\&=\frac{1}{(1-2q)}\Big [\mathrm {Area}(D_1)\nonumber \\&\quad -\mathrm {Area}(BOE)-\mathrm {Area}(CFG_1)\Big ] \end{aligned}$$
(12)

We proceed by computing the areas in the expression above. Area of \(D_1\) is

$$\begin{aligned}&\mathrm {Area}(D_1)\nonumber \\&\quad =\int _{-1}^{-(1-q)}\Big [\frac{(1-q)x+(1-2q)}{q}\nonumber \\&\quad -\frac{qx-(1-2q)}{1-q}\Big ]\,\mathrm{d}x\nonumber \\&\quad \quad +\int _{-(1-q)}^{-q}\Big [\frac{qx}{1-q}-\frac{qx-(1-2q)}{1-q}\Big ]\,\mathrm{d}x\nonumber \\&\quad \quad +\int _{-q}^0\Big [\frac{qx}{1-q}-\frac{(1-q)x}{q}\Big ]\,\mathrm{d}x\nonumber \\&\quad =\frac{q(1-2q)}{2(1-q)}+\frac{(1-2q)^2}{1-q}\nonumber \\&\qquad +\frac{q(1-2q)}{2(1-q)}\nonumber \\&\quad =1-2q. \end{aligned}$$
(13)

Area of BOE is

$$\begin{aligned} \mathrm {Area}(BOE)&=\mathrm {Area}(BOH)-\mathrm {Area}(HOE)\nonumber \\&=\frac{1}{2}q\Big [(1-q)-\frac{q^2}{1-q}\Big ]\nonumber \\&=\frac{q(1-2q)}{2(1-q)}, \end{aligned}$$
(14)

where \(H=(0,-q)\). Area of CFG is

$$\begin{aligned}&\mathrm {Area}(CFG_1)\nonumber \\&\quad =\int _{a}^{-q}\Big [\frac{qx-(1-2q)}{1-q}+\frac{x^2}{4q}+q\Big ]\,\mathrm{d}x\nonumber \\&\quad \quad +\int _{-q}^{2(q+\sqrt{1-2q}-1)}\Big [\frac{(1-q)x}{q}+\frac{x^2}{4q}+q\Big ]\,\mathrm{d}x\nonumber \\&\quad =\frac{(3\sqrt{q}+2)^2\sqrt{q}(5q^{3/2}+3q^2-9q-3\sqrt{q}+4)}{12(\sqrt{q}+1)^3}\nonumber \\&\qquad +\frac{-27 q^3-18q^2-32\sqrt{1-2q}q+48q+16\sqrt{1-2q}-16}{12q}. \end{aligned}$$
(15)

Substituting (13), (14), and (15) back to (12) we obtain, for \(0<q\le 4/9\)

$$\begin{aligned} p_3^\mathrm{SH}&=1-\frac{q}{2(1-q)} \\&\quad -\frac{1}{1-2q}\Bigg [\frac{(3\sqrt{q}+2)^2\sqrt{q}(5q^{3/2}+3q^2-9q-3\sqrt{q}+4)}{12(\sqrt{q}+1)^3} \\&\quad +\frac{-27 q^3-18q^2-32\sqrt{1-2q}q+48q+16\sqrt{1-2q}-16}{12q}\Bigg ] \end{aligned}$$

Now we consider the remaining case \(4/9<q<0.5\). In this case

$$\begin{aligned} p^\mathrm{SH}_3&=\frac{1}{(1-2q)}\mathrm {Area}(D\cap D_1)\nonumber \\&=\frac{1}{(1-2q)}\Big [\mathrm {Area}(D_1)\nonumber \\&\quad -\mathrm {Area}(BOE)-\mathrm {Area}(\lozenge G_1G_2)\Big ], \end{aligned}$$
(16)

where \(\lozenge G_1G_2\) is the domain with vertices \(G_1\) and \(G_2\) formed by the parabola \(y=-\frac{x^2}{4q}-q\) and the line \(y=\frac{qx-(1-2q)}{1-q}\). Thus

$$\begin{aligned} \mathrm {Area}(\lozenge G_1G_2)&=\int _{x_1}^{x_2}\Big [-\frac{x^2}{4q}-q-\frac{qx-(1-2q)}{1-q}\Big ]\,\mathrm{d}x\nonumber \\&=\frac{8\sqrt{q}(1-2q)^3}{3(1-q)^3}. \end{aligned}$$
(17)

Substituting (13), (14) and (17) back to (16) we obtain, for \(4/9<q<0.5\),

$$\begin{aligned} p_3^\mathrm{SH}=1-\frac{q}{2(1-q)}-\frac{8\sqrt{q}(1-2q)^2}{3(1-q)^3}. \end{aligned}$$

This finishes the proof of this theorem \(\square \)

Fig. 4
figure 4

Details of \(D\cap D_1\) for \(q=0.3\) and \(q=0.45\), for illustration of the proof and calculation in Theorem 2.3

2.4 Prisoner’s Dilemma (PD)

Proposition 2

The probability that PD games have 3 equilibria is given by

$$\begin{aligned} p^\mathrm{PD}_3=\frac{1}{(1-2q)}{\mathrm {Area}}(D\cap D_2), \end{aligned}$$
(18)

where D is defined above (as in the case of the SH games) and \(D_2\) is the triangle MNO with vertices

$$\begin{aligned} M=(-q,-(1-q)),\quad N=(0,-\frac{1-2q}{1-q}), \quad O=(0,0). \end{aligned}$$

See Fig. 5 for illustration of \(D_2\) and its intersection with D for several values of q.

Fig. 5
figure 5

PD game: regions \(D_2\) and \(D \cap D_2\) are shown for different values of q, namely, \(q = 0.1, \ 0.2, \ 0.3\) and 0.4, for illustration of Proposition 2

Proof

Recall that in PD games we have \(T\sim U(1,2)\), \(S\sim (-1,0)\). Thus \({\hat{T}}=T-1\sim (0,1)\). The joint distribution of \(({\hat{T}}, S)\) is

$$\begin{aligned} f(t,s)= & {} 1_{(x,y)\in (0,1)\times (-1,0)}\\= & {} {\left\{ \begin{array}{ll} 1\quad (t,s)\in (0,1)\times (-1,0),\\ 0\quad \text {otherwise}. \end{array}\right. }. \end{aligned}$$

According to (10), the joint probability distribution of (XY) is

$$\begin{aligned} g(x,y)= & {} |J|f({\hat{T}}(x,y),S(x,y))\\= & {} \frac{1}{(1-2q)}1_{(x,y)\in D_2}, \end{aligned}$$

where

$$\begin{aligned} D_2&=({\hat{T}}(x,y),S(x,y)\in (0,1)\times (-1,0) \\ {}&=\{(x,y)\in (-1,0)^2:~(1-q)x-qy,(1-q)y-qx)\\&\quad \in (0,1-2q)\times (-(1-2q),0)\} \\ {}&=\{(x,y)\in (-1,0)^2:~0<(1-q)x-qy<1-2q,\\&\quad -(1-2q)<(1-q)y-qx<0 \} \\ {}&=\Bigg \{(x,y)\in (-1,0)^2:\frac{(1-q)x-(1-2q)}{q}\\&\quad<y<\frac{(1-q)x}{q},\\&\quad \frac{qx-(1-2q)}{1-q}<y<\frac{qx}{1-q} \Bigg \}. \end{aligned}$$

We now characterise \(D_2\) further. We have

  1. (1)

    for \(-1<x<-q\) then

    $$\begin{aligned} \frac{(1-q)x-(1-2q)}{q}< & {} \frac{(1-q)x}{q}\\< & {} \frac{qx-(1-2q)}{1-q}\\< & {} \frac{qx}{1-q} \end{aligned}$$
  2. (2)

    for \(-q<x<0\) then

    $$\begin{aligned} \frac{(1-q)x-(1-2q)}{q}< & {} \frac{qx-(1-2q)}{1-q}\\< & {} \frac{(1-q)x}{q}\\< & {} \frac{qx}{1-q} \end{aligned}$$

It follows that

$$\begin{aligned} D_2= & {} \Bigg \{(x,y):~-q<x<0,~ \frac{qx-(1-2q)}{1-q}\\&<y<\frac{(1-q)x}{q}\Bigg \}. \end{aligned}$$

Thus \(D_2\) is the triangle MNO with vertices

$$\begin{aligned} M= & {} (-q,-(1-q)),\\ N= & {} (0,-\frac{1-2q}{1-q}), \quad O=(0,0). \end{aligned}$$

The probability that the SH game has three equilibria is thus

$$\begin{aligned} p^\mathrm{SH}_3&=\int _{D}g(x,y)\,\mathrm{d}x\mathrm{d}y\nonumber \\ {}&=\frac{1}{(1-2q)}\int _{D}1_{(x,y)\in D_2}\,\mathrm{d}x\mathrm{d}y\nonumber \\&=\frac{1}{(1-2q)}\mathrm {Area}(D\cap D_2). \end{aligned}$$

This finishes the proof of this proposition. \(\square \)

The following elementary lemma provides an upper bound for \(p_3^\mathrm{PD}\), particularly implying that it tends to 0 as q goes to 0.

Lemma 2

$$\begin{aligned} p_3^\mathrm{PD}\le \frac{q}{2(1-q)}. \end{aligned}$$
(19)

As a consequence, \(p_3^\mathrm{PD}\) is always smaller or equal to 0.5 and tends to 0 as q tends to 0.

Proof

Area of D

$$\begin{aligned} \mathrm {Area}(D)&=\int _{-1}^0\Big [-q-\Big (-\frac{x^2}{4q}-q\Big )\Big ]\,\mathrm{d}x\\&=\frac{1}{12 q}. \end{aligned}$$

Area of \(D_2\)

$$\begin{aligned} \mathrm {Area}(D_2)= & {} \int _{-q}^0\Big [\frac{(1-q)x}{q}-\frac{qx-(1-2q)}{1-q}\Big ]\,\mathrm{d}x\\= & {} \frac{q(1-2q)}{2(1-q)}. \end{aligned}$$

Hence

$$\begin{aligned} p_3^\mathrm{PD}&\le \frac{1}{1-2q}\min \Big \{\mathrm {Area}(D),\mathrm {Area}(D_2) \Big \}\\&=\frac{1}{1-2q}\min \Big \{\frac{1}{12 q},\frac{q(1-2q)}{2(1-q)}\Big \}\\&=\frac{q}{2(1-q)}. \end{aligned}$$

\(\square \)

Fig. 6
figure 6

Details of \(D \cap D_2\) for \(q = 0.3, \ 0.4, \ 0.45\), for illustration of the proof and calculation in Theorem 4

Theorem 4

The probability that PD games has three equilibria is given by

$$\begin{aligned} p_3^\mathrm{PD}={\left\{ \begin{array}{ll} \frac{1}{1-2q}\Big [-\frac{2(q^3+3q^2+(4\sqrt{1-2q}-6)q-2\sqrt{1-2q}+2)}{3q}-\frac{1}{2}\frac{q^3}{(1-q)}\Big ],\quad 0\le q\le \frac{3-\sqrt{5}}{2},\\ \frac{-16 \left( \sqrt{1-2 q}-1\right) q^{3/2}+2 q^{5/2}+15 q^3+\left( 8 \sqrt{1-2 q}-25\right) q^2+q-8 \sqrt{1-2 q}+2 \sqrt{q} \left( 8 \sqrt{1-2 q}-5\right) +5}{6 \left( \sqrt{q}-1\right) ^3 \left( q^{3/2}+q\right) },~\frac{3-\sqrt{5}}{2}<q\le 4/9,\\ \frac{1}{2}\frac{(1-2q)^2}{q(1-q)},\quad 4/9<q<0.5. \end{array}\right. } \end{aligned}$$

Proof

According to Proposition 2, in order to compute \(p_3^\mathrm{PD}\) we need to compute the area of \(D\cap D_2\). As in proof of Theorem 3, the parabola \(y=-\frac{x^2}{4q}-q\) always intersects with the line \(y=\frac{(1-q)x}{q}\) inside the domain \((-1,0)^2\) at the point

$$\begin{aligned} F=(2(q+\sqrt{1-2q}-1), 2(1-q)(q+\sqrt{1-2q}-1)/q). \end{aligned}$$

The point F is inside the edge DC if \(0\le q\le 4/9\) and is outside DC whenever \(4/9<q<0.5\).

On the other hand, the parabola \(y=-\frac{x^2}{4q}-q\) meets the line \(y=\frac{qx-(1-2q)}{1-q}\) at two points \(G_1=(x_1, -\frac{x_1^2}{4q}-q)\) and \(G_2=(x_2, -\frac{x_2^2}{4q}-q)\) with

$$\begin{aligned} x_1= & {} 2q \Big (-\frac{q}{1-q}-\frac{1-2q}{(1-q)\sqrt{q}}\Big ),\\ x_2= & {} 2q\Big (-\frac{q}{1-q}+\frac{1-2q}{(1-q)\sqrt{q}}\Big ). \end{aligned}$$

\(G_1\) is always outside edge AC. \(G_2\) is inside it if \(\frac{3-\sqrt{5}}{2}< q\le 4/9\) and outside it otherwise. Therefore, we have three cases (see Fig. 6 for illustration).

  1. (1)

    For \(0\le q\le \frac{3-\sqrt{5}}{2}\): the intersection \(D\cap D_2\) is formed by IFK where \(I=(-q^2/(1-q),-q)\) (which is the intersection of \(y=-q\) with \(y=\frac{(1-q)x}{q}\)), \(K=(0.-q)\) and

    • I and F are connected by the line \(y=\frac{(1-q)x}{q}\),

    • F and K are connected by the parabola \(y=-\frac{x^2}{4q}-q\),

    • K and I are connected by the line \(y=-q\).

    In this case

    $$\begin{aligned} p_3^\mathrm{PD}&=\frac{1}{1-2q}\mathrm {Area}(D\cap D_2) \\ {}&=\frac{1}{1-2q}\Big (\mathrm {Area}(OFK)-\mathrm {Area}(OIK)\Big ) \\ {}&=\frac{1}{1-2q}\Bigg (\int _{2(q+\sqrt{1-2q}-1)}^0\Big [\frac{(1-q)x}{q}\\&\quad +\frac{x^2}{4q}+q\Big ]\,\mathrm{d}x-\frac{1}{2}\frac{q^3}{(1-q)}\Bigg ) \\ {}&=\frac{1}{1-2q}\Big [-\frac{2(q^3+3q^2+(4\sqrt{1-2q}-6)q-2\sqrt{1-2q}+2)}{3q}\\&\quad -\frac{1}{2}\frac{q^3}{(1-q)}\Big ]. \end{aligned}$$
  2. (2)

    For \(\frac{3-\sqrt{5}}{2}<q\le 4/9\): the intersection \(D\cap D_2\) is formed by F, I, \(P=((q^3-3q+1)/q,-q)\) (which is the intersection of \(y=-q\) with \(y=\frac{qx-(1-2q)}{1-q}\)) and \(G_2\), where

    • F and I are connected by the line \(y=\frac{(1-q)x}{q}\),

    • I and P are connected by the line \(y=-q\),

    • P and \(G_2\) are connected by the line \(y=\frac{qx-(1-2q)}{1-q}\),

    • \(G_2\) and F are connected by the parabola \(y=-\frac{x^2}{4q}-q\).

    In this case

    $$\begin{aligned} p_3^\mathrm{PD}&=\frac{1}{1-2q}\mathrm {Area}(D\cap D_2)\nonumber \\&=\frac{1}{1-2q}\Bigg (\int _{2(q+\sqrt{1-2q}-1)}^{-\frac{q^2}{1-q}}\Big [\frac{(1-q)x}{q}\nonumber \\&\quad +\frac{x^2}{4q}+q\Big ]\,\mathrm{d}x+\int _{-\frac{q^2}{1-q}}^{x_2}\frac{x^2}{4q}\,\mathrm{d}x\nonumber \\&\quad +\int _{x_2}^{(q^2-3q+1)/q}\Big [-q-\frac{qx-(1-2q)}{1-q}\Big ]\, \mathrm{d}x\Bigg )\nonumber \\&=\frac{1}{6 \left( \sqrt{q}-1\right) ^3 \left( q^{3/2}+q\right) }\Bigg (-16 \left( \sqrt{1-2 q}-1\right) q^{3/2}\nonumber \\&\quad +2 q^{5/2}+15 q^3+\left( 8 \sqrt{1-2 q}-25\right) q^2\nonumber \\&\quad +q-8 \sqrt{1-2 q}+2 \sqrt{q} \left( 8 \sqrt{1-2 q}-5\right) +5\Bigg ). \end{aligned}$$
    (20)
  3. (3)

    For \(4/9<q<0.5\): the intersection \(D\cap D_2\) is the triangle MIP where \(M=(-q,-(1-q))\)

    • M and I are connected by the line \(y=\frac{(1-q)x}{q}\),

    • I and P are connected by the line \(y=-q\),

    • P and M are connected by the line \(y=\frac{qx-(1-2q)}{1-q}\).

    In this case

    $$\begin{aligned} p_3^\mathrm{PD}&=\frac{1}{1-2q}\mathrm {Area}(D\cap D_2) \\ {}&=\frac{1}{1-2q}\mathrm {Area}(MIP) \\ {}&=\frac{1}{2(1-2q)}\Big (\frac{q^2-3q+1}{q}\\&\quad +\frac{q^2}{1-q}\Big )\Big (1-2q\Big ) \\ {}&=\frac{1}{2}\frac{(1-2q)^2}{q(1-q)}. \end{aligned}$$

In conclusion

$$\begin{aligned} p_3^\mathrm{PD}={\left\{ \begin{array}{ll} \frac{1}{1-2q}\Big [-\frac{2(q^3+3q^2+(4\sqrt{1-2q}-6)q-2\sqrt{1-2q}+2)}{3q}-\frac{1}{2}\frac{q^3}{(1-q)}\Big ],\quad 0\le q\le \frac{3-\sqrt{5}}{2},\\ \frac{-16 \left( \sqrt{1-2 q}-1\right) q^{3/2}+2 q^{5/2}+15 q^3+\left( 8 \sqrt{1-2 q}-25\right) q^2+q-8 \sqrt{1-2 q}+2 \sqrt{q} \left( 8 \sqrt{1-2 q}-5\right) +5}{6 \left( \sqrt{q}-1\right) ^3 \left( q^{3/2}+q\right) },~\frac{3-\sqrt{5}}{2}<q\le 4/9,\\ \frac{1}{2}\frac{(1-2q)^2}{q(1-q)},\quad 4/9<q<0.5. \end{array}\right. } \end{aligned}$$

This completes the proof of this theorem. \(\square \)

3 Summary and outlook

It has been shown that in many social and, more generally, biological settings mutation is non-negligible [30, 37, 40]. How mutation affects the complexity and bio-diversity of the evolutionary systems is a fundamental question in evolutionary dynamics [24, 32]. In this paper, we have addressed this question for random social dilemmas by computing explicitly the probability distributions of the number of equilibria in term of the mutation probability. Our analysis based on random games is highly relevant and practical, because it is often the case that one might know the nature of a game at hand (e.g., a coordination or cooperation dilemma), but it is very difficult and/or costly to measure the exact values of the game’s payoff matrix. Our results have clearly shown the influence of the mutation on the number of equilibria in SH-games and PD-games. The probability distributions in these games are much more complicated than in SD-games and H-games and significantly depend on the mutation strength. For a summary of our results, see again Box 1 and Fig. 1. Our analysis has made use of suitable changes of variables, which expressed the probability densities in terms of area of certain domains. For future work, we plan to generalise our method to other approaches to studying random social dilemmas such as finite population dynamics and payoff disturbances [2, 3, 16, 36], as well as to multi-player [21, 27, 33] and more complex social dilemma games such as the climate change and technological race interactions [14, 35].