I have two random variables $X_{1}, X{2}$ following $U(0,1)$. I need to compute $E(X_{1}|X_{1} > X_{2})$.

I am thinking that since the random variables are independent, so $X_{1}|X_{1} > X_{2}$ should just be $X_{1}$ and its expectation should be $\frac{1}{2}$.

I don't have answer of this problem. I just want to check whether my approach is correct.


2 Answers 2


No, the event $X_1>X_2$ provides some information. Consider a more general case where you have independent $X_1,..,X_n$ and the event $\bigcap_{i=2}^n X_1>X_i$, surely you have the right to suspect that $X_1$ is closer to $1$ more probably than $0$.

For your question, there are various ways to calculate it, normalise the joint distribution in the region where $X_1>X_2$ and take the expectation. The answer will be $2/3$ (or a more straightforward way: $x_1$ coordinate of the center of mass of the triangle region).

  • $\begingroup$ Okay. Thanks for the answer. So, this way $f(x > y) = \frac{1}{2}$. Consequently, $f(x|x>y) = 2, y < x < 1$. I think this is what you meant? But i still don't understand why the x>y will depend on x? $\endgroup$
    – userNoOne
    Feb 3, 2021 at 10:47
  • 2
    $\begingroup$ yes, the complete region is the triangle: $0<y<x<1$ $\endgroup$
    – gunes
    Feb 3, 2021 at 10:49

Comment. illustrating @gunes (+1) argument via simulation in R.

X1 = runif(10^6);  X2 = runif(10^6)
[1] 0.6668622  # aprx 2/3

In the figure below, $E(X_1|X_1 >X_2)= 2/3$ is the the average horizontal value of the blue points.

#smaller samples for clearer figure
x1 = X1[1:30000];  x2 = X2[1:30000]
plot(x1, x2, pch=".")
 points(x1[x1 > x2], x2[x1 > x2], pch=".", col="blue")

enter image description here

hist(X1[X1 > X2], prob=T, col="skyblue2")
 curve(dbeta(x,2,1), add=T, col="orange", lwd=2, n = 10001)

enter image description here


Not the answer you're looking for? Browse other questions tagged or ask your own question.