I'm reading a book on measure-theoretic probability, and the author defines the expectation of a random variable $X$ on a probability space $(\Omega,\scr H,\mathbb{P})$ as $\int_\Omega Xd\mathbb{P}$, but I'm trying to reconcile this with the definition of expectation found in calc-based probability books $\int_{-\infty}^\infty xf_X(x)dx$, where there's an extra $x$ term in the integrand. My book doesn't do this explicitly.
$$\begin{array} A(\Omega,\scr H,\mathbb{P}) & \stackrel{X}{\longrightarrow} & (\mathbb{R},\scr B(\mathbb{R})) \\ \ & & \downarrow{Y(x)=x} \\ & \ & (\mathbb{R},\scr B(\mathbb{R})) \end{array} $$
Let $P=\mathbb{P}\circ X^{-1}$ be the distribution of $X$. Since $Y$ is a random variable, we can define the exectation of $\mathbb{E}(Y)$. But since $P(A)=P\circ Y^{-1}(A), \forall A\in\scr B(\mathbb{R})$, $X$ and $Y$ have the same distribution. Hence $\mathbb{E}(X)=\mathbb{E}(Y)$, i.e. $\int_\Omega X(\omega)\mathbb{P}(d\omega)=\int_\mathbb{R}Y(x)P(dx)=\int_\mathbb{R}xdP$. I know the Lebesgue measure $\lambda$ on $(\mathbb{R},\scr B(\mathbb{R}))$ is $\sigma$-finite, and I'm assuming, though I'm not sure, that $P$ is absolutely continuous with respect to the Lebesgue measure, and so by the Radon-Nikodym theorem, $X$ (and $Y$) both admit a density function and $\int_\mathbb{R}xdP=\int_\mathbb{R}x\frac{dP}{d\lambda}d\lambda=\int_\mathbb{R}xf_Xd\lambda=\int_\mathbb{R}xf_Yd\lambda.$
Is this right?
Your random variable has a density $f_X$ [not all random variables do]. That is, for all Borel sets $A \subseteq \mathbb R$, $$ \int_A f_X(x)\;dx = \mathbb P[X \in E] . \tag1$$ From this we will prove: for all measurable functions $\phi : \mathbb R \to \mathbb R$, $$ \int_{\mathbb R} \phi(x) f_X(x)\;dx = \mathbb E[\phi(X)] . \tag2$$ Do this as usual in measure theory. If $\phi = \mathbf1_E$ is an indicator function, then $(2)$ is $(1)$. Take linear combinations to deduce $(2)$ for simple functions $\phi$. Take pointwise limits to deduce $(2)$ for measurable functions $\phi$.
Once we have $(2)$, take the function $\phi(x) = x$ to get the result claimed.