\documentclass[11pt,onecolumn]{article}
\usepackage{amssymb, amsmath, amsthm,graphicx, paralist,algpseudocode,algorithm,cancel,url,color}
\usepackage{sectsty}
\usepackage{fancyvrb}
\usepackage{mathrsfs}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\usepackage{tikz}


\newcommand{\bvec}[1]{\mathbf{#1}}
\newcommand{\R}{\mathbb{R}}
\DeclareMathOperator{\Tr}{Tr}
\sectionfont{\Large\sc}
\subsectionfont{\sc}
\usepackage[margin=1 in]{geometry}
\begin{document}
\noindent
\textsc{\Large CS 3220: Homework 5}\\
Instructor: Anil Damle\\
Due: November 11\\

\subsection*{Policies}
You may discuss the homework problems freely with other students, but please refrain from looking at their code or writeups (or sharing your own). Ultimately, you must implement your own code and write up your own solution to be turned in. Your solution, including plots and requested output from your code should be submitted via the CMS as a pdf file. Additionally, please submit any code written for the assignment via the CMS as well.\\
\hrule
\vspace{5mm}

\subsection*{Question 1:}
An exponential random variable with parameter $\lambda > 0$ has CDF
\[
F_X(x) = 1-e^{-\lambda x}
\]
for $x\geq 0$ and $F_X(x) = 0$ for $x<0.$ Explicitly work out the procedure for sampling from this distribution using the inverse CDF method and write out the algorithm.


\subsection*{Question 2:}
Using the above we will devise one way to sample from a $\mathcal{N}(0,1)$ random variable. 

\begin{enumerate}[(a)]
\item Let $Z$ be distributed as $\mathcal{N}(0,1),$ show that the pdf of $\lvert Z \rvert$ can be written as
\[
f_{\lvert Z\rvert}(x) = \frac{\sqrt{2}}{\sqrt{\pi}}e^{-x^2/2}
\] 
for $x\geq 0$ and $0$ otherwise.
\item An exponential random variable $X$ with parameter $\lambda > 0$ has pdf
\[
f_X(x) = \lambda e^{-\lambda x}
\]
for $x\geq 0$ and $0$ otherwise. Show that for $x > 0$ and parameter $\lambda = 1$
\[
f_{\lvert Z\rvert}(x) / f_X(x) \leq \sqrt{\frac{2e}{\pi}}.
\]
\item Explain how the above lets draw i.i.d. samples from $\lvert Z\rvert$ assuming we can only draw uniform random variables on $[0,1].$
\item How might we use the above method for generating a sample from $\lvert Z\rvert$ coupled with one additional uniform $[0,1]$ to generate a sample from $Z.$
\end{enumerate}





\end{document}