# Change of variables formula for random variable

On Durrett, it has a theorem saying: Let $X$ is a random variable, and $f$ is a measurable function on $\mathbb{R}$. Assume $f\geq 0$ or $E|f(X)| < \infty$, then we have $Ef(X) = \int_{\mathbb{R}} f(y) d \mu (y)$, where $\mu$ is the probablity measure induced by the random variable $X$.

My question is: when we compute $Ef(X)$, why do we implicitly ignore the condition $f\geq 0$ or $E|f(X)| < \infty$ ? Actually, $E|f(X)| < \infty$ is not easy to be verified.

For example, let $X$ has an exponential distribution with rate 1, then $$EX^k = \int_0 ^{\infty} x^ke^{(-k)} dx = k!$$ we apply the change of variable without checking that $E|X^3| < \infty$. We do not even know what the random variable is.

A more general question is that when we talk about a random variable, why we usually ignore the probability space and the random variable which is a measurable function on such space?

I know that for each distribution function, there is a probability space with a random variable whose has the distribution function as its distribution. Namely, $\Omega = (0,1), p$ = lebesgue measure...

Based on what I understand, the condition of $f\ge 0$ or $\mathbf{E}|f(X)| < \infty$ is necessary for defining $\mathbf{E}f(X)$. First, by the monotone property of integral, $\mathbf{E}|f(X)| < \infty$ implies $\mathbf{E}f(X) < \infty$. Thus we can process or develop some theory based on this assumption. And such conditon brings various useful properties such as small-tail bound.
When only $f \ge 0$ is given, we cannot generally expect $\mathbf{E}f(X)$ be finite. However, it is allowed to be infinite. Thank about how the integration is defined in the first place (first, defined on simple functions, extended to non-negative functions, and general functions).
Therefore, when we compute $\mathbf{E}f(X)$, we do not ignore the fact that $\mathbf{E}|f(X)| < \infty$ or $f > 0$. Without such conditions, only few things can be discussed, as it is $\infty$.