# Modeling the Decay of a Pack of Cannibalistic Hyenas

A population of $p_0$ hyenas has run out of food in their ecosystem, and so sadly they have resorted to eating each other.

Hyenas need to consume one meal a day, and so exactly once per day, any given hyena will kill another hyena. The time at which this happens is random, meaning each hyena's mealtime is uniformly distributed throughout a set of $24$ hours.

Assuming that the last hyena will get hungry and die trying to eat himself, after how long will the population of hyenas become extinct?

I'm can think of two different ways to answer this (neither of which I know how to solve). The first is simpler and less accurate (and will therefore merit less glory).

We can discretize time into seconds, and so the population $p(t)$ hyenas after $t$ seconds can be written as: $$p(t) = p(t-1) - \frac{p(t-1)}{86400}.$$ (Why? At any given second--there are $60*60*24 = 86400$ seconds in a day--each hyena has a $1$ in $86400$ chance of eating another hyena.)

Clearly this is sloppy, since it is not guaranteed that such a number of hyenas will die every second. Also, when one hyena remains, it gets messy (although you could say it will take him a full day to die). I think this is actually modelling the expected value of $p(t)$, but I'm not sure.

But still, I'd like to see how we can get a clean formula for $p(t)$ from this recursion, and see when it becomes $0$.

We think of time as continuous, and the cannibalism of the hyenas as a (Poison?) process, in which each event--the death of a hyena--occurs at some rate. The tricky part is that this rate is dependent on the current population of the hyenas...

I assume the solution will be given by $E[t | p(t) = 0]$.

I've been thinking about this for a while, and am genuinely curious to see what you think!

-

I'll take the process as described by ShreevatsaR and Rahul Narain (with the "natural assumption". Describe the state of the process as $(j,k)$ where $j$ is the number of hyenas who have eaten today and $k$ is the number who have not.
The process starts in state $(0,h)$ (I prefer to use $h$ rather than $p_0$, because I want to use $p$ for transition matrix entries). Our Markov chain has $\sum_{n=1}^{h} (n+1) = h (h+3)/2$ states. If $k \ge 1$ and $j+k\ge 2$, then the result of the next step (in which one of the $k$ hyenas eats another hyena, randomly chosen from the $j+k-1$ hyenas other than himself) is $(j,k-1)$ with probability $j/(j+k-1)$ and $(j+1,k-2)$ with probability $(k-1)/(j+k-1)$. If $k = 0$, the rest of the day passes uneventfully and we go to state $(0,j)$. If $k=1$ and $j=0$, the process ends ($(0,1)$ is the absorbing state). We want to know how many days pass (i.e. how many times we are in a state $(0,k)$ with $k>1$, marking the start of a day) before we reach $(0,1)$. The expected number of days that pass, starting in states other than $(0,1)$, form the vector $u = (I-R)^{-1} b$ where $R$ is the transition matrix with the row and column for the absorbing state removed, and $b$ is the vector with $b_s = 1$ if $s = (0,k)$, $k > 1$, and $b_s = 0$ for any other non-absorbing state.

The results, if I have programmed this correctly, are as follows:

$$\matrix{h & \text{Expected days to absorption}\cr 2 & \ 1 \approx 1.00000 \cr 3 & \ 1 \approx 1.00000 \cr 4 & \ 3/2 \approx 1.50000 \cr 5 & \ 11/6 \approx 1.83333 \cr 6 & \ 47/24 \approx 1.95833 \cr 7 & \ 239/120 \approx 1.99167 \cr 8 & \ 371/180 \approx 2.06111 \cr 9 & \ 689/315 \approx 2.18730 \cr 10 & \ 94289/40320 \approx 2.33852 \cr 11 & \ 180541/72576 \approx 2.48761 \cr 12 & \ 9506489/3628800 \approx 2.61973 \cr 13 & \ 36300403/13305600 \approx 2.72820 \cr 14 & \ 673485851/239500800 \approx 2.81204 \cr 15 & \ 8947500347/3113510400 \approx 2.87377 \cr 16 & \ 127189413851/43589145600 \approx 2.91791 \cr 17 & \ 1928840613563/653837184000 \approx 2.95003 \cr 18 & \ 62260331884711/20922789888000 \approx 2.97572 \cr 19 & \ 152427596855969/50812489728000 \approx 2.99981 \cr 20 & \ 403599757786297/133382785536000 \approx 3.02588 \cr }$$ I doubt that there is a simple closed-form formula.

-
+1. I might also have made a mistake, but when I implemented a program to simulate the problem step by step and day by day, letting $T(h)$ be the average time for an initial population of $h$ to die, I get $T(10)\approx 2.34$, $T(15) \approx 2.87$, and $T(20) \approx 3.02$. So I think our results agree. –  Carl Mummert Oct 28 '12 at 19:36

I don't have the answer but I can think of two bounds.

The lower bound, the worst case scenario, would be that after one day, only one hyena survives. For, if you number the hyenas $$p_{0,1} \hspace{5mm} p_{0,2} \hspace{5mm} p_{0,3} \hspace{5mm} \cdots \hspace{5mm} p_{0,k}$$ and happens that hyena 2 eats hyena 1, and after that hyena 3 eats hyena 2, and so on, after only one day, the only hyena alive is the $k^{th}$ hyena.

But you can change the order in wich hyenas eat each others to get a upper bound. If you align the hyenas in two rows: $$p_{0,1} \hspace{5mm} p_{0,2} \hspace{5mm} p_{0,3} \hspace{5mm} \cdots \hspace{5mm} p_{0,k/2}$$ $$p_{0,k/2 + 1} \hspace{5mm} p_{0,k/2 + 2} \hspace{5mm} p_{0,k/2 + 3} \hspace{5mm} \cdots \hspace{5mm} p_{0,k}$$ and hyena $\frac{k}{2} + i$ eats the hyena $i$, the populations halfs its size after one day. So, if $2^{n-1} < p_0 \leq 2^n$ the population won't take longer than $n$ days to extinguish.

