Inverse Transform Sampling — Definition, Formula & Example
Inverse transform sampling is a way to turn random numbers between 0 and 1 into random values that follow any distribution you choose. You feed each uniform random number into the inverse of the target distribution's cumulative distribution function (CDF).
Let be a cumulative distribution function and define its generalized inverse for . If , then has CDF . The reason is that exactly when , so .
Key Formula
Where:
- = A random number drawn uniformly from the interval (0, 1)
- = The CDF of the distribution you want to sample from
- = The inverse (or generalized inverse) of F, which maps a probability back to a value
- = The generated sample, which has CDF F
Worked Example
Problem: A store models the distance, in miles, from the store to a delivery address with the density for . Your computer gives you two uniform random numbers, and . Use inverse transform sampling to turn them into two simulated delivery distances.
Step 1: Find the CDF by integrating the density from 0 to x.
Step 2: Set the CDF equal to u and solve for x. Keep the positive root, because distances in this model lie between 0 and 4.
Step 3: Substitute each uniform number into the inverse CDF.
Answer: The simulated delivery distances are 2 miles and 3.6 miles. Check: , which matches .
Why It Matters
Computer random number generators produce uniform values on (0, 1), so you need a method like this to simulate anything else. In queueing and Monte Carlo simulations, it gives exponential wait times through . Courses in probability, simulation, and actuarial science use this formula constantly.
Common Mistakes
Mistake: Treating as the reciprocal , or plugging into the density instead of inverting the CDF.
Correction: is the inverse function. Solve the equation for . The result is a value of the random variable, and it must lie in the distribution's support. In the example, always falls between 0 and 4.
