Browse Subject Areas

Click through the PLOS taxonomy to find articles in your field.

For more information about PLOS Subject Areas, click here.

  • Loading metrics

The evolution of sleep is inevitable in a periodic world

  • Jared M. Field,

    Roles Formal analysis, Investigation, Project administration

    Affiliations Wolfson Centre for Mathematical Biology, Mathematical Institute, University of Oxford, Oxford, United Kingdom, Mathematical Ecology Research Group, Department of Zoology, University of Oxford, Oxford, United Kingdom

  • Michael B. Bonsall

    Roles Supervision, Writing – review & editing

    Affiliation Mathematical Ecology Research Group, Department of Zoology, University of Oxford, Oxford, United Kingdom

The evolution of sleep is inevitable in a periodic world

  • Jared M. Field, 
  • Michael B. Bonsall


There are two contrasting explanations of sleep: as a proximate, essential physiological function or as a behavioral, adaptive state of inactivity and these hypotheses remain widely debated. To investigate the adaptive significance of sleep, we develop an evolutionary argument formulated as a tractable partial differential equation model. We allow demographic parameters such as birth and mortality rates to vary through time in both safe and vulnerable sleeping environments. From this model we analytically calculate population growth rate (fitness) for sleeping and non-sleeping strategies. We find that, in a temporally heterogeneous environment, sleep behavior always achieves a higher fitness than non-sleeping behavior. As organisms do not exist in constant environments, we conclude that the evolution of sleep is inevitable. Further, we suggest that the two contrasting theories need not be mutually exclusive.


Most attempts to explain the evolution of sleep, a vulnerable state observed across diverse taxa, have tended to focus on a search for benefits associated with physiological or vital functions. Sleep, it has been proposed, evolved because there is a universal core function that cannot occur during wakefulness. Indeed, it has been suggested that sleep can reduce oxidative stress accumulated during wakefulness [13], implicated in memory consolidation [4] and hypothesized to be necessary in heat regulation [5]. These and other theories, however, fail to explain either the diversity of sleep patterns observed in nature [6] or the existence of sleep or sleep-like behaviors in some organisms. It is difficult, for example, for the information processing theory of sleep [7] to account for lethargus, the sleep-like state in C. elegans [8].

An alternative perspective is to view sleep as an adaptive state of inactivity [9]. Sleep and sleep-like states have value insofar as they allow for efficient use of finite energy. Moreover, they may in some instances actually reduce the risk of injury and/or predation [9]. It is important to note that this adaptive view of sleep evolution does not exclude the existence of other vital functions. Indeed, there is no reason to suspect these functions did not evolve later via exaptation. A major objection to this view, however, is that if sleep is adaptive why do we not find organisms that have adapted to not sleep [10]? To be more precise, one should expect the costs and benefits of sleep to vary drastically across species in different ecologies and thus, one might expect to find scenarios where the costs outweigh the benefits. Even this question, of whether all organisms have sleep or sleep-like states, is still widely debated [11].

At the core of this particular debate is disagreement over the definition of sleep. Broadly speaking, there is the physiological definition (characterized by certain brain activities) and the behavioral definition (characterized by inactivity and arousal thresholds). Some organisms, like dolphins, sleep according to one definition but not the other [9]. While research concerning the physiological definition is important, the behavioral definition presents the evolutionary puzzle.

Issues relating to lowered arousal thresholds involve the collection of information and this theme has been developed and recently extended elsewhere [1214]. We have shown that there are certain periods when the collection of information will decrease an organism’s fitness. In this way, we should expect organisms to sometimes be disconnected from their environment. For this reason, here we focus on the inactivity aspect of sleep. However, in the discussion we link those results with the conclusions of this paper and show that these lowered arousal thresholds occur precisely when we find activity should be lowest. In this way, we cover both the characterizations of the behavioral definition of sleep.

