Give a method for generating a random variable with density function $$f(x) = \begin{cases} e^{2x}, - \infty < x < 0\\ e^{-2x}, 0 < x < \infty \end{cases}$$
Thoughts: I was thinking of either using the inverse transformation method or the acceptance-rejection method but I am thrown off by how to apply either of those methods for this specific density function, any thoughts or suggestions are greatly appreciated
We could apply the inverse transformation method where we have two cases:
Case 1: $f(x) = e^{2x}$, $-\infty < x < 0$. Solve $U_1 = f(x)$ for $x$ where $U_1\sim U(0,1)$.
Case 2: $f(x) = e^{-2x}$, $0 < x < \infty$. Solve $U_2 = f(x)$ for $x$ where $U_2\sim U(0,1)$.