$X_i \sim \mathscr{U}[0,2]$ independent R.V., find pdf of $Z=|X_1-X_2|$ trouble with setting convolution limits. $X_i \sim \mathscr{U}[0,2]$ find pdf of $Z=|X_1-X_2|$ trouble with setting convolution limits.
Notice $$Z=\begin{cases}X_1-X_2 \ \text{for} \ X_1\geq X_2
\\ X_2-X_1 \ \text{for} \ X_2> X_1\end{cases}$$
First of all I see it is symmetric but I did not know how to use this fact so I proceeded as follows
Set $Y=-X_2$ then $Y \sim \mathscr{U}[-2,0]$ we know pdf functions $f_{X_1}(t)=\frac{1}{2}\mathbb{1}_{[0,2]}(t)$ and $f_{Y}(t)=\frac{1}{2}\mathbb{1}_{[-2,0]}(t)$ So convolution $f_{X_1}\ast f_{Y}(t)=\int_\mathbb{R}(\frac{1}{2}\mathbb{1}_{[0,2]}(t-x))(\frac{1}{2}\mathbb{1}_{[-2,0]}(x))\mathop{dx} $
I will solve it for the first case only second one is analogical, so $X_1\geq X_2$
$$\begin{align} \\f_{X_1}\ast f_{Y}(t)&=\int_\mathbb{R}(\frac{1}{2}\mathbb{1}_{[0,2]}(t-x))(\frac{1}{2}\mathbb{1}_{[-2,0]}(x))\mathop{dx}\\ &=\int_\mathbb{R}(\frac{1}{2}\mathbb{1}_{[t-2,t]}(x))(\frac{1}{2}\mathbb{1}_{[-2,0]}(x))\mathop{dx} 
\\&=\int_\mathbb{R}(\frac{1}{4}\mathbb{1}_{[t-2,t]\cap[-2,0]}(x))\mathop{dx} 
\\&= \begin{cases} \int_{-2}^{t}\frac{1}{4}\mathop{dx} \ \ \text{for}  \ t< 0\\\int_{t-2}^{0}\frac{1}{4}\mathop{dx} \  \text{for} \ t\geq0\end{cases}\end{align}$$
And now confusion begins, because I am interested in situation where $t$ is positive since values of $f_{X_i}(t)$ are different than zero only in $[0,2]$ and so is $f_Z(t)$ so should I ignore the $t<0$ part? And second question how to respect the fact that  $X_1\geq X_2$ what does it mean for the result I obtained.
 A: There is a simple way to do this geometrically. Since $X_1, X_2$ are independent Uniform $[0,2]$ random variables,
$$
P((X_1, X_2)\in R)=\frac{m(R\cap [0,2]^2)}{m([0,2]^2)}=\frac{m(R\cap [0,2]^2)}{4}
$$
where $m$ is Lebesgue measure (area) and $R$ is any (Borel) set. In particular, we can compute the cdf of $Z=|X_1-X_2|$ in the following way. Note that
$$
Z\leq z\quad \text{iff} \quad X_1-z\leq X_2\leq X_1+z
$$
so
$$
P(Z\leq z)=P(X_1-z\leq X_2\leq X_1+z)=P((X_1, X_2)\in R)
$$
where
$$
R=\{(x,y)\in\mathbb{R}^2\mid x-z\leq y\leq x+z\}.
$$
We note that the area of $R\cap [0,2]^2$ can be computed by substracting the area of the square minus the area of twao right triangles with base and height equal to $2-z$.
Thus
$$
F(z)=P(Z\leq z)=\frac{m(R\cap [0,2]^2)}{4}=\frac{4-(2-z)(2-z)}{4}=1-\frac{(2-z)^2}{4}.
$$
It is easy to see that $Z$ is supported on $[0,2]$ and as a check $F(0)=0$ and $F(2)=1$. Differentiating we get the density as
$$
f(z)=\frac{1}{2}(2-z)\quad 0\leq z\leq 2.
$$
Indeed $f\geq 0$ and $\int_0^2 f(z)\, dz=1$ (as a check).
