I'm only starting to learn statistics.
The definition I've been given for the expected value (expectation) of a continuous random variable X with probability density function (PDF) $f_X$ is the following
$$ E[X] = \int_{-\infty}^{+\infty}f_X(x)xdx $$
Despite only beginning stats, I've already stumbled many times on the use of a property that was not explicited and that I don't find any explanation for. I don't know the exact conditions of application of this property, but it seems that $E[h(X)]$, where h is a function from $\mathbb{R}$ to $\mathbb{R}$, that, I guess, has to verify some conditions, is often expressed, by some people as:
$$ \int_{-\infty}^{+\infty}h(x)f_X(x)dx $$
For example, in the course I'm following, they define the variance $Var(X)$ as the expectation of $(X - \mu)^2$. All I get from this definition is that if $f_{(X-\mu)^2}$ is the PDF of $(X - \mu)^2$, then
$$ Var(X) = \int_{-\infty}^{+\infty}f_{(X-\mu)^2}(x)xdx $$
Yet, without other explanation, the variance is replaced with the following expression:
$$ Var(X) = \int_{-\infty}^{+\infty}(x-\mu)^2f_X(x)dx $$
during the course. Other example, in this post:
https://stats.stackexchange.com/a/133474/67507
it is written that ($f$ being the PDF of $X$): $$ E[X^2] = \int_{-\infty}^{\infty}{x^2 f(x) dx} $$
Integration is also a work in progress for me at the moment, so probably I'm just missing some basic property of integrals to make this step from $$ \int_{-\infty}^{+\infty}f_{h \circ X}(x)xdx $$ to $$ \int_{-\infty}^{+\infty}h(x)f_X(x)dx $$ But what is the theorem/property that allows to do that and where can I find a proof of it?