Tutorials › Statistical Theory I - Probability and Distribution Theory › The One-Dimensional Density Change-of-Variables Formula

One-to-One Transformations · Tutorial 399 of 994

The One-Dimensional Density Change-of-Variables Formula

Learn how a one-to-one smooth transformation changes a density, why the inverse derivative appears, and how to check the resulting formula.

Intermediate 10 min read

What You'll Learn

  • State conditions under which a one-to-one transformation produces a density.
  • Derive the density using the inverse transformation and its derivative.
  • Explain why the absolute value is essential for decreasing transformations.
  • Compute transformed densities for uniform, nonuniform, and normal models.
  • Check transformed-density calculations by integrating them to one.
  • Distinguish the density formula from the separate task of identifying the transformed range.

Why a Transformation Changes a Density

A density describes how probability is distributed across the measurement scale. When a random variable is transformed, the probability attached to a small region does not disappear, but the region may stretch or contract. A density must adjust to account for that change in scale: stretching spreads a fixed amount of probability across more distance, while contraction concentrates it.

For a one-to-one transformation, each transformed value corresponds to exactly one original value. This makes it possible to express the density of the transformed variable using the original density evaluated at the inverse-transformed value. The remaining factor measures how the inverse transformation changes local distance.

Definition: Let \(X\) have density \(f_X\) on an open interval \(I\), with \(P(X\in I)=1\). Let \(g:I\to J=g(I)\) be continuously differentiable and one-to-one, with \(g'(x)\ne 0\) for every \(x\in I\). For \(Y=g(X)\), write \(h=g^{-1}:J\to I\). Then \(Y\) has density $$ f_Y(y)=f_X(h(y))\,|h'(y)|,\qquad y\in J, $$ and \(f_Y(y)=0\) for \(y\notin J\), apart from any immaterial choices of density values at endpoints.

Because \(g'\) is continuous and never zero on the interval \(I\), it has a constant sign there. Thus \(g\) is strictly increasing or strictly decreasing, and its inverse \(h\) is differentiable on \(J\). Differentiating \(g(h(y))=y\) gives $$ h'(y)=\frac{1}{g'(h(y))}. $$ Consequently the density can also be written as $$ f_Y(y)=\frac{f_X(h(y))}{|g'(h(y))|},\qquad y\in J. $$ The absolute value makes the formula apply whether \(g\) increases or decreases.

The One-Dimensional Density Formula

The formula follows by tracking probability through the inverse map. For a measurable set \(A\subseteq J\), the event \(Y\in A\) is exactly the event \(X\in h(A)\). Therefore $$ P(Y\in A)=\int_{h(A)} f_X(x)\,dx. $$ The one-dimensional substitution rule, with \(x=h(y)\), rewrites this probability as $$ P(Y\in A)=\int_A f_X(h(y))\,|h'(y)|\,dy. $$ The integrand is nonnegative and measurable, and the equality holds for measurable \(A\). This identifies the transformed density.

Theorem: Under the conditions in the definition, the distribution of \(Y=g(X)\) is absolutely continuous on \(J\), with density \(f_Y(y)=f_X(g^{-1}(y))|(g^{-1})'(y)|\) there. Equivalently, for every measurable \(A\subseteq J\), $$ P(Y\in A)=\int_A f_X(g^{-1}(y))\,|(g^{-1})'(y)|\,dy. $$

Proof. Since \(g\) is one-to-one, \(Y\in A\) if and only if \(X\in g^{-1}(A)=h(A)\). As \(X\) has density \(f_X\), $$ P(Y\in A)=\int_{h(A)}f_X(x)\,dx. $$ The one-dimensional substitution theorem applies because \(h\) is continuously differentiable and monotone on \(J\). Under \(x=h(y)\), lengths in the \(x\)-scale contribute the factor \(|h'(y)|\), giving $$ \int_{h(A)}f_X(x)\,dx=\int_A f_X(h(y))|h'(y)|\,dy. $$ This identity for every measurable \(A\) is precisely the defining integral property of the stated density. In particular, taking \(A=J\) gives total probability one, since \(h(J)=I\) and \(P(X\in I)=1\). \(\square\)

This argument also explains the absolute value. If \(g\) is decreasing, then \(h'(y)<0\), but a density cannot assign negative probability. The magnitude \(|h'(y)|\) is the positive local change in the original scale per unit of transformed scale. Omitting it would give an invalid expression for a decreasing transformation.

Worked Applications

Worked Example: A Nonlinear Transformation of a Uniform Variable

Let \(X\sim\operatorname{Uniform}(0,1)\), and set \(Y=X+X^2\). Find \(f_Y\) and verify that it integrates to one.

On \(0<x<1\), \(g(x)=x+x^2\) has derivative \(g'(x)=1+2x>0\), so it is one-to-one and increasing. Solving \(y=x+x^2\) for \(x\) gives the inverse $$ h(y)=\frac{\sqrt{1+4y}-1}{2}. $$ Differentiation yields $$ h'(y)=\frac{1}{\sqrt{1+4y}}. $$ The original density is \(f_X(x)=1\) for \(0<x<1\). Thus, on the image \(0<y<2\), $$ f_Y(y)=f_X(h(y))|h'(y)|=\frac{1}{\sqrt{1+4y}}. $$ It is zero outside this interval. The normalization check is $$ \int_0^2\frac{1}{\sqrt{1+4y}}\,dy =\left[\frac{\sqrt{1+4y}}{2}\right]_{0}^{2} =\frac{3-1}{2}=1. $$ The density decreases across the transformed range because the map stretches more as \(x\) increases: its derivative \(1+2x\) grows, so the inverse derivative, and therefore the density, shrinks.

Worked Example: A Decreasing Transformation

Let \(X\) have density \(f_X(x)=2x\) for \(0<x<1\), and let \(Y=2-X-X^2\). Find the density of \(Y\), taking care with the direction of the transformation.

Here \(g'(x)=-1-2x<0\), so the transformation is decreasing. Solving \(y=2-x-x^2\) gives $$ h(y)=\frac{-1+\sqrt{9-4y}}{2}, \qquad h'(y)=-\frac{1}{\sqrt{9-4y}}. $$ The original density integrates to one because \(\int_0^1 2x\,dx=1\). Applying the absolute-value formula gives, for \(0<y<2\), $$ f_Y(y)=f_X(h(y))|h'(y)| =\frac{2h(y)}{\sqrt{9-4y}} =\frac{\sqrt{9-4y}-1}{\sqrt{9-4y}}. $$ The density is zero outside the image interval. To check its normalization while respecting the decreasing direction, substitute \(y=2-x-x^2\). As \(x\) runs from \(0\) to \(1\), \(y\) runs from \(2\) down to \(0\), and \(|dy|=(1+2x)\,dx\). Therefore $$ \int_0^2 f_Y(y)\,dy =\int_0^1 \frac{2x}{1+2x}(1+2x)\,dx =\int_0^1 2x\,dx=1. $$ Without the absolute value, the proposed density would be negative, an immediate sign that the formula had been misapplied.

Worked Example: A Smooth Transformation of a Normal Variable

Let \(X\sim N(0,1)\), and set \(Y=X+X^3\). Express the density of \(Y\) using the unique solution of an equation, and evaluate it at \(y=0\).

The transformation has derivative \(g'(x)=1+3x^2>0\) for every real \(x\). It is strictly increasing, and its image is all of the real line. For each \(y\in\mathbb R\), let \(x_y\) denote the unique real solution of \(x_y+x_y^3=y\). The inverse derivative is $$ h'(y)=\frac{1}{1+3x_y^2}. $$ Since the standard normal density is \(f_X(x)=(2\pi)^{-1/2}\exp(-x^2/2)\), the transformed density is $$ f_Y(y)=\frac{\exp(-x_y^2/2)}{\sqrt{2\pi}(1+3x_y^2)},\qquad y\in\mathbb R. $$ An elementary closed-form expression for \(x_y\) is not needed to use this density. At \(y=0\), the equation \(x_y+x_y^3=0\) has the unique solution \(x_0=0\). Hence $$ f_Y(0)=\frac{1}{\sqrt{2\pi}}. $$ Finally, the density integrates to one: substituting \(y=x+x^3\), so \(dy=(1+3x^2)dx\), gives $$ \int_{-\infty}^{\infty}f_Y(y)\,dy =\int_{-\infty}^{\infty}\frac{f_X(x)}{1+3x^2}(1+3x^2)\,dx =\int_{-\infty}^{\infty}f_X(x)\,dx=1. $$

Interpreting the Derivative Factor

For a small transformed interval near \(y\), the corresponding original interval is near \(h(y)\). Its length is approximately \(|h'(y)|\) times the transformed interval's length. The probability in that small interval is therefore approximately \(f_X(h(y))|h'(y)|\) times its transformed length. This local probability argument is useful for intuition; the theorem above supplies the exact result.

A large value of \(|h'(y)|\) means a small change in \(y\) corresponds to a larger stretch in the original scale, so more original probability can be collected per unit of \(y\). Conversely, a small inverse derivative corresponds to a locally stretched transformed scale and a lower transformed density. The factor depends on the inverse derivative, not the forward derivative, though the two are reciprocals at corresponding points.

Common Mistakes

  • Evaluating the original density at \(y\). The original variable takes the value \(h(y)\) when the transformed variable takes the value \(y\). The density factor is \(f_X(h(y))\), not generally \(f_X(y)\).
  • Using the forward derivative instead of its reciprocal. Differentiating \(g(h(y))=y\) gives \(h'(y)=1/g'(h(y))\). The density formula uses the magnitude of this inverse derivative.
  • Dropping the absolute value for a decreasing map. A negative derivative does not imply negative probability. Use \(|h'(y)|\) in every case.
  • Forgetting where the formula applies. The expression is used on \(J=g(I)\); outside the image, the transformed variable cannot take values. Determining the image is a necessary calculation, even when the main task is differentiating the inverse.
  • Skipping the normalization check. Integrating the proposed density to one is a useful way to catch a missing derivative factor or a sign error.
Key takeaway: For a differentiable one-to-one transformation \(Y=g(X)\) with nonzero derivative, evaluate the original density at \(g^{-1}(y)\) and multiply by \(|(g^{-1})'(y)|\). The absolute inverse derivative corrects for the change of scale and works for both increasing and decreasing transformations.

Check Your Understanding

Use the inverse transformation and its derivative in each calculation.

  1. State the conditions on \(g\) used in the density formula and explain why they ensure that the inverse is differentiable.
  2. If \(X\sim\operatorname{Uniform}(0,1)\) and \(Y=3X\), what are the inverse transformation and the density of \(Y\) on its image?
  3. Why does the density formula contain \(|(g^{-1})'(y)|\), rather than just \((g^{-1})'(y)\)?
  4. For a one-to-one transformation, explain why \(P(Y\in A)=P(X\in g^{-1}(A))\).
  5. What does it suggest if a proposed transformed density integrates to a value other than one?