Difference between two difference uniform distributions

46 Views Asked by At

Suppose we have two independent distributions $X \sim U[a,b]$ and $Y \sim [c,d]$, where $a < c < 0$ and $b > d > 0$.

How do you find $P(X > Y)$ ?

I've seen some answers here using the difference between two $U[0,1]$ and managed to think something like this:

First, we let $Z = X - Y$. Since the distributions are independent, we can multiply their densities:

$$f_Z = f_X \cdot f_Y = \frac{1}{(b-a)}\cdot\frac{1}{(d-c)}$$

Then we go on to take the integral:

$$P(Z \leq 0) = \int_a^b\int_c^df_X(c+x)f_Y(x)dxdc $$

But I didn't manage to get much further from this.

I suspect there exists a closed form, like this $P(Z \leq 0) = \frac{(b-a)}{(d-c)}$ (Not this exact format, but something along these lines)

Any tips?

2

There are 2 best solutions below

0
On

Since both of $X$ and $Y$ are uniformly distributed and they are independent. The joint pdf is $f_{XY}=\frac{1}{(b-a)(d-c)}$. The total $2D$ region is the rectangle region with vertices coordinates $A(b,d),~B(a,d),~C(a,c),~D(b,c)$

Then draw a line $y=x$ to intersect $AB$ with $P$ and intersect $CD$ with $Q$. So the probability $P(X>Y)$ equals the area of the trapezoid $APQD$ multiply the constant pdf $\frac{1}{(b-a)(d-c)}$

$$P(X>Y)=\frac{1}{(b-a)(d-c)}\cdot \frac{(b-d)+(b-c)}{2}\cdot(d-c)=\frac{2b-d-c}{2(b-a)}$$

0
On

Note: Always keep an eye on the supports.

First, we let Z=X−Y. Since the distributions are independent, we can multiply their densities:

No, not quite. The joint pdf between $Z$ and $Y$ is such a product, and this means:

$$\begin{align}f_{X-Y,Y}(z,y) &= f_X(z+y)f_Y(y)\\[1ex]f_{X-Y}(z)&=\int_\Bbb R f_X(z+y)f_Y(y)\,\mathrm d y\\[2ex]\mathsf P(X>Y) &=\iint_{\Bbb R^2} \mathbf 1_{0< z}\,f_X(z+y)\,f_Y(y)\,\mathrm d y\,\mathrm d z \\[1ex]&= \iint_{\Bbb R^2}\dfrac{\mathbf 1_{0<z}\mathbf 1_{a<z+y<b}\mathbf 1_{c<y<d}}{(b-a)(d-c)}\mathrm d (z,y)\\[1ex]&=\dfrac{1}{(b-a)(d-c)}\int_{0}^{b-c}\int_{\max[a-z,c]}^{\min[b-z,d]}\mathrm d y\,\mathrm d z\end{align}$$

Which may be found much easier without convolution:


$X\sim\mathcal U[a;b], Y\sim\mathcal U[c;d]\text{ where } a\lt c\lt 0\lt d\lt b$

Well, you could do :

$\qquad\begin{align}\mathsf P(X>Y)&=\int_c^d\int_t^b f_X(s)\,f_Y(t)\,\mathrm d s\,\mathrm d t\\[1ex]&=\dfrac{1}{(b-a)(d-c)}\int_c^d(b-t)\,\mathrm d t\\&~~\vdots\end{align}$

Or you could do:

$\qquad\begin{align} \mathsf P(X>Y) &=\mathsf P(c\leq Y<X\leq d)+\mathsf P(d\lt X\leq b)\\[1ex]&=\mathsf P(Y<X\mid c\leq X\leq d)\,\mathsf P(c\leq X\leq d)+\mathsf P(d\lt X\leq b)\\[1ex]&= \dfrac 12\cdot\dfrac{d-c}{b-a}+\dfrac{b-d}{b-a}\\[1ex]&=\dfrac{2b-c-d}{2\,(b-a)}\end{align}$