[Math] Expected Waiting Time in a Queue with exponential distribution

conditional-expectationexpected valueexponential distributionprobabilityprobability theory

I am trying to solve the following problem in my exercise sheet towards preparation of competitive exam:

A post office has 2 clerks. $A$ enters the post office while 2 other customers, $B$ and $C$, are being served by the 2 clerks. She is next in line. Assume that the time a clerk spends serving a customer has the Expo($\lambda$) distribution.

What is the expected time spent by $A$ in the post office?

My take:

Total time that A spends in the office is the sum of waiting time + the time taken to serve A.

$$E(\text{Total Time}) = E(\text{Waiting Time}) + E(\text{Service Time})$$

$$E(\text{Service Time}) = \frac{1}{\lambda}$$

Now I computed that the Probability that A is served at any of the counter is $1/2$. Therefore,

$$E(\text{Waiting Time}) = 1/2 \times E(\text{Service Time of B}) + 1/2 \times E(\text{Service Time of C})$$

$$=\frac{1}{\lambda}$$

Which gives me
$$E(\text{Total Time}) = \frac{2}{\lambda}$$
But the answer given is $\frac{3}{2\lambda}$.

Please point out the mistake in what I am thinking or if you think there's a better way to do it.

Thanks.

Best Answer

The mistake is that the waiting time is not distributed in the way that you have proposed, because the waiting time is the lesser of the service times of $B$ and $C$. This is because $A$ takes the first available opening, so whoever finishes first, $A$ chooses that clerk. That is to say, if $W_A$ is the waiting time of $A$ and $S_B$, $S_C$ are the service times of $B$ and $C$ respectively, then $$W_A = \min(S_B, S_C),$$ and it is not generally true that $\operatorname{E}[W_A] = \operatorname{E}[S_B]/2$.

Rather, you must compute the minimum order statistic of $B$ and $C$'s service times. Since these are iid exponentially distributed with rate $\lambda$, it follows that $$\Pr[W_A > t] = \Pr[\min(S_B, S_C) > t] = \Pr[(S_B > t) \cap (S_C > t)] \overset{\text{ind}}{=} \Pr[S_B > t] \Pr[S_C > t] \overset{\text{id}}{=} (e^{-\lambda t})^2.$$ That is to say, the probability that $A$ waits more than $t$ to begin service is the product of the probabilities that both $B$ and $C$ take more than $t$ to be finished. And this makes perfect intuitive sense--because if $A$ must wait more than $t$, then that means both $B$ and $C$ are still occupied, which means their service times are also more than $t$.

Now that you know $\Pr[W_A > t] = e^{-2\lambda t}$, what can you say about $\operatorname{E}[W_A]$?

Related Question