## Abstract

The emergence and abundance of cooperation in nature poses a tenacious and challenging puzzle to evolutionary biology. Cooperative behaviour seems to contradict Darwinian evolution because altruistic individuals increase the fitness of other members of the population at a cost to themselves. Thus, in the absence of supporting mechanisms, cooperation should decrease and vanish, as predicted by classical models for cooperation in evolutionary game theory, such as the Prisoner's Dilemma and public goods games. Traditional approaches to studying the problem of cooperation assume constant population sizes and thus neglect the ecology of the interacting individuals. Here, we incorporate ecological dynamics into evolutionary games and reveal a new mechanism for maintaining cooperation. In public goods games, cooperation can gain a foothold if the population density depends on the average population payoff. Decreasing population densities, due to defection leading to small payoffs, results in smaller interaction group sizes in which cooperation can be favoured. This feedback between ecological dynamics and game dynamics can generate stable coexistence of cooperators and defectors in public goods games. However, this mechanism fails for pairwise Prisoner's Dilemma interactions and the population is driven to extinction. Our model represents natural extension of replicator dynamics to populations of varying densities.

## 1. Introduction

Cooperative behaviour is abundant in animal and human societies (Binmore 1994; Colman 1995; Dugatkin 1997; Doebeli & Hauert 2005). Well-known examples include vampire bats regurgitating blood to feed hungry conspecifics (Wilkinson 1984), sticklebacks inspecting predatory pikes preferably in pairs (Milinski 1987), alarm calls from watchful sentinels warning other meerkats from predators (Clutton-Brock *et al*. 1999), musk oxen defending their young against wolves in groups (Wilkinson & Shank 1977), etc. In all these examples, cooperative individuals provide a benefit to one or more individuals at some cost to themselves. However, this behaviour is prone to exploitation by defectors that readily accept support but avoid the costs of assisting others. In the complex society of humans, social interactions lead to multifaceted dilemmas of cooperation. This is most apparent in the consumption of various kinds of public resources, which include public transportation, social welfare, drinking water or clean air. All such resources are prone to exploitation and overuse, as exemplified by the metaphor of the *The tragedy of the commons* (Hardin 1968). Over the past decades, a number of mechanisms have been suggested which are capable of supporting cooperation in absence of genetic relatedness. Most notably, this includes repeated interactions and direct reciprocity (Trivers 1971; Axelrod & Hamilton 1981), punishment (Clutton-Brock & Parker 1995; Fehr & Gächter 2002), spatially structured populations (Nowak & May 1992; Hauert & Doebeli 2004) or voluntary participation in social interactions (Hauert *et al*. 2002*b*). Unique to humans is apparently the capacity for indirect reciprocity (Alexander 1987; Nowak & Sigmund 1998, 2005) and the internalization of benefits as a foundation for moral systems.

Traditionally, the problem of cooperation in social dilemmas (Dawes 1980; Hauert *et al*. 2006) is investigated by means of the game theoretical models of the Prisoner's Dilemma for pairwise interactions and, more generally, public goods games for groups of interacting individuals (Kagel & Roth 1995). In a typical public goods experiment, an experimenter endows, for example, four players with 10 dollars each. All players then have the opportunity to invest their money into a common pool knowing that the experimenter will double the total amount and divide it equally among all participants, irrespective of whether they contributed. Thus, if everybody invests their money, each player ends up with 20 dollars, i.e. doubles the invested money. However, every player faces the temptation to defect, because each invested dollar returns only 50 cents to the investor. Consequently, the rational, selfish solution is to withhold the money and attempt to free ride on the other players' contributions—but if everybody follows this reasoning, no one increases the initial capital and foregoes the benefits of the public good.

