Grover Search
Grover search makes a marked input likely to appear when we measure a quantum register. Its mechanism is geometric: one reflection changes the signs of marked amplitudes, and a second reflection converts that phase difference into increased marked probability. Repeating the pair rotates the state toward the marked subspace.
For an unstructured predicate with marked inputs among , the quantum query complexity for success probability at least is when , compared with classically. These bounds assume the same Boolean oracle problem. They count calls to a supplied coherent oracle, not the gates or memory needed to implement it.
Helpful background. Phase kickback explains how a Boolean answer becomes a phase. Projectors supplies the geometry of the two reflections. Query complexity explains bounded-error oracle comparisons.
Marked inputs and Boolean oracle access
Section titled “Marked inputs and Boolean oracle access”Let , with exactly inputs satisfying . The task is to output any such input. If , no valid output exists; if , every label works. Apart from querying , assume the labels reveal no exploitable structure about which inputs are marked.
The supplied bit oracle acts on an address and a target qubit:
With the target in , one call applies the search-register phase oracle and returns the target unchanged:
where projects onto marked basis states. With a target in , a bit-oracle call instead checks a measured candidate.
These two uses explain why the access assumption matters. A supplied uncontrolled phase oracle alone cannot distinguish from : their operators differ only by a global minus sign. In particular, for a half-marked set and its complement, no common output distribution can succeed above one half on both. The full bit oracle removes this ambiguity and supports verification. See quantum oracles for the distinction between access types.
Classically, independent uniform trials fail with probability . Avoiding repeated addresses improves constants but leaves the scale for the stated success target. Grover search improves this scale quadratically. It does not replace binary search on a sorted list, which uses additional structure.
The marked–unmarked plane
Section titled “The marked–unmarked plane”Start in the uniform superposition
For , define normalized states in the marked and unmarked subspaces:
They are orthonormal. Introduce an angle by
The initial state becomes
Both the phase oracle and the diffusion operation preserve the plane spanned by and . The full -dimensional calculation therefore collapses to a planar rotation. Equal amplitudes within each class remain equal throughout the ideal algorithm.
The oracle reflects across the unmarked axis. Reflection about then produces , advancing the state toward by .
For , Hadamards prepare from . For other , the derivation assumes preparation of the uniform state on exactly the valid labels and a reflection about it. Padding to a larger power of two is also possible, but then the initial marked fraction and iteration count must use the padded size.
Two reflections and their rotation
Section titled “Two reflections and their rotation”The diffusion operator is
It fixes and reverses every vector orthogonal to , so it is reflection about the initial-state axis. One Grover iterate is
In the ordered basis ,
Although the last matrix depends on the chosen coordinate ordering, its action is unambiguous. Write
Each iterate advances the state-angle parameter by toward the marked axis.
Inversion about the mean
Section titled “Inversion about the mean”For , the diffusion operator can be written
If a state has computational-basis amplitudes and mean amplitude
then maps
This explains the traditional name inversion about the mean. It is the same reflection as , expressed component by component. Multiplying a reflection by an overall phase leaves this uncontrolled search experiment unchanged. In a controlled Grover operation, however, that phase becomes relative to the inactive control branch and must be tracked; this matters for amplitude estimation.
Success probability and when to stop
Section titled “Success probability and when to stop”The initial state has angle in the good–bad plane. After Grover iterations,
Measuring in the computational basis therefore returns a marked input with probability
Conditioned on success, each of the marked labels is equally likely in the symmetric version of the algorithm.
Choosing the stopping time
Section titled “Choosing the stopping time”The first probability maximum occurs when
Choose the nonnegative integer nearest to
Rounding changes the final angle by at most , giving
for . In particular, for the success probability is at least one half. Two independent runs, each followed by a bit-oracle check of the measured candidate, succeed with probability at least . Thus the stated target requires only a constant number of runs. Each verification costs one additional query; an exactly successful promised instance needs no verification. For a sparse marked set,
so
The probability is oscillatory. Continuing past the optimum rotates amplitude away from the marked subspace. More iterations are not automatically better.
Four-item and eight-item examples
Section titled “Four-item and eight-item examples”One marked item among four
Section titled “One marked item among four”For and ,
One iteration gives
This is the smallest familiar example in which the standard -phase reflections land exactly on the marked axis.
One marked item among eight
Section titled “One marked item among eight”For and ,
The nearest stopping time is , and
A third iteration would overshoot:
The comparison makes the coherent rotation, and the need to stop deliberately, concrete.
There is also an instructive boundary case: if , then and for every integer . Standard reflections never improve the initial probability. Independent sampling and verification already take only constant expected cost. For , this simple strategy is likewise sufficient.
Searching when the marked fraction is unknown
Section titled “Searching when the marked fraction is unknown”A stopping time chosen for one solution can overshoot when there are several. The randomized method of Boyer, Brassard, Høyer and Tapp avoids needing in advance. One convenient version starts with and repeats:
- Test a uniformly sampled label, stopping if it is marked.
- Choose an integer uniformly from ; prepare a fresh , apply Grover iterations, measure and verify.
- After failure, replace by .
The first test handles dense marked sets cheaply. For , the expected total query cost is , including verification. This is an expected stopping time, not a deterministic cap. If is allowed, impose a finite budget and specify the probability of incorrectly reporting no solution. Repeated failure alone is not a proof of emptiness.
Other useful variants solve different problems:
- Amplitude estimation estimates the marked fraction using the eigenphases of a controlled Grover operation.
- Given a positive lower bound , optimal fixed-point constructions choose phase shifts so that the completed sequence has failure at most , using queries for . This is a uniform guarantee over allowed marked fractions, not a claim that every intermediate step increases success. The response can have small oscillations within its guaranteed error band.
- When is known, suitable phase adjustments can produce exact success. These are modified reflections; their probabilities need not follow the standard above.
Amplitude amplification develops these phase schedules and replaces uniform preparation by an arbitrary reversible state preparation.
Query optimality and implementation cost
Section titled “Query optimality and implementation cost”The hybrid argument of Bennett, Bernstein, Brassard and Vazirani gives an bound for finding a single marked item with bounded error. Boyer and collaborators analyze multiple solutions and unknown ; Zalka establishes the optimal leading behavior for near-certain single-solution search, . More generally, the fixed-error bound is for . It applies to the unstructured oracle problem, not every structured problem that can be encoded as search.
For a single marked item and parallel oracle calls per round, the optimal round count is . Splitting the candidates into groups achieves this scale. Using all calls each round gives total work of order , so reducing depth by parallel hardware does not reduce total queries by the same factor.
A direct circuit implementation has several separate costs:
| Operation | Cost in one run | Physical meaning |
|---|---|---|
| Initial preparation | Make the intended distribution over valid labels. | |
| Phase predicate | Evaluate the predicate reversibly, apply its phase, and restore workspace. | |
| Diffusion reflection | Reflect about the prepared state. | |
| Candidate check | when used | Read whether the measured label is marked. |
Thus this implementation uses roughly gates before repetitions, synthesis and error-correction overhead. This is a circuit estimate, not a universal gate lower bound. Reversible computation explains workspace restoration, and universal gate sets explains decomposing the reflections into available gates.
A classical database does not automatically provide coherent predicate access. Loading arbitrary data, accessing it reversibly and comparing entries may dominate the search. Conversely, a compact arithmetic predicate can often be implemented without loading a list. The physical implementation determines whether a query advantage becomes a runtime advantage.
What applications can and cannot gain
Section titled “What applications can and cannot gain”For binary variables with one satisfying assignment, and the Grover query count is . This is still exponential in . It improves naive exhaustive enumeration, while classical pruning or other quantum algorithms may exploit structure unavailable to the black-box model.
The same qualification applies to key or preimage search: reversible checking gives an ideal square-root query reduction, but the number of targets, oracle gates, depth, parallelism and fault tolerance determine concrete cost. Grover search returns one candidate; it does not reveal all function values or list every solution at once.
The Dürr–Høyer minimum-finding algorithm uses repeated searches below a changing threshold to find an unstructured list minimum in value queries with bounded error. Its threshold updates are essential additional steps. Quantum algorithms for optimization compares this approach with methods that exploit more structure.
Exercises
Section titled “Exercises”1. Invariant two-dimensional subspace
Section titled “1. Invariant two-dimensional subspace”Show that and map every vector in
back into the same span. Explain why this is sufficient to analyze the uniform-start algorithm in two dimensions.
Solution
The oracle acts as
so it preserves the span. Since lies in the span, for any vector in it,
is also a linear combination of and . The initial state lies in this invariant plane, so every later state does as well.
2. Exact four-item search
Section titled “2. Exact four-item search”For and one marked item, calculate the marked amplitude before and after one Grover iteration.
Solution
Initially,
The marked amplitude in the normalized good direction is . One iterate changes the angle from to , so the marked amplitude becomes
There is only one marked basis state, hence measurement returns it with certainty.
3. Stopping-time guarantee
Section titled “3. Stopping-time guarantee”Let be the integer nearest to . Prove that the final success probability is at least .
Solution
Nearest-integer rounding gives
Multiplying by yields
Write the final angle as , where . Then
Using gives .
4. Several marked inputs
Section titled “4. Several marked inputs”Suppose and . Estimate , the optimal number of standard iterations, and the classical and quantum query scales.
Solution
Here
The real-valued optimum is
so choose . Classical sampling takes order
queries, whereas Grover search takes order
queries, with the leading constant setting the particular stopping time.
5. Over-rotation
Section titled “5. Over-rotation”For and , compare the success probabilities after two and three iterations. Why does this rule out a stopping policy of “continue until success is certain” without knowledge of ?
Solution
With ,
whereas
The unitary evolution rotates rather than relaxes toward the target. It contains no internal signal announcing that the probability has peaked. A stopping rule must use knowledge of , estimation, randomized schedules, or a fixed-point design.
6. Phase oracle and uncomputation
Section titled “6. Phase oracle and uncomputation”Assume the clean phase oracle . Show that . Then consider with one marked input. Suppose a faulty implementation leaves an orthogonal workspace label for each address. What happens if the workspace is discarded before applying ?
Solution
The projector has eigenvalue on marked basis states and on unmarked basis states. Therefore has eigenvalue when and when , exactly matching .
If evaluating the predicate instead produces
then different values remain correlated with different workspace states. The input register no longer undergoes the intended clean reflection . In the stated four-item example, tracing out the orthogonal workspace gives . Since , the marked probability stays , instead of becoming one. To implement the clean phase oracle on the search register, the workspace must finish in a common state independent of . Compute–phase–uncompute is the usual way to achieve this; merely discarding correlated workspace is not.
7. Quadratic is still exponential
Section titled “7. Quadratic is still exponential”An unstructured constraint problem has binary variables and one satisfying assignment. Express the classical and Grover query counts in terms of . What claim is justified?
Solution
There are assignments. Exhaustive classical search requires
predicate queries, while Grover search requires
The justified claim is a quadratic improvement in , or a halving of the exponent in this black-box enumeration model. It is not a polynomial-time algorithm in , and it does not establish an efficient algorithm for arbitrary structured instances.
References
Section titled “References”- C. H. Bennett, E. Bernstein, G. Brassard, and U. Vazirani, “Strengths and weaknesses of quantum computing,” SIAM Journal on Computing 26, 1510–1523, 1997, doi:10.1137/S0097539796300933.
- M. Boyer, G. Brassard, P. Høyer, and A. Tapp, “Tight bounds on quantum searching,” Fortschritte der Physik 46, 493–505, 1998, arXiv:quant-ph/9605034.
- G. Brassard, P. Høyer, M. Mosca, and A. Tapp, “Quantum amplitude amplification and estimation,” Contemporary Mathematics 305, 53–74, 2002, arXiv:quant-ph/0005055.
- C. Dürr and P. Høyer, “A quantum algorithm for finding the minimum,” 1996, arXiv:quant-ph/9607014.
- L. K. Grover, “A fast quantum mechanical algorithm for database search,” in Proceedings of the 28th Annual ACM Symposium on Theory of Computing, 212–219, 1996, doi:10.1145/237814.237866.
- M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press, 2010, doi:10.1017/CBO9780511976667.
- T. J. Yoder, G. H. Low, and I. L. Chuang, “Fixed-point quantum search with an optimal number of queries,” Physical Review Letters 113, 210501, 2014, doi:10.1103/PhysRevLett.113.210501.
- C. Zalka, “Grover’s quantum searching algorithm is optimal,” Physical Review A 60, 2746–2751, 1999, doi:10.1103/PhysRevA.60.2746.