Density function of a distribution $X+Y$ Random variables $X,Y$ are independent and have uniform distribution on line segments $[0,1]$ and $[0,2]$. Find density function of a distribution $X+Y$. I know I have to use a formula $$g _{X+Y}(t)= \int_{ \infty }^{- \infty }g _{X}(y)g _{Y} (t-y) \mbox{d}y$$ but I am not certain how to use it.
 A: The term $g_X(y)g_Y(t-y)$ can be sometimes extremely confusing, basically due to the domain of the variables $t, y$, so there is my approach with a lot of detail. 
Firstly, $X+Y$ takes values in $[0,3]$ (where $3=2+1$). So, we need to determine $g_{X+Y}(t)$ for $t\in[0,3]$ since otherwise $g_{X+Y}(t)=0$. Now, $$g_X(y)=\begin{cases}1, & 0\le y \le 1\\0, & \text{else}\end{cases}$$ and $$g_Y(t-y)=\begin{cases}\frac12, & 0\le t-y \le 2\\0, & \text{else}\end{cases}=\begin{cases}\frac12, & t-2\le y \le t\\0, & \text{else}\end{cases}$$ Combining these two, we have $$g_X(y)g_Y(t-y)=\begin{cases}1\cdot\frac{1}{2}, & \text{if } 0\le y\le 1 \textbf{ and } t-2 \le y\le t\\0, & \text{else}\end{cases}$$ So, when does $0\le y \le 1$ and $t-2\le y \le t$? We rewrite this equivalently as $$\max{\{0,t-2\}}\le y\le \min{\{1,t\}}$$ From this it is obvious that we have to take cases, depending on the value of $t$, which I remind you, ranges from $0$ to $3$. We have that $$\max{\{0,t-2\}}\le y\le \min{\{1,t\}}=\begin{cases}0\le y\le t,& \text{ for }0\le t\le 1\\ 0\le y\le 1, & \text{ for }1\le t \le 2\\t-2\le y\le 1, & \text{ for }2\le t \le 3\end{cases}$$
So, now (yes, now, after so much work on the domains) we can take without fear of making a mistake, the derivative of $g_X(y)g_Y(t-y)$ for all different values of t. 
