Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Stretching a rubber sheet
Sprinkle sand evenly on a rubber sheet, then stretch one end. The sand there spreads out and gets thinner. Where the sheet is squashed, the sand piles up thicker. No sand appears or disappears.
Probability behaves the same way. If is random and you compute , the total probability stays 1, but its density changes wherever stretches or squashes. The amount of stretching is the derivative (or, in several dimensions, the Jacobian). That’s the change-of-variables formula.
A lidar measures range and bearing, but a map wants x and y. A neural network outputs a number, but you need a probability between 0 and 1. A simulator needs Gaussian noise but the computer only makes uniform random numbers. Each time, you’re transforming a random variable and need to know its new distribution.
- 1. Where a map stretches space, the density…
- 2. After transforming, the total probability is…
- 3. If Y = 2X, Y's spread is…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Method 1: through the CDF
For increasing , . Differentiate to get the density. This works for any if you’re careful with the event .
Example. with : , so . This is the density.
Method 2: the change-of-variables formula
If is smooth and one-to-one with inverse ,
If several map to the same , sum over the branches.
- Affine: .
- Log-normal: , .
Inverse-transform sampling
If then has CDF . For example, . Conversely, for continuous : this is the probability integral transform, used to check calibration.
- 1. Y = 3X + 1. f_Y(y) =
- 2. To sample Exp(λ) from U ~ Uniform…
- 3. Y = X² needs how many inverse branches?
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.Several dimensions: the Jacobian
For a smooth one-to-one on with inverse ,
This is the multiple-integral change of variables (A3.2-8) read backwards. The determinant measures how much a tiny box’s volume changes.
- Linear maps: . For Gaussians this gives (A4.2-4).
- Polar coordinates: has .
- Box–Muller: and make two independent standard normals.
Sums: convolution
If are independent, . Use the transformation , whose Jacobian is 1, then integrate out . Two uniforms give a triangle, and two Exp(1) variables give a Gamma(2, 1).
The reparameterization trick
To differentiate with respect to and , write with . Then , which you can backpropagate through. It usually has much lower variance than the score-function (REINFORCE) estimator (Kingma and Welling, 2014; Practice Code 5).
- 1. |det J| of the polar map (r, θ) → (x, y) is…
- 2. The density of X + Y (independent) is…
- 3. The reparameterization trick writes X ~ N(μ, σ²) as…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Proof of the one-dimensional formula
Let be strictly increasing and differentiable, with inverse .
- CDF. .
- Differentiate. By the chain rule, .
- Decreasing case. If is decreasing, , so .
- Several branches. If is piecewise monotone, splits into disjoint pieces, and the densities add. ∎
Why Box–Muller works
Map . The inverse is and . Its Jacobian determinant has absolute value . The uniform density is 1, so
The density factors, so the two outputs are independent standard normals. ∎
Normalizing flows
Compose invertible maps with . Then
Coupling layers (Dinh et al., 2017) keep half the coordinates and scale/shift the rest, . The Jacobian is triangular, so its log-determinant is just , at no extra cost.
Exercise 3.1: Prove the probability integral transform
For continuous strictly increasing , for . That is the Uniform(0,1) CDF.
- 1. A decreasing g gives f_Y = f_X(h)·…
- 2. Box–Muller's outputs are independent because…
- 3. A coupling layer's log |det J| is…
Level 4: Expert
★★★★★ Expert⏱ 45 minResearchers: original papers and open problems.Range-bearing sensors and the banana
A lidar or radar measures range and bearing with roughly independent Gaussian errors. In Cartesian coordinates the uncertainty is a curved banana, not an ellipse: its density is . An EKF linearizes the map at the mean, which gives an ellipse centred at . But the true mean is along the boresight: closer to the sensor. With large bearing noise, the linearized filter is biased and overconfident. That’s why the unscented transform, particle filters and “debiased converted measurements” exist (Julier and Uhlmann, 2004; Lerro and Bar-Shalom, 1993).
Transformations in AI, robotics and aerospace
- Unscented transform. Instead of linearizing , push sigma points through it and refit the mean and covariance. This captures second-order effects like the banana’s bias (Julier and Uhlmann, 2004).
- Normalizing flows and diffusion models are change-of-variables machines. Flows learn invertible maps with tractable Jacobians (Rezende and Mohamed, 2015; Dinh et al., 2017). Continuous-time flows replace with the integral of a trace (Chen et al., 2018).
- Squashed Gaussian policies. Soft actor-critic samples to keep actions within limits. Its log-probability needs the correction , a Jacobian term (Haarnoja et al., 2018).
- Orbit uncertainty propagation. Gaussian uncertainty in Cartesian position stops being Gaussian after a few orbits. Mapping to orbital elements, which evolve nearly linearly, keeps it close to Gaussian far longer (Junkins et al., 1996).
- Calibration checks for probabilistic forecasts use the probability integral transform. If the forecasts are calibrated, is uniform.
References
- G. Casella, R. Berger (2002). Statistical Inference, 2nd ed., Ch. 2 and 4. Duxbury.
- G. Box, M. Muller (1958). “A note on the generation of random normal deviates.” Annals of Mathematical Statistics, 29(2).
- L. Devroye (1986). Non-Uniform Random Variate Generation. Springer.
- D. Kingma, M. Welling (2014). “Auto-encoding variational Bayes.” ICLR.
- D. Rezende, S. Mohamed (2015). “Variational inference with normalizing flows.” ICML.
- L. Dinh, J. Sohl-Dickstein, S. Bengio (2017). “Density estimation using Real NVP.” ICLR.
- R. Chen, Y. Rubanova, J. Bettencourt, D. Duvenaud (2018). “Neural ordinary differential equations.” NeurIPS.
- S. Julier, J. Uhlmann (2004). “Unscented filtering and nonlinear estimation.” Proceedings of the IEEE, 92(3).
- D. Lerro, Y. Bar-Shalom (1993). “Tracking with debiased consistent converted measurements versus EKF.” IEEE Transactions on Aerospace and Electronic Systems, 29(3).
- T. Haarnoja, A. Zhou, P. Abbeel, S. Levine (2018). “Soft actor-critic.” ICML.
- J. Junkins, M. Akella, K. Alfriend (1996). “Non-Gaussian error propagation in orbital mechanics.” Journal of the Astronautical Sciences, 44(4).