# Probability that distance between $X$ and $Y$ is $>$ $L/3$

Two points are selected randomly on a line of length $L$, so as to be on opposite sides of the midpoint of the line[In other words, the two points $X$ and $Y$ are independent random variables with a uniform distribution over $(0, L/2)$ and $(L/2, L)$ respectively. Find the probability that the distance between the two points is greater than $L/3$.

Attempt: We have $f_X(x) = f_Y(y) = 2/L => f(x,y) = 4/L^2$ The probability I want is $P(Y-X > L/3) = P(Y> L/3 + X)$. So I need to evaluate: $$\iint_{(x,y): y > L/3 + x} f(x,y)\,dy\,dx.$$ I said the limits on $y$ were from $L/3 + x$ to $L$ and $x$ from $0$ to $L/2$, so I evaluate $$\int_0^{L/2} \int_{L/3 +x}^{L} \frac{4}{L^2}\,dy\,dx$$ which gives $5/6$, but that is incorrect. Where did I go wrong?

-
Wlog. $L=2$ and you want the area of the unit square $[0,1]^2$ above the line $y=x-\frac23$, that is a triangle of size $\frac1{18}$ is cut off. –  Hagen von Eitzen Dec 10 '12 at 21:38

The problem is that for $x\lt L/6$ you're allowing $y\lt L/2$.

-
So for $y > L/3 + x > L/2 => x > L/6$ This gives one series of limits: $x$ from $L/6$ to $L/2$ and $y$ from $L/3 + x$ to $L$. If $x < L/6$ then $y$ has to be from $L/2$ to $L$ right? So these are my limits, right? –  CAF Dec 10 '12 at 22:16
@CAF: Yes, that's right –  joriki Dec 10 '12 at 22:19
One other Q I was doing was: 3 points, $X_1, X_2, X_3$ are selected at random on a line $L$. What is the prob that $X_2$ lies between $X_1$ and $X_3$? I said this was equal to $$2P(X_1 < X_2 < X_3) = 2 \int_{X_2}^{L} \int_{X_1}^{X_3} \int_{0}^{X_2} f(x_1, x_2, x_3)\, dx_1\,dx_2\,dx_3.$$ I know the second of these three limits is wrong (the answers have it from $0$ to $L$. Can you help? (I understand the order of integration is incorrect here, it's just the limits I need help on)(I would have put this in another thread, but it is similar to the question above). Thanks. –  CAF Dec 10 '12 at 22:31
@CAF: a) Why did you write the order of integration like that if you already know it's wrong? b) This expression doesn't make sense on several levels -- the limits are random variables $X_i$ instead of the integration variables $x_i$ you probably want them to be, and $X_2$ occurs in a limit outside the integral over $x_2$. c) This question doesn't require integration; the answer is $1/3$ by symmetry. –  joriki Dec 10 '12 at 22:47
So you essentially said there are 3! Arrangements of the $X_i$ and 2 of which result in $X_2$ between $X_1, X_3, => 2/6 = 1/3$. In terms of my integrand, is it okay to have the limits on the second integral from $x_1$ to $x_3$? It makes sense but then I don't get an actual probability (number) in the end. –  CAF Dec 11 '12 at 13:45

Since you are integrating a constant function, it's going to be so much easier if you draw yourself a picture of the area and use simple geometry, rather than integrating an analytic expression:

And dividing the hatched area by the total square area, the resulting probability is $\frac{7}{36}/\frac{1}{4} = \frac{7}{9}$

-
OP CAF has been advised previously (see e.g. the comments on this problem) to use geometry, but it is unlikely that he will heed that advice (or yours). –  Dilip Sarwate Dec 10 '12 at 23:03