Chapter 08 · Grover's algorithm
Searching with rotations
To find a marked item among with no structure to help, any classical algorithm needs about attempts. Lov Grover found a quantum algorithm that needs only about , by rotating a vector a little at a time in a two-dimensional plane. And it is provably impossible to do better.
In this chapter
Imagine a phone book with entries in random order and a single name you are looking for. With no structure to help, the only classical strategy is to look entry by entry: queries on average, in the worst case. In 1996 Lov Grover, at Bell Labs, showed that a quantum computer can find it with about queries. For a million entries, around 800 instead of half a million.
The problem
We have items and an oracle that recognizes the marked one, : a function if and 0 otherwise. Quantumly, the oracle acts as a phase flip:
The oracle flips the sign of the amplitude of the marked item but, on its own, does not change any probability. Something has to turn that sign into probability. That is the job of interference.
The algorithm
Start from the uniform superposition and repeat times the Grover iteration:
The operator , called diffusion, is an inversion about the mean: it sends each amplitude to , where is the average. After the oracle, the marked amplitude is negative and far below the mean; when inverted, it rises well above it. Each iteration pumps a little more amplitude into .
The geometry: two reflections make a rotation
The whole algorithm happens in a two-dimensional plane. Let be the marked state and the uniform superposition of the unmarked ones. The initial state lies in their span:
On the plane spanned by and , the oracle is the reflection across and is the reflection across . Their product is a rotation by towards . After iterations,
and the probability of measuring is .
Proof
fixes and flips , so it is the reflection across the line of . fixes and flips every vector orthogonal to it, the reflection across the line of . The composition of two reflections across lines that form an angle is a rotation by (a classical result of plane geometry). The initial state is at angle from ; after rotations it is at angle .
To reach we want , that is,
since for large . With marked items, and about iterations are needed. The quadratic speedup comes from the fact that the probability is the square of the amplitude: the amplitude grows linearly with , so it only has to reach starting from .
It cannot be done better
Before Grover's algorithm was even known, Bennett, Bernstein, Brassard and Vazirani had proved that it was optimal.
Any quantum algorithm that finds the marked item among with probability at least , consulting the oracle as a black box, must make queries.
Idea of the proof (hybrid argument)
Run the algorithm with an oracle that marks nothing. After queries, the total “query weight” it has placed on all items is , so some item has received weight at most . Changing the oracle to mark perturbs each step by an amount proportional to the square root of that weight, and the perturbations add up to at most in norm. To tell the two situations apart, the final states must differ by a constant, so .
Christof Zalka (1999) showed that Grover's algorithm is optimal even in the constant. The consequence is important: for problems with no structure, quantum computers offer a quadratic speedup, not an exponential one. In particular, they are not expected to solve NP-complete problems in polynomial time simply by “trying all the answers at once”.
Amplitude amplification
Brassard, Høyer, Mosca and Tapp (2002) generalized the idea. If a quantum algorithm succeeds with probability , it can be turned into one that succeeds with high probability using only repetitions of and , against the that classical repetition needs. It is a quadratic accelerator for almost any quantum subroutine.
References
- L. K. Grover (1996). “A fast quantum mechanical algorithm for database search”. STOC.
- C. H. Bennett, E. Bernstein, G. Brassard and U. Vazirani (1997). “Strengths and Weaknesses of Quantum Computing”. SIAM J. Computing, 26(5).
- M. Boyer, G. Brassard, P. Høyer and A. Tapp (1998). “Tight bounds on quantum searching”. Fortschritte der Physik, 46.
- C. Zalka (1999). “Grover's quantum searching algorithm is optimal”. Physical Review A, 60(4).
- G. Brassard, P. Høyer, M. Mosca and A. Tapp (2002). “Quantum amplitude amplification and estimation”. Contemporary Mathematics, 305.