Theorem (Inversion)

Let be on the Uniform Distribution and let be the target CDF. Let where is a s? RV. Then .

Desmos Graph

Consider the following CDF of .

What exactly is ? First, is an increasing function to (or asymptotically to ). If we take some point with the corresponding domain , then apart from the flat portion, it is clear what the value should be.

Now for the range of where the value is neither increasing nor decreasing (the red portion in the graph), then we define

or the Infimum. In particular,

which is sort of a “baby sampling algorithm”.

Inversion Algorithm

This gives us the following algorithm,

  1. Input: CDF (target)
  2. Output Sample
  3. Step 1: Generate
  4. Step 2: Assign

Example 1

Suppose we sampled the following RV with the PDF

or the Exponential distribution with parameter .

Solution: We know that the CDF is

Then we finish by

So, if , then


More generally, we want to know more about the Transformation of Random Variables.

Discrete Case

We can apply the same methods used of continuous RVs on discrete RVs.

Let RV with PMF and CDF defined below. Also is strictly increasing.

Desmos Graph
  1. Sample .
  2. Let for . Basically let the inverse be the minimum value that has the minimum probability of occurring.
  3. Set .