1

Note:- The question might have been asked several times before I present here. I am trying to derive it using some new approach.

$X,Y$ are i.i.d $U(0,1)$. Find the distribution of $X-Y$.

I have tried to do it using distribution function technique, and then breaking it into two parts. But I got stuck in the following steps...

$G(t)=P(X-Y\le t)=P(X\le t+Y) $

$=P(X\le t+Y \cap t+Y\le 1)+P(X\le t+Y \cap t+Y>1)$

Then I am stuck what to do. Will this method give success?

  • 1
    It may be simpler to compute the probability by integration of the joint density, which is a very simple function... – Nate Eldredge Sep 07 '19 at 18:32
  • 1
    even more simple is the geometrical approach of sketching a $1 \times 1$ square and the portion $x-y \le d$ – G Cab Sep 07 '19 at 18:57

3 Answers3

1

Let $W=-Y$, then the density of $Z=X+W$ is given by the convolution: \begin{align} f_Z(z) &= (f_X\star f_W)(z)\\ &= \int_{\mathbb R} f_X(x)f_W(z-x)\ \mathsf dx\\ &= \int_{\mathbb R} \mathsf 1_{(0,1)}(x)\cdot\mathsf 1_{(-1,0)}(z-x)\ \mathsf dx\\ &= \begin{cases} \int_0^{1+z}\ \mathsf dx = 1+z,& -1<z<0\\ \int_z^1\ \mathsf dx = 1-z,& 0<z<1. \end{cases} \end{align}

Math1000
  • 36,983
1

A slight variant on @Math1000's strategy is to use $1-Y\sim U(0,1)$ so $X-Y+1$ has an $n=2$ Irwin–Hall distribution. Another approach is to note $X$ has MGF $\frac{e^t-1}{t}$, so $X-Y$ has MGF $$\frac{e^t-1}{t}\frac{e^{-t}-1}{-t}=\frac{e^t-1-t}{t^2}+t\leftrightarrow -t.$$But $\frac{e^t-1-t}{t^2}$ is the MGF of the distribution with pdf $2(1-x)$ on $[0,\,1]$, since $$\int_0^12(1-x)e^{tx}dx=\frac{1}{t^2}[(2t+2-2tx)e^{tx}]_0^1=\frac{2(e^t-1-t)}{t^2}.$$Therefore, $X-Y$ has pdf $1-|x|$ on $[-1,\,1]$.

J.G.
  • 115,835
0

Just to illustrate this other post, in which the point was made that the distribution of two independent random variables $X$ and $Y$ is obtained by the cross-correlation of the original distributions, i.e. $\int_{-\infty}^\infty f(\tau) g(t+\tau) \rm d\tau,$ this is how the pdf (and cdf) above can be obtained without the change of sign:

With $Z=Y-X,$ and both $Y$ and $X\sim \text{Unif}[0,1],$ i.e. $f_X(x)=f_Y(y)=\mathbf 1_{x,y\in [0,1]},$

$$f_{Z}(z)=\int_{0}^1 f_X(x)f_Y(z+x) \rm dx$$

A quick sketch suggests breaking the integration in two parts:

enter image description here

If $-1\leq z < 0,$

$$f_Z(z) =\int_{-z}^1 \rm dx= 1+z$$

If $0\leq z \leq 1$

$$f_Z(z) =\int_0^{1-z}\rm dx=1-z$$

The cdf is for $-1\leq z < 0,$

$$F_Z(z)=\int_{-1}^z (1+z)\rm dz= \frac 1 2 (z^2 + 2z +1)$$

and if $0\leq z \leq 1,$

$$F_Z(z) = \frac 1 2 + \int_0^z (1-z)\rm dz= -\frac 1 2 (z^2-2z - 1).$$