# Create random variable Expo from Unif(0,1)

Working through some problems from Introduction to Probability (Blitzstein)

Let U~Unif(0,1). Using U, construct X~Expo($$\lambda$$).

My work: (edited with updates on CDF and inverse function)

• PDF of X is $$\lambda e^{-\lambda x}$$ by definition of exponential distribution

• CDF is therefore $$1-e^{-\lambda x}$$

• Use Universality of the Uniform: find inverse function for F

• $$F^{-1}(x) = \frac{ln(1-x)}{-\lambda}$$

( $$y=1-e^{-\lambda x} -> 1-y = e^{-\lambda x}) -> x = \frac{\ln(1-y)}{-\lambda}$$)

• $$F^{-1}(U) = \frac{ln(1-U)}{-\lambda}$$

I am pretty confused by the process of getting a random variable from a Uniform distribution. Any help?

• Your CDF and your $F^{-1}$ are incorrect. Please revise your work with much more care. – Did Dec 2 '18 at 16:41
• A very big red flag should be the fact that you're getting negative values for the CDF! – Boshu Dec 2 '18 at 17:18

So there's a mistake in your CDF as has been pointed out (hint: you need to add something) and I'll leave it to you to correct subsequent errors. If you want to know why this method works, then consider the fact that the CDF is a mapping of the support on the interval $$[0,1]$$. Therefore, if you have a random variable $$U\sim\text{Unif}[0,1]$$, then the random variable $$Z=F^{-1}_X(U)$$ has the distribution $$F_X$$. So what you're doing is essentially this: you have the graph of the CDF of your distribution of interest. You pick a number $$x\in[0,1]$$ and you see where the CDF attains this value. This is your simulated random variable, and your $$x$$ is generated by the uniform distribution.