Change of variables for probability densities

Database › Mathematics › Applied mathematics › Probability

PROB-0006FormulaUndergraduate

If Y = g(X), the density of Y is the density of X at each preimage divided by |g′| there; for several variables the absolute Jacobian determinant plays the role of |g′|.

$$f_Y(y)=\sum_i\frac{f_X(x_i)}{|g'(x_i)|},\quad g(x_i)=y;\qquad f_{\mathbf Y}(\mathbf y)=f_{\mathbf X}(\mathbf x)\left|\frac{\partial(x_1,\dots,x_n)}{\partial(y_1,\dots,y_n)}\right|$$

Explanation

Probability is conserved: $f_Y|dy|=f_X|dx|$ for each branch of the inverse. For a monotonic $g$ only one term appears; for $Y=X^2$ both $\pm\sqrt y$ contribute.

Taking $Y=F_X(X)$ (the cumulative distribution) always gives a uniform variable, so conversely $X=F^{-1}(U)$ with uniform $U$ samples any distribution. The Box–Muller transform, a polar change of variables, turns two uniform numbers into two independent Gaussians.

Example 1

$U$ is uniform on $(0,1)$. Find the density of $Y=-\frac1\lambda\ln U$.

Solution

$u=e^{-\lambda y}$, $|du/dy|=\lambda e^{-\lambda y}$, so $f_Y=\lambda e^{-\lambda y}$ for $y>0$: the exponential distribution.

Example 2

$X$ is a standard Gaussian. Find the density of $Y=X^2$.

Solution

Two preimages $\pm\sqrt y$, $|g'|=2\sqrt y$: $f_Y=2\cdot\frac{e^{-y/2}}{\sqrt{2\pi}\,2\sqrt y}=\frac{e^{-y/2}}{\sqrt{2\pi y}}$ ($y>0$) — the chi-square distribution with one degree of freedom.

Related entries