Finding the distribution of the sum of three independent uniform random variables

Let $X,Y,Z\sim Unif(0,1)$, all independent. Find the distribution of $W=X+Y+Z$

I'm trying to solve this by doing convolution twice. I'm letting $S=X+Y$, then $W=S+Z$. So I should end up with $f_W(w) = \int f_S(s)f_Z(w-s)ds$.

My solution for $f_S(s)$ is $f_S(s) = \begin{cases} s & 0 \leq s\leq 1 \\ 2-s & 1\leq s\leq 2 \\ \end{cases} $

However, I'm having trouble figuring out how to do the integral when I do my second convolution, since $f_S(s)$ is piecewise.

Any thoughts would be greatly appreciated.

Thanks in advance!

Edit for clarification: The problem I'm having isn't how to integrate over a piecewise function. It's how to adjust the bounds of integration when I consider the different possible values for $W$.

Specifically, when $w \in [0,1]$, I get $f_W(w) = \int_0^w f_S(s)ds = w^2/2 $. This part wasn't too bad.

However, when $w\in [1,2]$, we in order to keep $(w-s)$ in the support of $Z$ , we find that $w-1 \leq s \leq w$. The problem is that I'm not sure which part of $f_S(s)$ to use when integrating.

Let me know if I need to further elaborate on my problem.


Solution 1:

Use the definition. Therefore$$f_W(w)=f_S(w)*f_Z(w)=\int_{-\infty}^{\infty}f_S(w-u)f_Z(u)du=\int_{0}^{1}f_S(w-u)du=\int_{w-1}^{w}f_S(u)du$$for $w<0$ and $w>3$ the integral is zero. For $0<w<1$ we have $$f_W(w)=\frac{w^2}{2}$$for $1<w<2$ $$f_W(w)=-w^2+3w-\dfrac{3}{2}$$and for $2<w<3$ $$f_W(w)=\dfrac{(w-3)^2}{2}$$A sketch of $f_W(w)$ is as following:

enter image description here