probability of gamma greater than exponential Let $X \sim Gamma(3,3)$ and $Y \sim Exp(1)$.
How do I calculate $P(X>Y)$?
I believe I rewrite it as $P(X-Y>0)$ but I am unsure how to calculate $X-Y$ for two different distributions?
 A: There is a relationship between gamma and beta random variables that leads to a general expression for $P[X>Y]$ for any two independent gamma random variables.
If $X \sim \rm{Gamma}(\alpha_1,\beta_1)$ and $Y \sim \rm{Gamma}(\alpha_2,\beta_2),$ where $\alpha$ is the shape parameter, $\beta$ is the scale parameter, and the mean is $\alpha \beta,$ then 
$$P[X>Y] = H_{\alpha_2,\alpha_1} \left( \frac{\beta_1}{\beta_1+\beta_2} \right),$$
where $H$ is the cumulative distribution function of a beta random variable. In your case I calculate $P[X>Y]=0.984375$ 
If you have used a different parameterization of the gamma distribution, this will need to be adjusted. 
Here is the development. We can construct $\beta_1Y \sim \rm{Gamma}(\alpha_2,\beta_1\beta_2)$ and $\beta_2X \sim \rm{Gamma} (\alpha_1,\beta_1 \beta_2).$ Now consider 
$$W = \frac{\beta_1Y}{\beta_1Y+\beta_2X}$$
It is known (see https://en.wikipedia.org/wiki/Gamma_distribution, Related Distributions and Properties Section) that $W$ has a beta distribution with first shape parameter of $\alpha_2$ and second shape parameter of $\alpha_1.$
So then $$P \left[ W = \frac{\beta_1Y}{\beta_1Y+\beta_2X}<\frac{\beta_1}{\beta_1+\beta_2} \right]=H_{\alpha_2,\alpha_1} \left( \frac{\beta_1}{\beta_1+\beta_2} \right),$$
where $H$ is the cumulative distribution function of a beta random variable. 
Taking reciprocals and simplifying,
$$P \left[ W = \frac{\beta_1Y}{\beta_1Y+\beta_2X}<\frac{\beta_1}{\beta_1+\beta_2} \right]=P \left[ \frac{\beta_1Y+\beta_2X}{\beta_1Y} > \frac{\beta_1+\beta_2}{\beta_1} \right]$$
$$ = P \left[ 1 + \frac{\beta_2X}{\beta_1Y}>1+\frac{\beta_2}{\beta_1} \right]=P \left[ \frac{X}{Y} >1 \right] =P \left[ X>Y \right] =H_{\alpha_2,\alpha_1} \left( \frac{\beta_1}{\beta_1+\beta_2} \right)$$
A: The rote way to compute $P[Y>X]$ is by double integral
$$\int_0^\infty f_X(x) dx \int_x^\infty f_Y(y) dy $$
Where the inner integral may be recognized as the survival function of $Y$, an exponential with parameter $\lambda=1$, at $x$, equal to $e^{-x}$. Then the remaining integral
$$\int_0^\infty e^{-x} f_X(x) dx $$
may be recognized as the moment generating function of $X$ evaluated at $-1$. The MGF of a $\rm{Gamma}$ is $(1-\theta t)^{-k}$, which for $\theta = 3, k=3, t=-1$ is
$$(1+3)^{-3} = 0.015625$$
The question was for $P[X>Y] = 1-P[Y>X]$, so we want 
$$1-(1+3)^{-3} = 1-0.015625 =  0.984375$$
which agrees with soakley's answer.
A: If $X$ has density function $\lambda \frac{(\lambda x)^2}{\Gamma(3)}\exp(-\lambda x)\mathbf 1_{\{x\colon x > 0\}}$ and independent $Y$ has density function $\exp(-y)\mathbf 1_{\{y\colon x > 0\}}$, then
\begin{align}
P\{X < Y\} &= \int_{0}^\infty \lambda \frac{(\lambda x)^2}{\Gamma(3)}\exp(-\lambda x) \int_{x}^\infty \exp(-y)\, \mathrm dy \, \mathrm dx\\
&= \int_{0}^\infty \lambda \frac{(\lambda x)^2}{\Gamma(3)}\exp(-(\lambda+1) x)\, \mathrm dx\\
&= \left(\frac{\lambda}{\lambda+1}\right)^3\int_{0}^\infty (\lambda+1) \frac{((\lambda+1) x)^2}{\Gamma(3)}\exp(-(\lambda+1) x)\, \mathrm dx\\
&= \left(\frac{\lambda}{\lambda+1}\right)^3.
\end{align}

Consider also a Poisson process with arrival rate $\lambda+1$. We can decompose this process into two independent Poisson subprocesses $\mathcal X$ and $\mathcal Y$ of rates $\lambda$ and $1$ respectively by labeling each arrival as belonging either to the $\mathcal X$ process (with probability
$\frac{\lambda}{\lambda+1}$) or to the
$\mathcal Y$ process (with probability $\frac{1}{\lambda+1}$), with each label being chosen independently of 
all other labels.  Then, $X$ can be taken to be the time of the third arrival (after $t = 0$) in the $\mathcal X$ subprocess while $Y$ is the time of the first arrival (after $t = 0$) in the $\mathcal Y$ subprocess.  With this interpretation, $X < Y$ is just the event that the first three arrivals after $t=0$ were all labeled as belonging to the $\mathcal X$
subprocess, and this event has probability 
$\displaystyle \left(\frac{\lambda}{\lambda+1}\right)^3$. Look, Ma! No
integrals were computed in arriving at the answer!
