# Thread: Difficulty setting up double integrals for Joint Distributions

1. ## Difficulty setting up double integrals for Joint Distributions

I'm struggling to set up the correct range when calculating probabilities of joint distributions....anyone have any recommended reading or sites that go through some examples? or should I just do some examples and post when I am stuck on here? The bounds of the double integrals I seem to consistently mess up....

2. ## Re: Difficulty setting up double integrals for Joint Distributions

We can try to give you some advice when you post where you stuck at.

You may also try to see if you can follow the posts below

3. ## The Following User Says Thank You to BGM For This Useful Post:

hedgie (09-27-2012)

4. ## Re: Difficulty setting up double integrals for Joint Distributions

This video from India Institute of Technology was helpful for anyone else interested. I'll have problems to post later (hopefully not)

5. ## Re: Difficulty setting up double integrals for Joint Distributions

OK the first one I want to see about....these are not homework problems (I say these because I think I'll have four or more tonight posted):

X=time spent by customer in restaurant
Y=time waiting to be served

joint density function is f(x,y) = e^-x if 0<y<x<inf
0 otherwise

find the marginal density of X and Y:

(1) fx(x) = integral from 0 to x of e^-x*dy = xe^-x - 1
(2) fy(y) = integral from y to inf of e^-xdx = e^-y

find P[Y>5|X<10], P[X>10|Y<=2]

Assuming I have the marginal's correct and assuming independence:

fy|x (x) = f(x,y)of (x,y) / fx(x) if fx(x) >0

Reverse this formula for Y.

So the joint density (e^-x) / (xe^-x - 1)

I don't get this here should I be integrating these over the probabilities first of how do I handle the probability? Obviously I think I can answer the second if I understand the first probability

Last question on this problem:

Find P[X-Y>=2|X=10], P[X-Y>=2|1<=X<=10]

So here I'm lost, do I use the formula again and integrate the joint on top from 10 to 10 for dx and 2-x to Y for dy?....I'll worry about the second one when I understand the first.

I have more joint density problems with questions, but figured I'd post one at a time...Thanks in advance to anyone who can take the time out of their schedules to help!

6. ## Re: Difficulty setting up double integrals for Joint Distributions

(1) fx(x) = integral from 0 to x of e^-x*dy = xe^-x - 1
Should not have the -1 here. Double check again.

find P[Y>5|X<10], P[X>10|Y<=2]
You do not need to find the conditional density yet - use the definition of conditional probability first and then do the integration.

Find P[X-Y>=2|X=10]
You will need to find the conditional density by the definition now.

7. ## The Following User Says Thank You to BGM For This Useful Post:

hedgie (09-29-2012)

8. ## Re: Difficulty setting up double integrals for Joint Distributions

Originally Posted by BGM
Should not have the -1 here. Double check again.

You do not need to find the conditional density yet - use the definition of conditional probability first and then do the integration.

You will need to find the conditional density by the definition now.
Thanks, sorry I see why the -1 isn't there to start...I had written -e^-x evaluated at 0 the first time I evaluated the integral because I integrated it on dx at first.

For part two do you only use the conditional density definition when it is one point exact point?

So in the for P[Y>5|X<10] would one just do a double integral, if so this is where I am struggling. So would the double integral be from 5 to x integrated over dy and the 0 to 10 integrated over dx?

And for P[X>10|Y<=2] would it be integrated from 0 to 2 dy and then 10 to inf for dx? The less than or equal to two shouldn't matter since it's continuous correct?

And for P[X-Y>=2|X=10] what does one do with the dentition then? for fx(x_0) = (e^-x_0) / (x_0e^-x_0) or 1/e^-x_0; then what do I do I set x_0 = 10? or do I set x=10 on the bottom and the top equal to 2+y or something? Sorry I know these should be simple questions but I consistently mess up the double integrals.

9. ## Re: Difficulty setting up double integrals for Joint Distributions

Using the definition of conditional probability,
P[Y>5,X<10] = P[Y>5, X<10] / P[X<10]

thus there are two integrals to calculate for this. the probability in the numerator
is the integral of the joint pdf over the region defined by the inequalities X<10
and 5<Y<X. You may find it useful to sketch this region to help you set up the
double integral. you will find it is a triangle that may be parametrized by the
bounds
Int_5^10 Int_5^x f(x,y) dy dx

the probability in the denominator should be calculated from the marginal distribution
f_x(x) that you calculated above, with the bounds of integration 0 and 10.

The other problems are similar. In each case, it is helpful to sketch the region defined
by the double inequalities in the numerator. This will help you set up the correct bounds
of integration.

10. ## The Following User Says Thank You to Eugenie For This Useful Post:

hedgie (09-29-2012)

11. ## Re: Difficulty setting up double integrals for Joint Distributions

Super helpful....I can see the region on a sketch now....I do not know why I struggle so bad setting these up.

So in the second part P[X-Y>=2|X=10] is it again a double integral over fx(x) or do you plug 10 in to get Y>8 and plug that value in on the top?

Also let me try another one...

This is the soda machine problem that I've seen three times (you'd think I could get regions of integration at this point!!):

X_1 = supply @ beginning of day
X_2 = amount dispensed during the day

f(x_1,x_2) = 1/2 if 0 <= x_2 <= x_1 <= 2
0 otherwise

find density X_1 - X_2

Is this how I would set it up?
integrating dx_2 first from 0 to x_1 and then integrating dx_1 from 0 to 2?

12. ## Re: Difficulty setting up double integrals for Joint Distributions

