TITLE: Distribution of a difference of two Uniform random variables?
QUESTION [12 upvotes]: Let $X$ and $Y$ both be distributed between $[1,2]$, what is the distribution of $Z=X-Y$?

REPLY [12 votes]: If $x,y$ are independent and uniformly distributed on $[1,2]$, then the PDF of $x$ is $1_{[1,2]}$ and the PDF of $-y$ (note the minus sign) is $1_{[-2,-1]}$. Then the PDF of $z=x-y$ is given by the convolution $f_z=1_{[1,2]} * 1_{[-2,-1]}$.
Computing this is straightforward.
\begin{eqnarray}
f_z(x) &=& \int 1_{[1,2]}(y) 1_{[-2,-1]}(x-y) dy \\
&=& \int_1^2  1_{[-2,-1]}(x-y) dy \\
&=& \int_{x-2}^{x-1}1_{[-2,-1]}(t) dt \\
&=& \int 1_{[x-2,x-1] \cap [-2,-1]}(t)dt \\
&=& m([x-2,x-1] \cap [-2,-1]) \\
&=& m([x,x+1] \cap [0,1]) \\
&=& (1-|x|)1_{[-1,1]}(x)
\end{eqnarray}