# Change of variables for random variables

The change of variables for random variables is a formula that gives the probability density of a transformed random variable Y = g(X) directly from the density of X, using the Jacobian (derivative) of the transformation's inverse. It is the probabilistic counterpart of the change-of-variables theorem for integrals in calculus, and it applies to both a single variable and a random vector of the same dimension.

| Key fact | Statement |
|---|---|
| Univariate formula (monotone g) | \(f_{Y}(y) = f_{X}(g^{-1}(y)) \cdot \| d/dy \, g^{-1}(y) \|\) on the image support <sup>[1](https://randomservices.org/random/dist/Transformations.html)</sup> |
| Non-monotone maps | Split the domain into monotone branches and sum their contributions; treating y = z² as one-to-one gives exactly half the correct density <sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup> |
| Multivariate formula | For invertible differentiable \(g: \mathbb{R}^{n} \to \mathbb{R}^{n}\), \(f_Y(y) = f_X(g^{-1}(y)) \cdot \|\det J_{g^{-1}}(y)\|\) <sup>[3](https://www.stat.umn.edu/geyer/old/5102/n.pdf)</sup> |
| Dimension constraint | The formula applies only to transformations from Rᵐ to Rᵐ; otherwise no square Jacobian exists and an auxiliary variable must be introduced <sup>[4](https://math.iisc.ac.in/~gadgil/MA261/notes/chapter-19.html)</sup> |
| Why the absolute value | Determinants can be negative, signaling orientation reversal; densities must be non-negative, so the absolute value is taken <sup>[5](https://web.williams.edu/Mathematics/sjmiller/public_html/probabilitylifesaver/supplementalchap_changeofvar.pdf)</sup> |
| Classical result | The square of a standard normal has the chi-squared distribution with one degree of freedom <sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup> |
| Machine-learning use | Normalizing flows chain invertible layers, each contributing log\|det J\| to the log-density <sup>[6](https://www.varsitytutors.com/practice/subjects/statistics-graduate-level/lessons/transformations-and-jacobians)</sup> |

## The problem: from X to g(X)

Knowing the density of X does not by itself give the density of Y = g(X). Probabilities of Y are probabilities of X pushed through the map, and the map distorts lengths and volumes, so a naive substitution of g⁻¹(y) into f_X is wrong: it counts probability mass in the wrong-sized intervals. The correction factor is the Jacobian, the infinitesimal scale factor describing how n-dimensional volume changes under the transformation <sup>[1](https://randomservices.org/random/dist/Transformations.html)</sup>.

In its most compact differential form the rule reads g(y)\|dy\| = f(x)\|dx\|, with x expressed in terms of y through the inverse function <sup>[1](https://randomservices.org/random/dist/Transformations.html)</sup>. The same Jacobian appears in the change-of-variables theorem for multiple integrals, which is the mathematical basis of the density transformation result <sup>[3](https://www.stat.umn.edu/geyer/old/5102/n.pdf)</sup>; that integration theorem requires a one-to-one onto map with a Jacobian determinant J <sup>[5](https://web.williams.edu/Mathematics/sjmiller/public_html/probabilitylifesaver/supplementalchap_changeofvar.pdf)</sup>.

## The univariate formula

Suppose \(X\) is continuous with density \(f_{X}\), and \(y = h(x)\) where \(h\) is strictly monotone and continuously differentiable with inverse \(x = g(y)\) <sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup>. Then \(Y = h(X)\) is continuous with density

\(f_Y(y) = f_X(g(y)) \cdot \|g'(y)\| = f_X(x) \cdot \|1/h'(x)\|\), evaluated at \(x = h^{-1}(y)\),

for y in the image of the support, and 0 elsewhere <sup>[1](https://randomservices.org/random/dist/Transformations.html)</sup><sup> • </sup><sup>[7](https://dlsun.github.io/skis/multivariate/transformations.html)</sup>. The absolute value covers both increasing and decreasing h <sup>[7](https://dlsun.github.io/skis/multivariate/transformations.html)</sup>.

 The formula is proved by differentiating the CDF of Y. For increasing h, \(P(Y \leq y) = P(X \leq g(y)) = F_X(g(y))\); differentiating gives \(f_Y(y) = f_X(g(y)) \cdot g'(y)\). The multivariate proof follows the same route, applying the multivariable calculus identity \(dy = \|J_f(x)\|\,dx\) <sup>[8](https://statproofbook.github.io/P/pdf-invfct.html)</sup>. Validity requires h to be one-to-one, continuously differentiable, and to have \(g'(y) \neq 0\) where it matters; the general CDF-then-differentiate strategy works for any g, and the direct recipe is simply a shortcut for the differentiable, strictly monotone case <sup>[7](https://dlsun.github.io/skis/multivariate/transformations.html)</sup>.

Support matters. If the density of X has support \([a, b]\) and h is strictly increasing, the support of \(f_Y\) is exactly the image interval \([h(a), h(b)]\) <sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup>.

## Non-monotone transformations: summing over branches

When h is not globally monotone, for example h(x) = x² on all of R, no single inverse exists. The fix is to split the domain into intervals on which h is monotone, apply the formula to each piece, and sum the branch contributions <sup>[9](https://androma.org/theorems/1138)</sup>.

The standard example is \(Y = X^2\) with \(X\) a standard normal. There are two branches, \(x = \pm\sqrt{y}\), each contributing with density weight \(f_X(\pm\sqrt{y}) \cdot 1/(2\sqrt{y})\); their sum gives \(f_Y(y) = (1/(\sqrt{2\pi}\sqrt{y}))\,e^{-y/2}\) for \(y \ge 0\), which is the chi-squared distribution with one degree of freedom <sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup>. If instead \(X \sim \mathrm{Exp}(\lambda)\), so that only the positive branch matters on the support, \(Y = X^2\) has density \(f_Y(y) = (\lambda/(2\sqrt{y}))\,e^{-\lambda\sqrt{y}}\) for \(y > 0\) <sup>[9](https://androma.org/theorems/1138)</sup>.

The branch sum is not optional bookkeeping. Because the map y = z² is two-to-one, applying the one-to-one recipe directly (the "Engineer's Way") gives exactly one half times the correct answer <sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup>.

## The multivariate formula and the Jacobian

For a random vector \(X\) with joint density \(f_{X}\) and an invertible differentiable map \(g\) with nonzero Jacobian determinant, the density of \(Y = g(X)\) is

\(f_Y(y) = f_X(g^{-1}(y)) \cdot \|J_{g^{-1}}(y)\|\),

on the image of the support and 0 elsewhere, where \(J\) is the determinant of the first-derivative (partial derivative) matrix of the inverse <sup>[3](https://www.stat.umn.edu/geyer/old/5102/n.pdf)</sup><sup> • </sup><sup>[8](https://statproofbook.github.io/P/pdf-invfct.html)</sup>. The same result can be written with the forward Jacobian as \(f_X(x) \cdot \|\det[\partial(x_{1},\ldots,x_{n})/\partial(y_{1},\ldots,y_{n})]\|\) evaluated at the inverse image of y <sup>[7](https://dlsun.github.io/skis/multivariate/transformations.html)</sup>. The underlying reason is geometric: small neighborhoods of y change area or volume by the factor \(\|\det(DT^{-1}(y))\|\) <sup>[4](https://math.iisc.ac.in/~gadgil/MA261/notes/chapter-19.html)</sup>.

Two practical refinements apply. First, by the [inverse function theorem](https://www.edgepedia.org/inverse-function-theorem) the Jacobian determinant of the x's with respect to the y's is the reciprocal of the forward determinant, so either may be computed, whichever is easier <sup>[7](https://dlsun.github.io/skis/multivariate/transformations.html)</sup>. Second, for the affine map y = a + Bx the density simplifies to g(y) = (1/\|det(B)\|) f(B⁻¹(y − a)) <sup>[1](https://randomservices.org/random/dist/Transformations.html)</sup>; for example, the affine map (z, ρz + √(1−ρ²)w) applied to two independent standard normals has Jacobian determinant √(1 − ρ²) <sup>[7](https://dlsun.github.io/skis/multivariate/transformations.html)</sup>.

**Square Jacobians only.** A multivariate change of variables cannot be invertible unless it maps between spaces of the same dimension, from Rⁿ to Rⁿ <sup>[3](https://www.stat.umn.edu/geyer/old/5102/n.pdf)</sup>. To find the density of a statistic such as X₁ + X₂, which reduces two random variables to one, the formula cannot be applied directly. The standard workaround introduces an auxiliary variable, for instance Y₁ = X₁ + X₂ and Y₂ = X₁/(X₁ + X₂), applies the square-Jacobian formula to the two-dimensional map, and then integrates the auxiliary variable out of the joint density <sup>[4](https://math.iisc.ac.in/~gadgil/MA261/notes/chapter-19.html)</sup>.

This auxiliary-variable technique produces the classical product and ratio densities for independent X and Y with densities f and g on (0, ∞): V = XY has density h(v) = ∫₀^∞ f(x) g(v/x) (1/x) dx, and W = Y/X has density k(w) = ∫₀^∞ f(x) g(wx) x dx <sup>[1](https://randomservices.org/random/dist/Transformations.html)</sup>.

## How it compares with the CDF and transform methods

The Jacobian method requires the transformation to be (piecewise) invertible and differentiable. The CDF method, computing \(F_Y(y) = P(g(X) \leq y)\) and differentiating, works more broadly: for non-invertible g such as \(Y = X^2\), maxima, or order statistics, and for mixed discrete-continuous cases, though the differentiation step may be intractable. Moment generating function methods are strongest for sums of independent random variables <sup>[6](https://www.varsitytutors.com/practice/subjects/statistics-graduate-level/lessons/transformations-and-jacobians)</sup>. In practice the Jacobian route is preferred when g is differentiable and strictly monotone, because it is a direct recipe rather than a limit computation <sup>[7](https://dlsun.github.io/skis/multivariate/transformations.html)</sup>.

## By the numbers: classical derived distributions

Several canonical distributions are derived by change of variables:

- The square of a standard normal variable has the chi-squared distribution with one degree of freedom, with density \((1/(\sqrt{2\pi}\sqrt{y}))\,e^{-y/2}\) for \(y \geq 0\) <sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup>.
- The square of an Exp(λ) variable has density \((\lambda/(2\sqrt{y}))\, e^{-\lambda\sqrt{y}}\) for \(y > 0\) <sup>[9](https://androma.org/theorems/1138)</sup>.
- Affine transformations rescale the density by 1/\|det(B)\|, the mechanism behind location-scale families <sup>[1](https://randomservices.org/random/dist/Transformations.html)</sup>.
- Product and ratio densities for independent variables follow from the auxiliary-variable map and a one-dimensional integration <sup>[1](https://randomservices.org/random/dist/Transformations.html)</sup>.

## Practice and pitfalls

**Common errors** fall into a few recurring patterns:

- [Forgetting](https://www.edgepedia.org/forgetting) the absolute value. Determinants can be negative; a negative determinant signals an orientation reversal, not negative probability mass, and densities are non-negative so the absolute value is always taken <sup>[5](https://web.williams.edu/Mathematics/sjmiller/public_html/probabilitylifesaver/supplementalchap_changeofvar.pdf)</sup><sup> • </sup><sup>[6](https://www.varsitytutors.com/practice/subjects/statistics-graduate-level/lessons/transformations-and-jacobians)</sup>.
- Using the Jacobian in the wrong direction. The derivative can be taken from ∂y/∂x or from the inverse relationships ∂x/∂y, whose value is the reciprocal of the first; mixing the two up is a common point of confusion <sup>[10](https://pages.stat.wisc.edu/~st309-1/jacobian.pdf)</sup>.
- Misidentifying the support. The support of Y is the image of the support of X under g, and the transformed density is zero outside it; for increasing h on [a, b] it is [h(a), h(b)] <sup>[6](https://www.varsitytutors.com/practice/subjects/statistics-graduate-level/lessons/transformations-and-jacobians)</sup><sup> • </sup><sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup>.
- Treating a many-to-one map as one-to-one, which loses branch contributions entirely or halves the density, as with y = z² <sup>[2](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)</sup>.

**Applications.** Applying the CDF itself as the transformation produces a uniform random variable; this [probability integral transform](https://www.edgepedia.org/probability-integral-transform) is the theoretical basis of inverse-transform sampling <sup>[9](https://androma.org/theorems/1138)</sup>. In machine learning, normalizing flows chain K invertible layers with \(\log f_Y = \log f_X(g^{-1}(y)) + \sum \log \lvert \det J_k \rvert\), and architectures are designed to make Jacobian computation \(O(n)\) instead of \(O(n^3)\); the same formula underlies the reparameterization trick in variational inference <sup>[6](https://www.varsitytutors.com/practice/subjects/statistics-graduate-level/lessons/transformations-and-jacobians)</sup>.

## References

1. [Transformations of Variables (Random Services, Kyle Siegrist)](https://randomservices.org/random/dist/Transformations.html)
2. [Change of Variable handout (University of Maryland STAT400)](https://math.umd.edu/~millson/teaching/STAT400/handouts/changeofvariable.pdf)
3. [Stat 5101 Lecture Notes (University of Minnesota, Geyer)](https://www.stat.umn.edu/geyer/old/5102/n.pdf)
4. [Probability Models and Statistics — Change of variable (IISc MA261)](https://math.iisc.ac.in/~gadgil/MA261/notes/chapter-19.html)
5. [The Probability Lifesaver: Change of Variable Theorem](https://web.williams.edu/Mathematics/sjmiller/public_html/probabilitylifesaver/supplementalchap_changeofvar.pdf)
6. [Transformations & Jacobians (Varsity Tutors)](https://www.varsitytutors.com/practice/subjects/statistics-graduate-level/lessons/transformations-and-jacobians)
7. [Multivariate Transformations – The Art of Chance](https://dlsun.github.io/skis/multivariate/transformations.html)
8. [Probability density function of an invertible function of a continuous random vector — The Book of Statistical Proofs](https://statproofbook.github.io/P/pdf-invfct.html)
9. [Density of a Transformed Variable — Statement & Proof (Androma)](https://androma.org/theorems/1138)
10. [Jacobian notes (UW–Madison Statistics 309)](https://pages.stat.wisc.edu/~st309-1/jacobian.pdf)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Statistics and probability › Probability theory › Random variables › Algebra and transformations of random variables › Change of variables for random variables*

*Initially written Sep 17, 2026 · Edited: Oct 11, 2026; Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
