10 min read
Amplitude Amplification
The geometric picture behind Grover's algorithm, two reflections make a rotation, and why unstructured search takes only O(√N) queries instead of O(N).
Suggested before this lesson
Deutsch-Jozsa and Bernstein-Vazirani both answer a yes/no or read-out-a-string question in one query. This lesson starts a different kind of problem, unstructured search, where one query can't possibly be enough, but a clever sequence of them still beats any classical approach by a quadratic factor. The technique is amplitude amplification, and Grover's algorithm (next lesson) is what you get from applying it.
You're given an oracle for again, but this time the promise is different: exactly one input (out of total) has ; every other input has . Find . Classically, with no structure to exploit, you have to check inputs one at a time; the expected number of queries before finding is .
Write for the marked basis state you're looking for, and for the uniform superposition over every other basis state (all unmarked ones, equally weighted, normalized). These two are orthogonal, , and together they span a 2D plane inside the full -dimensional space, the only plane this entire algorithm ever needs.
The starting state, uniform superposition over everything (, from Superposition and Interference at Scale), decomposes inside that plane as
Every basis state has equal amplitude to start, so 's own slice of that is exactly , small for large : this is the whole problem in one picture. Measuring right now succeeds with probability , exactly as bad as guessing randomly. The algorithm's job is to rotate toward before measuring.
The oracle flips the sign of 's amplitude and leaves everything orthogonal to it alone: a reflection about (the axis it doesn't touch).
The diffusion operator is a reflection about itself, the original uniform superposition axis, regardless of what the oracle just did to the state.
A basic fact from plane geometry: reflecting about one line, then reflecting about a second line at angle to the first, is the same as a single rotation by . That's exactly : reflect about , then about (which sits at angle from ), composes into a rotation by , rotating the state vector toward . One application of is called one Grover iteration.
After Grover iterations, the state sits at angle from the axis (the original , plus rotations of each), so the probability of measuring is
This grows with up to a peak near , then decreases again if you keep iterating past it, overshooting is real, unlike classical search where more checking can never hurt. Solving for the peak gives the optimal iteration count:
iterations, each one query to the oracle, versus classically: a quadratic speedup. It's smaller than Deutsch-Jozsa's exponential gap, but it applies to a much more general problem: searching anything representable as "find the input a black-box function accepts," with no structure to exploit at all.
Slide to add Grover iterations and see the state vector rotate by each time, with the success probability tracking below.
N =
State in the (|s'⟩, |ω⟩) plane
1
47.3%
Each iteration rotates the state by toward . Slide up past and watch the success probability peak, then fall again, overshoot is real in Grover's algorithm, unlike classical search. Try a bigger : the starting angle shrinks, so more iterations are needed, but the achievable peak probability stays close to 1.