# Find the density function of the random variable $Z=X_1+X_2$

Problem: Let $X_1,X_2$ be independent variables with common density function $f(x)=0.5e^{-0.5x},0<x<\infty.$ Find the density function of the random variable $Z=(X_1+X_2)$.

My attempt:

Let $X_1, X_2$,and $Z=X_1+X_2$ denote the relevant random variables and $f_{X_1}, f_{X_2},f_{Z}$ their densities.

Then $f_{x_1}=f_{x_2}=0.5e^{-0.5x}, 0<x<\infty$ and $0$, Otherwise

$H(z)=P(Z\leq z)=P(x_1+x_2\leq z)=\int\limits_{-\infty}^{\infty}f_{X_1}(z-x_2)*f_{X_2}(x_2)dx_2$

$=\int\limits_0^z 0.5e^{-0.5(z-x_2)}*0.5e^{-0.5x_2} dx_2$

$=\frac{1}{4}\int\limits_0^z e^{-0.5z}dx_2$

$=\left.\frac{1}{4}x_2e^{-0.5z}\right|_0^z$

$=\frac{1}{4}ze^{-0.5z}$

So $f_z(z)$= \begin{array}{l l} \frac{1}{4}ze^{-0.5z} & \quad \textrm{if z $\geq$ 0 }\\ 0 & \quad \textrm{otherwise} \end{array}

Does this attempt show the correct answer? I appreciate any feedback. Thank you.

• You have the right density, calculated directly using a convolution. Note that you are not computing the cdf, namely $\Pr(X_1+X_2\le z)$, contrary to the assertion. – André Nicolas Nov 29 '14 at 2:54

## 1 Answer

You can either find the density function of $Z$ by double integrating to find the cumulative density function then differentiating that.

\begin{align} f_Z(z) & = \frac{\operatorname d\mathsf P_Z(z)}{\operatorname d z} \\ & = \tfrac{\operatorname d\;}{\operatorname d z} \int_{-\infty}^\infty \int_{-\infty}^{z-x_1} f_{X_1}(x_1)f_{X_2}(x_2)\operatorname d x_2\operatorname d x_1 \\ & = \tfrac 1 4 \tfrac{\operatorname d\;}{\operatorname d z}\int_0^z e^{-x_1/2}\int_0^{z-x_1} e^{-x_2/2}\operatorname d x_2\operatorname d x_1 \\ & = \tfrac{1}{2}\tfrac{\operatorname d\;}{\operatorname d z}\int_0^z e^{-x_1/2}(1-e^{(x_1-z)/2})\operatorname d x_1 \\ & = \tfrac{1}{2}\dfrac{\operatorname d\;}{\operatorname d z}\int_0^z e^{-x_1/2}-e^{-z/2}\operatorname d x_1 \\ & = \dfrac{\operatorname d\;}{\operatorname d z}\left(1-(\tfrac{1}{2}z+1)e^{-z/2}\right) \\[2ex] & = \tfrac 1 4 z e^{-z/2} \end{align}

Or else you can find it directly by finding the convolution. (As you did.)

\begin{align} f_Z(z) & = \mathsf E(f_{X_2}(z-X_1)) \\ & = \int_{-\infty}^\infty f_{X_1}(x_1)f_{X_2}(z-x_1)\operatorname dx_1 & { = \int_{-\infty}^\infty f_{X_1}(x_1)\frac{\operatorname d\;}{\operatorname d z}} \int_{-\infty}^{z-x_1} f_{X_2}(x_2)\operatorname d x_2\operatorname d x_1 \\ & =\tfrac 1 4 \int_0^z e^{-x_1/2} e^{(x_1-z)/2}\operatorname d x_1 \\ & = \tfrac 1 4 e^{-z/2}\int_0^z 1\operatorname d x_1 \\ & = \tfrac 1 4 z e^{-z} \end{align}

Clearly a much easier approach. Don't confuse them.