Expected Value and Variance of the Absolute Difference of Uniforms
Let $X$ and $Y$ be independent, each uniformly distributed on $[0, 60]$. Compute:
- $E[|X - Y|]$
- $\text{Var}(|X - Y|)$
Hints
- Use symmetry: $E[|X - Y|] = 2 E[(X - Y)^{+}]$. Split the integral into the region where $X > Y$.
- For the variance, use the identity $\text{Var}(|X-Y|) = E[(X-Y)^2] - (E[|X-Y|])^2$. Note that $|X-Y|^2 = (X-Y)^2$ and use $\text{Var}(X-Y) = 2\text{Var}(X)$ by independence.
- The inner integral $\int_0^x (x - y) dy = x^2/2$. Then integrate $x^2/2$ over $[0, 60]$ to get the first moment.
Worked Solution
How to Think About It: You have two independent uniform draws from $[0, 60]$ and want the expected absolute difference and its variance. For the expectation, symmetry helps: $|X - Y|$ has the same distribution as $|Y - X|$, so you can compute $E[|X - Y|] = 2 E[\max(X - Y, 0)]$ and split the integral into the region where $X > Y$. For a general Uniform$(0, a)$, dimensional analysis suggests $E[|X - Y|]$ scales linearly with $a$, and a quick computation confirms $E[|X - Y|] = a/3$.
Quick Estimate: For $\text{Uniform}(0, a)$, the expected absolute difference is $a/3$. With $a = 60$, that gives $E[|X - Y|] = 20$. For the variance, we need $E[(X-Y)^2]$. Since $X$ and $Y$ are independent with the same distribution, $\text{Var}(X - Y) = 2 \text{Var}(X) = 2 \times 60^2/12 = 600$. Then $\text{Var}(|X - Y|) = E[(X-Y)^2] - (E[|X-Y|])^2 = 600 - 400 = 200$.
Approach: Compute $E[|X - Y|]$ by splitting into two symmetric regions, then use the identity $\text{Var}(|X-Y|) = E[(X-Y)^2] - (E[|X-Y|])^2$.
Formal Solution:
Part 1: $E[|X - Y|]$
The joint density is $f(x, y) = 1/3600$ on $[0, 60]^2$.
$$E[|X - Y|] = \int_0^{60} \int_0^{60} \frac{|x - y|}{3600} \, dx \, dy$$
By symmetry ($|x - y| = |y - x|$), split into $x > y$ and double:
$$= 2 \int_0^{60} \int_0^x \frac{x - y}{3600} \, dy \, dx$$
The inner integral:
$$\int_0^x (x - y) \, dy = \left[xy - \frac{y^2}{2}\right]_0^x = x^2 - \frac{x^2}{2} = \frac{x^2}{2}$$
So:
$$E[|X - Y|] = \frac{2}{3600} \int_0^{60} \frac{x^2}{2} \, dx = \frac{1}{3600} \int_0^{60} x^2 \, dx = \frac{1}{3600} \cdot \frac{60^3}{3} = \frac{216000}{10800} = 20$$
Part 2: $\text{Var}(|X - Y|)$
Note that $|X - Y|^2 = (X - Y)^2$, so:
$$E[|X - Y|^2] = E[(X - Y)^2] = \text{Var}(X - Y) + (E[X - Y])^2$$
Since $E[X] = E[Y] = 30$, we have $E[X - Y] = 0$. And by independence:
$$\text{Var}(X - Y) = \text{Var}(X) + \text{Var}(Y) = 2 \cdot \frac{60^2}{12} = 2 \times 300 = 600$$
Therefore:
$$\text{Var}(|X - Y|) = E[(X-Y)^2] - (E[|X-Y|])^2 = 600 - 20^2 = 600 - 400 = 200$$
General formula for $\text{Uniform}(0, a)$: - $E[|X - Y|] = a/3$ - $\text{Var}(|X - Y|) = a^2/18$
Check: $60^2/18 = 3600/18 = 200$.
Answer: $E[|X - Y|] = 20$ and $\text{Var}(|X - Y|) = 200$.
Intuition
For two independent uniform draws on $[0, a]$, the expected absolute difference is always $a/3$. This is a useful fact to memorize -- it comes up in geometric probability problems and as a quick sanity check in interviews. The factor of $1/3$ arises because the density of $|X - Y|$ is triangular on $[0, a]$, peaking at 0 and linearly decreasing to 0 at $a$. Most of the probability mass is near small differences.
The variance calculation uses a nice trick: even though $|X - Y|$ and $(X - Y)$ are different random variables, their squares are identical. This lets you compute $E[|X-Y|^2]$ using the much simpler variance-of-a-difference formula. This trick -- converting an absolute value problem to a squared problem for the second moment -- is widely applicable whenever you need $\text{Var}(|Z|)$ for a symmetric $Z$.