In formal terms, the payoffs for cooperators and defectors in a group with *k* cooperators is given by(1.1a)(1.1b)where *r* denotes the multiplication factor, *c* the cooperative investment and *N* the size of the group engaging in public goods interactions. For simplicity, the costs *c* are set to unity in the remainder of the text. Note that for pairwise interactions (*N*=2), the public goods formalism can be easily mapped onto the traditional formulation of the Prisoner's Dilemma in terms of costs that a cooperator incurs and benefits that accrue exclusively to their interaction partners (Hauert & Szabó 2003).

In populations of interacting individuals, the dynamics of cooperators and defectors in the public goods game is determined by their respective payoffs obtained in randomly formed groups of *N* individuals. Thus, any given focal individual finds itself in a group with other individuals. If *x* is the frequency of cooperators in the population, then the chance that *k* of those other individuals are cooperators isThis probability is independent of whether the focal individual is a cooperator or a defector. Therefore, every focal individual encounters the same expected number of cooperators, and hence the same expected payoff from the other players during game interactions. From this it follows that the only determinant of success in the well-mixed public goods game is the payoff that the focal individual receives from itself. This payoff is zero if the focal individual is a defector, and is equal to if the focal individual is a cooperator. The traditional formulation of public goods games requires , such that defectors are better off and *x*=0 is globally stable. Conversely, for *r*>*N*, the social dilemma posed by the public goods game is relaxed and cooperation dominates. However, also note that even in this case, defectors are better off than cooperators in any group consisting of both types. The fact that evolution nevertheless favours cooperation represents an instance of Simpson's paradox (Simpson 1951; Hauert *et al*. 2002*b*). This follows by noting that in this case cooperators receive, on average, higher payoffs than defectors according to the argument given above.

The basic idea of the present paper is that if the public goods game is played in populations of varying densities, then the effective group size *S* of the public goods interactions also varies. Small population densities result in small effective group sizes and vice versa if population densities are large. Assuming that birth rates are proportional to payoffs, population growth is small or negative if defectors abound, because payoffs in groups with many defectors are low according to equations (1.1*a*) and (1.1*b*). However, if population densities decrease, then the effective interaction group size *S* also decreases until eventually *r*>*S* holds and cooperation is favoured. Thus, we expect scenarios where large population densities favour defection, leading to a decrease in population density and hence to a decrease in *S*, which, in turn, favours cooperation. Here, we show that this feedback between game dynamics and ecological dynamics can maintain cooperation and lead to stable coexistence of cooperators and defectors.

## 2. Game dynamics and population dynamics

In order to combine game dynamics and population dynamics in a replicator equation, we assume that *x* denotes the fraction of cooperators, *y* the fraction of defectors and the fraction of empty space. Thus, denotes a normalized population density, such that 0 corresponds to extinction and 1 is the maximal population density. The fractions *x* and *y* determine the average payoffs of cooperators, , and of defectors, , at any given point in time, as detailed below. To determine the dynamics of *x*, *y* and *z*, we assume that cooperators and defectors die at a constant rate *d* and give birth at a rate proportional to their average payoffs. We also assume that reproduction can only occur into empty space, so that birth rates are proportional to *z*. This leads to the following population dynamic model:(2.1a)(2.1b)(2.1c)This system of equations represents a natural extension of the replicator dynamics (Taylor & Jonker 1978; Hofbauer & Sigmund 1998). If the population density is kept constant by adjusting the death rate accordingly, i.e. by setting (where denotes the mean fitness), then the traditional replicator dynamics is recovered.

