# Sum of two independent, continuous random variables

I am having trouble finding the integral bounds when I compute the sum of two independent, continuous random variables. For example:

Let $X$ be an exponential variable with parameter $\lambda$ and $Y$ be a uniform random variable on $[0,1]$ independent of $X$. Find the probability density function of $X+Y$.

So, we have that $f_X(x)=\lambda e^{-\lambda x}$ and $f_Y(y)=\begin{cases} 1, \hspace{0.2in} 0\leq y \leq 1 \\ 0 \hspace{0.2in} \text{ otherwise} \end{cases}$

The following formula applies here: $$f_{X+Y}(a)=\int_{-\infty}^\infty f_X(a-y)f_Y(y)dy=\int_{-\infty}^\infty f_Y(a-x)f_X(x)dx$$

Then, $$f_{X+Y}(a)=\int_0^a \lambda e^{-\lambda (a-y)}dy=1-e^{-\lambda a}$$

However, the answer is the following: $$f_{X+Y}(a)=\begin{cases} 1-e^{-\lambda a}, \hspace{0.2in} 0 \leq a \leq 1 \\ e^{-\lambda a}(e^{\lambda}-1) ,\hspace{0.2in} a \geq 1 \\ 0 \hspace{0.2in} \text{otherwise} \end{cases}$$

It seems that my process only found the solution for the interval $0\leq a \leq 1$. How would I find the solution for the interval $a \geq 1$? My textbook is rather vague about finding these integral boundaries, and I was wondering if there is a good method for this, that I can apply to varying combinations of distributions $X$ and $Y$. Thank you.

## 2 Answers

First notice that $f_X(s) =1_{\{s>0\}} \lambda e^{-\lambda s}$ and that $f_Y(s)= 1_{\{0\leq s \leq 1\}}$. Therefore

\begin{align} f_{X+Y}(a)&=\int_{-\infty}^\infty f_Y(a-x)f_X(x)dx = \int_{-\infty}^\infty 1_{\{a-x>0\}} 1_{\{0\leq x \leq 1\}}\lambda e^{-\lambda (a-x)}dx \\ & = \int_0^{\min(a,1)} \lambda e^{-\lambda (a-x)}dx =e^{-\lambda (a-x)}\big\vert_0^{\min(a,1)} = \begin{cases} 1-e^{-\lambda a}, \hspace{0.2in} 0 \leq a \leq 1 \\ e^{-\lambda a}(e^{\lambda}-1) ,\hspace{0.2in} a \geq 1 \\ 0 \hspace{0.2in} \text{otherwise} \end{cases} \end{align}

remark Boundaries appear as a consequence of the indicator functions $1_{\{s>0\}}$ and $1_{\{0\leq s \leq 1\}}$, that is the boundaries of your original density functions. As a general rule I suggest you keep remembering at every step those indicator functions (just as I did above) since this will provide the different conditions you need to take into account.

Since $f_Y(a-x)=1\{a-1\le x \le a \}$ we have (for $a\ge 0$)

$$f_{X+Y}(a)=\int_{-\infty}^\infty f_Y(a-x)f_X(x)dx=\int_{0}^\infty 1\{a-1\le x \le a \}\lambda e^{-\lambda x}dx$$ $$=\int_{0\vee(a-1)}^a\lambda e^{-\lambda x}dx=\left.-e^{-\lambda x}\right|_{0\vee(a-1)}^a$$