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.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+