# Computing the PDF of $X + Y$ if $X, Y \sim \text{U}(0, 1)$ using a convolution

Theorem: If $$X$$ and $$Y$$ are independent continuous random variables with density functions $$f_{X}$$ and $$f_{Y}$$, the probability distribution $$f_{X + Y}$$ of $$X + Y$$ is given by

$$f_{X + Y}(a) = \int_{-\infty}^{\infty} f_{X}(a - y) f_{Y}(y) \mathop{dy}$$

If $$X$$ and $$Y$$ are independent random variables, both uniformly distributed on $$(0, 1)$$, calculate the probability density of $$X + Y$$.

We have

$$f_{X}(a) = f_{Y}(a) = \begin{cases} 1 & \text{ if } 0 < a < 1 \\ 0 & \text{ otherwise.} \end{cases}$$

So, we obtain

$$f_{X + Y}(a) = \int_{-\infty}^{\infty} f_{X}(a - y)f_{Y}(y) \mathop{dy}.$$

$$= \int_{0}^{1} f_{X}(a - y) \mathop{dy}.$$

(My first question here is what happened to the $$f_{Y}(y)$$ term? Did they just equate it to $$1$$ because a probability distribution has total area $$1$$ under the curve? Wouldn't this be assuming that the integral of the product of two functions is equal to the product of their integrals?).

Okay, from here, the book writes for $$0 \leq a \leq 1$$, this yields

$$f_{X + Y}(a) = \int_{0}^{a} \mathop{dy} = a$$

and for $$1 < a < 2$$, we get

$$f_{X + Y}(a) = \int_{a - 1}^{1} \mathop{dy} = 2 - a.$$

I am also lost here. How did they figure out to split it into two cases, and how did they know it is on the interval $$0$$ to $$2$$?

• The density of $f_Y$ is $1$ so there's no need to write it. It should be clear that adding two $(0, 1)$ variables means the sum can be at most $2.$ Also, uniform plus uniform is triangle. – Sean Roberson Nov 26 '18 at 6:12
• how'd they know to split it into the case where $0 \leq a \leq 1$ and $1 < a < 2$? why not like $0 \leq a \leq 1/2$ etc? – user614735 Nov 26 '18 at 6:13

Answer to your first question: As you yourself noted, $$f_Y(a) = 1 \; \forall a \in [0,1]$$, so the $$f_Y(a)$$ term disappears from the integration. It is not because $$\int_0^1 f_Y(a)da=1$$, which is also true. Also, the limits of integration changed from $$(-\infty,\infty)$$ to $$[0,1]$$ because $$f_Y(a)=0$$ outside $$[0,1]$$.
Now you are left with the term $$f_X(a-y)$$, which equals 1 when $$(a-y) \in [0,1]$$ and 0 otherwise. If $$a \leq 1$$, this holds true when $$y \leq a$$ and $$a-y \leq 1$$. The latter condition can be rewritten as $$y \geq a-1$$. Since $$a \leq 1$$, the condition is equivalent to $$y \geq 0$$. Hence, the limits of integration are $$[0,a]$$ and over this range $$f_x(a-y)=1$$, by definition.
By similar reasoning, if $$a>1$$, $$f_X(a-y)=1$$ only when $$y \geq (a-1)$$ and $$y \leq 1$$, which explains the integration limits [you can fill in the blanks].
Finally, since $$0 \leq X \leq 1$$ and $$0 \leq Y \leq 1$$, you have $$0 \leq X+Y \leq 2$$.