[Math] Using pdf or marginal pdfs to calculate expected value

density functionexpectationprobability theory

I have a little doubt concerning the calculation of expected values when dealing with marginal distributions. Consider, for instance, a real bidimensional random variable $(X,Y)$ with pdf $f(x,y)$, and its marginal distributions $X$ and $Y$ having marginal pdfs $f_x(x)$ and $f_y(y)$, respectively.

We then know the expected value of each component can be computed as

$$\mathbb{E}[X]=\int_{\mathbb{R}}xf_x(x)dx\qquad\mathbb{E}[Y]=\int_{\mathbb{R}}yf_y(y)dy$$

But then, when you need to compute the expected value of some combination of both, you need to use the joint pdf, for example

$$\mathbb{E}[XY]=\iint_{\mathbb{R}^2}xyf(x,y)dxdy$$

But, we could think of $\mathbb{E}[X]$ and $\mathbb{E}[Y]$ as particular cases of combinations between both, in which case we would do

$$\mathbb{E}[X]=\iint_{\mathbb{R}^2}xf(x,y)dxdy\qquad\mathbb{E}[Y]=\iint_{\mathbb{R}^2}yf(x,y)dxdy$$

Are both of these ways of calculating $\mathbb{E}[X]$ and $\mathbb{E}[Y]$ (and similar expressions) correct? This would of course imply the following holds

$$\int_{\mathbb{R}}xf_x(x)dx=\iint_{\mathbb{R}^2}xf(x,y)dxdy$$
$$\int_{\mathbb{R}}yf_y(y)dy=\iint_{\mathbb{R}^2}yf(x,y)dxdy$$

Best Answer

You are correct: since the marginal pdf $f_X(x)$ can be obtained from the joint pdf by $$ f_X(x)=\int_{\mathbb{R}}f(x,y)\;dy $$ it follows that $$ \int_{\mathbb{R}^2}xf(x,y)\;dxdy=\int_{\mathbb{R}}x\Big[\int_{\mathbb{R}}f(x,y)\;dy\Big]\;dx=\int_{\mathbb{R}}xf_X(x)\;dx=\mathbb{E}[X] $$

Related Question