# Thread: P.D.F. with two variables! Help!

1. ## P.D.F. with two variables! Help!

I am having some trouble with multiple variables when one is fixed, and vice versa. I was wondering if someone could please help me - I missed a day of class, and it seems like everything was taught while I was sick!

Anyway, if someone could please explain the following problem, I would really appreciate it!

Let the probability density function of variables X and Y equal

f(x,y) = 1/2 when 0<x<y, 0<y<2 and zero elsewhere. Find the conditional means and variances for each variable when another is fixed and the correlation of X and Y.

2. Originally Posted by ScienceGeniusGirl
I am having some trouble with multiple variables when one is fixed, and vice versa. I was wondering if someone could please help me - I missed a day of class, and it seems like everything was taught while I was sick!

Anyway, if someone could please explain the following problem, I would really appreciate it!

Let the probability density function of variables X and Y equal

f(x,y) = 1/2 when 0<x<y, 0<y<2 and zero elsewhere. Find the conditional means and variances for each variable when another is fixed and the correlation of X and Y.

Definitions:

Marginal density of Y: $\displaystyle f(y) = \int_{-\infty}^{+\infty} f(x, y) \, dx$.

Marginal density of X: $\displaystyle f(x) = \int_{-\infty}^{+\infty} f(x, y) \, dy$.

Conditional density of X given Y = y: $\displaystyle f(x | y) = \frac{f(x, y)}{f(y)}$ for $\displaystyle f(y) > 0$ and 0 otherwise.

Conditional density of Y given X = x: $\displaystyle f(y | x) = \frac{f(x, y)}{f(x)}$ for $\displaystyle f(x) > 0$ and 0 otherwise.

$\displaystyle E(X | Y = y) = \int_{-\infty}^{+\infty} x \, f(x | y) \, dx$.

$\displaystyle E(Y | X = x) = \int_{-\infty}^{+\infty} y \, f(y | x) \, dy$.

$\displaystyle Cov(X, Y) = E(XY) - E(X) E(Y)$ $\displaystyle = \int_{-\infty}^{+\infty} \int_{-\infty}^{+\infty} x y \, f(x, y) \, dx \, dy - \left( \int_{-\infty}^{+\infty} x \, f(x) \, dx \right) \, \left( \int_{-\infty}^{+\infty} y \, f(y) \, dy \right)$.

Application of the definitions to the given joint pdf:

Marginal density of Y: $\displaystyle f(y) = \int_{x = 0}^{x = y} \frac{1}{2} \, dx = \frac{y}{2}$, $\displaystyle x < y < 2$.

Marginal density of X: $\displaystyle f(x) = \int_{y=x}^{y=2} \frac{1}{2} \, dy = 1 - \frac{x}{2}$, $\displaystyle 0 < x < y$.

Conditional density of X given Y = y: $\displaystyle f(x | y) = \frac{1/2}{\frac{y}{2}} = \frac{1}{y}$ for $\displaystyle x < y < 2$.

Conditional density of Y given X = x: $\displaystyle f(y | x) = \frac{1/2}{1 - \frac{x}{2}} = \frac{1}{2-x}$ for $\displaystyle 0 < x < y$.

$\displaystyle E(X | Y = y) = \int_{x=0}^{x=y}\frac{x}{y} \, dx = \frac{y}{2}$.

$\displaystyle E(Y | X = x) = \int_{y=x}^{y=2} \frac{y}{2-x}\, dy = \frac{2+x}{2}$.

Cov(X, Y):

$\displaystyle E(XY) = \int_{-\infty}^{+\infty} \int_{-\infty}^{+\infty} x y \, f(x, y) \, dx \, dy = \int_{y=0}^{y=2} \int_{x=0}^{x=y} \frac{xy}{2} \, dx \, dy$ $\displaystyle = \int_{y=0}^{y=2} \frac{y^3}{4} \, dy = 1$.

The rest of the calculations are left for you to do.

3. Cov(X, Y):

$\displaystyle E(XY) = \int_{-\infty}^{+\infty} \int_{-\infty}^{+\infty} x y \, f(x, y) \, dx \, dy = \int_{y=0}^{y=2} \int_{x=0}^{x=y} \frac{xy}{2} \, dx \, dy$ $\displaystyle = \int_{y=0}^{y=2} \frac{y^3}{4} \, dy = 1$.

The rest of the calculations are left for you to do.[/quote]

I guess I don't understand how you got to this point - I understand that if the E(X,Y) is equal to one, then to be calculating the Cov(X,Y), I need to calculate the -E(x)E(y) part - but how does one do that?

I vaguely follow the above posted math, but not strongly enough to calculate the rest of it?

4. Mostly, how did you get from the left side of that equation to the right side?

I'm sorry for all the trouble, I just really don't understand.

5. Originally Posted by ScienceGeniusGirl
Mostly, how did you get from the left side of that equation to the right side?

I'm sorry for all the trouble, I just really don't understand.
By definition: $\displaystyle E(XY) = \int_{-\infty}^{+\infty} \int_{-\infty}^{+\infty} x y \, f(x, y) \, dx \, dy$

Put in integral terminals that define the region of the xy-plane in which the joint pdf is non-zero: $\displaystyle = \int_{y=0}^{y=2} \int_{x=0}^{x=y} \frac{xy}{2} \, dx \, dy$

To get these terminals, draw the lines y = x and y = 2. 0 < x < y and 0 < y < 2 define the region of the xy-plane that lies between the y-axis and the lines y = x and y = 2. This is the area the integral terminals define. You're expected to have experience with doing this sort of thing.

Integrate with respect to x:

$\displaystyle = \int_{y=0}^{y=2} \left[\frac{x^2 y}{4}\right]_{0}^{y} \, dx \, dy$

(note that y is treated as a constant because the integration is with respect to x)

$\displaystyle = \int_{y=0}^{y=2} \frac{y^3}{4} \, dy$

Integrate with respect to y: $\displaystyle \left[ \frac{y^4}{16}\right]_{0}^{2} = 1$.

6. Ok, so I did the calculations for E(x) and E(Y) - Or tried to!

I got E(X) = -1/2
and E(Y) = 1

Therefore, my Cov(X,Y) = 1 - (-1/2)(1) = 1.5 ???

Currently working on my correlation, based on this covariance

7. Originally Posted by ScienceGeniusGirl
Ok, so I did the calculations for E(x) and E(Y) - Or tried to!

I got E(X) = -1/2 Mr F says: Since the pdf is non-zero only for 0<x<y, 0<y<2, this cannot possibly be correct. Surely 0 < E(X) < 2 .....!

and E(Y) = 1 Mr F says: Incorrect.

Therefore, my Cov(X,Y) = 1 - (-1/2)(1) = 1.5 ???

Currently working on my correlation, based on this covariance
How did you get those answers?

$\displaystyle E(X) = \int_{-\infty}^{+\infty} x \, f(x) \, dx = \int_{0}^{2} x \, \left(1 - \frac{x}{2} \right) \, dx = \frac{2}{3}$.

$\displaystyle E(Y) = \int_{-\infty}^{+\infty} y \, f(y) \, dy = \int_{0}^{2} y \, \left(\frac{y}{2} \right) \, dy = \frac{4}{3}$.