# Average bus waiting time

My friends and I were "thinking" yesterday in the pub about the following: if a person is standing on a bus stop that is served by a single bus which comes every p minutes, we would expect the average waiting time to be p/2 (which may or may not be correct). But we had no idea how to calculate the average waiting time if there is more than one bus. So let's assume there is n many buses serving the stop, and each comes once in m1, m2 ... mn minutes. How would we go about calculating the average time a person has to wait for a bus? What is the theory behind it?

Thank you

-
Google "Poisson paradox" regarding one bus situation. –  Geoff Robinson Oct 28 '12 at 11:47
Once in every m minutes is not very clear. Do the buses have same starting point in time, I mean all these buses start at 6AM in morning and then once in every m1, m2 ... minutes? It seems to be a vital information which is missing. –  LieX Oct 28 '12 at 11:49
@Liex we thought about that bit since we had no idea how to calculate any of it, we couldn't decide how it would change the situation. Could you pls explain how/why it mattered, i.e. how is the situation diferent from you know all buses start at 6am vs the situation when you don't know when the buses start? thanks –  scibuff Oct 28 '12 at 11:55
@scibuff, this starting point is essential especially in case you have waiting time less than m1, m2... As you can see (as counter-example), it may or may not be possible to get the bus within this waiting time based on global schedule. But may be I am missing something in the question. –  LieX Oct 28 '12 at 12:20
add comment

## 4 Answers

As mentioned in the comments, the answer depends very much on the model used to describe the passage times of the buses. The deterministic situation where the passage times of buses of type $k$ are $s_k+m_k\mathbb N$ for some initial passage time $s_k$ in $(0,m_k)$ is too unwieldy to be dealt with in full generality hence we now study two types of assumptions.

(1) Fully random passage times

Here the passage times of buses of type $k$ are a Poisson process of intensity $1/m_k$ and the passage times of buses of different types are independent. Then, starting at time $t_0$, the next bus of type $k$ arrives after a random time exponential with mean $m_k$ hence the waiting time $T$ is such that $$\mathbb P(T\gt t)=\prod_k\mathbb P(\text{no bus of type}\ k\ \text{in}\ (t_0,t_0+t))=\prod_k\mathrm e^{-t/m_k}=\mathrm e^{-t/m},$$ where $$\frac1m=\sum_k\frac1{m_k}.$$ In particular, $T$ is exponentially distributed with parameter $1/m$, hence $$\mathbb E(T)=m.$$ The case $m_1=m_2=\cdots=m_n$ yields $$\mathbb E(T)=\frac{m_1}{n}.$$ (2) Fully periodic passage times with random uniform initializations

Here, buses of type $k$ pass at times in $S_k+m_k\mathbb N$ where $S_k$ is uniform on $(0,m_k)$ and the random variables $(S_k)$ are independent. Now, starting at time $t_0$, the next bus of type $k$ arrives after time $t_0+t$ if $t\leqslant m_k$ and if $S_k$ is not in a subinterval of $(0,m_k)$ of lenth $t/m_k$. Thus, $$\mathbb P(T\gt t)=\prod_k\left(1-\frac{t}{m_k}\right),\qquad t\leqslant \bar m=\min\limits_km_k.$$ A consequence is that $$\mathbb E(T)=\int_0^{+\infty}\mathbb P(T\gt t)\,\mathrm dt=\int_0^{\bar m}\prod_k\left(1-\frac{t}{m_k}\right)\,\mathrm dt.$$ Expanding the product yields $$\mathbb E(T)=\sum_{i\geqslant0}(-1)^i\bar m^{i+1}\frac1{i+1}\sum_{|K|=i}\frac1{m_K},$$ where, for every subset $K$, $$m_K=\prod_{k\in K}m_k.$$ For example, time intervals $m_1$, $m_2$, $m_3$ with minimum $m_1$ yield $$\mathbb E(T)=m_1-\frac{m_1^2}2\left(\frac1{m_1}+\frac1{m_2}+\frac1{m_3}\right)+\frac{m_1^3}{3}\left(\frac1{m_1m_2}+\frac1{m_2m_3}+\frac1{m_3m_1}\right)-\frac{m_1^4}{4m_1m_2m_3},$$ which can be simplified a little bit (but not much) into $$\mathbb E(T)=\frac{m_1}2-\frac{m_1^2}{6m_2}-\frac{m_1^2}{6m_3}+\frac{m_1^3}{12m_2m_3}.$$ The case $m_1=m_2=\cdots=m_n$ yields $$\mathbb E(T)=\frac{m_1}{n+1}.$$

