Let $X,Y,Z$ be iid $\mathcal{U}(0,1)$. 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.
