# How do I get a pdf based on these acceptance-rejection simulation criteria?

I have been given an algorithm to generate a random variable $Y$, as follows:

• $X=-\ln(Z)$
• If $X>2$ then $Y=X-2$, otherwise reject.

I'm then asked to find the pdf and cdf of $Y$.

Can anyone tell me how to read this?

I know in theory what both are but I'm finding it difficult to infer them from problems like this.

• I think you will need to tell us what $Z$ is first. – whuber Feb 3 '14 at 19:36
• Is $Z$ intended to be uniform on $(0,1)$? Or something else? – Glen_b -Reinstate Monica Feb 3 '14 at 22:31

If $Z$ is intended to be standard uniform, you can use elementary probability arguments in terms of the cdf to derive that $-\ln Z$ is standard exponential (the details of which arguments I leave to you).

The distribution is then truncated to be $>2$ and then shifted by subtracting 2. For the truncation you just need to consider the effect on the density:

Or you can get there from the memoryless property of the exponential.