So maybe, if you see the population as an stochastic process you should conditionate with the chance that the hyena being eaten has already eat another sister.

-

Here is a sketch of an approach that should show that the number of days to termination is asymptotic to $c\log (n)$ for some computable $c$. I'm a bit busy now, but I can add more details later if necessary.

Let $n$ be the number of hyenas at the beginning of a day. It suffices to show that the fraction of hyenas surviving to the next day is asymptotic to some constant.

Arrange the hyenas from left to right by their planned meal times. Now construct the directed graph on the hyenas where an edge points from hyena $A$ to hyena $B$ if $A$ eats $B$. Observe that every valid graph is equally probable.

What does this graph look like? A component consists of a path of leftward edges terminating in a single rightward edge. The number of surviving hyenas is the number of components in the graph.

Let the number of such graphs be $f(n)$. We can count the number of such graphs with an EGF. We will find that $f(n+1)/f(n)\sim \alpha n^d$ for some constants $\alpha$ and $d$.

Now we can calculate the expected number of components of size $k$, since we can count the number of ways to choose a component of size $k$ and then fill in the rest of the graph in $f(n-k)\sim \alpha^d n^{kd}f(n)$ ways. Summing over $k$ will yield the expected number of components, which should be asymptotically $cn$ for some constant $c$.

To prove the desired concentration result, we can use Chebyshev's inequality. Calculating the variance of the number of components is equivalent to counting the expected number of pairs of components.

-

Your conditions are contradictory. If the consumption time is random, each hyena cannot consume meals exactly every day. The easy resolution is to say that if $p$ is the current population, we have $\frac {dp}{dt}=-p, p(0)=p_0$, where time is measured in days. The solution to this is $p=p_0\exp(-t)$ which ignores the discrete nature of coyotes. Another solution is that each coyote has a time of day when it consumes another, and that time of day is the same every day for as long as that coyote is alive. The difference will be small as long as the population is large, but in this case you have at least one death per day, so there is no long tail.

-
I'm not sure why you say it's contradictory; the question seems to have specified the process precisely enough. You can think of it like this: at the start of each 24-hour day (say midnight), each hyena uniformly picks a time of day when it will consume its next meal, and then consumes the meal at that time. –  ShreevatsaR Oct 26 '12 at 5:10
(That is, if it is still alive.) I think the point of the randomness is to avoid situations where two hyenas try to eat the same one at the same time, or try to eat each other at the same time etc. -- basically, to ensure there is a strict ordering between them, by making the times distinct. This works in the continuous case, as the probability of two hyenas picking the same time is 0. –  ShreevatsaR Oct 26 '12 at 5:17
@ShreevatsaR: it seemed to me that each coyote's meal time was periodic at exactly 24 hours. I can see your reading as well. –  Ross Millikan Oct 26 '12 at 5:20
@ShreevatsaR, there is also the issue of how the hyenas choose their victims. If the hyenas prefer eat someone who has already eaten, only the last hyena is left at the end of the first day. If they prefer someone who is yet to eat, $\lfloor p_0/2\rfloor$ hyenas remain. Of course, the natural assumption is that the hyenas choose randomly among all the other hyenas that are still alive, and then we get a Markov process mapping $p$ into $\{1,\ldots,\lfloor p/2\rfloor\}$ each day. –  Rahul Narain Oct 26 '12 at 5:21
@Ross Millikan: ShreevatsaR is correct, and explained it very well. Starting from $t=0$, each hyena will eat another exactly once per day--but the time of day is random (and different for each hyena, and different every day). –  jamaicanworm Oct 26 '12 at 12:22

Let the number of hyenas alive at any given time be $N(t)$. Clearly, $N'(t)$ must be proportional to $N(t)$--the rate of consumption depends on the number of hyenas themselves.

$$N'(t) = \alpha N(t)$$

For some proportionality constant $\alpha$. Of course, solutions to this ODE are exponentials.

$$N(t) = e^{\alpha t} N(0)$$

If we measure $t$ in days, then we want that $N(1) = N(0)/2$. This sets $\alpha = \ln \frac{1}{2}$, or

$$N(t) = \left(\frac{1}{2} \right)^t N(0)$$

This is a classic half-life decay process, and one expects it to be a good model when the population is high. When discrete nature of the problem becomes important, though, the Poissson process is indeed what we should expect to use. There are some problems--the probablistic nature means it's only expected that each hyena will eat once in a given day. Still, this is probably the best way to go about it. The Poisson process should give a distribution of probabilities for when the population goes extinct. Per wiki, the probability of a given number of events (in this case, hyena deaths) over a given time $\tau$ is

$$P[N(t + \tau) - N(t) = k] = \frac{e^{-\lambda \tau} (\lambda \tau)^k}{k!}$$

where here, $\lambda = \ln 2$. For any given time $\tau$, one can sum all the $k \geq N_0$ (or, more likely, sum all the cases for $k < N_0$ and subtract this from 1) to find the net probability that, at that time, the population has gone extinct.

-
Why do you say $N(1) = N(0)/2$? That is an assumption not stated in the problem. –  jamaicanworm Oct 28 '12 at 19:06
You're right; in the large population limit this should represent only a lower bound on the actual proportionality constant. –  Muphrid Oct 28 '12 at 19:12
So the upper bound is the number of bits in the initial population: $1 + \lfloor \log_2(p_0) \rfloor$ days.