# Probability for joint distribution

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.

When $$0 and $$X-Y>z$$, then $$0 and $$0 so....
\begin{align}\mathsf P(X-Y>z) &=\mathbf 1_{0
• @Fardeem It is an indicator function; a piecewise function that equals one when the indicated condition is true, otherwise equals zero. \begin{align}\mathbf 1_{z\leq 0}&=\begin{cases}1&:&z\leq 0\\0&:&\text{otherwise}\end{cases}\\[2ex](1-z)^2\mathbf 1_{0<z\leq 1}+\mathbf 1_{z\leq 0}&=\begin{cases}1&:&z\leq 0\\(1-z)^2&:&0<z\leq 1\\0&:&\text{otherwise}\end{cases}\end{align} – Graham Kemp Apr 28 '19 at 14:31
• But the book says the answer is $\frac{(1-z)^2}{2}$. Are you sure this is the answer? – Fardeem Apr 29 '19 at 16:58
• @Fardeem To be sure, check that $\lim\limits_{h\to 0^+}\mathsf P(X-Y>h) = 1$ as it should. – Graham Kemp Apr 29 '19 at 23:39