# Finding the distribution of $M$

Let $(X_1,X_2)$ be uniformly distributed in $[0,1]^2$ and define $Y_1=\max(X_1,X_2)$, $Y_2=\min(X_1,X_2)$. What is then the distribution of $M:=Y_1-Y_2$ ?

To find the joint distribution we take a test function $g$, which is Borel. Then:

$\displaystyle E(g(M))=\int_0^1\int_0^1g(y_1-y_2)1_{\{y_1>y_2\}}dy_1dy_2=\int_0^{1}\int_{y_2}^1g(y_1-y_2)dy_1dy_2$

now I'm stuck. Can you help please ?

• What do you call the joint distribution of a random variable? I guess you mean the joint distribution of $(Y_1,Y_2)$. – Davide Giraudo Jun 4 '14 at 14:44

First note that $M=|X_1-X_2|$ hence $E(g(M))$ is not what you write but $$E(g(M))=\iint_{[0,1]^2}g(|x_1-x_2|)\mathrm dx_1\mathrm dx_2=2\iint_{[0,1]^2}g(y-x)\mathbf 1_{x\lt y}\mathrm dy\mathrm dx.$$ Second, a standard change of variable is $(u,v)=(y-x,x)$, with Jacobian $1$ and such that $$0\lt x\lt y\lt1\iff0\lt u\lt1,\ 0\lt v\lt1-u,$$ hence $$E(g(M))=2\int_0^1g(u)\int_0^{1-u}\mathrm dv\,\mathrm du=\int_0^1g(u)(2(1-u))\,\mathrm du.$$ This proves that $M$ has a density $f_M$, defined by $$f_M(u)=2(1-u)\mathbf 1_{[0,1]}(u).$$