# Merged Poisson Process: Finding the Probability of nth Arrival of A Before the mth Arrival of B

You take a safari trip to the Porobilati game reserve. A highlight of the game reserve is the Poseni river where one can watch deer and elephants coming to drink water. Deer come to the river according to a Poisson process with arrival rate λd=8 per hour; elephants come to the river according to an independent Poisson process with arrival rate λe=2 per hour. On the first day of your safari, you reach the Poseni river early in the morning hoping to see some elephants. Assume that deer and elephants are the only kinds of animals that visit this river.

What's the probability of seeing your 3rd elephant before your 9th deer?

I got this from https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-041-probabilistic-systems-analysis-and-applied-probability-spring-2006/exams/final.pdf . Any idea of how to solve this problem?

## 2 Answers

This probability is the same as the probability of tossing 3 Heads before 9 Tails with a coin whose Heads probability is $1/5(=2/(2+8))$. If $X$ is a random variable with the negative binomial distribution with parameters $3$ and $4/5$: $$P[X=k] = {k+2\choose k}(4/5)^k(1/5)^3,\qquad k=0,1,\ldots,$$ then the desired probability is $$P[X<9] =\sum_{k=0}^8 {k+2\choose k}(4/5)^k(1/5)^3.$$ According to wolphrmalpha.com, the value of this sum is $${3736313\over 9765625}=0.3825984512.$$

The arrival of each animal follows an exponential distribution of parameter $\lambda$

The arrival of the n-th animal follows a gamma distribution of parameters $(n,\frac 1 \lambda)$

Thus, if $D_9$ is the arrival time of the ninth deer, it follows a gamma distribution of parameters $(9,\frac 1 8)$, and the third elephant follows a gamma distribution of parameters $(3,\frac 1 2)$. Both variables are independent.

The probability that one is higher than the other is given by $\int_{0<x<y} f_1(x)f_2(y)$ where $f_1$ and $f_2$ are the PDF of the corresponding gamma distributions:

$\int_{0}^{\infty}\frac{8^9}{8!} x^{8} e^{-8x}\int_{0}^{x}\frac{2^3}{2!} y^{2} e^{-2y} dydx =\int_{0}^{\infty}\frac{8^9}{8!} x^{8} e^{-8x} (\frac 1 4 (1-e^{-2x} \times (1+2 x (1+x)))) dx \approx 0.38260$

according to WolframAlpha which seems to make sense but I didn't try to integrate this myself.