Find the density function of $Z=Y-X$ where the joint density function of X and Y is given by $f(x,y)=1/2,x>0,y>0,x+y<2$ and $0$ otherwise. I know how to do it by finding the CDF first with double integral and then differentiate it w.r.t Z. I learn it like in this link.
Firstly I search for, $F_Z(z)=P(Z<z)=P(Y-X<z)=P(X>Y+z,Y<z)$
And then i had a trouble to find the bounds of the integral. The least I know is just $|y-x|<2$
Can you give me an explanation?
You can do it by changing variables .
Let $U=Y-X$ and $V=Y+X$.
Then $|\frac{\partial(x,y)}{\partial(u,v)}| = \frac{1}{2}$
And $f(u,v)=\frac{1}{2}\cdot\frac{1}{2} \,, v>u\,,u>-v,v<2$
Then $$f_{U}(u)=\int_{-\infty}^{\infty}f(u,v)\,dv =\begin{cases}\int_{u}^{2}\frac{1}{4}dv\,,0\leq u\leq2\\ \int_{-u}^{2}\frac{1}{4}\,dv\,,-2\leq u<0\end{cases} $$
$$=\begin{cases}\frac{2-u}{4}\,,0\leq u\leq2\\ \frac{2+u}{4}\,,-2\leq u<0\end{cases}$$
is your required density for $U=Y-X$