# Expected value of a distribution function

Here is an interesting probability problem: Suppose ${X}$ is a random variable with absolutely continuous distribution function ${F}$. What is ${\mathbb E[F(X)]}$?
Since ${F}$ is absolutely continuous, ${F}$ is differentiable a.e. and ${X}$ has a density, i.e. there is a nonnegative function ${f}$ such that

$\displaystyle F(x) = \int_{-\infty}^t f(t)\mathsf dt$

for each ${x\in\mathbb R}$, where ${F'=f}$ a.e. By the law of the unconscious statistician,

$\displaystyle \mathbb E[F(X)] = \int_\mathbb R F(x)\mathsf dF(x) = \int_{-\infty}^\infty F(x)f(x)\mathsf dx.$

Replacing ${F}$ with the integral of its density and applying Tonelli’s theorem, we have

\displaystyle \begin{aligned} \mathbb E[F(X)] &= \int_{-\infty}^\infty \int_{-\infty}^t f(x)\mathsf dx\; f(t)\mathsf dt\\ &= \int_{-\infty}^\infty \int_x^\infty f(t)\mathsf dt \;f(x)\mathsf dx\\ &= \int_{-\infty}^\infty (1-F(x))f(x)\mathsf dx. \end{aligned}

Adding the two equations, we get

$\displaystyle 2\mathbb E[F(X)] = \int_{-\infty}^\infty f(x)\mathsf dx = 1,$

and hence

$\displaystyle \mathbb E[F(X)] = \frac12.$