The average payoffs or fitnesses and are determined by public goods interactions in randomly formed groups. These interaction groups are formed by interpreting the densities as probabilities for drawing a particular strategy and for failing to find a participant, respectively. The general idea is that for large proportions of empty space *z* individuals typically find themselves in small groups of interacting individuals, and vice versa if *z* is small. Specifically, we envisage a scenario in which interaction groups are formed randomly in such a way that the available *N* places are randomly filled with either cooperators or defectors, or are left empty, according to the probabilities *x*, *y* and *z*, respectively; in particular, if *z*>0 individuals typically find themselves in interaction groups of size . Thus, the chance that an individual finds itself in a group of size is given by the chance to find interaction partners:(2.2)If an individual finds itself in a group of size *S*, it faces *m* cooperators and defectors among its interaction partners with probabilityIt follows that the average payoffs to defectors and cooperators, and , in a group of size *S* are(2.3a)(2.3b)Taking the weighted average over all possible group sizes *S*, with the weights given by the probabilities described by equation (2.2), yields the average fitness of defectors and cooperators asEvaluating the sums, this yields(2.4a)(2.4b)where(2.5)We note that could in principle become negative, in which case it could not be interpreted as a birth rate. However, positivity of can be achieved by adding a constant baseline birth rate to both and . As long as the death rate is assumed to be larger than this baseline birth rate, populations cannot persist in the absence of public goods interactions, and the results will be qualitatively unchanged. Therefore, we carry out the analysis based on equations (2.4).

We note that we have excluded groups with *S*=1, in which only a single individual joins the public goods game, because this no longer refers to social interactions and cooperation becomes trivial for *r*>1. Thus, the exclusion of such groups is a conservative assumption that nevertheless does not affect the qualitative conclusion that population dynamics can promote cooperation. However, we note that due to this restrictive assumption, cooperation cannot persist for *N*=2, i.e. in the Prisoner's Dilemma. In this case, there is no smaller effective group size that would favour cooperation. The parameter *N* simply acts as an upper bound for the interaction group size. We also note that since interaction groups are formed at random, there is no spatial structure in this model.

### (a) Homogenous populations

When analysing equations (2.1*a*)–(2.1*c*), it is useful to first consider the special cases where one of the two strategies is absent. In the absence of cooperators (*x*=0), the average payoff of defectors is and hence , such that defectors decrease in frequency and eventually vanish and the system converges to the steady state *z*=1.

Conversely, in absence of defectors (*y*=0), the dynamics becomes more interesting. In this case, , and depending on the values of the parameters *N*, *r* and *d*, the system has one to three fixed points determined by the roots of (see figure 1). If the death rate *d* is larger than the maximum of the function , i.e. if , then the population goes extinct . However, if , then cooperation can persist for sufficiently large initial densities (see figure 1). If is too small, fitness benefits from public goods interactions are insufficient to prevent extinction, because individuals are not encountering sufficiently many interaction partners. The fact that population persistence hinges on sufficiently high population densities relates to the Allee effect (Stephens 1999), which describes a positive correlation between population density and *per capita* growth rate, such that at low densities, populations become prone to extinction, typically due to increasing difficulties in finding mating partners.

### (b) Heterogenous populations

Interestingly, population dynamics enables cooperators to survive even when facing exploitation by defectors. In order to analyse this scenario, we introduce the new variable , i.e. the relative proportion of cooperators, and rewrite equations (2.1*a*)–(2.1*c*) as(2.6a)(2.6b)Here, is given by equation (2.5). Thus, the dynamics unfold in a rectangle determined by and . The dynamics on the boundaries of this rectangle are easily understood. The boundaries *f*=0 and 1 represent the two homogenous scenarios discussed in §2*a*. Thus, *z* converges to 1 on the boundary *f*=0 (no cooperators), and the dynamics on the boundary *f*=1 has one to three equilibria, corresponding to extinction or possible persistence of cooperators (see figure 2).

The boundary *z*=1 is attracting, as it is easy to see that for sufficiently small population densities , holds. Thus, states where the population goes extinct are locally attracting, essentially because at low population densities, there are not enough public goods interactions to sustain positive growth rates. In contrast, the opposite boundary with maximal population density (*z*=0) is repelling, (see equations (2.6*a*) and (2.6*b*)), because offspring production is limited by available space, i.e. proportional to *z*.

Our analysis of the behaviour in the interior of the phase space reveals four qualitatively different dynamic regimes, which are illustrated in figure 2. These regimes depend largely on the existence of interior equilibrium points. Such points are of the form , where is solution of and where . It follows from the results in Hauert *et al*. (2002*a*) that has at most one solution in the interval , and hence the dynamical system (2.6*a*) and (2.6*b*) admits at most one equilibrium point in the interior of the phase space.

