Finding P(XX ~ Gamma ($r_1$ = 3, $\lambda_1$ = 2)
Y ~ Gamma ($r_2$ = 5, $\lambda_2$ = 7)
Find P(X > Y)
To find this, I know that I can double integrate the joint distribution of X and Y but I wanted to know a more intuitive approach to this problem. I was suggested to think of this probability as a binomial distribution where T~ Bin( n = $r_1$ + $r_2$ - 1 = 7, p = $\left(\frac{\lambda_2}{\lambda_1 + \lambda_2}\right)$) I would like to have this explained please.
 A: Let $\{X_n\}$ be the jump times of a Poisson process $N_X(t)$ with intensity $2$ and $\{Y_n\}$ the jump times of a Poisson process $N_Y(t)$ with intensity $7$, independent of $\{X_n\}$. The probability in question is $\mathbb P(X_3 > Y_5)$. Let $Z_n=X_n+Y_n$, then it is a well-known theorem that the superimposed process $$N(t):=\sup\{n: Z_n\leqslant t\}$$ is a Poisson process with intensity $2+7$. For each $n$, we have
$$\mathbb P(N_X(Z_n)-N_X(Z_n-)=1) = \frac2{2+7}=\frac29=1-P(N_Y(Z_n)-N_Y(Z_n-)=1). $$
Conditioning on $N_X(Z_5)$, we have
\begin{align}
\mathbb P(X_3>Y_5\mid N_X(Z_5)=0) &= 1,\\
\mathbb P(X_3>Y_5\mid N_X(Z_5)=1) &= \frac 79 +\left(\frac29\right)\left(\frac79\right)= \frac{77}{81}\\
\mathbb P(X_3>Y_5\mid N_X(Z_5)=2) &= \left(\frac 79\right)^2\\
\mathbb P(X_3>Y_5\mid N_X(Z_5)=n) &= 0,\ n=3,4,5.
\end{align}
Now, $N_X(Z_5)$ has $\operatorname{Binom}\left(5,\frac29 \right)$ distribution, and so we compute
\begin{align}
\mathbb P(X_3>Y_5) &= \sum_{n=0}^5 \mathbb P(X_3>Y_5\mid N_X(Z_5)=n)\mathbb P(N_X(Z_5)=n)\\
&=1\cdot\left(\frac 79\right)^5 + \left(\frac{77}{81}\right)\binom 51 \left(\frac 29\right)\left(\frac 79\right)^4 + \left(\frac79\right)^2\binom 52\left(\frac 29 \right)^2\left(\frac 79\right)^3\\
&= \frac{1294139}{1594323}\\
&\approx 0.81172.
\end{align}
A: I think @JeanMarie's suggestion is an interesting one.
I don't know if you find simulations to be intuitive. But here is an
approximate solution (correct to about three places) based on simulation in R. In the following
I'm assuming the $\lambda$'s are rate parameters. (If they're mean parameters,
change to $1/2$ and $1/7$.) The desired probability is about 0.812.
The following code performs your experiment a million times and then
finds the proportion of instances in which $X > Y.$ (In the code,
x > y is a logical vector of TRUEs and FALSEs, and mean finds
the proportion of TRUEs.)
 x = rgamma(10^6, 3, 2)
 y = rgamma(10^5, 5, 7)
 mean(x > y)
 ## 0.812151

The figure below has 50,000 points (a million would have made a dense
smudge). Blue points (40,619 of them) satisfy the condition $X >  Y$. 

