Probability and uniform distribution

How to calculate the probability that one random sample say X1 will be greater than the other random sample say X2 if they are from a uniform distribution with [0,1] ? This is not a homework. I'm trying to solve some exercise problem and this is a part of the problem.

-
By the way, this works whatever the probability distribution is. – Yuval Filmus Feb 7 '11 at 17:35
There's a related riddle. Two non-atomic (i.e. continuous) equidistributed random variables $X_1,X_2$ are sampled. You're given one of them, and you guess whether it is the smaller one or the larger one. Show that even without knowing the distribution you can always guess correctly with probability strictly greater than $1/2$! – Yuval Filmus Feb 7 '11 at 17:37

You could do it by integration or argue out directly.

To argue out directly, all you need to recognize is that since the two samples are independent, $P(X_1>X_2) = P(X_1<X_2)$. And we have $P(X_1>X_2)+P(X_1=X_2)+P(X_1<X_2) = 1$ since all three are mutually exclusive. $P(X_1=X_2) = 0$ and hence we get $P(X_1>X_2) = P(X_1<X_2) = \frac{1}{2}$.

To do it by integration, first find the $P(X_1>X_2 | X_2=x)$. Since the distribution is uniform, $P(X_1>X_2 | X_2=x) = 1-x$. Now $P(X_1>X_2) = \displaystyle \int_{0}^1 P(X_1>X_2 | X_2=x) f_{X_2}(x) dx = \int_{0}^1 (1-x) \times 1 dx = \frac{1}{2}$

EDIT:

As Yuval points out this is true irrespective of the distribution.

The direct argument holds good irrespective of the distribution.

Also, leonbloy's argument based on areas still work out fine irrespective of the distribution.

As for the argument based on integration,

$P(X_1>X_2 | X_2=x) = 1-F_{X}(x)$.

Now,

$P(X_1>X_2) = \displaystyle \int_{ll}^{ul} P(X_1>X_2 | X_2=x) dF_{X_2}(x) = \int_{ll}^{ul} (1-F_X(x)) dF_X(x)$.

Hence,

$P(X_1>X_2) = \displaystyle \int_{ll}^{ul} (1-F_X(x)) dF_X(x) = \int_{ll}^{ul} dF_X(x) -\int_{ll}^{ul} d(\frac{F_X^2(x)}{2})$

$P(X_1>X_2) = F_X(ul) - F_X(ll) - \frac{F_X^2(ul) - F_X^2(ll)}{2} = 1 - 0 - \frac{1-0}{2} = \frac{1}{2}$

All these seemingly different arguments are fundamentally the same way of expressing the same idea but I thought it would be good to write it out explicitly.

-
If I do this way then for example P(X1 >= (3X2)/2) = 1/4. Am I right? I'm trying to solve for different values. In this case X1 is at least one and a half times X2. – Sunil Feb 7 '11 at 17:41
@Sunil: To do this easily, you might find leonbloy argument easier. $P(X_1 \geq \frac{3X_2}{2})$ is the area of the triangle with side $1$ and height $\frac{2}{3}$. So the desired probability is $\frac{1}{3}$ – user17762 Feb 7 '11 at 17:52
@Sunil: To look at it in an other way, if you want $X_1 \geq \frac{3X_2}{2}$, then $X_2 \leq \frac{2}{3}$ and now you have equal probability for $X_1 > X_2$ and $X_1 < X_2$. Hence the answer is $\frac{1}{2} \frac{2}{3} = \frac{1}{3}$. Generally, $P(X_1>a X_2) = \frac{1}{2a}$ if $a \geq 1$ and $P(X_1>a X_2) = 1-\frac{a}{2}$ if $a \leq 1$ – user17762 Feb 7 '11 at 17:56
Is this irrespective of the distribution ? If so we cannot tell the area in this case or the integral limits right ? – Sunil Feb 7 '11 at 18:01
@Sunil: This is still irrespective of the distribution. If you feel confused, you can revert to the integral argument for a general distribution and see what happens. – user17762 Feb 7 '11 at 18:03

