0

Let $X$ be a continuous random variable with pdf $f_X(x)$, cdf $F_X(x)$, and finite raw moments. Prove that:
$$ \mathbb{E}[X] = \int_0^\infty (1 - F_X(x)) \, dx - \int_{-\infty}^0 F_X(x) \, dx $$
by swapping integrals, and show that this simplifies to:
$$ \mathbb{E}[X] = \int_{-\infty}^\infty x f_X(x) \, dx. $$

What I have done so far:

$$ \mathbb{E}[X] = \int_0^\infty \left( \int_x^\infty f_X(t) \, dt \right) dx - \int_{-\infty}^0 \left( \int_{-\infty}^x f_X(t) \, dt \right) dx. $$

Now, swap the order of integration for each term. For the first integral, $t$ ranges from $x$ to $\infty$, and $x$ ranges from $0$ to $t$. For the second integral, $t$ ranges from $-\infty$ to $x$, and $x$ ranges from $t$ to $0$? This is where I struggle. But assuming it would be true, this gives:
$$ \mathbb{E}[X] = \int_0^\infty f_X(t) \left( \int_0^t 1 \, dx \right) dt - \int_{-\infty}^0 f_X(t) \left( \int_{t}^{0} 1 \, dx \right) dt. $$

Evaluate the inner integrals:
$$ \int_0^t 1 \, dx = t, \quad \int_{t}^{0} 1 \, dx = -t. $$

Substitute these into the expression:
$$ \mathbb{E}[X] = \int_0^\infty t f_X(t) \, dt + \int_{-\infty}^0 t f_X(t) \, dt. $$

Combine the two terms:
$$ \mathbb{E}[X] = \int_{-\infty}^\infty t f_X(t) \, dt. $$

This shows that the expectation of $X$ is equal to the integral of $x f_X(x)$ over the entire real line, as required. But I reverse engineered the solution (i.e. I went from the definition of the expected value backwards). So in particular I don't really get why the second inner integral ranges from $t$ to $0$. Can anyone explain why this should be correct? I tried to draw the integral, but I failed. Maybe someone knows how to that?

  • 1
    Getting the integral limits right when you do Fubini is not specific to this question. Hint: in the second integral you always have $x>t$ and $x<0,.$ – Kurt G. Nov 18 '24 at 08:31
  • Draw a sketch to visualize what the two-dimensional regions of integration are and you can then figure out how the limits change when you reverse the order of integration. – Dilip Sarwate Nov 18 '24 at 14:37

0 Answers0