In general, if exists, its stability depends on parameter values. Specifically, standard stability analysis shows that the equilibrium is locally stable whenever (i.e. whenever the total population density at the equilibrium is higher than the population density that can sustain the highest death rate in the absence of defectors, see figure 1). Moreover, the equilibrium is always a focus (i.e. the two eigenvalues of the corresponding Jacobian matrix are never real).

Figure 2*a* illustrates the first regime, in which exists and is a stable focus . The basin of attraction of is substantial, but it does not span the entire phase space. Whenever defectors abound or population densities are too small, populations remain unable to recover from exploitation and disappear. However, inside the basin of attraction, the system exhibits oscillatory behaviour with decreasing amplitude as the system converges to , which represents stable coexistence of cooperators and defectors.

Increasing the death rate *d* generates the second regime, which is illustrated in figure 2*b*. Larger *d* increases and eventually crosses the boundary *f*=1. Once has disappeared, the pure cooperator saddle point, which is stable along the boundary *f*=1, becomes a stable equilibrium. In this case, cooperators and defectors cannot coexist, but cooperators may survive depending on initial conditions. Otherwise, the whole population goes extinct. Note that for further increases of *d*, the fixed points along *f*=1 collide and disappear , as explained in §2*a* (cf. figure 1).

A stable interior equilibrium may be destabilized by decreasing the multiplication factor *r*, which generates the third dynamic regime (figure 2*c*). In this case, is an unstable focus and the system invariably converges to the line of fixed points with *z*=1, corresponding to extinction of the population. However, owing to the presence of the unstable focus, the system may exhibit oscillatory behaviour, depending on initial conditions. Owing to the instability of the equilibrium, the amplitude of the oscillations keeps growing and the population eventually disappears.

Increasing the death rate *d* in this third scenario generates the final regime, which is illustrated in figure 2*d*. Once has disappeared, the low-density saddle point, which is unstable along *f*=1, becomes unstable in all directions. This change precludes oscillatory behaviour, but does not affect the evolutionary outcome, and the system keeps converging to the line *z*=1. This scenario also applies to public goods interactions with *r*<2, for which no solution to exists (Hauert *et al*. 2002*a*) and cooperators are always worse off than defectors . For *r*<2, cooperation cannot be favoured, because the effective group size is and thus never falls below *r*. Note that this scenario includes pairwise Prisoner's Dilemma interactions because *N*=2 implies *r*<2. Also note that decreasing *r* in the second regime (figure 2*b*) again destabilizes cooperation and generates this final regime where populations eventually disappear.

## 3. Conclusions

The public goods game is a basic and general mathematical metaphor for the problem of cooperation in groups of *N* interacting individuals. For any multiplication factor *r*<*N*, defectors dominate and cooperators vanish. In contrast, we have demonstrated that by combining game dynamics and ecological dynamics, cooperators may thrive if the average population payoff determines the population growth rate. Cooperation can be maintained because decreasing population densities can reduce the effective interaction group size *S* to a point where *r*>*S*. In these groups, the social dilemma is relaxed and cooperation is favoured. Conversely, high population densities generate large effective interaction group sizes *S*, in which *r*<*S*, so that defection is favoured. Thus, if populations are large and defection is favoured, average fitness is low and populations decrease, while if populations are small a high frequency of cooperation leads to high average fitness and triggers an increase in population density. The main result of this paper is that this eco-evolutionary feedback can stabilize cooperation at intermediate frequencies (figure 2). At equilibrium, the population density is such that the expected size of the interaction groups is exactly equal to the multiplication factor *r*, so that cooperators and defectors have equal payoffs.

