Why does expectation of a transformation of one random variable appear different from expectation of one random variable? Let's say we have a continuous random variable $X_{1}$ with a probability density function $p_{X_{1}}$. The expectation is: $$E(X_1) = \int_{X_{1}} dx_{1} \Big ( x_{1} \cdot p_{X_{1}}(x_{1}) \Big)$$.
Now say we have a random variable $Y_{1}$, which is obtained as a transformation $g_{1}:X_{1} \rightarrow Y_{1}$ where $y_{1} = (x_{1} - 4)^{2} $. The expectation for $Y_{1}$ is: $$E(Y_{1})=\int_{X_{1}} dx_{1} \Big( (x_{1}-4)^2 \cdot p_{X_{1}}(x_{1}) \Big) $$. 
Why is the expectation not: $$E(Y_{1})= \int_{Y_{1}} dy_{1} \Big( y_{1} \cdot p_{Y_{1}}(y_{1}) \Big) =\int_{X_{1}} dx_{1} \Big( (x_{1}-4)^2 \cdot p_{Y_{1}}((x_{1}-4)^2) \Big)$$? Does it mean $p_{Y_{1}}\big((x_{1}-4)^2\big) = p_{X_{1}}(x_{1}) $ and if so why is that the case?
 A: Because
$$E(Y_{1})= \int_{Y_{1}} dy_{1} \Big( y_{1} \cdot p_{Y_{1}}(y_{1}) \Big) \neq \int_{X_{1}} dx_{1} \Big( (x_{1}-4)^2 \cdot p_{Y_{1}}((x_{1}-4)^2) \Big)$$
you need to substitute the expression for $y_1$ into the differential too.
A: $E(Y_{1})= \int_{Y_{1}} dy_{1} \Big( y_{1} \cdot p_{Y_{1}}(y_{1}) \Big) =\int_{X_{1}} dx_{1} \Big( (x_{1}-4)^2 \cdot p_{Y_{1}}((x_{1}-4)^2) \Big)$
is not true.
This is because by definition of expected value we know that the expected value of a discrete random variable is the probability-weighted average of all possible values. The same principle applies to an absolutely continuous random variable, except that an integral of the variable with respect to its probability density replaces the sum. 
And, we also know that a function of a random variable i.e. a transformation of type $g_{1}:X_{1} \rightarrow Y_{1}$ is a random variable. In the above case you have a probability measure defined over $\mathbb{R}$ (the distribution of $Y$) instead of $\mathbb{R}$(the distribution of $X$).
You can compute expectation in below three ways, in general:
Assuming the probability measure $P$ on the sample space $S$ has a pdf $f$. And, random variable $X$ is mapping from probability space $(S,P)$ to $\mathbb{R}$ and function $g$ mapping $\mathbb{R}$ into $\mathbb{R}$, and $g(X) = Y$, then expectation of $Y$ can be calculated in following ways:
$E(Y)= \int_{Y} \Big( y \cdot p_{Y}(y) \Big) dy$
$ =\int_{X}  \Big( g(X)\cdot p_{X}(X) \Big)dx$
$ = \int_{s\in{S}} g(X(s))\cdot f(s)ds$
