Suppose $X$ and $Y$ have joint density $f(x, y) = 2$ for $0 < y < x < 1$.
Find $P(X − Y > z)$.
The answer is supposedly $\frac{(1-z)^2}{2}$ but I couldn't figure out why. I have tried doing the following:
$\int_{0}^{1} \int_{z+y}^{1} 2 dxdy$
since $x > z + y$ and $1 > x > y$ hence x is bounded by $(z + y) < x < 1$. Then I tried integrating over the interval $[0, 1]$ for y but I'm pretty sure the condition $y < x$ somehow affects the limit of the integral.
Please help, Thank You!
Always look to the support.
When $0<Y<X<1$ and $X-Y>z$, then $0<z<X-Y<X<1$ and $0<Y<X-z$ so....
$$\begin{align}\mathsf P(X-Y>z) &=\mathbf 1_{0<z<1} \int_z^1\int_0^{x-z}2~\mathrm dy~\mathrm d x+\mathbf 1_{z\leqslant 0}\\[2ex]&=(1-z)^2\mathbf 1_{0< z\leq 1}+\mathbf 1_{z\leq 0} \end{align}$$