[Math] Overlapping Events

probabilitystatistics

I have an event that will start exactly X times within a single 24 hour period.

Each event lasts Y milliseconds.

The start time of an individual event is uniform randomly distributed throughout the 24 hour period. The start time of each event is independent of the others.

What is the probability that at any point during the 24 hour period Z (or more) events are currently occurring and overlapping each other?

Best Answer

I doubt that you'll find an exact closed form. However, since the event duration $Y$ is measured in milliseconds and the time period $T$ in hours, it seems likely that for practical purposes only the leading term in an expansion in $q:=Y/T$ will be relevant.

In that case, the possibility of more than $Z$-fold overlap can be neglected, and the desired probability is just $\binom XZ$ times the probability $p$ that $Z$ uniformly distributed events overlap. Boundary effects will also be of higher order in $Y/T$ than the leading term, so we can neglect them and treat the time period as if it wrapped around at the ends.

Here are two different ways to determine $p$, and also the probability distribution of the lengths of the overlaps.

Let $p(L)$ be the probability density of an overlap of length $L$, that is, $p(L)\mathrm dL$ is the probability of an overlap of length between $L$ and $L+\mathrm dL$. For any given instant $t$ in $T$, the probability that the interval $[t,t+L]$ is entirely covered by a given one of the events is $(Y-L)/T$, so the probability that it is covered by all $Z$ events is $((Y-L)/T)^Z$. Integrating this over $t$ gives the measure of points followed by a fully covered interval of length $L$. But we can also obtain the same measure in another way: An overlap of length $L'\gt L$ leads to an interval of length $L'-L$ of points followed by a fully covered interval of length $L$. Integrating this over $L'$ from $L$ to $Y$ also gives the measure of points followed by a fully covered interval of length $L$. Thus we have

$$\int_L^Yp(L')(L'-L)\,\mathrm dL'=\int_0^T\left(\frac{Y-L}T\right)^Z\,\mathrm dt=T\left(\frac{Y-L}T\right)^Z\;.$$

Applying $-\mathrm d/\mathrm dL$ yields

$$\int_L^Yp(L')\,\mathrm dL'=Z\left(\frac{Y-L}T\right)^{Z-1}\;,\tag{1}$$

and then setting $L=0$ gives

$$p=Z\left(\frac YT\right)^{Z-1}\;.$$

To get the distribution of the overlap lengths, we can apply $-\mathrm d/\mathrm dL$ once more to $(1)$ to obtain

$$p(L)=\frac{Z(Z-1)}T\left(\frac{Y-L}T\right)^{Z-2}\;.$$

Another way to derive this result is to place the events one by one and keep track of the probability that an overlap of length $L$ with $0\lt L\le Y$ remains. With one event placed, the "overlap" is $L$ with probability $1$. If we place a second event, there's a window of size $2Y$ in which an overlap will occur, so an overlap will occur with probability $2q$, and its length ranges from $0$ to $Y$ with uniform probability, so the probability density is $2q/Y=2/T$ for $0\lt L\le Y$.

Generally, if there was an overlap of length $L'$ and we place another event, there's a probability $(Y-L')/T$ that the same overlap remains, and a probability $2L'/T$ that the overlap is reduced to a new value $L\gt0$, with uniform probability for all values $L\lt L'$. This gives a recurrence for the probability density $p_Z(L)$:

$$p_Z(L)=\frac{Y-L}Tp_{Z-1}(L)+\frac2T\int_L^Yp_{Z-1}(L')\,\mathrm dL'\;.$$

It's straighforward to check that the result derived above satisfies this recurrence with the initial condition $p_2(L)=2/T$.

Related Question