# What is the expected distance between these two points?

Suppose you have a straight line of length L, and a point is chosen at random along the line.

Now suppose a second point is chosen at random to the left of the first point.

What is the expected distance between these points?

Note: I am aware that if two points are independently chosen at random, the expected distance is L/3, but is it the case in this scenario where the second point is dependent upon the first? Please justify answers with mathematics.

We have the density function for uniform $x\in[0,L]$ and uniform $y\in[0,x]$ $$f(x,y)=\frac 1L\cdot\frac 1x$$ so it is $$\int_0^L\int_0^x (x-y)\frac 1L\cdot\frac 1x\ dy\ dx=\frac L4$$ which can be confirmed by this Wolfram|Alpha-computation.

• Thanks this is what I thought. Commented Apr 2, 2015 at 14:42

I am thinking something along the following lines:

Let $X$ denote the position of the first point, and let $Y$ denote the position of the second point. You have that $X\sim\text{unif}(0,L)$, and $Y|X=x\sim\text{unif}(0,x)$.

Let $Z=X-Y$, which is the distance between $X$ and $Y$. I find $\mathbb{E}Z$ using the law of iterated expectations:

$$\mathbb{E}Z = \mathbb{E}[\mathbb{E}[Z|X]] = \int_0^L\mathbb{E}[Z|X=x]\frac{1}{L}\ dx=\int_0^L\mathbb{E}[X-Y|X=x]\frac{1}{L}\ dx$$ $$=\int_0^L\left(x-\mathbb{E}[Y|X=x]\right)\frac{1}{L}\ dx = \int_0^L(x-\frac{x}{2})\frac{1}{L}\ dx = \frac{L}{4}.$$

let [0, L] represent the line.

If X1 and X2 are the Random Variables representing the expected positions of the two points, then:

E(X1 - X2) = E(X1) - E(X2) = L/2 - L/4 = L/4

• Can you explain where your probabilities $E(X_1)$ and $E(X_2)$ come from? Commented Jun 5, 2015 at 10:08