I have a simple question about probability. Three variables $X$, $W$ and $Y$ with pdfs $f_X(x), f_W(w)$ and $f_Y(y)$, where $Y=X+W$ and $X$ and $W$ are independent.
My question is: how to express $E(W^2)$ (expectation) in terms of $x$ and $y$, one paper points out that $$E(W^2)=\iint (y-x)^2 f_X(x) f_W(y-x) dx dy$$ How to get this? Thanks in advance.
Mimiga,
Since $W=Y-X$, we can write $E(W^2)=\int W^2f_W(W)dW=\int (y-x)^2f_W(W)dW$ (this actually doesn't make sense yet but I couldn't find a better way to explain it). So we get $$\int (y-x)^2f_W(W)dW=\int \left(\int (y-x)^2f_W(y-x)dy\right)f_X(x)dx$$ This is because since $W=Y-X$, to do the integral on the left hand side, it is equal to first integrating $(y-x)^2f_W(y-x)$ with respect to $y$, then taking the expected value with respect to $x$. Now, by Fubini we get: $$\int \left(\int (y-x)^2f_W(y-x)dy\right)f_X(x)dx=\int\int (y-x)^2f_X(x)f_W(y-x)dx dy$$
I hope this helps!