Find PDF of $X-Y$

5.9k Views Asked by At

Let $X$ and $Y$ be independent random variables, uniformly distributed on the interval $[0,1]$. Find the PDF of $X − Y$

This is how I solved it:

\begin{align} f(x) = f(y) = \begin{cases}1 & 0 \leq x \leq 1, 0 \leq y \leq 1\\0 & Otherwise \end{cases} \end{align} \begin{align} f_{Z}(z)=\int_{-\infty}^{\infty} f_{X}(y+z)f_{Y}(y)dy \end{align} now the integrated is $0$ unless $0 \leq y+z \leq 1 (i.e, -z \leq y \leq 1-z)$ and then it is $1$

but I don't know how I can find ranges for $Z$

3

There are 3 best solutions below

0
On BEST ANSWER

This is how I solved it:

$$\begin{align} f(x) = f(y) &= \begin{cases}1 & 0 \leq x \leq 1, 0 \leq y \leq 1\\0 & Otherwise \end{cases} \\[2ex]f_{Z}(z)&=\int_{-\infty}^{\infty} f_{X}(y+z)f_{Y}(y)dy \end{align}$$

Almost okay, but more correctly : $$\begin{align} f_X(x) \cdot f_Y(y) &= \begin{cases}1 & 0 \leq x \leq 1, 0 \leq y \leq 1\\0 & \text{Otherwise} \end{cases} \end{align}$$

now the integrated is $0$ unless $0 \leq y+z \leq 1 (i.e, -z \leq y \leq 1-z)$ and then it is $1$

but I don't know how I can find ranges for $Z$

You find it from the joint support.   $0\leq z+y\leq 1, 0\leq y\leq 1 \implies -1\leq z\leq 1$

So your integral is: $$\begin{align}f_Z(z) &= \mathbf 1_{-1\leq z\leq 1}\cdot \int_{\Bbb R} \mathbf 1_{-z\leq y\leq 1-z, 0\leq y\leq 1}\operatorname d y \\[1ex] &= \mathbf 1_{-1\leq z\leq 1}\cdot \int_{\max\{-z,0\}}^{\min\{1-z,1\}} 1\operatorname d y \\[1ex] &= \mathbf 1_{-1\leq z\leq 1}\cdot (\min\{1-z,1\}-\max\{-z,0\}) \\[2ex] &= (1-\lvert z\rvert)\cdot \mathbf 1_{-1\leq z\leq 1} \end{align}$$

0
On

I think the easiest way to go about this is with the CDF. If you view the two unit intervals as a square in the XY plane and let Z=X-Y then all you need to do is integrate the PDFs under the Y=X-Z line.

\begin{align} P[Z \leq z] &= P[X-Y \leq z]\\ &= \int_0^z \int_0^1 f_{X,Y}(x,y) \text dy \text dx + \int_z^1\int_{x-z}^1 f_{X,Y}(x,y)\text dy \text dx \end{align}

0
On

Assume $V=-Y$, $Z=X+V$, and let $\Pi_{[a,b]}$ be a unit rectangular function on $[a,b]$. Then $$f_X(x)=\Pi_{[0,1]}$$ $$f_V(v)=\Pi_{[-1,0]}$$ The pdf of $Z$ is the convolution of the pdf of $X$ and $V$. The convolution of two rectangular functions with the same length is a triangular function.

$$f_Z(z)=f_X(z)*f_V(z)$$ Graphically solving the convolution, the maximum is at $z=0$ which is equal to one, and it linearly reaches zero at $z=\pm1$. So we have: $$f_Z(z)=\begin{cases} z+1, & z\in[-1,0]\\ -z+1, & z\in[0,1]\\ 0,&\text{otherwise} \end{cases}$$