In this paper, we present a model for the behavioral, adaptive theory of sleep and in particular its inactivity characterization. This is in contrast to the model in [15], which investigates how predator-prey interactions produce particular sleeping patterns or as in [16], which studies behavioral shutdown. Both of these papers, as do others, assume a priori that sleep serves a separate function—here, we do not. Our model is formulated as a continuous partial differential equation (PDE) akin to the McKendrick-von Förster equation of classical demography [17]. However, we allow basal demographic and ecological parameters, such as birth and mortality rates, to vary through time. We then weight these basal parameters by sleep strategies or functions that quantify activity to find effective mortality and birth rates for a particular strategy. A constant-value sleep function is taken to describe no sleep, whereas oscillations about this value are taken to reflect a sleeping strategy; the cost of higher activity at some times is offset by lower activity (sleep) at other times. We ensure, however, that over a sleep cycle the total amount of activity (defined as the integral over the sleep function) is the same. This way, when we compare the fitnesses of a sleeping and non-sleeping strategy, we are able to evaluate comparable activity strategies. We stress that the period of these cycles need not necessarily correspond to one day. The cave dwelling A. mexicanus, for example, has sleep bouts in the order of 2-5 minutes during the night [18].

Our analyses show that when birth or mortality rates are non-constant, there is always a sleep strategy that achieves a fitness higher than the no sleep strategy. Indeed, we show that in a heterogeneous environment the evolution of sleep is inevitable. Further, contrary to the major objection of the adaptive view of sleep, one should only expect to find an organism that does not sleep in a purely constant environment. That is, in the wild we should in fact not expect to find organisms that have evolved to forgo sleep. Interestingly, it suggests that we may be able to evolve them in the lab.

The rest of this paper is organized as follows: In the next section we explain the model and assumptions. Following this, we present analytic calculations of population growth rate, which we use as a measure of fitness [19, 20]. We then go on to compare sleeping and non-sleeping strategies under constant and non-constant mortality and birth rates. We additionally consider different sleeping environments where sleeping is assumed to either increase or decrease mortality. Finally, we summarize our findings and suggest future work.

Materials and methods


We start by defining n(t, τ, x) the population density of organisms employing a given strategy at time t, time they last consumed food τ, and age x. We say that a population has a different strategy if it has a different sleep function s(t) that quantifies how active an organism is at any time t. We take large values of s(t) to represent highly active periods and values approaching zero to represent inactive periods. In this way, if we let α(t) be the baseline foraging success rate then α(t)s(t) will quantify the foraging success rate for a strategy with sleep function s(t). With this form, an organism that is active (high s) when the resources or prey it consumes are plentiful (high α) will be more successful than one that is inactive (low s) at the same time.

Similarly, we denote the basal mortality rate γ(t) which we weight more generally by a function f(s), giving an effective mortality of γ(t)f(s). The functional form of f will change depending on the particular ecological scenario under consideration. In particular, this will alter depending on if we assume sleeping increases or decreases predation rates.

The rate of change of the population density with sleep strategy s can now be written as (1) Successful foraging appears to reduce population size here because if resources are found, then the time they last consumed food, τ, is reset to zero. To be clear, individuals are not lost but are transferred to the boundary so that when τ = 0 we have (2) where d is the maximum time an organism can live without food.

If we denote the birth rate by β(t), then similarly when x = 0 we have (3) where m is the maximum life span. In (3), we assume that activity levels affect effective birth rates as they do foraging successes—an organism that is sleeping while potential mates are available will enjoy less success than those that are awake.

Using the chain rule on the right-hand-side of (1) this becomes (4) where, being in the same units, we have taken /dt = 1 and dx/dt = 1.

Finally, we close this hyperbolic system (2)–(4) with the initial condition (5)

Population growth rate

To compare different strategies we will eventually use population growth rate as a measure of fitness. To get us there, we start by integrating the left-hand-side of (4) with respect to τ. Doing so gives (6) by the Fundamental Theorem of Calculus. As d is the maximum time an organism can survive without food, such that n(t, d, x) = 0 and n(t, 0, x) is given by (2), we can express the right-hand-side of (6) as (7) If we define N(t) such that (8) which is the total population at any time and integrate the left-hand-side of (6) and (7) with respect to x we obtain (9) by assuming n is sufficiently smooth so we can change the order of integration. As m is the maximum life span n(t, τ, m) = 0 and as n(t, τ, 0) is given by (3) we can write (9) as (10) Finally, performing the same integrations, but on the right hand side of (4), and equating to the right hand side of (10), we find that the dynamics of N are described by (11) which has solution (12) Hence the growth of any population with strategy s(t) will be characterized by (13)

Constant birth & mortality rate

