Confusion about notation and definition for expectation

41 Views Asked by At

Let $X$ and $Y$ be continuous random variables over the supports $S_{1},S_{2}$ respectively and let $f_{x}(x),f_{y}(y)$ be the density functions for $X,Y$ respectively . Then $E[X]$ is defined as $$E[X] = \int_{S1} x f_{x}(x) dx$$ and similarly, $$E[Y] = \int_{S2} y f_{y}(y) dy$$

Then consider $E[XY]$. Then is it correct to write $$E[XY] = \int_{S2}\int_{S1} xy *f_{x}(x)f_{y}(y) \ dx dy $$

My confusion exists because although the above makes sense to me, if we define $Y = X$, then we get (from the above) $$E[X^{2}] = \int_{S1}\int_{S1} x^{2} *f_{x}(x)f_{x}(x) \ dx dx $$ but I would expect that $$E[X^{2}] = \int_{S1} x^{2} *f_{x}(x) \ dx $$ Are these the same thing? Even if they are, is it always ok to use a single integral instead of multiple integrals if they all have the same support?