TITLE: Convolution of 2 uniform random variables
QUESTION [9 upvotes]: I really do not know how to do this.
Let $X$ have a uniform distribution on $(0,2)$ and let $Y$ be independent of $X$ with a uniform distribution over $(0,3)$. Determine the cumulative distribution function of $S=X+Y$.

REPLY [20 votes]: The density of $S$ is given by the convolution of the densities of $X$ and $Y$:
$$f_S(s) = \int_{\mathbb R}f_X(s-y)f_Y(y)\ \mathsf dy. $$
Now
$$
f_X(s-y) = \begin{cases}
\frac12,& 0\leqslant s-y\leqslant2\\
0,&\text{otherwise}
\end{cases}
$$
and
$$
f_Y(y) = \begin{cases}
\frac13,& 0\leqslant y\leqslant3\\
0,&\text{otherwise.}
\end{cases}
$$
So the integrand is $\frac16$ when $s-2\leqslant y\leqslant s$ and $0\leqslant y\leqslant3$, and zero otherwise. There are three cases (drawing a picture helps to determine this); when $0\leqslant s<2$ then
$$f_S(s)=\int_0^s\frac16\mathsf dy = \frac16s. $$
When $2\leqslant s< 3$ then
$$f_S(s)=\int_{s-2}^s\frac16\ \mathsf dy = \frac16(s-(s-2))= \frac13. $$
When $3\leqslant s\leqslant 5$ then
$$f_S(s)=\int_{s-2}^3\frac16\ \mathsf dy = \frac16(3 - (s-2)) = \frac56 - \frac16s. $$
Therefore the density of $S$ is given by
$$
f_S(s) =
\begin{cases}
\frac16s,& 0\leqslant s<2\\
\frac13,& 2\leqslant s<3\\
\frac56-\frac16s,& 3\leqslant s<5\\
0,&\text{otherwise.}
\end{cases}
$$
The distribution function of $S$ is obtained by integrating the density, i.e.
$$F_S(s)=\mathbb P(S\leqslant s)=\int_{-\infty}^s f_S(t)\ \mathsf dt. $$