For the moment, we assume that γ(ρ) = Γ is constant and f(s) = 1 so that mortality is unaffected by sleep. We start by comparing the fitness of organisms with different sleep functions when the birth rate has the constant value β(ρ) = B. We denote the fitness of an organism with constant activity (s(ρ) = 1) by r1 which, from (13), is given by (14)

We take the simple function s(ρ) = 1 + cos ρ as an example sleep function. This way, the activity of this phenotype oscillates about the awake case of s(ρ) = 1, benefiting from higher activity levels at some times at the cost of lower activity at others (as in Fig 1). We do not expect that this form will coincide with the sleep pattern of any organism in particular. It is a convenient fiction that aids the demonstration of a principle. We denote the fitness of this phenotype by r2 which, again by (13), is given by (15) Note that r2 oscillates about r1 so that on average neither phenotype will have a higher fitness than the other. In other words, sleeping is selectively neutral.

Fig 1. Sleep function s(ρ) = 1 + cos(ρ) oscillating about the constant case of s(ρ) = 1.

Observe the cost of higher activity at some times is lower activity at others.

Variable birth rate & constant mortality rate

We now consider a birth rate that oscillates about the constant case. This variation may arise for a variety of reasons, and may include availability of resources or availability of mates. In particular, we take β(ρ) = B(1 + cos ρ). In this case, we find r1 to be given by (16) whereas r2 is given by (17) Oscillations aside, observe that the coefficient of t is larger in r2 than in r1 so that for almost all t (18)

In Fig 2 we present a typical plot of r1 (dashed line) and r2 (solid line) as a function of time, showing that r2 > r1. The precise parameter values have no significance of themselves but demonstrate that for large times the oscillations are unimportant.

Fig 2. Typical population growth rates r1 (dotted line) and r2 (solid line) as a function of time when birth rates are variable and mortality is constant.

Observe that r2 > r1 for almost all t. Here B = 5 and Γ = 2.5.

Hence, subject to a constant mortality rate and oscillating birth rate one should expect an organism that sleeps to have a greater fitness than one that does not.

Constant birth rate & variable mortality rates

In the case where birth rate and activity are constant but mortality is variable such that γ(ρ) = Γ(1 + cos ρ), again from (13), we find that (19)

Sleep in a vulnerable environment

We now consider the case where f(s) = max ss, is a decreasing function of s. This way, if an organism is sleeping (low s) it increases its mortality rate. This we take to model the situation of an organism sleeping in an open environment or non-socially so that the vulnerability associated with sleep increases predation. So in the case of our simple sleep function we have f(s) = 1 − cos ρ. We continue to assume that birth rates are unaffected by sleep. In this instance, we denote the associated fitness by r2v which, by (13), takes the value (20)

Sleep in a safe environment

In a safe environment whereby sleeping would be expected to decrease predation, we take f(s) = s. This may occur primarily for two reasons. First, it may be that an organism does not sleep openly but burrows or climbs away from predation. Second, an organism may sleep socially gaining the benefit of being alerted to predators by conspecifics. In this case, we choose the sleep function such that s(ρ) = 1 − cos ρ. We let the fitness under these conditions be given by r2s, which is found to be (21) Clearly, for almost all t we then have the following inequalities: (22) (23) In other words, when birth rates are constant but mortality rates oscillate there exists a sleep function in both safe and vulnerable environments such that an organism that sleeps enjoys a higher fitness than one that does not (again see Fig 3 for a typical example). Intuitively, in the vulnerable case it is best to stay most active during periods with the highest mortality. Whereas in the safe environment it is more beneficial to shift activity such that the peaks occur when mortality is lowest.

Fig 3. Typical population growth rates r1 (dotted line), r2s (solid line) and r2v (coincides with r2s) as a function of time when birth rates are constant and mortality is variable.

Observe that r2s = r2v > r1 for almost all t. Here B = 5 and Γ = 2.5.

Variable birth & mortality rates

We now consider the most general case where both birth and mortality are non-constant and affected by activity. We take the mortality function as before so that γ(ρ) = Γ(1 + cos ρ). As there is no particular reason to assume that birth rates will be in phase with mortality rates, we now take β(ρ) = B(1 + cos(ρg)), for a constant g ∈ [0, 2π). Again by (13), we find for the awake strategy s(ρ) = 1, the fitness given by (24)

Sleep in a safe environment II

