# Exponential Probability of customers

Assume there is post office that is run by two clerks $1$ and $2$. Customers arrive at times that follow exponential distribution with rate $λ_a$. The amount of time that the clerks 1 and 2 serve are exponentially distributed with mean $1/λ_1$ and $1/λ_2$. The first customer that arrives in the post office is served by clerk $1$ and the second by clerk $2$. The three exponential random variables are independent. Two customers A and B have decided to go to the post office. What is the probability that A arrives before and departs after B?

So, $T_1$ = time taken by clerk $1$ and $T_2$ = time taken by clerk 2. To solve for the probability, if A is the first one there, she goes to clerk $1$ and clerk $1$ has to be faster than clerk $2$ ($T_1 < T_2$). Now what?

• How do you know that A is the first one to arrive? Are you just giving the name A to the first one to arrive? If so, your question would be: What is the probability that the first one to arrive is also the first one to depart? Construed that way, it would be a well-formed math problem, and it would explain why the number of exponential random variables is three, but it's not completely clear from your phrasing that that is what you meant. – Michael Hardy Nov 29 '17 at 17:24
• @MichaelHardy I fixed it, does it make more sense now? I still want the probability that A arrives before and departs after B, I just don't know how to go about that. – AmaC Nov 30 '17 at 17:02
• You refer to three exponential random variables. One of them is the time taken by clerk $1.$ Another is the time taken by clerk $2.$ What is the third? I am guessing that its the time between the arrival of A and the arrival of B, but so far that's only a guess. – Michael Hardy Nov 30 '17 at 17:12
• Yes, that makes sense, $λ_a$. – AmaC Nov 30 '17 at 17:24
• So apparently the question is to be contrued as follows: Let $T_1$ and $T_2$ be the service times of the first and second customers respectively. Let $T_0$ be the time from the arrival of the first customer until the arrival of the second. Then the time of departure of the first customer is $T_1$ and the time of departure of the second customer is $T_0+T_2.$ The question then is: What is $\Pr( T_1<T_0+T_2 )\text{ ?} \qquad$ – Michael Hardy Nov 30 '17 at 18:46

## 1 Answer

The question of the probability density of $T_0+T_2$ arises: \begin{align} f_{T_0+T_2}(t) & = \int_0^t f_{T_0}(s) f_{T_1} (t-s) \, ds = \int_0^t (e^{-\lambda_a s} \cdot\lambda_a)\, e^{-\lambda_2(t-s)} (\lambda_2\,ds) \\[10pt] & = \lambda_a\lambda_2 e^{-\lambda_2 t} \int_0^t e^{(\lambda_2-\lambda_a)s} \,ds =\lambda_a \lambda_2 e^{-\lambda_2 t} \left[ \frac{e^{(\lambda_2-\lambda_a)s}}{\lambda_2 -\lambda_a} \right]_{s\,:=\,0}^{s\,:=\,t} \\[10pt] & = \lambda_a\lambda_2 e^{-\lambda_2 t} \cdot \frac{e^{(\lambda_2 - \lambda_a) t} - 1}{\lambda_2 - \lambda_a} = \frac{\lambda_a\lambda_2}{\lambda_2 - \lambda_a} \left( e^{-\lambda_a t} - e^{-\lambda_2 t} \right) \text{ for } t \ge 0. \end{align} In case $\lambda_a=\lambda_2,$ one might think that the limit of that last expression as $\lambda_a\to\lambda_2$ would be the thing to find. Maybe what is a bit simpler is that the integral on the second line is easy to evaluate in that case.

Then we have \begin{align} \Pr(T_1 < T_0+T_2) & = \operatorname E(\Pr(T_1 < T_0 + T_2) \mid T_0+T_2) = \operatorname E\left( 1 - e^{-\lambda_1(T_0+T_2)}\right) \\[10pt] & = 1 - \int_0^\infty t f_{T_0+T_2} (t) \, dt \end{align} and so on.

To find this last integral, one should recall that

$$\int_0^\infty t e^{-ct} \, dt = \frac 1 {c^2} \int_0^\infty (ct) e^{-ct} (c\, dt) = \frac 1 {c^2} \int_0^\infty ue^{-u} \, du = \frac 1 {c^2}.$$ (One can derive this by integrating by parts $\displaystyle \int u \Big(e^{-u}\,du\Big) = \int u\,dv = \cdots$