# Constructing a random variable $X$ from another random variable $Y$ with known distribution

I am just trying to understand my notes from my probability class.

Say that the only probability distribution available to you is the continuous Uniform distribution defined on the interval $[0,1]$. So $Y\sim \text{Unif}[0,1]$. Now you want to simulate an exponential random variable, $X\sim \text{Exp}(\lambda)$ with the CDF $F_X(x) = 1-\exp(-\lambda x)$, $x\geq0$.

My notes continue to say that you can construct it by the following:

$(1)$ $Y(\omega) = F_{X}^{-1}(\omega)$

$(2)$ $y=1 - e^{-\lambda x}$

$(3)$ $\log(1-y) = -\lambda x$

$(4)$ $\frac{1}{\lambda}\log\left(\frac{1}{1-y}\right) = x$

$(5)$ $F_{X}^{-1}(y) = \frac{1}{\lambda}\log\left(\frac{1}{1-y}\right)$

At $(1)$, are we setting an observation of the random variable $Y$, $Y(\omega)$ to the inverse of the CDF of the r.v. $X$ at the same observation?

I understand that $(2)$, $(3)$, and $(4)$ are just solving for $x$ after setting $y$ equal to the CDF of $X$. But I don't understand why this works.

-
Typos: (1) is absurd since the image set of $F_X$ is not $\Omega$. In (5), replace $F_Y$ by $F_X$. – Did Oct 8 '12 at 6:05
@did: Thanks, I was trying to keep up with the class, so I may have transcribed the notes incorrectly. Though I think what I wrote in (1) is what the prof wrote on the board - what should it be instead? – user42478 Oct 8 '12 at 6:15
Well, assuming $X$ and $Y$ are defined on the same probability space $(\Omega,\mathcal F,\mathbb P)$, one has $Y:\Omega\to[0,1]$, $X:\Omega\to\mathbb R_+$, $F_X:\mathbb R\to[0,1]$, $F_X^{-1}:[0,1]\to\mathbb R_+$, hence $F_X^{-1}(Y):\Omega\to\mathbb R_+$ has at least the proper source set and target set to be a candidate for a realization of $X$. And, behold! indeed $F_X^{-1}(Y)$ is distributed like $X$. – Did Oct 8 '12 at 7:07

• you have $P(Y \le y) = y$ for $0 \le y \le 1$.
• you want $P(X \le x) = 1-\exp(-\lambda x)$ for $0 \ge x$
so you solve $y=1-\exp(-\lambda x)$ to give $x=\frac{1}{\lambda}\log_e(\frac{1}{1-y})$.
This means that if $Y$ is uniformly distributed on $[0,1]$ then $X=\frac{1}{\lambda}\log_e(\frac{1}{1-Y})$ is exponentially distributed with rate $\lambda$, as $P(F_X(X) \le y)=P(F_Y(Y) \le y)=P(Y \le y) = y$.