Recall that in a safe environment f(s) = s, so that sleeping reduces mortality. In this case, we take the general form s(ρ) = 1 + cos(ρq), where q ∈ [0, 2π) is a constant phase shift. This way, we can quantify the fitness of a sleep strategy that is possibly out of phase by q, in an environment where the birth rate is possibly out of phase by g. This time we present only the part of the fitness that is not oscillatory, which for long times is sufficient to compare fitnesses. We do however, present the full value and details of the calculation in the Appendix. We find the non-oscillating fitness under the above conditions to be given by (25)

Sleep in a vulnerable environment II

As before, in a vulnerable environment we take f(s) = max ss. Hence, for the general sleep function s(ρ) = 1 + cos(ρw) we find that f(s) = 1 − cos(ρw), where w is another constant phase shift. Here we also only present the non-oscillatory part of the fitness, which is given by (26)

Observe that the non-oscillatory part of r1 is given by (B − Γ)t, which appears in both r2s and r2v. Notice that if for any given g we pick (27) then the extra terms in (25) are always positive. Similarly in (26), the same is true if for any given g we pick (28) While these sleeping strategies may not be the most optimal, we have nonetheless shown that in both environment types, with any degree of asynchrony between birth and mortality rates, there always exists a sleeping strategy that enjoys a higher fitness than constant activity. As before, we provide a typical example of this case in Fig 4.

Fig 4. Typical population growth rates r1 (dotted line), r2s (solid line) and r2v (coincides with r2s) as a function of time when birth rates and mortality rates are variable.

Observe that r2s = r2v > r1 for almost all t. Here, B = 5, Γ = 2.5 and g = π/3.

Results & discussion

Here we have developed a tractable model to investigate when, if at all, sleep as a behavior may be adaptive. This model allowed demographic parameters such as birth rate and mortality rate to (potentially) oscillate through time about basal values. We then defined individual sleep strategies or functions, s(t), that quantified the activity of an organism through time. We took s(t) = 1 to model an organism that remains awake indefinitely, whereas sinusoidal oscillations about this value modelled sleep. The cost of higher activity at some times was lower activity (sleep) at other times. These functions were then used as weights to find effective demographic values for an organism employing a given strategy. Again, we stress that the period of these oscillations need not correspond to one day. Further, the baseline demographic rates are permitted to be any size relative to each other. In other words, birth, death and foraging can occur at vastly different timescales. With this set-up, we were then able to compare the fitness (defined as population growth rate) of sleeping and non-sleeping strategies under an array of conditions. More accurately defined, sleep involves not just inactivity but also lowered arousal thresholds. While our model does not deal with this problem directly, we discuss how it has been addressed elsewhere (see below) [14].

When birth rates were allowed to vary but mortality kept constant, we found that a sleeping strategy achieved a higher fitness than remaining active indefinitely. We then kept birth rates constant and instead allowed mortality to vary. This split into the two cases of when sleeping would increase or decrease mortality. In both instances however, the sleeping strategy had a higher fitness. Intuitively, in a safe sleeping environment it was best to be most active when mortality was lowest. Whereas in a vulnerable sleeping environment, the converse was found to be true.

Both mortality rates and birth rates were then allowed to vary at the same time, potentially out of phase. Yet again, we found that in both environment types, there is always a sleep strategy that trumps staying awake indefinitely. Note that the sleep strategies we found in this case were not necessarily the most optimal. However, if there are strategies that are more optimal they must be of the sleeping type.

The only instance where constant activity has a fitness as good as sleeping was found to be when birth and mortality rates are constant. However, organisms do not exist in a constant world. This result nonetheless highlights that the adaptive theory of sleep is testable. Indeed, in a recent study on Drosophila, sleep duration was observed to change adaptively in response to environmental change [21]. Amongst others, this suggests that model organisms such as Drosophila have the potential for testing evolutionary and ecological theories of sleep. Designing experiments where demographic variability can be controlled and hence environmental constancy might be approximated quite well is a challenge for future work. However, instances of short-term environmental constancy coupled with almost sleeplessness have recently been observed. In periods where predation and mating rates are practically zero, and foraging constant, great frigatebirds (Fregata minor) were found to sleep very little viewed both from the physiological and behavioral definitions of sleep [22].

