# PDF of the product of two independent Gamma random variables

I am trying to find out the density of the product $XY$ of two independent Gamma random variables $X \sim \mathrm{Gamma}(k_1, \theta_1)$ and $Y \sim \mathrm{Gamma}(k_2, \theta_2)$, where $k_i$'s are the shape parameters and $\theta_i$'s are the scale parameters.

I know the formula for the density of the product of two independent RV https://en.wikipedia.org/wiki/Product_distribution, but I couldn't evaluate the integral.

I know the resulting density will involve Meijer G-functions, and I found this paper: http://epubs.siam.org/doi/abs/10.1137/0118065, but the Gamma distribution density in this paper is given as $$f_i(x_i)=\frac{1}{\Gamma{\left(b_i\right)}} x_i^{b_i-1} e^{-x_i}$$ with unity scale parameter.

Is there a formula to find the density of the product of two independent Gamma random variables with arbitrary shape and scale parameters?

Any help is highly appreciated.

• What is amma RV? – MAN-MADE Aug 17 '17 at 2:24

## 1 Answer

Let $X \sim \text{Gamma}(a,b)$ with pdf $f(x)$: and $Y \sim \text{Gamma}(\alpha,\beta)$ be independent with pdf $g(y)$: Then, the pdf of the product $Z = X Y$ can be obtained as $h(z)$: where I am using the TransformProduct function from mathStatica/Mathematica to do the nitty-gritties, and BesselK[n,z] denotes the modified Bessel function of the second kind. This is much simpler than requiring MeijerG functions. I should note that I am one of the authors of the software function used.

Quick Monte Carlo check

• against theoretical solution derived above when $a =2$, $b = 3$, $\alpha = 4$, and $\beta = 1.1$ Looks fine :)

• This is perfect! Thank you so much :) Can you point to any documentation about how this function TransformProduct works? – Mohamed Ali Aug 17 '17 at 23:18