For normal rejection sampling with an exponential envelope, complete the square in the probability density function ratio:
The maximum occurs at , which lies in the support because . Thus
The PDF exponent is inside the square root; this distinction is lost in the converted TeX.
The acceptance rule simplifies to
An exponential proposal can be generated as from an independent uniform distribution value . Since the target is normalized, the overall acceptance probability is . To maximize it,
Therefore the optimal rate is , with acceptance probability .
Finally, give each accepted half-normal distribution value an independent fair sign and output . On each half-line its probability density function is half the reflected half-normal distribution probability density function:
Consequently . The sign must be drawn independently; rejection itself does not supply it.
Choose a proposal probability density function and a finite envelope constant such that wherever the target has positive density. A rejection sampling trial draws and, independently, ; accept when
otherwise repeat with fresh independent draws. For any measurable set ,
In particular , so the conditional accepted density is . More explicitly, summing over the possible first accepted trial gives
Thus the algorithm terminates almost surely and its output has exactly the requested law.
The envelope constant satisfies and is the expected number of proposal trials for one output, by the geometric distribution of the waiting time. This is the quantity often called the rejection rate . The actual probability of rejecting a particular proposal is , and the expected number of rejections before one acceptance is ; these conventions should not be conflated.
To generate a standard normal distribution, first generate its absolute value, whose half-normal distribution density is
With the given exponential distribution proposal, the density ratio is
Its maximum is at , hence the normal rejection sampling with an exponential envelope constant is
Draw and a fresh uniform ; accept when . An accepted has density . Independently choose a sign, positive or negative with probability , and output with that sign and magnitude . On either half-line its density is , proving the normal output law.
To optimize the rejection rate, differentiate
Its derivative is , negative before one and positive after one; equivalently its second derivative is . Thus
The rejection probability is consequently about .
To use only uniforms, apply inverse transform sampling: for an independent ,
has survival probability for . Use a second independent uniform for acceptance, and, after acceptance, a third independent uniform to choose the sign. Repeat with fresh uniforms after any rejection. No exponential generator is then needed.