The Method of Inverse Transforms

This Demonstration illustrates the method of inverse transforms, which can be used to generate random numbers from a particular continuous or discrete probability distribution. By passing random numbers on the unit interval through the inverse of the cumulative distribution function (CDF), a sample of a random variable governed by that CDF is obtained. Each output is collected in a bin of an evolving histogram. During each iteration, the dotted red line running from the axis to the graph of the CDF to the axis illustrates the method explicitly. With multiple samples, you can obtain an approximation of the probability density function (PDF) associated with the given random variable. In this Demonstration, an assortment of continuous and discrete random variables are considered.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


You may choose from these distributions: exponential, uniform, triangular, Pareto, Gaussian, Rayleigh, binomial, negative binomial, geometric, and Poisson.
The method of inverse transforms is most often used to simulate a realization of a random variable associated with a particular distribution. Inverse transform sampling works as follows.
Consider, for example, a continuous random variable with cumulative distribution function . Let be a uniform random variable over the unit interval and pass through the inverse of the cumulative distribution function, that is, compute . We call the sample.
It can be seen that for a sufficiently large set of samples, the associated normalized histogram generates a close approximation to the probability density function of the random variable associated with the cumulative distribution function . A result of Kolmogorov asserts that if is continuous, then the rate of convergence in the sup-norm topology is .
For more information about generating samples from random variables, see, for example, S. M. Ross, Simulation, 3rd ed., London: Elsevier Academic Press, 2002.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.