If the adaptive value of sleep relates to the efficient use of energy in variable environments, then why not simply evolve a state of rest? As described in other studies [9], we suggest that sleep and other quiescent states are in fact best viewed on a continuum. For instance, there is growing evidence that the dormancy in animals and plants evolves in response to varying environmental cues. A recent study argues that seed dormancy emerged at the inception of seed plants due to environmental variability [23]. While in animals, such as mosquitoes, dormancy and diapause are intimately associated with critical photoperiod length and latitudinal variation [24]. However, in general, the evolution of these periods of inactivity are best broadly viewed as adaptations towards the evolution of risk-averse strategies in fluctuating environments [25].

Nonetheless, sleep can be distinguished behaviorally from other states by significantly reduced environmental awareness. This issue is more fully treated in a separate study [14]. The relevant point here is that if an organism enters a period of certainty (with respect to the pressures that mould a certain trait), then they should not collect information about those pressures. This arises due to the costliness of information collection [14]. To be more concrete, if it is such that temporarily an organism will not be preyed upon, say, then it is in the interest of the organism to not collect information about this. However, if an organism is not collecting information then they are necessarily less aware of their environment. Now, consider for example, our simple case of sleep in a vulnerable environment (the other cases are similar). When the effective mortality rate sγ goes to zero, it should be that the probability (as in [14]) of being preyed upon also goes to zero. However, this always occurs when activity is lowest. In other words, when activity is lowest, from [14], we should also expect that organisms will have lowered arousal thresholds. In this way, both characterizations of behavioral sleep are covered.

Our analyses have hence shown that the evolution of sleep and sleep-like states is inevitable in sinusoidal environments (a good first approximation to changes in many ecologies). Sleep as a behavior is, in and of itself, valuable. While much research has been done to find vital functions that explain why organisms sleep [14, 6], here we have provided broad ecological reasons applicable to diverse taxa. This is not to say that these vital functions do not exist. Undeniably some of them do. However, they are not initially needed for sleep to evolve. Indeed, our analyses plausibly suggest that sleep first evolved simply because activity-inactivity cycles are adaptive in a non-constant world.

Given a certain ecological context we showed that there is always a sleeping strategy that gained a higher fitness than not sleeping. All of these strategies, however, changed only the amount of activity at given times. In reality, organisms change the frequency of their sleeping cycles and the length of inactive periods. In future work, it will be interesting to investigate this diversity. In particular, can we specify demographic and ecological parameters and generate optimal sleep patterns for those values?


Here we present the detailed calculation to determine the population growth rate as in (25). While we only present r for the case of a safe environment, with variable birth and mortality rates, the integrals performed here include all of the integrals necessary to calculate every other population growth rate presented.

As outlined in the main part of the paper to find r2s we need to calculate (29)

We split this larger calculation into the two smaller integrals given by (30) (31)

In the case with which we are concerned we take β(ρ) = B(1 + cos(ρg)) and s(ρ) = 1 + cos(ρq) so that, in fact, (32) Expanding this gives (33) Using the standard sum of angles formula cos(ρg) = cos(ρ) cos(g) + sin(ρ) sin(g), the first three terms are trivial to calculate.

We use the same sum of angles formula to expand the fourth term. Doing so, and collecting terms, gives (34) where we have used the sum of angles formula again to get the terms involving g + q.

Hence, to calculate I1 we need, in fact, to calculate (35) (36) We focus attention first on G1. As , from standard double angle formula, we find that (37) Using integration by parts to calculate G2 we find that (38) Putting this all together we find (39)

Recall that, in a safe sleeping environment we took f(s) = s and γ(ρ) = Γ(1 + cos ρ). Hence, to calculate I2 we simply need to replace B with Γ and set g = 0 in (39). It follows then that (40) Finally, if we take the difference of (39) and (40) the non-oscillatory parts are as in (25) in the main text, if the term is expanded once more.


