A trial of Amy's rejection sampling uses exactly fair Bernoulli trials. Exactly of the equally likely binary sequences have heads, so the acceptance probability is
Independent retries make the number of trials a geometric random variable on with expectation . The total number of coin tosses is , so
Using Stirling's approximation, the central binomial coefficient satisfies
Consequently
The rejection sampling output is uniform among the balanced binary sequences: they have equal probability on every trial, and conditioning on acceptance preserves that equality. For , the empty output needs zero tosses; the formula above concerns .
Betty's scheme is biased for every . The output occurs precisely when the first tosses are heads: the algorithm stops there and appends tails. Thus
For comparison, take the output . Its first symbols contain heads and tails, so neither stopping threshold has been reached. The next symbol is the th head, at which point the last tail is appended. Its unique generating prefix has length , giving
Therefore
The faster stopping rule does not produce a uniform distribution on a finite set of balanced binary sequences. For example, at the six outputs have the following exact probabilities:
OutputBettyUniform target
HHTT
HTHT
HTTH
THHT
THTH
TTHH
For , the two possible outputs each have probability , so that special case is uniform. For , simply return the empty output.
Use uniform balanced binary sequence sampling by choosing the positions of the heads. Number the positions from zero to . Start with no selected positions. Repeatedly toss the fair coin times, interpret the resulting bits as a position, and select that position if it has not already been selected; otherwise discard this block of tosses and retry. Stop when distinct positions have been selected. Put heads at those positions and tails everywhere else.
After positions have been selected, every one of the remaining positions has the same probability of being the next new position. This follows either by summing a geometric series over rejected blocks or by conditioning a uniform distribution on a finite set on avoiding the selected positions. Every ordered list of distinct selected positions consequently has probability
Each fixed -element subset has such orders, so its probability is
Thus every balanced binary sequence is equally likely.
When positions are selected, a block succeeds with probability , so the geometric distribution gives expectation blocks until the next new position. By linearity of expectation, the total expected toss count is
The strict inequality holds since , making each term less than two. A Boolean array records membership of each position; initializing it and constructing the output require additional work. The scheme terminates with probability one, since every stage has positive success probability.
Colour each edge of the complete graph independently red or blue, with probability for each colour. Every four-element subset of vertices determines exactly one copy of , containing six edges. These six edges are all red with probability and all blue with probability . The events are disjoint events, so
Let be the indicator random variable for this event and let count the monochromatic copies. Linearity of expectation gives
The indicator random variables for overlapping copies need not be independent. Averaging over all edge colorings ensures that at least one has . Thus the probabilistic method proves
For , both sides are zero and any edge coloring works. Copies are counted by their four-vertex subsets, rather than by their possible labellings.
Set . Independently sample an edge coloring exactly as in part (d), count its monochromatic copies of by examining all four-vertex subsets, and accept precisely when . Otherwise start over with a fresh edge coloring.
To prove an expected polynomial time bound, the existence argument alone is insufficient: we need a lower bound on the acceptance probability at this exact threshold. Since is a nonnegative integer with expectation , rejection implies . Markov's inequality therefore gives the integer-valued expectation threshold restart bound
The number of attempts has a geometric distribution, with expectation at most . Sampling the edge coloring costs random bits, and checking all four-vertex subsets costs operations, since only six edges must be tested per subset. Hence
This is a randomized algorithm that always returns an edge coloring meeting the original threshold and terminates with probability one. The stated operation count uses -bit counters; counting their bit complexity explicitly introduces at most a further logarithm factor and still gives polynomial time. For , return any edge coloring immediately.
Order the edges arbitrarily and fix their colours one at a time. After a partial assignment , regard all unassigned edges as independent fair red/blue choices, and compute
The conditional expectation of a monochromatic clique count is easy to compute. For each four-vertex subset , let be the number of its six edges still unassigned. Its contribution to is
In the second case, every remaining edge must match the already fixed colour; this includes a completely fixed monochromatic copy, for which and the contribution is one. In the last case, the six unassigned edges may become either all red or all blue. By linearity of expectation,
For the next unassigned edge , compute and . The law of total expectation gives
Choose the colour with the smaller value, resolving a tie by a fixed rule. At least one is at most their average, so the loop invariant is that never increases. Initially ; once every edge is fixed, there is no randomness left and . Therefore the method of conditional expectations guarantees
A direct implementation recomputes both sums over all four-vertex subsets for each of the edges, requiring arithmetic operations. The comparisons can be exact: every contribution is a multiple of , so store as an integer with bits. This gives bit complexity with elementary arithmetic, and hence a deterministic polynomial time construction. No random sampling is performed by this derandomization.

Articles by others on the same topic (0)

There are currently no matching articles.