Similar effects promoting cooperation based on variable sizes of the group engaging in public goods interactions were observed in Hauert *et al*. (2002*b*). These authors introduced a third strategic type, the loners. Loners are risk averse and do not participate in the public goods game, and instead rely on small but fixed earnings. Thus, the presence of many loners implies small interaction groups for the public goods game. This generates a rock–scissors–paper type cyclic dominance of cooperators, defectors and loners: if the population mainly consists of defectors, then the loner's payoff is higher than the average fitness, and hence the frequency of the loners increases. As the loner frequency increases, the size of the interaction groups decreases, so that eventually cooperation becomes advantageous and takes over. This, in turn, creates the conditions for defectors to thrive and the cycle continues. The cyclic dynamics has actually been verified in experiments where students opted for the three behavioural options in a periodically alternating manner (Semmann *et al*. 2003). In contrast to the ecological model presented here, the inclusion of loners cannot create a locally stable interior equilibrium at which cooperators and defectors persist. Nevertheless, the two scenarios are similar in that in both cases, a third variable is introduced (empty space and loners, respectively), and the dynamics of this third quantity mediates the transitions between the different regimes in the public goods game. However, also note that both scenarios fail to promote cooperation in pairwise Prisoner's Dilemma interactions—in one case only loners survive and in the other the population goes extinct altogether.

Figure 2 gives a complete classification of the configuration and stability of equilibrium states occurring in the model given by equations (2.1*a*)–(2.1*c*). If the interior equilibrium at which cooperators and defectors coexist is present, it is always a focus, i.e. small perturbation away from generates oscillatory dynamics. In principle, destabilization of would therefore open up the possibility of a Hopf bifurcation and of stable limit cycles, leading to cyclic coexistence between cooperators and defectors. However, extensive numerical simulations indicate that such stable limit cycles do not occur in this model. It would be interesting to investigate suitable extensions and modifications of the model that would generate limit cycles. One extension that seems particularly worthwhile is the continuously varying cooperative strategies, rather than just the all-or-nothing strategies cooperate and defect, and how ecological feedback mechanisms affect the evolutionary dynamics of continuous cooperative investments. Continuously varying cooperative investments can lead to interesting new insights and scenarios (Killingback *et al*. 1999; Wahl & Nowak 1999), including evolutionary diversification of cooperative investments levels (Doebeli *et al*. 2004).

Biologically, the models studied here correspond to scenarios in which the size of interaction groups only varies as a consequence of variation in the overall population density. However, one could also imagine scenarios in which the size of an interaction is influenced by how many defectors and cooperators it contains. For example, the tendency of individuals to join an interaction group might depend on the expected benefit from joining the group, and hence on the number of cooperators it contains. Moreover, this tendency might itself be an evolving trait (Aviles 2002). Even if joining the group is not a behavioural choice, the marginal benefit obtained from having an additional cooperator added to an interaction group could depend on how many cooperators the group already contains. Thus, benefits from cooperation could be saturating or synergistic (Hauert *et al*. 2006). It would be interesting to extend the model presented here to such scenarios.

Furthermore, it would also be interesting to develop empirical tests of the role of ecological dynamics for the evolution of cooperation. There are a number of experimental model systems that could be used for such studies (Doebeli & Hauert 2005). For example, Greig & Travisano (2004) reported that in the yeast *Saccharomyces cerevisiae*, selfish strategies that do not produce an enzyme needed for digestion of sucrose do well when population densities are large, but fare poorly compared to cooperators producing the enzyme when population densities are small. This indicates that there is the potential for an ecological feedback to maintain cooperation as envisaged in our models.

In conclusion, our model represents a step towards understanding how the interplay between population dynamics and game dynamics can affect the evolution of cooperation. The results reported here demonstrate that ecological feedback mechanisms can facilitate the origin and maintenance of cooperation in public goods interactions.

## Footnotes

↵† Present address: Courant Institute of Mathematical Sciences, New York University, 251 Mercer Street, New York, NY 10012, USA.

- Received February 7, 2006.
- Accepted April 28, 2006.

- © 2006 The Royal Society

## References

## Notice of correction

A Corrigendum to this article was published on 26 July 2007.