There's no calculation to perform -- the answer must be $1/2$ by symmetry.

-

Just plot the posible pair ocurrences (in the X1-X2 plane: it lies inside the unit square), identify the "success" region (in which X1>X2 : a triangle). The probability is given (assuming that the variables are not only uniform but also independent) by the area of the triangle. That is, 1/2.

In this particular problem, it's easy to guess the result from its symmetry.

-
Symmetry is not guessing :-) More formally: $\{X_1,X_2:X_1=X_2\}$ is a set of measure $0$; hence $p(X_1 > X_2) + p (X_1=X_2) + p (X_1 < X_2) = p(X_1 > X_2) + p (X_1 < X_2)$. Symmetry (rigorously) implies $p(X_1 > X_2) = p (X_1 < X_2)$. Thus, $p(X_1 > X_2) + p (X_1 < X_2) = p(X_1 > X_2) + p (X_1 > X_2) = 1\Rightarrow p(X_1 > X_2)=1/2$. No guessing involved :-) – joriki Feb 7 '11 at 17:37
I can understand this for P(X1>X2). What if we want to find P(X1>2X2) or something like that. Can you shed more light on your answer. It seems interesting but I fail to picture your answer. – Sunil Feb 7 '11 at 17:43
Draw the square $[0,1]\times[0,1]$. The joint variable $(X_1,X_2)$ takes values in this square, uniformly. Identify your desired region (eg $X_1>2X_2$). The probability that $(X_1,X_2)$ falls in that region is simply the area of that region. – leonbloy Feb 7 '11 at 17:46
That's what I meant. X1 = X2 will be a diagonal right? The area under it is 1/2 ab which is 1/2. Where would X1 > 2X2 fall ? – Sunil Feb 7 '11 at 17:52
See the answer by Shai Covo for a treatment of that case. To picture it on the square $[0,1]\times[0,1]$: A general principle for picturing inequalities is to consider the corresponding equation; the inequality picks out one side of the manifold (in this case a line) determined by the corresponding equation. So in your example, the equation would be $X_1=2X_2$, which is a line from the origin to the point $(1,1/2)$ on the right-hand border of the square. This line cuts out the lower-right half of the lower half of the square, so the probability is 1/4, in accordance with Shai Covo's result. – joriki Feb 7 '11 at 19:00

Consider the following experiment. Pick $X_1,X_2$ independently, uniformly at random from $[0,1]$; now, with probability $1/2$, switch $X_1$ and $X_2$. What does this tell you about the probability you're looking for?

-

Let's consider the more general case of the probability ${\rm P}(X_1 \geq a X_2)$, where $a \geq 1$ is constant. You can find this probability as follows. Use the law of total probability, conditioning on $X_2$, to obtain $${\rm P}(X_1 \geq a X_2) = \int_0^1 {{\rm P}(X_1 \ge aX_2 |X_2 = u)\,{\rm d}u} = \int_0^1 {{\rm P}(X_1 \ge au)\,{\rm d}u},$$ where the last equality follows from independence. Hence, since $a \geq 1$, $${\rm P}(X_1 \geq a X_2) = \int_0^{1/a} {{\rm P}(X_1 \ge au)\,{\rm d}u} + \int_{1/a}^1 {{\rm P}(X_1 \ge au)\,{\rm d}u}.$$ Finally, we obtain $${\rm P}(X_1 \geq a X_2) = \int_0^{1/a} {(1 - au)\,{\rm d}u} + 0 = \frac{1}{a} - a\frac{1}{{2a^2 }} = \frac{1}{{2a}}.$$ In particular, $${\rm P}\bigg(X_1 \ge \frac{{3X_2 }}{2}\bigg) = \frac{1}{{2(3/2)}} = \frac{1}{3}.$$

-
As an exercise, apply the same method to compute the probability of $X_1 \geq aX_2$, where $X_1$ and $X_2$ are independent exponential rv's with different means. – Shai Covo Feb 7 '11 at 18:27