# Sum of probability density functions, exponential distribution

Let $X_1$ and $X_2$ be iid with pdf $$f(x)=\lambda e^{-\lambda x}, \quad \lambda>0, \quad x \in (0, \infty)$$ Find the density function of $Z = X_1+X_2$.

I tried to solve it using this formula: $$f_Z \left( z \right) = \int_{-\infty}^{\infty} f_X \left( z - y \right) f_Y \left( y \right) d y$$

$$\lambda^2 \int_{-\infty}^{\infty} e^{-\lambda (z-w)} \cdot e^{-\lambda w} dw= \lambda^2 \int_{-\infty}^{\infty} e^{-\lambda z} dw$$ but the integral diverges...

I tried the second way: $$F(x) = 1-e^{-\lambda z} \quad Z=X_1+X_2 = 2X_1$$

$F_{2X_1}(z)=P(2X_1 \le z) = P(X_1 \le \frac{t}{2})=1-e^{\frac{-\lambda}{2} z} \\$

$f_Z(z)=\frac{-\lambda}{2} e ^{\frac{-\lambda}{2} z}$ Is it ok?

Which way is good?

• $f_X(x)\neq e^{-x}$ when $x$ is negative. – T.J. Gaffney Dec 7 '15 at 21:43
• Your second attempt seems successful. – T.J. Gaffney Dec 7 '15 at 21:44
• For the first attempt, integrate from $z$ to infinity. The second attempt is wrong, $2X_1$ and $X_1+X_2$ have very different distributions. – André Nicolas Dec 7 '15 at 21:49

Specifically, you should be guided by the general result $X_{1}+X_{2} \sim Gamma(2, \lambda)$. In particular, using convolution you should integrate over $(-\infty, z]$, because, as @Gaffney said, the pdf is $0$ for negative values. Hence,
\begin{align} f_Z \left( z \right) &= \int_{-\infty}^{z} f_X \left( z - y \right) f_Y \left( y \right) \mathrm{d} y\\ &= \int_{-\infty}^{z} \lambda e^{-\lambda\left( z - y \right)} \lambda e^{-\lambda y} \mathrm{d} y \\ &=\lambda ^2 e^{-\lambda z}z, \quad z\ge 0 . \end{align} Which is pdf of $Erlang(2,\lambda)$. Another possible way to show it is by using MGF of the exponential distribution.
• I don't get it why the limits are $-\infty$ and $z$. y >=0. – maro Dec 7 '15 at 22:07
• @maro You are right. I corrected the answer. Regrading the limits - note that $f _{X}(z-y) =0$ for $y > z$, because the support of the exponential r.v is $[0,\infty)$. – V. Vancak Dec 7 '15 at 22:11
• So is $Gamma(2, \lambda)$ (the same as) = $\lambda ^2 e^{-\lambda z}z$? – maro Dec 8 '15 at 23:28
• @maro Yes, more formally: $\frac{\lambda^2}{\Gamma(2)}e^{-\lambda z}z^{2-1}$, where $\Gamma(2) = (2-1)!$. – V. Vancak Dec 8 '15 at 23:40