TOPICS
Search

Grover's Algorithm


Grover's algorithm is a quantum search algorithm that finds a unique marked item among N candidates with bounded error using O(sqrt(N)) queries to an oracle that recognizes the marked item (Grover 1996). A classical unstructured search requires order N queries in the worst case to achieve a fixed success probability bounded away from zero.

Suppose N>=2 and exactly one item is marked. Denote its basis vector by |w> and the normalized sum of the unmarked basis vectors by |u>. The initial quantum state is the uniform superposition |s>=cos(theta)|u>+sin(theta)|w>, where theta=sin^(-1)(1/sqrt(N)). Let P_w and P_s denote the orthogonal projections onto the lines spanned by |w> and |s>, respectively. One iteration applies the phase oracle I-2P_w and then the diffusion operator 2P_s-I, where I is the identity operator. On the real linear span of |u> and |w>, these are reflections across the lines through |u> and |s>, respectively. Their composition is a rotation through 2theta toward |w>. After k iterations the probability of measuring the marked item is sin^2((2k+1)theta) (Boyer et al. 1998, Brown 2020). Choosing k to be a nearest integer to pi/(4theta)-1/2 makes this probability at least 1-1/N. Verifying the measured item with the oracle and repeating a fixed number of times raises the success probability above 2/3 even for N=2. 3Blue1Brown (2025) illustrates the two reflections.

In the equivalent Galperin's billiards model (Brown 2020), the light and heavy masses start with the same velocity toward the wall and have mass ratio M/m=N-1. In coordinates scaled by the square roots of the masses, the velocity components of the heavy and light masses correspond to the components along |u> and |w>, respectively, up to a common normalization and sign convention. The wall collision flips only the light component, and the mutual collision reflects the scaled velocity about the direction of equal physical velocities. These are the phase oracle and diffusion operator, respectively.


See also

Galperin's Billiards, Oracle, Quantum State, Reflection

Explore with Wolfram|Alpha

References

3Blue1Brown. "But What Is Quantum Computing? (Grover's Algorithm)." YouTube. Apr. 30, 2025. https://www.youtube.com/watch?v=RQWpF2Gb-gU.Boyer, M.; Brassard, G.; Høyer, P.; and Tapp, A. "Tight Bounds on Quantum Searching." Fortschr. Phys. 46, 493-505, 1998. https://doi.org/10.1002/(SICI)1521-3978(199806)46:4/5%3C493::AID-PROP493%3E3.0.CO;2-P.Brown, A. R. "Playing Pool with |psi>: From Bouncing Billiards to Quantum Search." Quantum 4, 357, 2020. https://doi.org/10.22331/q-2020-11-02-357.Grover, L. K. "A Fast Quantum Mechanical Algorithm for Database Search." In Proc. 28th Annual ACM Symp. on Theory of Computing. New York, NY: ACM, pp. 212-219, 1996. https://doi.org/10.1145/237814.237866.

Cite this as:

Weisstein, Eric W. "Grover's Algorithm." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/GroversAlgorithm.html

Subject classifications