# Calculating expectation with density

This is Exercise 5.1.1 from Achim Klenke: »Probability Theory — A Comprehensive Course«.

Exercise: Let $X$ be an integrable real random variable whose distribution $\mathbf{P}_X := \mathbf{P}\circ X^{-1}$ has a density $f$ (with respect to the Lebesgue measure $\lambda$). Show (using Theorem 4.15) that $$\mathbf{E}[X] = \int_{\mathbb{R}} x f(x) \, \lambda(dx)\, .$$

Definition 4.13: Let $\mu$ be a measure on $(\Omega, \mathcal{A})$ and let $f\colon \Omega \rightarrow [0,\infty)$ be a measurable map. Define the measure $\nu$ by $$\nu(A) := \int (\mathbf{1}_A f)\, d\mu \quad \text{for }A \in \mathcal{A}\, .$$ We say that $f\mu\colon = \nu$ has density $f$ with respect to $\mu$.

Theorem 4.15: We have $g \in \mathcal{L}^1 (f\mu)$ if and only if $(gf) \in \mathcal{L}^1 (\mu)$. In this case, $$\int g \, d(f\mu) = \int (g f) \, d\mu\, .$$

Solution: \begin{align*} \mathbf{E}[X] & = \int X \, d\mathbf{P} = \int \mathrm{id}\circ X \, d \mathbf{P} \overset{4.10}{=} \int \mathrm{id} \, d \bigl(\mathbf{P}\circ X^{-1}\bigr) \\ & = \int \mathrm{id} \, d(f \lambda) \overset{4.15}{=} \int (\mathrm{id} f) \, d \lambda = \int_{\mathbb{R}}x f(x) \, \lambda(d x) \, .\quad \square \end{align*}

Could you please check my proof? It seems too easy... did I miss anything?

Thank you!

I don't know what your 4.10 and 4.15 are, but one needs to be more careful. You know that $\int f \circ X dP = \int f d(P\circ X^{-1})$ for all functions $f$? No not quite. Look at the set of functions for which this holds. Characteristic functions, simple functions, monotone and dominated limits therof.
You need to mention something about how the identity function is $\mathrm{id}^+ - \mathrm{id}^-$ and $\mathrm{id}^\pm$ is an increasing limit of simple functions. Use this to show that $\mathrm{id}^\pm$ are in the set of $f$ that you can apply $\int f \circ X dP = \int f d(P\circ X^{-1})$ to and that both of these integrals are finite (this is where you use $X$ integrable). Then you can use the theorem on $\mathrm{id}$ by linearity.