# Comparison of 2 samples from different uniform distributions

Given that $0\le a\le b<1$ and $p$ is uniform on $[a,1]$ and $q$ is uniform on $[b,1]$ then if $p$ and $q$ are random selections then what is the probability that $q>p$?

Edit: I am trying to work on an opening strategy for poker as a function of the ante, bet, number of players, and position at the table by doing a simulation. The a and b values represent the minimum opening/calling requirements assuming that the hand each player gets is from a uniform distribution on [0,1] with 1 being the best hand.

-
both answers give the same result! - thanks to André Nicolas and Did. – Ray Tayek Jan 24 '13 at 23:08

Procedure: (We use $X$ instead of $p$, and $Y$ instead of $q$.)

So we want the probability that $Y\gt X$.

Note that the joint distribution of $X$ and $Y$ is uniform on a certain rectangle. The area of that rectangle is $(1-a)(1-b)$. The joint density function is the reciprocal of this area, on the rectangle, and $0$ elsewhere.

Draw the coordinate axes, and draw a picture of the rectangle. Now draw the line $y=x$. We want the probability that we are above the line.

Find the area of the region which is in the rectangle but above the line. This could be done by integration, but calculus is unnecessary: basic geometry is enough.

Then divide this area by $(1-a)(1-b)$.

-

Since $\mathbb P(p\lt x)=(x-a)/(1-a)$ for every $x$ in $(b,1)$ and since $p$ and $q$ are independent, $$\mathbb P(p\lt q)=\int_b^1\mathbb P(p\lt x)\frac{\mathrm dx}{1-b}=\frac1{(1-a)(1-b)}\left[\frac{x^2}2\right]_{b-a}^{1-a}=\frac{1+b-2a}{2(1-a)}.$$ Sanity checks: If $a=b$, the result is $\frac12$ (why?). If $b=1$, the result is $1$ (why?). The result is increasing with respect to $b$ (why?) and decreasing with respect to $a$ (why?).

-