Expectation of a function of a random variable using marginal distribution

252 Views Asked by At

This relates to Q5, part (d) here and given below. The solutions are here.

enter image description here

It boils down to the calculation of $E[Y^2]$ in the solution where I wanted to do this by using $f_Y(y)$ and in the answer it is calculated from $f_{X,Y}(x,y)$.

I used identity: $$ E[g(Y)] = \int_{-\infty}^{\infty} g(y) f_Y(y) \, dy$$ where here $g(Y) = Y^2$.

And:

$f_Y(y) = y$ for $0 \leq y \leq 1$ and for $1 < y \leq 2$ we have $f_Y(y) = 2 - y $.

So $f_Y(y)$ is a triangle looking like:

enter image description here

I split up the piecewise function and tried calculating (this is where I think I'm perhaps wrong): $$E[Y^2] = \int_{0}^{1} g(y) f_Y(y) \, dy + \int_{1}^{2} g(y) f_Y(y) dy$$

To give:

$$E[Y^2] = \int_{0}^{1} y^3 dy + \int_{1}^{2} y^2(2-y) \, dy$$

but this doesn't give the correct answer - so I'm assuming I've set something up wrong.

For what it's worth, I see why the solution essentially did:

$$ E[Y^2] = \int_{0}^{1} \int_{x}^{x+1} g(y) \, f_{X,Y}(x,y) \, dy \, dx $$

with $f_{X,Y}(x,y) = 1$ as it avoids the piecewise trouble.

My question relates to how to calculate $E[Y^2]$ from $f_Y(y)$. After that I'd happily take advice on when to use $f_Y(y)$ or $f_{X,Y}(x,y)$ in future.

Any help greatly appreciated, including directing me to further reading.

1

There are 1 best solutions below

1
On BEST ANSWER

I think that you can use both methods. Your method is correct, but I don't understand why you didn't get the right answer, since when I did the calculation you did to find $\mathbb E[Y^2]$ from $f_Y(y)$, I got $7/6$, which is the correct answer.

You can use both methods, but which one you pick depends on the information available. In this question, $f_{XY}(x,y)=1$, so that is easier to work with.