= Solution
{c}
Integrating the <conditional distribution> against the <exponential distribution> <probability density function> gives, for integer $k\geq0$,
$$
\begin{aligned}
\mathbb P(Y=k)
&=\int_0^\infty\frac{e^{-x}x^k}{k!}\lambda e^{-\lambda x}\,dx\\
&=\frac{\lambda}{k!}\frac{\Gamma(k+1)}{(1+\lambda)^{k+1}}
=\frac{\lambda}{1+\lambda}\left(\frac1{1+\lambda}\right)^k.
\end{aligned}
$$
Here the <gamma function> identity $\Gamma(k+1)=k!$ evaluates the integral. Hence
$$
\boxed{Y\sim\operatorname{Geom}\!\left(\frac{\lambda}{1+\lambda}\right)}
$$
on $\{0,1,2,\ldots\}$. Put $r=1/(1+\lambda)$ and $\rho=1-r$. The <geometric series> gives $F(k)=1-r^{k+1}$. Its generalized inverse, the <quantile function>, is
$$
\boxed{F^{-1}(u)=\left\lceil\frac{\log(1-u)}{\log r}\right\rceil-1,\qquad0<u<1.}
$$
This is the smallest nonnegative integer $k$ for which $1-r^{k+1}\geq u$; dividing by $\log r<0$ reverses the inequality. Draw $U$ from the <uniform distribution> on $(0,1)$ and use this formula. The commonly used expression $\lfloor\log(1-U)/\log r\rfloor$ has the same <probability distribution>, but differs from the exact generalized inverse when $U$ is precisely a jump value of the <cumulative distribution function>. Such values have <probability> zero for an ideal continuous uniform draw.
Back to article page