# How to Calculate the Conditional Distribution of a Sum of Uniform Random Variables given the Observed Range

Suppose $X_1$ and $X_2$ are taken at random from a uniform distribution on the interval $[\theta - 1/2, \theta + 1/2]$, where $\theta$ is unknown $(-\infty < \theta < \infty)$. Let $Z = Y_2 - Y_1$, where $Y_1 = min(X_1, X_2)$ and $Y_2 = max(X_1, X_2)$.

How do I calculate the conditional distribution of $X = 0.5(X_1 + X_2)$ given $Z=z$? Specifically, how do I show that this conditional distribution is uniform on the interval $[\theta - 1/2(1 - z), \theta + 1/2(1 - z)]$?

-
You can use $\TeX$ on this site by enclosing formulas in dollar signs; single dollar signs for inline formulas and double dollar signs for displayed equations. You can see the source code for any math formatting you see on this site by right-clicking on it and selecting "Show Math As:TeX Commands". Here's a basic tutorial and quick reference. There's an "edit" link under the question. – joriki Sep 27 '12 at 3:33

## 1 Answer

One can assume without loss of generality that $\theta=\frac12$, hence $X_1$ and $X_2$ are i.i.d. uniform on $[0,1]$, and compute the distribution of $(X,Z)$. Since $Z=|X_1-X_2|$, for every test function $u$, $$\mathrm E(u(X,Z))=\iint u\left(\tfrac12(x_1+x_2),|x_1-x_2|\right)\,[0\leqslant x_1,x_2\leqslant 1]\,\mathrm dx_1\mathrm dx_2.$$ The change of variable $x=\tfrac12(x_1+x_2)$, $z=|x_1-x_2|$, yields $x_1=x\pm \frac12z$, $x_2=x\mp\frac12z$, $dx_1dx_2=2dxdz$ (the factor $2$ for the fact that two points $(x_1,x_2)$ correspond to the same point $(x,z)$), and $$\mathrm E(u(X,Z))=\iint u(x,z)\,2\,[0\leqslant 2x\pm z\leqslant2,\,z\geqslant0]\,\mathrm dx\mathrm dz.$$ The indicator function is $[z\leqslant 2x\leqslant2-z,\,0\leqslant z\leqslant1]$, hence $(X,Z)$ is uniform on this set (this is the triangle in the $(x,z)$ plane with vertices $(0,0)$, $(1,0)$ and $(\tfrac12,1)$) and, conditionally on $[Z=z]$ for some $z$ in $[0,1]$, $X$ is uniform on the set $\{x\mid z\leqslant2x\leqslant2-z\}$, which is the interval $[\frac12z,1-\tfrac12z]$.

If $\theta\ne\frac12$, $X_1$, $X_2$, $Y_1$, $Y_2$ and $X$ are shifted by $\theta-\frac12$ and $Z$ is unchanged hence, conditionally on $[Z=z]$ for some $z$ in $[0,1]$, $X$ is uniform on the interval $[\theta-\frac12+\frac12z,\theta+\frac12-\tfrac12z]$.

This, or draw a picture.

-
WOW! Simply amazing. Thanks so much. I will never ceased to be amazed that there are people out there with that special combination of generosity and intellect necessary to leave the above post. thanks again. This problem comes from a discussion in Degroot's Statistics and Probability textbook about the shortcomings of confidence interval in which he asserts the statement above without proof. I suppose it is clear if one draws a picture but I was just not seeing it. Thanks for clearing this up for me!!! – Will Sep 28 '12 at 1:38