Functions of random variables

Let xx be some random variable. Then y=f(x)y = f(x) is a function of that random variable. Given the probability distribution of the variable p(x)p(x), we wish to find the distribution of the function p(y)p(y).

Consider first that we can write the probability density at some given x0x_0 as an integral over the entire range of xx

p(x0)=p(x)δ(xx0) ⁣dx. p(x_0) = \int_{-\infty}^\infty p(x) \delta(x-x_0) \dx.

We can equivalently write the probability of finding some y=y0y=y_0 as an integral over the range of xx, and selecting the values where f(x)=y0f(x)=y_0 using a delta function.

p(y0)=p(x)δ(y0f(x)) ⁣dx. p(y_0) = \int_{-\infty}^\infty p(x) \delta(y_0-f(x)) \dx.

Evaluating this integral requires us to recall that integrating a delta applied to a function yields a result inversely proportional to that function’s derivative.

f(x)δ(g(x)) ⁣dx=f(x0)g(x0). \int f(x) \delta(g(x)) \dx = \frac{f(x_0)}{|g'(x_0)|}.

Thus, allowing xix_i to be the roots of f(x)f(x), we find

p(y0)=f(xi)=0p(xi)f(xi). p(y_0) = \sum_{f(x_i)=0} \frac{p(x_i)}{|f'(x_i)|}.

For a function of multiple variables, write the probability similarly as several integrals of the joint probability density.