-
+1 for a nice answer that entails all the discussed materials. –  sos440 Oct 28 '12 at 12:44
@sos440 Thanks for the appreciation. –  Did Oct 28 '12 at 12:57
add comment

Let us label the bus-lines serving the stop by the numbers $1, \cdots, n$. The situation can be modeled by introducing a random variable $X_1, \cdots, X_n$, where $X_k$ denotes the first arrival time of the bus of line $k$ after you arrived the bus stop. It is reasonable, under the setting, that each $X_k$ has a uniform distribution on $[0, m_k)$. Then your waiting time is given by the random variable

$$U = \min\{X_1, \cdots, X_n \}.$$

The problem is that there is no information on the joint distribution of $X_1, \cdots, X_n$, as LieX pointed out. On the one extreme, we can imagine a situation where each bus-line begins its first operation at a fixed time, say 6:00 am for line 1, 6:20 am for line 2, and so forth. On the other extreme, each bus-line operates in such a chaotic manner(!) that the first operation time is of completely random and independent fashion.

Now for the sake of simplicity, let us assume that $m_1 = \cdots = m_n$. Then in the former case, with the additional assumption that the bus-line begins at the same time, all the bus-lines are synchronized. Thus we have $X_1 = \cdots = X_n$ and hence $U = X_1$. This implies that the expected waiting time is

$$\Bbb{E} U = \Bbb{E} X_1 = \frac{m_1}{2}.$$

On the other hand, if we assume the latter case, then $X_1, \cdots, X_n$ are $n$ independent copy of $X_1$ and hence

\begin{align*} F_{U}(t) = \Bbb{P}(U \leq t) &= 1 - \Bbb{P}(U > t) \\ &= 1 - \Bbb{P}(X_1 > t, \cdots, X_n > t)\\ &= 1 - \Bbb{P}(X_1 > t) \cdots \Bbb{P}(X_n > t)\\ &= 1 - \left( 1 - \frac{t}{m_1} \right)^n \end{align*}

Thus we have

\begin{align*} \Bbb{E}U &= \int_{0}^{m_1} t \, dF_{U}(t)\\ &= \left[ t F_{U}(t) \right]_{0}^{m_1} - \int_{0}^{m_1} F_{U}(t) \, dt \\ &= m_1 - \int_{0}^{m_1} \left\{ 1 - \left( 1 - \frac{t}{m_1} \right)^n \right\} \, dt \\ &= \frac{m_1}{n+1}. \end{align*}

In conclusion, the answer depends on the information not specified by the problem. But since the buses in practice has a fixed time schedule, it seems that the former case is much more reasonable.

p.s. Since coprime numbers mimic independence, we can expect that the situation will be much similar to the latter case if $m_1, \cdots, m_n$ reasonably differ. But anyway it seems not a simple problem, depending highly on the parameters $m_1, \cdots, m_n$.

-
add comment

Here's an intuitive argument for your first query. Plot a graph of the $t$, the time the next bus is in when you arrive at the bus stop, against $P(t)$. This will obviously be a horizontal straight line graph. Call $\int_{0}^{p} P(t)dt=P(t)p=1$

What do we want to know? The time waited in each possibility (including a factor to weight the probability of that time).

Plot a graph of $P(t)t$ against $t$: this gives you the contribution to the average time from each of the possible $t$, and will evidently be a linear graph. The area of this linear graph will be $0.5 P(t)p *p$, which is $0.5 p$

Note that I assumed that buses arrive and depart instantaneously.

-
add comment

In $r$ minutes, you would see $r/m_1$ of the first type of bus, and $r/m_2$ of the second, and ... and $r/m_n$ of the $n$th type of bus, so, all told, $$\left({1\over m_1}+{1\over m_2}+\cdots+{1\over m_n}\right)r$$ buses in $r$ minutes, so you expect $$\left({1\over m_1}+{1\over m_2}+\cdots+{1\over m_n}\right)^{-1}$$ minutes between buses. So your expected wait should be half that.

-
Does this invalidate the OP's comment about the average waiting time being $p/2$? –  wj32 Oct 28 '12 at 12:02
But the number of buses should be integer while $\frac{r}{m_1}$ need not be. –  LieX Oct 28 '12 at 12:16
@wj32, good point --- I have corrected my answer. –  Gerry Myerson Oct 28 '12 at 12:50
@LieX, why should the expected number of buses be an integer? What if Bus A comes every 3 minutes, and Bus B comes every $\pi$ minutes? –  Gerry Myerson Oct 28 '12 at 12:51
So your expected wait should be half that... Things are more complicated than that, as the inspection paradox shows. –  Did Oct 28 '12 at 12:52
show 1 more comment