PDF of $X-Y$ if the PDF of $(X,Y)$ is $6x$ on the triangle $x>0$, $y>0$, $x+y<1$

123 Views Asked by At

Consider the joint pdf given as:

$f_{XY}(x,y) = \begin{cases} 6x \quad x>0, y>0, 0<x+y\leq 1\\ 0 \quad else \end{cases} $

and the random variable Z defined as Z=X-Y.

My expectation would be that finding the joint pdf of Z with either X or Y, and then integrating that pdf over all values of X or Y would yield the marginal distribution of Z (i.e. $f_Z(z)$).

I obtained the marginal PDFs of X and Y as follows:

$f_X(x) = \begin{cases} \int_0^{1-x} 6x dy = 6x(1-x) \quad 0<x<1\\ 0 \quad else \end{cases}$

$f_Y(y) = \begin{cases} \int_0^{1-y} 6x dx = 3(1-y)^2 \quad 0<y<1\\ 0 \quad else \end{cases}$

Then I considered the joint distribution of Z with either of the random variables (this derivation is not mathematically rigorous):

$f_{XZ}(x,z)dxdz \approx P(Z = z \cap X=x)$

$f_{XZ}(x,z)dxdz \approx P(X-Y = z \cap X=x)$

$f_{XZ}(x,z)dxdz \approx P(x-Y = z)$

$f_{XZ}(x,z)dxdz \approx P(Y=x-z)$

$f_{XZ}(x,z)dxdz \approx f_Y(x-z)dxdz$

$f_{XZ}(x,z) \approx f_Y(x-z)$

and

$f_{YZ}(y,z)dydz \approx P(Z = z \cap Y=y)$

$f_{YZ}(y,z)dydz \approx P(X-Y = z \cap Y=y)$

$f_{YZ}(y,z)dydz \approx P(X-y = z)$

$f_{YZ}(y,z)dydz \approx P(X=y+z)$

$f_{YZ}(y,z)dydz \approx f_X(y+z)dydz$

$f_{YZ}(y,z) \approx f_X(y+z)$

yielding:

$f_{XZ}(x,z) = \begin{cases} 3(1-(x-z))^2 = 3(1+z-x)^2 \quad 0<x<1, x-1<z<x\\ 0 \quad else \end{cases}$

$f_{YZ}(y,z) = \begin{cases} 6(y+z)(1-(y+z))^2 = 6(y+z)(1-y-z) \quad 0<y<1, -y<z<1-y\\ 0 \quad else \end{cases}$

I have checked that both these joint PDFs integrate to 1 over their respective sample spaces.

http://www.wolframalpha.com/input/?i=integral+from+0+to+1+of+integral+from+x-1+to+x+of+3(x-+z+-1)%5E2+dz+dx

http://www.wolframalpha.com/input/?i=integral+from+0+to+1+of+integral+from+-y+to+1-y+of+6(y%2Bz)(1-y-z)+dzdy

I expect that $f_Z(z)=\int_{-\infty}^\infty f_{XZ}(x,z) dx = \int_{-\infty}^\infty f_{YZ}(y,z) dy $

(this will be a piecewise function for two intervals $-1<z<0$ and $0<z<1$).

However when I carry out the integration I receive a different marginal pdf of Z depending on the joint PDF I integrated.

Using $F_{XZ}$:

$f_Z(z) = \begin{cases} \int_0^{z+1} 3(1+z-x)^2dx = (z+1)^3 \quad -1<z<0\\ \int_z^1 3(1+z-x)^2dx = 1-z^3 \quad 0<z<1 \end{cases}$

verified with: http://www.wolframalpha.com/input/?i=integral+from+0+to+z%2B1+of+3(x-z-1)%5E2+dx

http://www.wolframalpha.com/input/?i=integral+from+z+to+1+of+3(x-z-1)%5E2+dx

Using $F_{YZ}$:

$f_Z(z) = \begin{cases} \int_{-z}^{1} 6(y+z)(1-y-z)dy = -(z+1)^2(2z+1) \quad -1<z<0\\ \int_{0}^{1-z} 6(y+z)(1-y-z)dy = (z-1)^2(2z+1)\quad 0<z<1 \end{cases}$

verified with: http://www.wolframalpha.com/input/?i=integral+from+-z+to+1+of+6(y%2Bz)(1-y-z)+dy

http://www.wolframalpha.com/input/?i=integral+from+0+to+1-z+of+6(y%2Bz)(1-y-z)+dy

The results here are unexpected and obviously incorrect, I was hoping someone could point out where my erroneous logic occurred. Thank you for taking the time to read and reply.