Proposition (expectation of continuous random variable)

Let $X$ be a random variable with desnity function $f_X$ and let $g$ be a non-negative Borel function on $\R$.

Then $$ \begin{align*} \expect(g(X)) = \int_{\R} g(x) f_X(x)\, dx. \end{align*} $$ This remains valid without assuming $g$ is non-negative provided that $\expect|g(x)|<\infty$.