For P[X-Y>=2|X=10], you need to set X=10 in the joint pdf and normalise
the resulting distribution to a function of y whose integral equals 1. This is because
the integral of the joint pdf over the region X=10
will equal zero, so it is not possible to divide by this in the definition of
relative probability.

So you set X=10 to obtain the function f(10,y) = e^{-10) for 0<y<10 and 0 otherwise.
This integrates to 10e^{-10}, so divide by this to obtain the resulting pdf
p(y) = 1/10 if 0<y<10 and 0 otherwise.
Now set X=10 and rearrange the first inequality: X-Y >= 2 to Y <= 8.
Now if you integrate p(y) between 0 and 8, you get 8/10 or 4/5.
In this problem, the "integrals" are easy--just products, but this technique
generalises to situations when they are not.

I am afraid I don't know what is meant by the density X_1-X_2. What is the
interpretation of what you are supposed to calculate?

13. ## Re: Difficulty setting up double integrals for Joint Distributions

The function like is not one-to-one as it maps from to

To find the density after the transformation, you can first find the CDF and then do the differentiation.

14. ## The Following User Says Thank You to BGM For This Useful Post:

hedgie (09-29-2012)

15. ## Re: Difficulty setting up double integrals for Joint Distributions

No problem Jimmy Brooks, it helps me...I need to be typing all this in LaTeX so it's not so messy when people are helping out!!

Originally Posted by Eugenie
In this problem, the "integrals" are easy--just products, but this technique
generalises to situations when they are not.
Thanks Eugenie. Are you just referencing a more complicated joint density function where the integrals are messier?

This is just the marginal density function with fx(x) and 10 plugged in, 10e^(-10) for the bottom of the equation....then stick the joint density on top and that's what you did......although I think I understand it better the way you wrote it out....rather than just giving me a formula. So is p(y) the same as

16. ## Re: Difficulty setting up double integrals for Joint Distributions

Originally Posted by BGM
The function like is not one-to-one as it maps from to

To find the density after the transformation, you can first find the CDF and then do the differentiation.
Thanks BGM. I have been confused by the or because in one textbook (Wackerly) I've seen them use the Y_i's (when graphing) and they are doing so as though they are separate axes in the pictures so I did not know if in this instance it was just confusing notation. I always had just seen it as ordered statistics where all x_i's or y_i's were on the same axis and ordered. I mean clearly from the soda description they are from just R...should've picked up on that. Thanks!

So to find the cdf would I apply the transformation theorem to to get to get just y because (1/2)(2y) = y.

Then take this and how do I get a cdf of both x and y? Can I take and and multiply them together to get y/2 because they are independent?

Thanks.

17. ## Re: Difficulty setting up double integrals for Joint Distributions

First for the conditional density,

Note that the joint pdf is in the numerator. And of course this holds for any point inside the support of

Secondly, what I mean to find the CDF is that first evaluate

by integration. The dummy variable is arbitrary, as long as it is consistently used throughout the calculation it is fine. Then differentiate with respect to this dummy variable you shall get the pdf.

Your reference book should have also tell you a technique that create an auxiliary variable to make it a one-to-one transformation, such that you can use the Jacoby method with integration. The amount of effort required is almost the same.

18. ## Re: Difficulty setting up double integrals for Joint Distributions

Originally Posted by BGM
First for the conditional density,

Note that the joint pdf is in the numerator. And of course this holds for any point inside the support of

Secondly, what I mean to find the CDF is that first evaluate

by integration. The dummy variable is arbitrary, as long as it is consistently used throughout the calculation it is fine. Then differentiate with respect to this dummy variable you shall get the pdf.

Your reference book should have also tell you a technique that create an auxiliary variable to make it a one-to-one transformation, such that you can use the Jacoby method with integration. The amount of effort required is almost the same.
I do not understand how to get the CDF....sorry I'm lost here.

19. ## Re: Difficulty setting up double integrals for Joint Distributions

I am not using formulas, I am basing what I say on my knowledge of calculus and measure theory.
I am a mathematician, not a statistician, so i have actually never had a course in probability! but I have
had (and taught) LOTS of calculus, analysis and measure theory. So there
are probably other ways of expressing things in terms of probability vocabulary.

Based on what you and others have said, I believe for the X-Y problem, you proceed as follows:

Set U=X-Y and V=X+Y. This gives you a coordinate transformation you can use to rewrite your
integral in which the combination (X-Y) you are interested in is one of the new variables (U).
Note that X=(U+V)/2 and Y=(V-U)/2, so the transform is given by Phi, where
(X,Y) = Phi(U,V) = ( (U+V)/2 , (V-U)/2 ).
You need to use the standard change of coordinate formula for densities:
f(x,y) dx dy = f(Phi(u,v)) |Jacobian of Phi|dudv

The determinant of the Jacobian of Phi is 1/2,
so you get the new pdf in terms of u and v to be:

g(u,v) = (1/2) e^{-(u+v)/2} for 0< (V-U)/2 < (V+U)/2
0 otherwise

This is obtained by substituting X=(U+V)/2 and Y=(V-U)/2
in the formula for f(X,Y) and multiplying by the determinant of the Jacobian, which is 1/2.

By solving the inequalities above, this can be simplified to

g(u,v) = (1/2) e^{-(u+v)/2} for 0 < u < v
0 otherwise

Now you just need to find the marginal density for this joint density
for the variable u. You seemed to do this fine above, so I will not
do that for you here.

Incidentally, you may wonder how I arrived at the second coordinate, V=X+Y.
In general, if you are interested in a linear combination of two variables,
aX+bY (here a=1 and b=-1), you want to use this as one of your new variables, U
and take the orthogonal linear combination -bX + aY as your other variable, V.