# Proof that the sum of two independent exponential random variables is gamma with $\alpha=2$

I'm trying to prove that the sum of two exponential random variables is gamma. This proof is straightforward using the uniqueness of moment generating functions however I'm asked to find the density function specifically by first finding the cumulative distribution function and then differentiating. My solution is not giving the density function of a gamma distribution so I'm hoping someone can point out my mistake because I can't find it.

First I let $X$ and $Y$ be independent exponentially distributed random variables with the same mean $\beta$. Then by independence the joint density is: $$f_{X,Y}(x,y)= \frac{e^{\frac{-x}{\beta}}}{\beta}\frac{e^{\frac{-y}{\beta}}}{\beta}=\frac1{\beta^2}e^{\frac{-x-y}{\beta}}$$ $$x,y \geq0$$ Define $U=X+Y$. To find the cumulative distribution function of $U$ I calculated that:

$F_U(u)=\mathbb P(U\leq u)=\mathbb P(X+Y \leq u)= \mathbb P(X\leq u-Y)$ and so $$F_U(u)=\int_{0}^{u}\int_{0}^{u-y}f_{X,Y}(x,y)dxdy=\int_{0}^{u}\int_{0}^{u-y}\frac1{\beta^2}e^{\frac{-x-y}{\beta}}dxdy=\frac1{\beta^2}\int_0^u-\beta e^{\frac{-u}{\beta}}+\beta e^{\frac{-y}{\beta}}dy=\frac1{\beta}\int_0^u e^{\frac{-y}{\beta}}-e^{\frac{-u}{\beta}}dy=\frac1\beta(-\beta e^{\frac{-u}{\beta}}-ue^{\frac{-u}{\beta}}+\beta)$$ for $0\leq u <\infty$. Then to get the density function I differetiate: $$f_U(u)=\frac {dF_U(u)}{du}=\beta e^{\frac{-u}{\beta}}-\frac 1\beta e^{\frac{-u}{\beta}}+ue^{\frac{-u}{\beta}}=e^{\frac{-u}{\beta}}(\beta+u-\frac 1\beta)$$ This is clearly not the density for a gamma random variable. Using moment generating functions I can show that the answer should be: $$f_U(u)=\frac {1}{\beta^2}ue^{\frac{-u}{\beta}}$$ so where am I going wrong?

• Looks like wrong differentiation! – André Nicolas Jul 12 '16 at 2:02
• oops, you're right. Differentiating again I actually do get the gamma density function. Thank you! – Alex Jul 12 '16 at 2:07

$$\frac{dF_U(u)}{du}=\frac{d}{du}(-e^{\frac{-u}{\beta}})-\frac{d}{du}(\frac u\beta e^{\frac{-u}{\beta}})+\frac{d}{du}(1)=\frac 1\beta e^{\frac{-u}{\beta}}-\frac {1}{\beta}e^{\frac{-u}{\beta}}- \frac u{\beta}\frac {1}{(-\beta)} e^{\frac{-u}{\beta}}+0=\frac{1}{\beta^2}u e^{\frac{-u}{\beta}}$$
which is the expected result. Rewriting as $$\frac {u^{2-1}e^{\frac{-u}{\beta}}}{\beta^2 \Gamma(2)}$$
it is easy to see this is a gamma distribution with parameters $\alpha=2$, $\beta$. This notion can also be generalised to the sum of $n$ independent exponential RV's with mean $\beta$ and you will simply get a gamma distribution with $\alpha=n$ and the same $\beta$