9.8
Grover's search algorithm
Two mirrors squeeze out a rotation: an oracle reflection plus an inversion-about-the-mean turns the state 2θ toward the target each round, hitting it in about (π/4)√N rounds — a quadratic speedup, proven to be the limit.
Recommended first
After this section you should be able to
- Explain the Grover iteration with two-dimensional plane geometry: two reflections compose into one 2θ rotation
- Hand-compute the complete N = 4 example and verify a 100% hit after one iteration
- Derive the optimal iteration count ≈ (π/4)√N and explain why overshooting hurts
- State the BBBV lower bound: √N is the limit of black-box search, not an engineering shortfall
Deutsch–Jozsa won on an artificial problem. This section tackles a problem everyone understands — finding a needle in a haystack — and this time the opponent is a genuine classical lower bound.
The problem at the door: N drawers, one key
drawers, numbered to , exactly one of which (call it ) hides the key. You have a black box : give it a number and it answers if and only if . The only classical strategy is opening drawers: on average, in the worst case, with no shortcut whatsoever — has no structure to exploit (this is not a sorted phone book; it is shuffled).
The quantum oracle copies last section’s phase kickback (the ancilla is now left implicit):
It does exactly one thing: flip the sign of the target branch.
Why one round of interference no longer suffices
Try copying DJ’s three moves: a row of ‘s prepares the uniform superposition , call the oracle once, then interfere. The trouble: the oracle flips the sign of only one of the amplitudes, and that perturbation affects the overall distribution at order — one round of interference cannot wash it out, and a direct measurement still hits with probability about . In DJ’s problem, “all the function values conspiring” produced a stark global signal; the search problem’s signal is thread-thin. The way out: stop hoping for a one-shot kill and let a small advantage snowball. Each round twists the amplitude pointing at the target a little larger; twist for rounds. This “amplitude amplifier” is built from two mirrors.
The geometric picture: two mirrors = one rotation
All the action happens in a two-dimensional plane — the one spanned by the target state and the uniform superposition . Take the in-plane unit vector perpendicular to , (the “uniform superposition of the other drawers”); then
The initial state sits only a small angle above the “ground” . The Grover iteration has two steps:
- The oracle : flips the sign of the component = a reflection about (mirror one);
- The diffusion operator : a reflection about (mirror two).
Two reflections compose into one 2θ rotationbasic~7 min
Step 1: confirm is a reflection. For any in-plane state :
The angle maps : precisely a reflection with as the mirror.
Step 2: confirm is a reflection. satisfies (vectors on the mirror stay put) and negates the component perpendicular to — a reflection with (at angle ) as the mirror: .
Step 3: compose. first, then :
Two reflections = one rotation, by angle , toward . This is an old theorem of plane geometry (mirrors at angle : two reflections make a rotation by ), restaged verbatim in Hilbert space.
Step 4: iterate rounds. Starting angle , adding per round:
We want (dead-on target), so
(The last step uses for large .) queries, each round costing only two rows of ‘s and a little phase work — the quadratic speedup is in hand.
Hand-compute N = 4: one iteration, a perfect hit
(two qubits), target . Here , — not a “small” angle, which lets us hand-compute a whole round.
Step 0: , all four amplitudes .
Step 1 (oracle): the target flips sign:
Step 2 (inversion about the mean): the mean is . Each amplitude :
The state has become exactly . Measure: 100% hit, one query. Classically it takes drawer-openings on average (3 in the worst case) to be sure. Geometric check: , dead-on target, to the degree.
The picture
Overshooting hurts. The rotation has no automatic brake: past it keeps turning and the hit probability turns around and falls. For , a second round gives , — back down to guessing level. Grover’s algorithm must count its laps and stop, the exact opposite of the classical instinct that “more computation can only make you safer”. Fortunately is a known sinusoid: at the failure probability is at most , and a rerun or two makes it negligible.
The mathematics
: .
: , .
With targets, and — the more needles, the faster the fishing.
Quadratic is the limit: the BBBV lower bound
Could a cleverer quantum algorithm manage ? No. The Bennett–Bernstein–Brassard–Vazirani theorem: any quantum algorithm for unstructured search needs at least oracle queries. The idea is worth remembering: each query perturbs the state by at most (it moves the sign of only one branch), while pulling the final states for “the target is ” and “the target is ” apart to a distinguishable distance requires a cumulative perturbation of — divide, and falls out. Grover flies flush against the bound; even the constant is optimal.
Key formulas
Grover iteration
Two mirrors: oracle reflection + mean reflection = rotation by 2θ
Angle parameter
M is the number of targets; each round turns 2θ toward the target
Hit probability
A sinusoidal oscillation — past π/2 it turns back down; count laps and park
Optimal rounds
BBBV lower bound Ω(√N): quadratic speedup is the black-box search limit
Self-check4 questions
- 1.
Geometrically, what are the two steps of a Grover iteration?
- 2.
N = 10⁶ entries, a single target. Roughly how many Grover iterations are optimal? (Integer.)
300% relative tolerance - 3.
N = 4, a single target, and you ran 2 Grover iterations (one too many). What is the hit probability now?
2% relative tolerance - 4.
Which statements about the scope of Grover’s algorithm are correct? (Select all that apply.)
Select all that apply
What comes next
The quadratic speedup already touches the ceiling of black-box search; for exponential speedup we must leave the black box behind and mine the problem’s internal structure. One problem’s structure happens to be exactly what quantum mechanics does best — periodicity: factoring large integers reduces to “finding the period of a function”, and finding periods is interference’s signature trade. Next section: Shor’s algorithm, and the sword it dangles over RSA.
Section 72 of 106 · use ← → to turn the page