# Joint probability density function and limits of integration

Suppose we have $f(x,y) = 2$ when $x>0$, $y>0$, $x+y <1$ and $0$ elsewhere. I want to find the $\Pr(Y>X)$ and I'm struggling with finding the correct limits of integration generally but especially when we want to find $\Pr(Y>X)$ or similar.

Can anyone explain the general method please, would be very grateful.

• Try to draw a graph corresponding to $x+y < 1$ and $y >x$. You'll figure out the limits of integration should be $x=0$ to $x=1/2$, and $y=x$ to $y=1-x$. Nov 26, 2017 at 22:45
• Can you please confirm that the area we want to integrate should be (0,0) (0.5,0.5) (1,0.5) Nov 27, 2017 at 9:07

Here, the blue line is the line $x+y=1$. The region where $y>x$ is the triangle formed above the red line. You want to integrate your pdf over this region.

To find the limits, first notice that $y$ ranges from $0$ to $1$, and $x$ ranges from $0$ to $\frac 12$. You can choose which variable you want to integrate over first. Lets say you choose $y$. Then your integral will be of the form $$\color{red}{\int_\text{limits}}\int_\text{limits}\,dy\,\color{red}{dx}$$ First we look at the red limits. This is just the limits of $x$, i.e. $$\int_{0}^{\frac12} [... ]dx$$

Now is the key step - you want to see what the $y$ limits should be for some value of $x$. You can see from the graph that integrating in the $y$ direction always starts on the line $y=x$, so this is where you start to integrate $y$. A little more thought will lead you to seeing that you stop integrating at $1-x$, which is when you hit the blue line. So your limits on the $y$ integration are $$\int_{x}^{1-x}...\,dy$$ Now put it all together to get $$\int_{0}^1\int_0^{1-x} f(x,y)\,dy\,dx$$

However, it actually necessary to integrate here. This is because $f(x,y)$ does not depend on $x$ or $y$, so you can take it out of the integral - $$\int_A f(x,y) \,dx\, dy=\int_A 2 \,dx\, dy=2 \int_A \,dx\, dy$$ So you end up getting an area integral. So all you need to do is find the area of the region - here it is a triangle, so its area is $\frac{b\times h}2=\frac{1\times\frac12}2=\frac14$, and so the probability you require is $$P(Y>X)=2 \int_A \,dx\, dy=2\times \frac14=\frac12$$

This is the same result you will get by integrating.

• Why is not the red line y=x and the triangle that you want to integrate bounded by (0,0) (0.5,0.5) (1.0.5) ? Nov 27, 2017 at 8:29
• Thanks for the answe Nov 27, 2017 at 8:29
• Because the area of the triangle you graphed is not 1/4 ? Nov 27, 2017 at 9:04
• @user496975 Yes, of course, you're right. I updated the answer. Nov 27, 2017 at 16:42