# The probability distribution of waiting time until two exponentially distributed events with different parameters both occur

I am working on a problem related to the waiting time until a parking garage is empty. We are given that the cars independently spend an exponential distributed time in the parking garage, with parameter $$\mu$$. We are at a point where the garage is closed and no more cars are arriving, but two cars remain. The problem is to find the probability distribution of the waiting time until the garage is empty. Conveniently, we are given the solution. Letting $$T$$ denote the waiting time, we have $$f_T(t) = 2 \mu e^{-\mu t} \left(1 - e^{-\mu t}\right).$$ However, I do not understand how to arrive at this answer.

Here is my work so far: Let $$X$$ denote the number of cars in the parking garage. We may model this as a death process, where the death rate at $$X = 2$$ is $$2\mu$$, and then at $$X=1$$ it is $$\mu$$. Then the waiting time for the first car to leave is exponentially distributed with parameter $$2\mu$$, i.e. $$f_{\text{Car 1}}(t) = 2\mu e^{-2\mu t},$$ and similarily $$f_{\text{Car 2}}(t) = \mu e^{-\mu t}.$$ I believe it is correct so far. However, I am not sure on how to proceed from here. Any help or hints are greatly appreciated.

• I would have difficulty justifying this answer because for any positive values of $\mu$ and $t,$ $f_T(t)$ is negative. What would that mean? What is $f_T$ intended to represent?
– whuber
Commented Nov 25, 2018 at 21:59
• @whuber You are correct, I wrote up the wrong answer. The post is now updated with the correct answer. The following is copy-and-paste from the problem set: The garage is closing. They receive no more arriving customers, while the customers who are in the garage leave at the rates described above. There are two customers at closing time. Find the probability density of the waiting time until the parking garage is empty. Commented Nov 25, 2018 at 22:27

Let $$T_1$$ and $$T_2$$ be the waiting times for each car. You are trying to find $$T \equiv \max (T_1, T_2)$$. For this type of problem it is fairly simple to obtain the result by working with the CDFs. Assuming that the waiting times for each car are independent you can use the following rule:
\begin{aligned} F_T(t) \equiv \mathbb{P}(T \leqslant t) &= \mathbb{P}(T_1 \leqslant t, T_2 \leqslant t) \\[6pt] &= F_{T_1}(t) F_{T_2}(t) \\[6pt] &= (1-\exp(-\mu t)) (1-\exp(-\mu t)) \\[6pt] &= 1-2\exp(-\mu t)+\exp(-2\mu t). \\[6pt] \end{aligned}
\begin{aligned} f_t(t) = \frac{d F_T}{dt}(t) &= 2 \mu \exp(-\mu t) - 2 \mu \exp(-2\mu t) \\[6pt] &= 2 \mu \exp(-\mu t) (1 - \exp(-\mu t)). \\[6pt] \end{aligned}
• Thank you! I also found an alternative approach: We are looking for the probability that the final car leaves at time $t$. This would imply that the first car left at some time $s \in (0, t)$. This means the sojourn time of the system at state $X=2$ would be $s$, and the sojourn time at state $X=1$ would be $t-s$. As we may pick an arbitrary $s$ in the interval, we need to integrate over the interval to find the answer. Then $f_T(t) = \int_{0}^{t} f_1(s) f_2(t-s) \mathop{\mathrm{d}s}$, which yields the same answer. Commented Nov 26, 2018 at 10:05