# Given $X,Y\sim i.i.U[0,1]$, what is $P(X<Y)$?

Let a, b be real numbers randomly selected independently and uniformly from the range of (0,1).

What is P(a < b)?

The problem here is that a can be equal to b, so is P(a < b) ≈ 0.5 or P(a < b) → 0.5 formally correct? Or anything else?

What I'm looking for here is a correct formal way to write this probability down.

• The probability of having a single value is zero, if the the probability density is $f(x)$ then the probability that the outcome is equal to $a$ is $\int_a^a f(x)dx=0$ because the lower and upper limit are the same. – user83346 Aug 12 '16 at 10:56
• "random real numbers between 0 and 1" does not contain enough information to determine $p(a<b)$ (though it can be guessed that independence and uniform distribution were intended). – Juho Kokkala Aug 12 '16 at 11:03
• @JuhoKokkala correct – Riko Aug 12 '16 at 11:04
• @Riko, it is best to edit these facts into the question rather than leave them in the comments, since not everybody will read the comments and comments may eventually be deleted. I have done this for you in this case. – Silverfish Aug 12 '16 at 11:21
• All the following material has appeared elsewhere on this site (search if you need details): Making no assumptions about the distribution, it is trivial that $\Pr(a\lt b)=\Pr(b\lt a)$. It is axiomatic that $1=\Pr(a\lt b) + \Pr(a=b) + \Pr(a \gt b)$. Algebra implies $\Pr(a\lt b) = (1-\Pr(a=b))/2.$ Any distribution for which $\Pr(a=b)=0$ is non-discrete. Such distributions include all continuous distributions, such as the Uniform$(0,1)$ distribution. – whuber Aug 12 '16 at 14:08

If $a$ and $b$ are independent and identically distributed as $U[0,1]$, then $P(a \lt b) = 0.5$. It is also true that $P(a \le b) = 0.5$, because $P(a = b) = 0.$

In fact, if $a$ and $b$ are independent and identically distributed from any continuous distribution on the real numbers, then $P(a \lt b) = 0.5$, $P(a \le b) = 0.5$, and $P(a = b) = 0.$

• They dont even need to be independent, exchangeable is enough – kjetil b halvorsen May 15 '18 at 0:48

For independent continuous $U(0,1)$ random variables we have (taking into account that their density is constant and equal to $1$) $$P(a<b) =P(a\leq b)= \int_0^1 \int_0^b da\,db = \int_0^1(b-0)\, db$$

$$=\int_0^1b\, db = \frac 12 b^2 \big|^1_0 = \frac 12\cdot1^2 - \frac 12\cdot 0^2 = \frac 12$$

If we start with an infinitely-large ordered set and we pick two elements from the set, we know that one (and only one) of the following situations can be correct:

• a < b
• a = b
• a > b

We can state:

• P( a = b ) = 0 (assuming selection from an infinite set of values)
• P( a < b ) = P ( a > b ) (because a and b are independently selected)

Therefore P( a < b ) = 0.5.

Your example refer to independent selection from the set of all real numbers in the range (0, 1), so this result applies.

• Your first statement does not follow from the assumptions. For instance, let the underlying distribution be geometric with parameter $p$, $0\lt p\lt 1$, where the probability associated with a natural number $n$ is $(1-p)^n p$. Although the natural numbers are infinite and ordered, $$\Pr(a=b)=\sum_{n=0}^\infty ((1-p)^n p)^2 = \frac{p}{2-p}\ne 0.$$ – whuber Aug 12 '16 at 14:39