# 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
Looks like homework. Homework problems should be tagged as such. Then the answers are supposed to be hints to make it easier for you to get the solution on your own. –  Michael Chernick Sep 27 '12 at 16:26

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]$.