Problem
Suppose I have a random variable $z$ following a distribution $p(z)$. Suppose I have a transformation
$$ f(z) = x $$
that transforms the random variable $z$ into a new random variable $x$ with distribution $p(x)$. I have often seen the following result
$$ \mathbb{E}_{p(x)}[g(x)] = \mathbb{E}_{p(z)}[g(f(z))]. $$
In other words, the expectation with respect to a distribution $p(x)$ can be written in terms of the original distribution $p(z)$.
Is there proof of this? I think this should work even if $f(z)$ is not invertible and/or differentiable.
My Set-Up for a Solution
I will describe my measure theory set up.
Distribution of Z
Suppose we have two measurable spaces $(\Omega, \mathcal{F})$ and $(\mathsf{Z}, \mathcal{Z})$. The random variable $Z$ is a measurable mapping $$ Z: \Omega \to \mathsf{Z} $$
such that the pre-image $Z^{-1}(B)$ of any $\mathcal{Z}$-measurable set $B\in \mathcal{Z}$ is also $\mathcal{F}$-measurable:
$$ Z^{-1}(B) = \{\omega\in \Omega \, :\, Z(\omega) \in B \} \in \mathcal{F} \qquad \forall \, B \in \mathcal{Z} $$ Now the distribution of $Z$ is a push-forward measure. Suppose we have a probability space $(\Omega, \mathcal{F}, \mathbb{P})$. This means we can measure sets in $\mathcal{F}$. The push-forward or distribution for $Z$ is a way of measuring sets in $\mathcal{Z}$ via $\mathbb{P}$.
Basically, the distribution $Z_*\mathbb{P}$ assigns to sets $B\in\mathbb{Z}$ the same value as if we map $B$ back to $\mathcal{F}$ via $Z^{-1}$ first, and then we find its measure using $\mathbb{P}$.
$$ (\mathbb{P} \circ Z^{-1})(B) = Z_*\mathbb{P}(B) \qquad \forall \, B\in \mathcal{Z} $$
Distribution of X
Now, the new random variable $X$ is basically a function of the random variable $Z$ and therefore $X$ is also a random variable.
Consider the probability space $(\mathsf{Z}, \mathcal{Z}, Z_*\mathbb{P})$ for $Z$. Consider also a measurable function $$ X: \mathsf{Z} \to \mathsf{X} $$ where $(\mathsf{X}, \mathcal{X})$ is a measurable space. This essentially defines the random variable $X$. Since we can measure sets in $\mathcal{Z}$ using $Z_*\mathbb{P}$ we would like to measure sets in $\mathcal{X}$ too. To do this, we define the distribution of $X$ to be a push-forward measure. Essentially, to give a measure to a set $C\in \mathcal{X}$ it maps it to $\mathcal{Z}$ via $X^{-1}$ and then measures it with the distribution $Z_*\mathbb{P}$.
$$ (Z_*\mathbb{P} \circ X^{-1})(C) = X_*Z_*\mathbb{P}(C) \qquad \forall \, C\in\mathcal{X} $$
Expected Value with respect to $Z$
I am using this definition. $$ \mathbb{E}_{p(Z)}(Z) = \int_{\mathsf{Z}} Z(\omega_z) \,\,d Z_*\mathbb{P}(\omega_z) $$
Expected Value with respect to $X$
$$ \mathbb{E}_{p(X)}[X] = \int_{\mathsf{X}} X(\omega_x) \,\, d X_*Z_*\mathbb{P}(\omega_x) $$