# Average waiting times

I have the following exercise, which I would like to solve:

Company A run buses between New York and Newark, their bus leaves New York every half an hour starting from 0:00, 24h a day. Company B also runs buses on the same route, however we know that their bus leaves New York on average twice per hour, (possibly) without keeping the fixed schedule. Do passengers who use buses from Company A wait shorter, on average, than the passengers who use buses from Company B. We assume that all the passengers don't have watches, do not plan their journeys etc.

My attempt is the following: I assume that the passengers using the bus service from Company A arrive at the bus stop uniformly in the interval $[0, 30]$, and so it is easy to calculate that the expected waiting time is $$\int_0^{30} \frac{1}{30}x dx = 15.$$ It is more complicated with the other passengers, if we assume that one bus just left that I think that it is reasonable to assume that the passengers using the bus service from company B are arriving and the bus stop uniformly in the interval $[0, 30-a]$ or $[0, 30+a]$ for some $a>0$. The joint expected value should be the weighted average of the corresponding expectations, that is, $$\frac{30-a}{60}\cdot \int_0^{30-a}\frac{1}{30-a}x dx +\frac{30+a}{60}\cdot \int_0^{30+a}\frac{1}{30+a}x dx = \frac{30-a}{60}\frac{30-a}{2}+\frac{30+a}{60}\frac{30+a}{2}= \frac{(30-a)^2 +(30+a)^2}{120}= \frac{1800+2a^2}{120}= 15 + \frac{a^2}{60}>15$$ Therefore, the passengers who use buses from Company A wait shorter on average.

I don't know if my solutions is correct. Maybe I should have considered a collection of random variables $a_i$, because in each hour the value of $a$ may change. I also would be interested in more formal solution, I cannot justify this weighted average it is just the intuition.

For company $B$, let $\{X_n\}$ be the interarrival times, supposing that they are independent and identically distributed with mean $\mathbb E[X_1]=30$. Let $S_n=\sum_{k=1}^n X_k$, then $\{S_n\}$ is a renewal process. Let $N(t)=\sum_{n=1}^\infty\mathsf 1_{(0,t]}S_n$ be the number of renewals up to time $t$, then at a given time $t$, the time until the next renewal is $$Y(t) := S_{N(t)+1}-t.$$ Then conditioning on whether one has arrived before or after the first bus arrival, we have \begin{align} \mathbb E[Y(t)] &= \mathbb E[Y(t)\mid X_1>t]\mathbb P(X_1>t) + \mathbb E[Y(t)\mid X_1\leqslant t]\mathbb P(X_1\leqslant t)\\ &= \mathbb E[X_1-t\mid X_1>t]\mathbb P(X_1>t) + \int_0^t \mathbb E[Y(t)\mid X_1=s]\ \mathsf dF_X(s)\\ &= \mathbb E[X_1-t\mid X_1>t](1-F_X(t)) + \int_0^t \mathbb E[Y(t-s)]\ \mathsf dF_X(s)\\ \end{align} Let $g(t)=\mathbb E[Y(t)]$, then $$g(t) = h(t) +g\star F_X(t)$$ where $$h(t)=\mathbb E[X_1-t\mid X_1>t](1-F_X(t)).$$ Let $m(t)=\mathbb E[N(t)]$, then from the renewal equation $$m(t) = F_X(t) + m\star F_X(t)$$ we see that $$(h+h\star m)\star F=h\star F + h\star m\star F=h\star F+h\star(m-F)=h\star m,$$ so $g = h+h\star m$. Since $\lim_{t\to\infty}h(t)=0$, we have by the key renewal theorem \begin{align} \lim_{t\to\infty} g(t) &= \lim_{t\to\infty}h\star m(t)\\ &= \frac1{\mathbb E[X_1]}\int_0^\infty h(t)\ \mathsf dt\\ &= \frac1{\mathbb E[X_1]}\int_0^\infty \mathbb E[X_1-t\mid X_1>t](1-F_X(t))\ \mathsf dt\\ &= \frac1{\mathbb E[X_1]}\int_0^\infty\int_t^\infty (x-t)\ \mathsf dF_X(x)\ \mathsf dt\\ &= \frac1{\mathbb E[X_1]}\int_0^\infty \int_0^t (x-t)\ \mathsf dt\ \mathsf dF_X(x)\\ &= \frac1{2\mathbb E[X_1]}\int_0^\infty x^2\ \mathsf dF_X(x)\\ &= \frac{\mathbb E[X_1^2]}{2\mathbb E[X_1]}. \end{align} Now, since $\mathsf{Var}(X_1)>0$, we have $$\mathbb E[X_1^2] = \mathsf{Var}(X_1)+\mathbb E[X_1]^2>\mathbb E[X_1]^2,$$ and so asymptotically, the mean of the time until the next renewal satisfies $$\lim_{t\to\infty}\mathbb E[S_{N(t)+1}-t] =\frac{\mathbb E[X_1^2]}{2\mathbb E[X_1]}>\frac12\mathbb E[X_1] = 15.$$ We conclude that passengers who use buses from company $B$ wait longer on average than passengers who use buses from company $A$.