Changing variables in a probability density
10 questions on how a probability density changes under a transformation, why the mode can move and what the Jacobian factor does.
- 10 questions
- Stopwatch
- Instant feedback
Sample questions
Play now ↑Answers stay hidden. Start the quiz to play them.
Sample 1
A transformation stretches one region of the axis to twice its original length. What happens to the density there?
- It doubles
- It is halved
- It stays the same
Sample 2
You draw many samples from a distribution, push each one through a nonlinear function, and make a histogram of the results. Which curve will it match?
- The original curve, with the transformed variable simply substituted in
- A straight line
- The properly transformed density, including the stretching factor
How it works
- One question per screen. An answer is final once sent.
- You see right away whether you were right, with a short explanation.
- The stopwatch runs: on equal scores, the faster player ranks first.
- Only your best attempt counts, so replaying is never risky.
About this quiz
Suppose you record how long a task takes in seconds and then, for convenience, report it in minutes, or on a logarithmic scale. The data are the same, but the curve that describes how likely each value is will look different. A plain function simply gets relabelled when you change its variable. A probability density does not, and the difference is a quiet source of confusion and error. It is also the mathematical idea behind a whole family of modern generative models, which turn a simple distribution into a complicated one by transforming variables.
This quiz explains why a density needs a correction when you change variables, in plain terms. The key is conservation: the probability that a value lands in a small interval does not change just because you described the interval in different units. If the transformation stretches the interval, the same amount of probability is spread over a longer stretch, so the density there has to fall. If the transformation squeezes the interval, the density has to rise. Everything else follows from that picture.
One surprising consequence is that the most likely value of a variable depends on how the variable is written. The peak of a density can move when you apply a nonlinear transformation, even though the data have not changed. Only for a simple rescaling or shift does the peak move in the obvious way. The quiz tests whether you see why, and what that means for phrases such as « the most probable value ». It also covers how the idea extends from one variable to many, where the stretching factor becomes the amount by which a transformation expands or shrinks small regions of space.
The usual mistakes follow directly. People substitute the new variable into the old density and forget the stretching factor. They assume that a peak stays a peak after any change of scale. They forget that the total probability must still come to one. And they overlook that the factor must be positive, whichever way the transformation turns the axis, since a density can never be negative. Seeing the examples in words, without heavy algebra, makes these points far easier to remember. Even if you never build a flow model, the lesson carries over to everyday work: a statement about the most typical value of a quantity can change when the quantity is measured on a different scale, so it is worth saying which scale you mean.
The quiz suits students who have met densities and want to see where the fine print lies, and practitioners who have heard of flow-based models and want the intuition. No calculus is needed. There are 10 questions, each with an explanation, and it takes about four minutes.
Questions and answers
›How long does the quiz take?
About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. An explanation appears after every answer.
›Do I need calculus or linear algebra?
No. The ideas are explained through stretching and squeezing, with simple numbers. The words derivative and Jacobian are used only as names for the stretching factor, and you never have to calculate either.
›Why can't I just substitute the new variable into the old density?
Because a density measures probability per unit of the variable, and the unit has changed. If the new variable stretches the axis, each small step covers more of the old scale, and the density has to be scaled down by the amount of stretching. Without that factor, the total probability would no longer add up to one.
›Why can the most likely value change when I change variables?
The peak of a density is where probability per unit is highest, and that depends on the unit. After a nonlinear transformation, different parts of the curve are stretched by different amounts, so the highest point can shift. The probability of landing in a given interval is unaffected, but the location of the peak is not. The same caution applies in plain data analysis. When a skewed quantity such as income is analysed on a logarithmic scale, its typical value, spread and shape all look different, and none of these views is more correct than the others, but they answer slightly different questions.
›When does the peak move in the obvious way?
When the transformation is linear, such as changing units or adding a constant. Every part of the axis is then stretched by the same amount, so the shape stays the same, and the new peak is just the old peak converted into the new units.
›What is the Jacobian determinant?
For a transformation of several variables it is the number that tells you how much a tiny region of space is expanded or shrunk. Its absolute value is the ratio of the volumes before and after, and the density has to be scaled by this factor so that the probability inside the region is conserved.
›Why does the correction use an absolute value?
A transformation can reverse the direction of the axis, which would make the derivative negative. The density, however, must remain positive, because it measures a ratio of probability to length or volume. Taking the absolute value of the stretching factor removes the sign and keeps the density valid.
›Where does this idea matter in machine learning?
It is the foundation of normalising flows, which build complicated distributions by passing a simple one through a chain of invertible transformations and tracking the stretching factor at each step. It also explains why quantities such as the mode and the entropy of a distribution depend on the parameters chosen to describe it.