# Expected waiting time

Posted on February 25, 2011 by phimuemue

When I'm waiting for the bus, it may happen, that I decide to go home by foot, since it might be faster than waiting for the bus. I told my grandmother that I go home from time to time by foot and she asked me how long this would take. So I told her, normally it takes an hour or so, but sometimes someone who knows me comes by and picks me up.

So I wanted to know the following: When going home, I assume constant speed. Going the whole way takes $$L$$ hours ($$L\in \mathbb{R}$$ obviously). There are several cars on the road occurring poisson-distributed with parameter $$\lambda'$$. Each of these cars has a driver that knows and picks me up with probability $$p$$.

What's the expected time to go?

## Considerations

Note that If the occurrence of cars is poisson-distributed with parameter $$\lambda'$$, then the waiting times between the cars is exponentially distributed with parameter $$\lambda=\dfrac{1}{\lambda'}$$.

First of all, we have to calculate the time to wait for the first driver that picks me up. So we have first'' an exponentially distributed variable and then for each driver a Bernoulli-distributed variable indicating whether he picks me up or not. Since this model is quite inconvenient, we change the point of view byinverting'' the order of the experiments:

That means, at the beginning we do toss a coin (with success probability $$p$$) until we get a success. The number of necessary toin cosses is the number of car drivers needed until the one picking me up.

So we obtain $$T$$ by adding up exponentially distributed waiting times for several cars ($$T_i$$ denotes waiting time for the $$i$$-th car). Let $$N$$ call the number of necessary toin cosses. Obviously, $$N$$ is geometrically distributed. That means:

$$T=\sum_{i=1}^NT_i=\sum_{i=1}^NT_1=E(N)\cdot E(T_1)=\frac{1}{p} \cdot \frac{1}{\lambda} = \frac{1}{p\lambda}$$

The above formulas use the fact that the single waiting times are independent and a fact from the lecture Diskrete Wahrscheinlichkeitstheorie'' (the second equality).

Allthough this is not a proof, I concluded from that $$T$$ is exponentially distributed with parameter $$\lambda p$$ (this intuition came also from the lecture).

In fact we can conculde it, since we know from the lecture that if we combine a poisson-process (parameter $$\lambda'$$) with a bernoulli-variable (success probability $$p$$) for each occurence of the poisson process, then the resulting experiment is a poisson-process with parameter $$\lambda' p$$, which leads to the fact that the waiting times then are exponentially distributed with parameter $$\frac{1}{\lambda p}$$.

So the actual walking time is $$min(L,T)$$, which follows easily from the fact that we either come home before getting picked up or getting picked up and get driven home.

So the question we want to answer is what is $$E(min(L,T))$$. By definition, we get

$$E(min(L,T))=\int_0^\infty f_T(x)\cdot(min(L,x))dx,$$

which can be easily transformed to the following:

$$E(min(L,T))=\int_0^L f_T(x)\cdot x dx + \int_L^\infty f_T(x)\cdot L.$$

Knowing $$f_T(x)=\lambda p \cdot e^{-\lambda p x}$$ for $$x\geq 0$$, I evaluated the above equation using Maxima and obtained

$$E(min(L,T))=\frac{\exp(-\lambda p L) (\exp(\lambda p L) - \lambda p L - 1)}{\lambda p}$$