Draw independent uniforms on , put , and accept if ; otherwise repeat independently. This is rejection sampling from the uniform proposal . Its accepted unnormalized density is , and the acceptance probability is
Dividing by gives the target Wigner semicircle distribution. The number of trials up to and including the first acceptance has a geometric distribution with success probability , so
The expected number of rejected trials alone is .
Write for individual survival probability. Conditional on a clump of size , its death probability is . Averaging with the geometric distribution gives
Thus
Here and ; different clumps and experimental repetitions are understood independent for the sampling model.
The live-clump counts have independent binomial distributions, all with the same . Up to a constant, their combined likelihood function is , maximized at when . Solving for gives . Therefore
Monotonicity of in makes this the maximum-likelihood estimator. At the sampling boundaries, gives , while gives only a supremum as , with no finite maximizer. These are the limiting interpretations of the formula.
Write . The two multivariate normal distribution probability density functions have ratio
Here is the Euclidean norm. Consequently the smallest rejection sampling envelope constant, and its acceptance probability, are
The supremum is attained at ; hence no smaller constant can dominate the ratio. Draw and an independent from the uniform distribution on . Accept when
otherwise repeat with fresh independent random variables. One can generate using a random vector with independent standard normal distribution coordinates.
For any measurable set , the joint acceptance probability is . Dividing by proves that the returned random vector has probability density function . The number of proposals has a geometric distribution on the positive integers, with expected value . When , every proposal is accepted.
Write . The target Poisson distribution and proposal geometric distribution have probability mass functions and . Their ratio is
The successive ratio shows that a maximizing integer is , with a tie at when is an integer. Thus the tight envelope is
For any fixed , draw using (ii)'s inversion formula with this new parameter, and draw an independent from the uniform distribution on . Accept when
otherwise restart. The acceptance probability is and the expected number of proposals is .
To minimize that expected count, set . The exact answer is
Here is a proof that includes the changes of maximizing integer. Each is a convex function of , since its second derivative is . Their pointwise maximum is also a convex function. When is fixed its derivative is
If , take , where changes from on the left to on the right. The left derivative is nonpositive because ; the right derivative is nonnegative because . This is a minimum. If , take . There and the active branch has except for the endpoint tie; its derivative vanishes. Convexity again proves the global minimum. The formulas agree at the boundary.
For a fully specified optimal algorithm, compute and once, then use the preceding acceptance test with and . At an integer tie either maximizing integer gives the same test. In code, factorials can be evaluated through the logarithm of the gamma function:
and acceptance is . This avoids overflowing factorials.
The optimum minimizes expected trials, the usual idealization of time when each proposal and test has constant cost. Actual runtime also depends on the implementation of discrete inversion and factorial evaluation. Simply minimizing an upper bound for would not necessarily give the exact optimum above; see optimal geometric envelope for a Poisson distribution.
Stop rejection sampling when exactly target draws have been accepted. The total proposal count is a sum of independent waiting times with geometric distribution, equivalently a negative binomial distribution counting trials. Consequently
The accepted-sample Monte Carlo estimator then has the approximate precision from (a)(iii). The displayed proposal cost is an expected value, which need not be an integer. Spending this many proposals in advance does not ensure that target draws will have been accepted.
Integrating the envelope shows . One trial of rejection sampling draws and an independent from the uniform distribution on , and accepts if . Repeat with fresh independent random variables after each rejection. Ratios need only be evaluated where ; the envelope makes the target zero wherever .
For any measurable set , integration of the conditional probability of acceptance gives
Taking the whole domain gives acceptance probability , and dividing gives . Fresh trials therefore supply independent and identically distributed random variables with target probability density function . The corresponding Monte Carlo estimator is
The proposal count up to and including one acceptance has the geometric distribution
For example, the tail-sum formula gives . Thus the expected cost is proposal draws per accepted target draw.
The law of total expectation gives . The law of total variance separates the two sources of randomness:
Substitution gives
The binomial thinning of a geometric random variable identity supplies a further check: itself has a zero-based geometric distribution with success probability .
Put . By the law of total probability,
For , termwise differentiation of the geometric series, valid inside its radius of convergence, gives
Taking therefore yields
Since , this is the zero-based geometric distribution with parameter
This illustrates Bernoulli thinning of a geometric count. Here , as .
For the reverse conditional distribution, Bayes' theorem gives, for ,
Thus
For the conditional probability is zero. The conditional distribution of is the failure-count form of a negative binomial distribution, with successes and success parameter : the geometric-binomial posterior is shifted negative binomial.
Summing a geometric series gives the probability generating function of the zero-based geometric distribution:
The series converges for , in particular on . At , , , and . The factorial moment identities give and . Thus
A Bernoulli random variable with parameter has . Part (i) and the geometric distribution formula give
Comparing coefficients in the probability generating function identifies
Thus has the zero-based geometric distribution with success parameter . The probabilities sum to one, and its mean agrees with the random-sum mean .
Let be the number of days up to and including the first breakdown, and the event of a morning first breakdown. For , conditional probability gives
Thus
This geometric distribution counts the day on which the first breakdown occurs. Its parameter is the probability of at least one breakdown during a day, rather than the morning breakdown probability alone.
Let be the expected additional flips when there is no immediately preceding tail, and the expectation when the preceding flip is a tail. A one-step first-step analysis gives
Solving gives and . To justify finiteness before manipulating these expectations, split the flips into independent two-flip blocks. Each block has probability of being ; hence . This geometric tail bound from a uniform escape probability makes the expectation finite. The state is essential because successive possible pairs overlap: the waiting time is not itself a geometric distribution with parameter .
For , the first digits must all differ from and the next digit must be . Independence gives
Thus has the geometric distribution counting trials up to and including the first success, with success probability . For completeness, its mean follows from the tail-sum formula:
The sum of the geometric series also proves finiteness of this expectation.
In independent Bernoulli trials with success probability , counts failures before the first success. The event requires failures followed by one success, giving . This is the zero-based geometric distribution, rather than the count of trials including the success.
The given four probabilities factor into independent Bernoulli indicators for the occurrence of and on each trial, with parameters and . Independent trials make the full sequence of indicators independent of the full sequence of indicators. Let count trials strictly before the first . Then , independently of the indicators, and the desired count is their sum over these trials. Therefore its distribution is , as in part (b).
The word “before” excludes the stopping trial: an on that trial stops the experiment but does not add to the count. Another check is to discard all trials. Among the remaining relevant outcomes, stopping has probability and an additional pre-stopping has the complementary probability, again giving the same zero-based geometric distribution.
Posterior coin count after exactly one head Created 2026-10-07 Updated 2026-10-18
Let have the positive-integer geometric distribution with success parameter , and conditionally toss independent coins with head probability . Exactly one head has conditional probability . Combining this with the prior by Bayes' theorem gives the displayed posterior with ; its normalization uses . For , the posterior is . It is also a shifted negative binomial distribution, with equal in law to the number of failures before two successes of probability .
Prefix code for a rare geometric success Created 2026-10-14 Updated 2026-10-25
For a success index with geometric distribution of parameter , write , . Encode by ones followed by zero, then encode in exactly bits. This prefix code has length . Since , its expected length is the displayed expression, at most . Thus a very rare success can be communicated in approximately the logarithm of its inverse probability, rather than one bit per trial.
// Target: quantum-theory.bigb