# Difference of two independent gamma distribution

Given two independent random variables $X\sim\Gamma(s,r)$ and $Y\sim\Gamma(t,u)$, what is the distribution of the difference, i.e. $D=X−Y$? I assume that $s$ and $t$ are integers. How can I obtain the skewness of the difference distribution?

• Duplicate of Difference of Gamma random variables – Dilip Sarwate May 14 '14 at 3:01
• It's only a partial duplicate because the question and answer in the other post doesn't respond to the skewness question, which can be answered. I don't think this one should close. – Glen_b May 14 '14 at 4:53
• @Glen_b: Thank you for your help. I really need the closed form solution of skewness. But it looks like very difficult. – zmgao May 15 '14 at 1:20
• Um, no - my answer all but gives it to you. You merely need to substitute the gamma parameters into the formulas for the second and third moments of a gamma and then put those into the formula at the bottom of my answer. If that takes you more than two minutes, I'd be amazed. – Glen_b May 15 '14 at 1:34
• @Glen_b: I also want to obtain the kurtosis. But I don't know how to calculate the u4 from MGF? Would please help me? Thank you! – zmgao May 15 '14 at 13:55

Even if we don't have the distribution in closed form, the skewness we can get somewhere with.

For example:

$\,E(D^3) = E((X-Y)^3)\\ \quad\quad\quad= E(X^3)-3E(X^2Y)+3E(XY^2)-E(Y^3) \\ \quad\quad\quad= E(X^3) - 3E(X^2)E(Y)+3E(X)E(Y^2)-E(Y^3)$

and so on with the lower order moments. As a result, $E[(D-\mu_D)^3]$ and $E[(D-\mu_D)^2]$ can be derived and from that, the skewness of the difference. Alternatively,

$E[(D-\mu_D)^3]\\ \quad\quad=E[(X-Y-\{\mu_X-\mu_Y\})^3]\\ \quad\quad=E[(\{X-\mu_X\}-\{Y-\mu_Y\})^3]$

$\quad\quad=E[(X^*-Y^*)^3]\quad$ where here $^*$ indicates centered variables.

$\quad\quad= E(X^{*3}) - 3E(X^{*2})E(Y^{*})+3E(X^{*})E(Y^{*2})-E(Y^{*3})\quad$ as before

$\quad\quad= E(X^{*3}) - 3\text{Var}(X)\cdot 0+3\cdot 0\cdot\text{Var}(Y) -E(Y^{*3})\quad$

$\quad\quad= E(X^{*3}) -E(Y^{*3})\quad$

Similarly, $\text{Var}(D) = \text{Var}(X)+\text{Var}(Y)$.

Or, even more alternatively, we could have just relied on additivity of cumulants to arrive at the same results.

Consequently, $\gamma_1(D) = \frac{\mu_3(D)}{\mu_2(D)^{3/2}}= \frac{\mu_3(X)-\mu_3(Y)}{(\text{Var}(X)+\text{Var}(Y))^{3/2}}$

And of course, $\mu_3(X)=\gamma_1(X)\sigma_X^3$. So we have the skewness of the difference in terms of the skewness and standard deviation of the original variables - so far this is a general result; it doesn't rely on the variables being gamma random variables.