[Math] The probability that an event with exponential distribution will happen before an event with a Poisson distribution

probability

I have two variables depicting arrival. One (lets call it $A$) has a Poisson distribution, so the probability of $n$ elements arriving in time period $\tau$ is: $P_n(\tau)=\frac{\left(\lambda t\right)^ne^{-\lambda t}}{n!}$.

One (lets call it $B$) has an exponential distribution, so the probability of an element arriving in under time $\tau$ is $P(t)=1-e^{-\mu t}$.

$A$ and $B$ are unrelated/independent.

I'm asked what is the probability that an element from group $B$ will arrive before an element before group $A$.

The correct answer is given as $\frac{\mu}{\mu+\lambda}$

What I did is:

$$\int_0^{\infty}P\left( T_B<t\right)\cdot P^A_0(t)dt=\int_0^{\infty}\left( 1-e^{-\mu t}\right)\cdot e^{-\lambda t}dt=\int_0^{\infty}e^{-\lambda t}-e^{-(\lambda +\mu) t}dt=\frac{1}{\lambda}-\frac{1}{\mu + \lambda}=\frac{\mu}{\lambda (\mu + \lambda)}$$

Explanation: I tried to calculate the probability that $B$ arrives before time $t$ and that during that time 0 elements of $A$ arrive.

Where is my mistake?

Best Answer

Perhaps this is more intuitive: Consider time epochs of $\delta$ seconds each, for small $\delta$. Let the probability of an "A" event occurring in an epoch to be $p_A$; similarly for a "B" event. In your situation, $p_A = \lambda \delta \exp(-\lambda \delta)$ and $p_B = 1- \exp(- \mu \delta)$. Let $q_A$ and $q_B$ be the complementary probabilities that an event does not occur in an epoch. Then the probability that a "B" event occurs before an "A" event is $$q_A p_B + (q_A q_B) q_A p_B + (q_A q_B)^2 q_A p_B + \cdots = \frac{q_A p_B}{1 - q_A q_B} = \frac{q_A p_B}{p_A + p_B - p_A p_B}.$$ Now $p_A = \lambda \delta + O(\delta^2)$ and $p_B = \mu \delta + O(\delta^2)$, so the desired probability is $$\frac{\mu \delta + O(\delta^2)}{\lambda \delta + \mu \delta + O(\delta^2)} = \frac{\mu}{\lambda + \mu} + O(\delta).$$