# Probability density function of sum of uniform random variables

Let $$X$$ and $$Y$$ be independent random variables with density functions

$$f_X(a) \begin{cases} 1\over2 & -1\le a\le1 \\ 0 & \text{otherwise} \end{cases}$$

$$f_Y(a) \begin{cases} 1\over2 & 3\le a\le5 \\ 0 & \text{otherwise} \end{cases}$$

Find the probability density function of $$X + Y$$

I have been trying to do this without convolution, but with using the standard double integral method of finding the CDF and then the PDF (as opposed to using a purely geometrical method) and I have been successful in the case of $$2 \le a \le 4$$ by using an integral of $${1\over 4}\int_3^a \int_{-1}^{a-y}dxdy$$

However I have been having trouble in the other case of $$4 \le a \le 6$$. My attempt was this:

$${1\over 4}\int_3^5 \int_{-1}^{min \{1, a-y\}}\ dx \ dy$$

$${1\over 4}\left (\int_3^5 ({min \{1, a-y\}} +1) \ dy \right)$$

$${1\over 4}\left (\int_3^5 ({min \{1, a-y\}}\ dy+ \int_3^5 1\ dy \right)$$

At this point I said that since the minimum function depends on whether $$y>a-1$$ or $$y, therefore there are two cases and thus

$${1\over 4}\left (\int_3^{a-1}1 \ dy +\int_{a-1}^{5} \ y \ dy+ \int_3^5 1\ dy \right)$$

$${1\over 4}\left (a-4-\dfrac{a^2-2a-24}{2}+ 2\right)$$

Taking the derivative of this CDF yields $${1\over2} - {a\over4}$$, whereas the true solution is $${3\over2} - {a\over4}$$. Where am I going wrong?

In $$\int_3^5 {\min \{1, a-y\}}\ dy$$, the integrand should equal $$a-y$$ when $$a-y < 1$$, i.e. when $$y > a-1$$. So when you split it into two, it should read $$\int_3^{a-1} 1\,dy + \int_{a-1}^5 (a-y)\,dy.$$ In your work, you have $$y$$ in the second integral instead of $$a-y$$. Fixing this gives the expected answer.
• How does one determine to use $\int_3^{a-1} 1\,dy + \int_{a-1}^5 (a-y)\,dy$ rather than $\int_3^{a-1} (a-y)\,dy + \int_{a-1}^5 1\,dy$? – agblt Oct 14 '18 at 15:54
• Because when $y \in (3,a-1)$, we have $a-y \ge a-(a-1) = 1$, so $\min\{1, a-y\} = 1$, not $a-y$. So when we integrate $\min\{1,a-y\}$ from $y=3$ to $a-1$, we are really just integrating 1. Similarly, when $y \in (a-1,5)$ we have $\min\{1, a-y\} = a-y$. – Nate Eldredge Oct 14 '18 at 15:59