We use the following public goods game to study the evolution of cooperation in social dilemmas. We assume that

*n* individuals each make an investment

*x*_{i} in a public good, where each

*x*_{i} (

*i*=1,

…,

n) is a real number between 0 and some positive maximum value

*V*. The payoff to individual

*i* is given by

, where

*k* is a positive constant (which can be viewed as the ‘interest rate’), and

denotes the strategy profile of the individuals in the group. The first term in this expression represents the benefit that the individual gets from the public good, while the second term represents the cost of making the investment. This definition extends the notion of a public goods game that is used in experimental situations to a general game with continuous investments. In our formulation of the public goods game, we have assumed that the interest rate

*k* is a constant, independent of the group size

*n*. This is a standard assumption in work on the public goods game: however, we note that, in principle, we could also consider a variant of our model in which

*k* depends on

*n*. We also note that in our formulation of the game the strategy is an arbitrary real number between 0 and

*V*. This definition extends the standard discrete strategy public goods game. In principle, it is also possible to consider more complex strategies that depend explicitly on the group size

*n*, but we will not do this here.

Since the payoff can be written as

, it is clear that, for

, every individual will maximize its payoff by making zero investment, irrespective of the investments made by the other individuals (i.e. for 1<

*k*<

*n* defection is the dominant strategy). However, if all the players make zero investment, they each receive a payoff

*E*_{0}=0, while if every player instead invested

*V* they would each receive the larger payoff

*E*_{V}=(

*k*−1)

*V*. This is a social dilemma: groups of cooperators outperform groups of non-cooperators, but it is always individually advantageous to cheat by not cooperating.

For 1<

*k*<

*n*, the public goods game is a social dilemma and zero investment is the individually optimal strategy. More generally, if the public goods game is considered as an evolutionary game (

Maynard Smith 1982), then selection will always result in individuals making zero investment, even for

*k*>

*n*. This follows from the fact that, in any group, for any

*k*, low investors obtain a greater payoff than higher investors. In the evolutionary context, we consider a population of

*N* individuals, each making an investment

*x*_{i}. We assume that all individuals in the population participate in the public goods game. The fitness of individual

*i* is taken to be

, which is always positive. We assume that individuals reproduce in proportion to their fitness, subject to the condition that the total population size remains constant. During reproduction mutations can occur, which change the investment level of the offspring. If we denote the lowest investing strategy in the population by

*x*_{i} then, since

, for all

*j*≠

*i*, strategy

*x*_{i} will go to fixation. Consequently, the average level of investment in the population will evolve to zero as selection consistently favours lower investing mutants. Evolutionary simulations confirm this result (see ).

Since cooperation cannot evolve in the public goods game in a well-mixed population, it is important to consider the effect of other population structures. In many social situations, individuals do not interact with all members of the population in every generation—rather, in a given generation, individuals only interact socially with a sub-group of the population. Consider now the total population to be composed of *m* disjoint interaction sub-groups. We assume that each individual in the population obtains a payoff by playing the public goods game with the other individuals in its interaction group. We also assume that individuals compete with all other individuals in the population. Thus, social interactions are local, while competition is global. We implement the assumption of global competition by having individuals reproduce in their group in proportion to their fitness, subject to the condition that the total population size remains constant. To achieve this constraint on the total population size we allow individuals to reproduce in their group (in proportion to their fitness) and then rescale the size of all groups to maintain a constant total population size. During reproduction occasional mutations occur, which change the investment level of the offspring. Finally, a fraction *d* of the individuals in each group disperses randomly to the other groups in the population. We assume that initially all groups are of equal size, containing *n*>*k* individuals, so the public goods game in each group is a social dilemma. We also assume that, if any group consists of only a single individual, then this individual does not play the public goods game, and receives zero payoff.

Despite its simple definition, it is not easy to study this group-structured model analytically. Thus, our investigation is based on extensive evolutionary simulations (source code available in the electronic supplementary material). Our simulations show that the evolution of cooperation in such a group-structured population can be dramatically different from that in a well-mixed population and that with such a population structure substantial cooperative investments can readily evolve from low initial levels and be maintained indefinitely. Typical simulation results are shown in . The following mechanism is responsible for the evolution of cooperation in the group-structured situation. The combination of reproduction within groups and limited random dispersal among groups results in groups of varying size (although the mean group size remains constant at

*n*). For certain parameter values the variation is such that groups with fewer than

*k* individuals form. In such groups, the public goods game is no longer a social dilemma, in that zero investment is no longer the dominant strategy. Although lower investors always have greater fitness than higher investors, in any given group, it is now possible that Simpson's paradox (

Sober & Wilson 1999;

Hauert *et al*. 2002) applies—the fitness of higher investors, when averaged over all groups, will be greater than that of lower investors—and higher investors will increase in frequency. Thus, interaction and reproduction within groups, together with limited dispersal among groups, results in a natural mechanism for the evolution of cooperation. The exact range of dispersal values for which cooperation is maintained depends on the parameters in the model. We find that there exists a significant region of dispersal values for which cooperation evolves for a wide variety of parameter choices (see ).