# Finding the density function

I have this problem Let $$X$$ and $$Y$$ be random variables that have a joint density function given by,

Find the density function of $$X - Y$$.

My problem is, that I don´t how to choose the integrals intervals

$$\int_{0}^{\infty}\int_{y}^{y+z}8(y+z)y\,dy\,dz$$

Is this statement correct?

• No. Your inner integral has both $y$ and $z$ mentioned in its bounds, so that is clearly erroneous. – Graham Kemp Jun 30 at 6:44

First do a drawing. Then realize that

$$F_Z(z)=\int_{0}^{1+z} 8x dx \int_{x-z}^{1}y dy$$

This because:

1. $$z \in [-1;0]$$

2. Using the CDF method you get

$$F_Z(z)=\mathbb{P}[X-Y \leq z]=\mathbb{P}[Y \geq X-z]$$

Then the area to be integrated is the purple one, as shown in the following picture • Thanks, for your help. Could you tell me why doesn´t FZ(z) have an expression like this one fX,Y(ξ,ξ−a)dξ – rosita galixx Jul 2 at 4:19

Well, firstly note that the support $$0\leq X\lt Y\leq 1$$, means $$-1\leq X{-}Y\lt 0,$$ and $$-(X{-}Y)\lt Y\leq 1$$.

Then we just use the Jacobian transformation, to find the joint pdf, and integrate this to find the required marginal.

\begin{align}f_{\small X-Y,Y}(z,y)&=\begin{Vmatrix}1&1\\1&0\end{Vmatrix}~f_{\small X,Y}(z+y,y)\\[1ex]&=8(z+y)y~\mathbf 1_{\small 0\leq z+y\lt y\leq 1}\\[1ex]&=8(z+y)y~\mathbf 1_{\small 0\lt -z\leq y\leq 1}\\[4ex]f_{\small X-Y}(z)&={8\int_\Bbb R (z+y)y~\mathbf 1_{\small 0\lt -z\leq y\leq 1}~\mathrm d y}\\[1ex]&={8~\mathbf 1_{\small -1\leq z\lt 0}\cdot\int_{-z}^1 (z+y)y~\mathrm d y}\\[1ex]&~~\vdots\end{align}

• thanks, but I have doubts already, I just want to understand better. Sorry It´s a little bit confusing for me :( – rosita galixx Jul 2 at 5:41

It looks like you are integrating over a triangle given by points $$(x, y)=(0, 0)$$, $$(0, 1)$$, and $$(1, 1)$$. Your solution should cover the whole region to be correct.

Then consider that the probability that $$X-Y$$ equals a given quantity $$a$$ as lines intersecting the triangle with slope 1 and $$x$$-intercept of $$a$$.

Then the integrated probability that $$X$$ and $$Y$$ lie on that line would be the following integral

$$P(X-Y=a)=\int_{a}^{1} f_{X,Y}(\xi, \xi-a)d\xi$$

Here $$\xi$$ is a variable of integration which represents the $$x$$ coordinate on the prescribed line. With $$a$$ taking values from 0 to 1 the whole region is covered.

• Thanks for your help, could u show me how can I express fX,Y(ξ,a−ξ)dξ, this part, this is to know if what I am thinking is correct – rosita galixx Jun 30 at 4:40
• Because the integral is only placed on the region where the function is nonzero then $f_{X,Y}(\xi, a-\xi)=8\xi(a-\xi)$ – eschavez Jun 30 at 5:03
• I'm sorry, i misread your original question, I need to edit my response – eschavez Jun 30 at 5:09