We thank Thomas W. Scott for valuable comments and discussion.


  1. 1. Reimund E. The free radical flux theory of sleep. Medical hypotheses. 1994;43(4):231–233. pmid:7838006
  2. 2. Eiland MM, Ramanathan L, Gulyani S, Gilliland M, Bergmann BM, Rechtschaffen A, et al. Increases in amino-cupric-silver staining of the supraoptic nucleus after sleep deprivation. Brain research. 2002;945(1):1–8. pmid:12113945
  3. 3. Ramanathan L, Gulyani S, Nienhuis R, Siegel JM. Sleep deprivation decreases superoxide dismutase activity in rat hippocampus and brainstem. Neuroreport. 2002;13(11):1387–1390. pmid:12167758
  4. 4. Mednick S, Nakayama K, Stickgold R. Sleep-dependent learning: a nap is as good as a night. Nature neuroscience. 2003;6(7):697–698. pmid:12819785
  5. 5. McGinty D, Szymusiak R. Keeping cool: a hypothesis about the mechanisms and functions of slow-wave sleep. Trends in neurosciences. 1990;13(12):480–487. pmid:1703678
  6. 6. Campbell SS, Tobler I. Animal sleep: a review of sleep duration across phylogeny. Neuroscience & Biobehavioral Reviews. 1984;8(3):269–300.
  7. 7. Tononi G, Cirelli C. Sleep function and synaptic homeostasis. Sleep medicine reviews. 2006;10(1):49–62. pmid:16376591
  8. 8. Raizen DM, Zimmerman JE, Maycock MH, Ta UD, You Yj, Sundaram MV, et al. Lethargus is a Caenorhabditis elegans sleep-like state. Nature. 2008;451(7178):569–572. pmid:18185515
  9. 9. Siegel JM. Sleep viewed as a state of adaptive inactivity. Nature Reviews Neuroscience. 2009;10(10):747–753. pmid:19654581
  10. 10. Cirelli C, Tononi G. Is sleep essential. PLoS Biol. 2008;6(8):e216. pmid:18752355
  11. 11. Siegel JM. Do all animals sleep? Trends in neurosciences. 2008;31(4):208–213. pmid:18328577
  12. 12. McNamara JM, Dall SR. Information is a fitness enhancing resource. Oikos. 2010;119(2):231–236.
  13. 13. Pike RK, McNamara JM, Houston AI. A general expression for the reproductive value of information. Behavioral Ecology. 2016;27(5):1296–1303.
  14. 14. Field JM, Bonsall MB. Ignorance can be evolutionarily beneficial. Ecology and evolution. 2018;8(1):71–77. pmid:29321852
  15. 15. Acerbi A, Nunn CL. Predation and the phasing of sleep: an evolutionary individual-based model. Animal Behaviour. 2011.
  16. 16. Lima SL, Rattenborg NC. A behavioural shutdown can make sleeping safer: a strategic perspective on the function of sleep. Animal Behaviour. 2007;74(2):189–197.
  17. 17. Keyfitz BL, Keyfitz N. The McKendrick Partial Differential Equation and its Uses in Epidemiology and Population Study; 1997.
  18. 18. Duboué ER, Keene AC, Borowsky RL. Evolutionary convergence on sleep loss in cavefish populations. Current biology. 2011 Apr 26;21(8):671–6.
  19. 19. Fisher RA. The genetical theory of natural selection: a complete variorum edition. Oxford University Press; 1930.
  20. 20. Keyfitz N, Caswell H. Applied mathematical demography. vol. 47. Springer; 2005.
  21. 21. Slocumb ME, Regalado JM, Yoshizawa M, Neely GG, Masek P, Gibbs AG, et al. Enhanced sleep is an evolutionarily adaptive response to starvation stress in Drosophila. PloS one. 2015;10(7):e0131275. pmid:26147198
  22. 22. Rattenborg NC, Voirin B, Cruz SM, Tisdale R, Dell’Omo G, Lipp HP, et al. Evidence that birds sleep in mid-flight. Nature Communications. 2016;7. pmid:27485308
  23. 23. Willis CG, Baskin CC, Baskin JM, Auld JR, Venable DL, Cavender-Bares J, et al. The evolution of seed dormancy: environmental cues, evolutionary hubs, and diversification of the seed plants. New Phytologist. 2014;203(1):300–309. pmid:24684268
  24. 24. Bradshaw WE, Lounibos LP. Evolution of dormancy and its photoperiodic control in pitcher-plant mosquitoes. Evolution. 1977; p. 546–567. pmid:28563474
  25. 25. Venable DL, Brown JS. The selective interactions of dispersal, dormancy, and seed size as adaptations for reducing risk in variable environments. American Naturalist. 1988; p. 360–384.