# Sum of Two Continuous Random Variables

Consider two independent random variables $X$ and $Y$. Let $$f_X(x) = \begin{cases} 1 − x/2, & \text{if 0\le x\le 2} \\ 0, & \text{otherwise} \end{cases}$$.Let $$f_Y(y) = \begin{cases} 2-2y, & \text{if 0\le y\le 1} \\ 0, & \text{otherwise} \end{cases}$$. Find the probability density function of $X + Y$.

Can anyone show me a step by step solution to this problem?

I've been applying this theorem to solve the problem with limited success

• It is the convolution of the two densities, assuming independence. – Gary. Jul 10 '15 at 4:10

Let $Z=X+Y$. We know $0\leq Z\leq 3$ but for the density of $Z$ we have three cases to consider due to the ranges of $X$ and $Y$.

If $0\leq z\leq 1$:

\begin{eqnarray*} f_Z(z) &=& \int_{x=0}^{z} f_X(x)f_Y(z-x)\;dx \\ &=& \int_{x=0}^{z} (1-x/2)(2-2y)\;dx \\ &=& \left[ 2x-2zx+zx^2/2+x^2/2-x^3/3 \right]_{x=0}^{z} \\ &=& 2z - \dfrac{3}{2}z^2 + \dfrac{1}{6}z^3. \end{eqnarray*}

If $1\lt z\leq 2$:

\begin{eqnarray*} f_Z(z) &=& \int_{x=z-1}^{z} f_X(x)f_Y(z-x)\;dx \\ &=& \int_{x=z-1}^{z} (1-x/2)(2-2y)\;dx \\ &=& \left[ 2x-2zx+zx^2/2+x^2/2-x^3/3 \right]_{x=z-1}^{z} \\ &=& \dfrac{7}{6} - \dfrac{1}{2}z. \end{eqnarray*}

If $2\lt z\leq 3$:

\begin{eqnarray*} f_Z(z) &=& \int_{x=z-1}^{2} f_X(x)f_Y(z-x)\;dx \\ &=& \int_{x=z-1}^{2} (1-x/2)(2-2y)\;dx \\ &=& \left[ 2x-2zx+zx^2/2+x^2/2-x^3/3 \right]_{x=z-1}^{2} \\ &=& \dfrac{9}{2} - \dfrac{9}{2}z + \dfrac{3}{2}z^2 - \dfrac{1}{6}z^3. \end{eqnarray*}

• Mick, I'm not completely sure how you chose the bounds for the different integrals- do you mind briefly explaining? – aman1230 Jul 10 '15 at 16:56
• @aman1230 For $0\leq z\leq 1:\;$ Here, $x$ must be less than $z$ since $y$ can't be negative. So we must have $0\lt x\lt 1$. For $1\lt z\leq 2:\;$ Again, $x$ must be less than $z$ since $y$ can't be negative. Also, since $y\lt 1$, we must have $x$ at least $z-1$. Thus, $z-1\lt x\lt z$. For $2\lt z\leq 3:\;$ Again, since $y\lt 1$, we must have $x$ at least $z-1$. Also, $x$ cannot exceed $2$ so that instead of $z$ is the upper limit here. Thus, $z-1\lt x\lt 2$. I hope that helps explain it. – Mick A Jul 10 '15 at 17:25
• This is quite intuitive Mick. I appreciate your help. Thanks. – aman1230 Jul 11 '15 at 2:01