Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 7

PDFs of Transformed Random Variables: Jacobian Method

Recommended resources

Hello! Let's dive into our next lesson in the "Probability Models for Data" module.

Introduction

In our last lesson, we reviewed some of the most fundamental probability distributions—Binomial, Poisson, and Normal—and learned how to work with them in Python. These are the standard blueprints for many random phenomena. However, we often encounter situations where the quantity we're interested in is a function of a variable whose distribution we already know.

For example, from your mechanical engineering background, you know that the kinetic energy of a particle is . If the velocity is a random variable (perhaps following a Maxwell-Boltzmann distribution, which is related to the Normal distribution), what is the probability distribution of the kinetic energy ? A simple substitution into the PDF of is not enough.

This lesson addresses exactly that problem. We will derive a robust method for finding the probability density function (PDF) of a transformed random variable. Our goal is to master the Jacobian method, a powerful technique that correctly accounts for how a transformation stretches, compresses, and warps the space of outcomes, ensuring that our resulting probabilities are always consistent.


1. The Problem with Simple Substitution: The 1D Case

Let's start with a simple one-dimensional example to see why a naive approach fails. Suppose a random variable follows an Exponential distribution with a rate of 1, so its PDF is for . Now, let's define a new random variable .

What is the PDF of , ? The most intuitive guess might be to solve for in terms of (so ) and substitute this into . This would give us a supposed PDF of .

However, a valid PDF must integrate to 1 over its domain. If we integrate our guess, we find it equals 2, which is impossible. We've somehow created probability out of thin air. To understand why, let's build some intuition.

Keeping Probabilities Honest: The Jacobian Adjustment

This article provides a fantastic analogy to understand why this happens and introduces the concept of the Jacobian adjustment. We'll start with the intuitive explanation.

Read the sections 'Introduction' and 'The Intuition'. Pay close attention to the 'sand on a rubber sheet' analogy. It perfectly explains how a transformation can change probability density by stretching or compressing the axis.

As the article explains, a transformation doesn't just change the values of the random variable; it changes the space those values occupy. The probability, which we can think of as a fixed amount of "mass" or "sand," gets redistributed. Where the axis is compressed, the density must increase. Where it's stretched, the density must decrease.


2. Deriving the Change of Variables Formula (1D)

Let's formalize this with the principle of conservation of probability. The probability contained in a small interval must be the same as the probability in the interval that it maps to.

For a strictly increasing function :

Using the definition of a PDF, this can be written as:

From calculus, we know that for a small change , the corresponding change is . Substituting this in, we get:


To account for both increasing () and decreasing () functions, we use the absolute value. This leads to the general 1D change of variables formula.

Keeping Probabilities Honest: The Jacobian Adjustment

The same article we just read provides a clear, step-by-step mathematical derivation of this formula. This will formalize the intuition we've built.

Read the section titled 'The Math' and 'The General Form'. This will walk you through the derivation and show how applying the correct formula fixes our initial problem with the Y = X² transformation.

The general formula is:

where:

  • is the forward transformation.
  • is the inverse transformation.
  • is the derivative of the inverse transformation.
  • The term is the Jacobian adjustment. It is the scaling factor that ensures the total probability remains 1.

3. Extending to Multiple Dimensions: The Jacobian Matrix

What happens when we transform multiple random variables at once? For instance, let and . The 1D scaling factor is no longer sufficient. We need a way to describe how a small area (or volume, in higher dimensions) is transformed.

This is exactly what the Jacobian matrix and its determinant do. For a function that maps a point to , the Jacobian matrix describes the best linear approximation of that transformation at that point. It tells us how the basis vectors of the original space are stretched, sheared, and rotated.

Jacobian Matrix Transformation of the x-y Plane
This image visualizes how a Jacobian matrix transforms a 2D space. The original vectors (light grey) are mapped to new vectors (dark purple) through a combination of scaling and rotation, changing the area of the grid cells.

The absolute value of the determinant of the Jacobian matrix gives the factor by which the area (or volume) changes.

What is Jacobian? | The right way of thinking derivatives and integrals

This video provides an outstanding geometric intuition for the Jacobian. It starts from the 1D derivative as a 'scaling factor' and builds up to the Jacobian determinant as a '2D area scaling factor'. This perspective connects calculus and geometry beautifully.

Watch from 05:54 to 13:04. Focus on these key ideas: The derivative in 1D is the local scaling factor. The Jacobian matrix in 2D represents the best local linear map. The Jacobian determinant is the local scaling factor for areas.


4. The Multivariate Change of Variables Formula

The multivariate formula is a direct extension of the 1D case. To find the joint PDF of the transformed variables , we use:

where:

  • is the inverse transformation.
  • is the Jacobian matrix of the inverse transformation . Its elements are the partial derivatives .
  • is the absolute value of the determinant, which is our multidimensional scaling factor.

Geometry of Transformations of Random Variables

For a more formal and geometric derivation of this multivariate formula, let's turn to this handout. It shows precisely how a small rectangle in the original space transforms into a parallelogram, with the area scaling given by the Jacobian determinant.

Read the sections 'Bivariate Distributions' and 'More than two dimensions' (pages 2-5). This will solidify the geometric reasoning behind the formula, which you will find satisfying.


5. A Step-by-Step Worked Example

Let's see this method in action. The process generally involves these steps:

  1. Solve for the inverse transformation: Express the original variables () in terms of the new variables ().
  2. Calculate the Jacobian matrix of this inverse transformation.
  3. Compute the determinant of the Jacobian matrix.
  4. Substitute the inverse expressions into the original joint PDF.
  5. Multiply by the absolute value of the Jacobian determinant.
  6. Determine the new domain (or support) of the transformed variables. This is a critical step!

The following video provides a concise walk-through of this entire process for a two-variable transformation.

2 RV Transform Joint PDF | Change of Variables

This video walks through a complete example of a 2D random variable transformation. It's a great practical guide to applying the steps we've just outlined.

Watch the entire video. Follow along as the presenter executes each of the six steps, from finding the inverse transformation to calculating the final joint PDF and its new domain.


Conclusion

In this lesson, we tackled the crucial and often tricky task of transforming random variables. You now have a deep, principled understanding of why a simple substitution isn't enough and how to correctly derive the new distribution.

Key Takeaways:

  • Transforming a random variable warps the underlying sample space, requiring a correction factor to ensure probability is conserved.
  • In one dimension, this correction factor is the absolute value of the derivative of the inverse transformation, .
  • In multiple dimensions, this generalizes to the absolute value of the determinant of the Jacobian matrix of the inverse transformation, .
  • The procedure is systematic: find the inverse, compute the Jacobian determinant, substitute into the old PDF, multiply by the adjustment factor, and find the new domain.

Preview of the Next Lesson:
We have now explored how to define and transform specific probability distributions. But what if we don't know the exact distribution of our data? Can we still say anything useful about it? In the next lesson, we will explore Markov's and Chebyshev's inequalities, powerful tools that allow us to place bounds on probabilities even with limited information about the underlying distribution.