# Given the distribution of a variable X, what is the distribution of f(X)?

Suppose I know the mean and standard deviation of a (roughly) normally distributed variable x. Is there any way for me to calculate the mean and standard deviation of f(x)?

The particular problem I am working with involves needing to find the mean and standard deviation of sine and cosine of variables whose mean and standard deviation I already know.

• Knowing the mean and standard deviation of a random variable $X$ is not the same as being "given the distribution of a variable $X$" as your title puts it. May 14, 2014 at 4:07
• This is a question for which answers exist (I'll dig you up a link). Under some circumstances, you reasonably might use Taylor series expansion. In other situations, if you know (or can reasonably approximate) the distribution, you can compute (or at worst, simulate) the distribution of the transformed random variable and hence its moments. May 14, 2014 at 4:08
• Some derivation and analysis here. An example using the usual first two-nonzero-terms for $E(f(X))$ and a single term approximation for $Var(f(X))$ is here (which then relies only on the first two moments of $X$). Pay particular attention to the warnings in comments about the radius of convergence in that second one. There are other expansions that are sometimes used in particular situations. ...ctd May 14, 2014 at 4:16
• ctd ... In cases where the distribution of $X$ is known, see the discussion here May 14, 2014 at 4:20

Suppose that $f()$ is a smooth function (if not infinitely differentiable, we'll need it to have a least a couple of continuous derivatives.) Also, assume that $X$ has $E[X]=\mu$, and $Var(X)=E[(X-\mu)^{2}]=\sigma^{2}$. Then by Taylor's theorem, assuming that $X-\mu$ is "small", we have

$f(X) \approx f(\mu)+ f'(\mu)(X-\mu)+ \frac{f''(\mu)}{2}(X-\mu)^{2}$

Taking the expected value of both sides gives

$E[f(X)] \approx f(\mu) + \frac{f''(\mu)}{2} \sigma^{2}.$

You can take this idea and extend it include higher order derivatives and higher order moments of $X$. You can also extend this in an obvious way to to estimate higher order moments of $f(X)$. This technique is called "the method of moments."

The obvious problem with the method of moments is the assumption that $X-\mu$ is small. If that assumption isn't reasonable for your problem then the method of moments can lead to very bad answers.

Another approach to this kind of problem is to use Monte Carlo simulation. Using a pseudo-random number generator, generate a bunch of $x$ values drawn from the distribution of $X$. Compute $y=f(x)$ for each of these random $x$ values, and then statistically analyze the $y$ values to estimate the mean, standard deviation, or other properties of the random variable $f(X)$. The Monte Carlo approach is more robust in the face of nonsmooth functions $f()$ and can deal better with situations in which $X-\mu$ can be large. However, it also tends to be more computationally intensive.

You've mentioned that your actual problem involves finding the mean and standard deviation of $\sin(X$). Unless the standard deviation of $X$ is quite small compared to the period of the sine function, you should avoid using the method of moments, since the Taylor series approximation won't work very well. e.g. if the standard deviation of $X$ is 10 and $E[X]=0$, then $X$ will effectively range over several cycles of the sine function (even if you ignore extreme values of $X$ beyond one standard deviation), and your Taylor series approximation will not be good over that range.

If the RV is an asymptotically normal estimator $$\bar X$$, the Taylor's theorem approximation given in Brian Borcher's answer is called the Delta method.

If for large $$n$$, $$\bar{X}_n \ \dot\sim \ N(\mu, \sigma^2 / n)$$, then $$g(\bar X_n) \ \dot\sim \ N(g(\mu), \sigma^2 (g'(\mu)^2))$$. The precise mathematical statement is given with convergence in distribution for a sequence $$X_n$$ in the link.

In certain cases when the distribution of $$X$$ is known, it is possible to derive the distribution of $$f(X)$$ by transforming the RV.