Density of sum of two independent uniform random variables on $[0,1]$ I am trying to understand an example from my textbook.
Let's say $Z = X + Y$, where $X$ and $Y$ are independent uniform random variables with range $[0,1]$. Then the PDF
is
$$f(z) = \begin{cases}
z & \text{for $0 < z < 1$} \\
2-z & \text{for $1 \le z < 2$} \\
0 & \text{otherwise.}
\end{cases}$$
How was this PDF obtained? 
Thanks 

By the hint of jay-sun, consider this idea, if and only if $f_X (z-y) = 1$ when $0 \le z-y \le 1$. So we get 
$$ z-1 \le y \le z $$ 
however, $z \in [0, 2]$, the range of $y$ may not be in the range of $[0, 1]$ in order to get $f_X (z-y) = 1$, and the value $1$ is a good splitting point. Because $z-1 \in [-1, 1]$.
Consider (i) if $z-1 \le 0$ then $ -1 \le  z-1 \le 0$ that is $ z \in [0, 1]$, we get the range of $y \in [0, z]$ since $z \in [0, 1]$. And we get $\int_{-\infty}^{\infty}f_X(z-y)dy = \int_0^{z} 1 dy=z$ if $z \in [0, 1]$.
Consider (ii) if $z-1 \ge 0$ that is $ z \in [1, 2]$, so we get the range of $y \in [z-1, 1]$, and $\int_{-\infty}^{\infty}f_X(z-y)dy = \int_{z-1}^{1} 1 dy = 2-z$ if $z \in [1, 2]$.
To sum up, consider to clip the range in order to get $f_X (z-y) = 1$.
