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.
 A: 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:

A: See here we can simplify 2 of the cases:

*

*$0 \leq W \leq 1$: 
You can consider X, Y, Z to be uniform points in a Unit cube. Now, This condition implies that we have to consider the all the points which are present inside the tetrahedron formed by the plane $X+Y+Z = 1$ and the edges of the cube.
Suppose $W < w$ then $F_{W} (w) = P(W \leq w) = P(X+Y+Z \leq w) = \frac{w^{3}/6}{1}$, as the volume of the tetrahedron will be $\frac{1}{3} \cdot Area_{base} \cdot height = \frac{1}{3} \cdot \frac{w^2}{2} \cdot w$. This method works as Uniform Distribution can be calculated from areas or volumes depending on the problem. So, $f_W(w) = F'_{W}(w) = \frac{w^2}{2}$


*$2 < W \leq 3$: 
You can go via the same approach as we did before in this case also just that here we have to subtract the volume of the tetrahedron from the unit cube, since $X+Y+Z \geq 2$ so we will have $F_{W} (w) = P(W \leq w) = P(X+Y+Z \leq w) = 1 - P(X+Y+Z > w) = 1 - \frac{(3-w)^{3}/6}{1}$. So, $f_W(w) = F'_{W}(w) = \frac{(3-w)^2}{2}$


*$1 < W \leq 2$: 
Here you can also go via the volum approach but it will be bit harder to visualize. You can see the steps as mentioned by @Mostafa. Since, we know that $S = X+Y$ follows the triangle distribution.
Hope it helps.
A: The sum of n i.i.d uniform random variables follows Irwin–Hall distribution that parameterized by n. Check it out. https://en.wikipedia.org/wiki/Irwin%E2%80%93Hall_distribution
