TITLE: Clarification of an example.
QUESTION [5 upvotes]: I am currently learning about measure theory and I am a bit behind. I came across an example over the holiday and I didn't understand one of the equalities. It's probably just because I'm a bit behind on some of the stuff and have a memory like an 2 year old, so I hope someone can help me. 
So let $X$ be a stochastic variable on $(\Omega,\mathbb{F},P)$ with values in $(X,\mathbb{E})$. Now equip $(X,\mathbb{E})$ with the basic measure $\mu$, and assume that the distribution of $X$ has density $f$ with respect to $\mu$. Furthermore let $t:(X,\mathbb{E})\rightarrow (\mathbb{R},\mathbb{B})$ be a measurable map, and consider the real-valued stochastic variable $t(X)$. If we try to calculate the expectation to $|t(X)|$ we see that:
$$E|t(X)|=\int|t(X)|\:\mathrm{d}P=\int|t|\:\mathrm{d}X(P)=\int|t|f\:\mathrm{d}\mu$$
Now... the first equality is just the definition of expectation. The second equality is due to the abstract change-of-variable formula: (http://mathworld.wolfram.com/ChangeofVariablesTheorem.html) 
And the last one is the one puzzling me. Now.. I understand that since the distribution of $X$ has density $f$ with respect to $\mu$, we know that:
$$X(P)(A)=\int_A f\:\mathrm{d}\mu$$
But I'm not sure if that is even used. Thanks for any help.

REPLY [5 votes]: If $X$ has density $f$ with respect to $\mu$, i.e.
$$X(P)(A) = \int_A f \, d\mu, \qquad A \in \mathbb{E},\tag{1}$$
then this implies
$$\int g \, dX(P) = \int g \cdot f \, d\mu \tag{2}$$
for any measurable $g: X \to [0,\infty)$.
Proof:

Let $g= 1_A$ be an indicator function. Then, by $(1)$, $$\int 1_A \, dX(P) \stackrel{\text{def}}{=} X(P)(A) \stackrel{(1)}{=} \int_A f \, d\mu = \int g \cdot f \, d\mu.$$ This shows that $(2)$ holds for $g=1_A$.
By linearity of the integral, $(2)$ holds for all simple functions $g$, i.e. functions of the form $$g = \sum_{j=1}^n c_j 1_{A_j}$$ where $A_j \in \mathbb{E}$ and $c_j \in \mathbb{R}$ for $j=1,\ldots,n$.
Now let $g \geq 0$ be an arbitrary measurable function. Then there exists a sequence of simple functions $(g_n)_{n \in \mathbb{N}}$ such that $0 \leq g_n \uparrow g$. By the monotone convergence theorem (MCT) and the second step, we get $$\begin{align*} \int g \, dX(P) &\stackrel{\text{MCT}}{=} \sup_{n \in \mathbb{N}} \int g_n \, dX(P) \\ &= \sup_{n \in \mathbb{N}} \int g_n \cdot f \, d\mu \\ &\stackrel{\text{MCT}}{=} \int g \cdot f \, d\mu. \end{align*}$$


If we choose $g(t) := |t|$, this proves the last equality.