Randomized algorithms can solve problems that seem to demand much more work deterministically. A single coin flip can replace a complicated search. But is any of that power real, or is every randomized algorithm just a deterministic one we haven't been clever enough to find?
Four kinds of coin flipping#
A randomized algorithm flips coins during execution and might give different answers on different runs. The classes sort algorithms by error behavior. RP is one-sided error: a yes instance is accepted with probability at least one half, a no instance always rejected. coRP is the mirror image. ZPP is their intersection, the Las Vegas class: always correct, with variable running time. BPP is two-sided bounded error: every answer is correct with probability at least . The containments run , with coRP inside BPP too. The two-thirds threshold is a convention: take the majority of runs, and by a Chernoff bound any constant edge over one half boosts to near certainty at polynomial cost.
MaxCut with coin flips#
MaxCut: given a graph with vertices and edges, partition the vertices into two sets and to maximize the number of edges crossing between them. Solving it exactly is NP-hard, so we approximate. The randomized algorithm is almost trivially simple: for each vertex, flip a fair coin. Heads, put it in . Tails, . Done. The two endpoint coins of any edge are independent, so the endpoints land on opposite sides with probability exactly one half. By linearity of expectation,
The maximum possible cut is at most , so the expected cut is at least half the optimum, and since the average over all coin sequences is , at least one assignment achieves it: the probabilistic method. A guaranteed approximation for an NP-hard problem, from coin flips and a one-line analysis.
So: can we always remove the coins? Formally, is BPP equal to P? Most complexity theorists believe yes. No one has proved it.
Try every coin sequence#
The obvious approach: the algorithm uses random bits, so run it on all random strings and take the majority answer. Correct, but most BPP algorithms use polynomially many random bits, and two to a polynomial is exponential: BPP inside EXP, not P. The special case is the insight: with only random bits, enumeration costs , polynomial. The obstacle is not randomness itself. It is the number of random bits.
Even amplification can be thrifty with bits: instead of independent trials at bits, take a -step random walk on an expander graph whose vertices are the random strings, at bits total, and by the expander walk theorem the error still falls like .
There is also Adleman's nonuniform shortcut: amplify the error below and union bound over the inputs, so some single random string works for every input of one length. Hardwiring it gives BPP inside P/poly, but nonuniformly and nonconstructively: circuits, not algorithms.
The method of conditional expectations#
Think of a BPP algorithm's execution as a binary tree of depth , one level per random bit: internal nodes are partial assignments of random bits, leaves are complete assignments with deterministic outcomes. Let be the conditional probability of success given the bits fixed so far. At the root, ; at a leaf, is 0 or 1. The key observation: at any node is the average of at its two children, so at least one child is at least as large as the parent. Walk down the tree greedily, always taking the better child. The invariant never drops, so the leaf you reach has , which forces . Always correct, no coins.
The catch is the greedy step: computing the conditional success probability can mean summing over exponentially many leaves, as hard as the original problem. The method works when the conditional expectation has a closed form, and MaxCut is exactly such a case: the conditional expected cut is the number of edges already cut plus half the edges touching an undecided vertex. The rule that falls out is to place each vertex opposite the majority of its already-placed neighbors: a deterministic time algorithm guaranteed to cut at least edges, derived systematically from the probabilistic analysis.
Pause and try: derive the greedy rule from the conditional expectation.
Write for the conditional expected cut: edges already cut contribute 1, edges with an undecided endpoint contribute . Placing the next vertex in cuts its edges to placed -neighbors and uncuts its edges to placed -neighbors; comparing with placing in , the unplaced terms cancel and the difference is (placed neighbors in ) minus (placed neighbors in ). Going opposite the majority never decreases , which starts at .
Pairwise independence#
The second derandomization asks a different question: how much randomness did we actually need? The MaxCut analysis used only that each coin is unbiased and that the two coins on each edge are independent, never mutual independence of all coins. Pairwise independence is enough.
And pairwise independence is cheap. Take truly random seed bits, and for each nonempty subset of the seed positions define as the XOR of the seed bits indexed by : that is output bits, each unbiased, and any two are jointly uniform, because two distinct subsets decompose into at least two nonempty groups of independent bits. For , eight seeds produce seven pairwise-independent bits.
Apply this to MaxCut with about : at least pairwise-independent bits from only possible seeds. The expected cut under any pairwise-independent distribution is still , so some seed achieves it; enumerate every seed and keep the best cut. Deterministic, guaranteed, polynomial time.
Pseudorandom generators#
Both attacked the randomness itself, one by simulating the coins greedily, one by shrinking how many you need. The general strategy: build a function stretching a -bit seed into bits that look random to any efficient computation. Formally, is an pseudorandom generator if it runs in polynomial time and no circuit of size at most distinguishes from a truly random -bit string with advantage more than .
Why this settles the question: drive a BPP algorithm's error down to , so on true randomness it succeeds with probability at least . If fools circuits of the algorithm's size with advantage at most , swapping true random bits for moves the success probability by at most , leaving . With , enumerate all seeds and take the majority: BPP equals P, if such a generator exists. Pairwise independence fools only tests that look at pairs; Nisan and Wigderson built a generator that fools all small circuits.
Hardness versus randomness#
The Nisan-Wigderson generator starts from a Boolean function on bits that is hard for small circuits, and evaluates on many overlapping windows of a short seed: sets through of seed positions, each of size , any two overlapping in at most positions. Such designs come from finite fields, with windows the graphs of low-degree polynomials over a by grid of seed positions.
The security proof uses hybrids, interpolating between the generator's output and true randomness one bit at a time. A circuit distinguishing the ends with advantage must distinguish some adjacent pair with advantage , meaning it predicts one output bit of from the earlier bits. Because the windows barely overlap, those earlier bits constrain only a few of the relevant window's inputs, and hardcoding them yields a small circuit for . If requires large circuits, no small distinguisher exists: the harder , the stronger the generator.
The basic construction gives a polylogarithmic seed, so quasi-polynomial deterministic time. Impagliazzo and Wigderson closed the gap in 1997: if E, deterministic time , contains a function requiring circuits of size , then BPP equals P. The proof amplifies worst-case hardness into average-case hardness with XOR lemmas and direct product theorems, feeds the result into a refined Nisan-Wigderson generator with seed length , and enumerates the seeds.
And there is an irony. The natural proofs barrier says that if pseudorandom functions exist, the known proof strategies cannot establish circuit lower bounds. Impagliazzo-Wigderson says that if circuit lower bounds hold, pseudorandom generators exist. Lower bounds give generators, generators give BPP equals P, and strong pseudorandomness blocks the very proofs that might establish the lower bounds. Whether randomness is necessary and whether computation has provable structure are the same question.
If you remember three things#
- The obstacle to derandomization is the number of random bits: bits can be brute-forced, and for MaxCut, conditional expectations and pairwise independence get all the way there.
- A pseudorandom generator with seed length that fools small circuits would prove BPP equals P; the question reduces to whether such generators exist.
- Hardness yields randomness: exponential circuit lower bounds for a function in E imply BPP equals P, and those are the very lower bounds the natural proofs barrier guards.
Discussion
No comments yet. Be the first.