Expression of variance of function of random variable

meansprobabilityrandom variablesvariance

Given a random variable $x$ with known distribution form (pdf, cdf) and an arbitrary continuous function $f$ (don't need to be bijective), how to calculate the variance of $f(x)$ as a rv because of $x$?"

When watching at Wikipedia, it says the variance can be calculated as:
\begin{equation}
Var(f) = E_f[f^2] – E_f[f]^2
\end{equation}

but this expression is shown by treating $f$ itself as random variable, which looks a bit difficult to handle as one have to figure out $f$'s distribution. Is there some way around of writing it as an expression in terms of the original random variable $x$ directly?

Best Answer

Let $(\Omega,\mathcal{A},\mu)$ be a probability space and $X:\Omega \to \mathbb{R}$ a random variable and $f:\mathbb{R} \to \mathbb{R}$ Borel measurable. The most basic expression for the second moment of $f(X)$ (assuming it's finite) is $$E[f(X)^2]=\int_\Omega f(X(\omega))^2\mu(d\omega)$$ If we define $T(x)=f(x)^2$ we can use the results on pushforward measures to assert $$E[f(X)^2]=\int_\Omega T(X(\omega))\mu(d\omega)=\int_{\mathbb{R}}T(x)\mu_X(dx)=\int_{\mathbb{R}}f(x)^2\mu_X(dx)$$ where $\mu_X$ is the probability distribution of $X$. If $X$ has a continuous probability density $p_X$, this can be further linked to a familiar representation $$E[f(X)^2]=\int_{\mathbb{R}}f(x)^2p_X(x)dx$$ The same results hold for $E[f(X)]$ (assuming it's finite), leading to $$E[f(X)]=\int_{\mathbb{R}}f(x)p_X(x)dx$$ So I hope that now $\textrm{Var}[f(X)]=E[f(X)^2]-E[f(X)]^2$ makes more sense to you.

Related Question