Skip to main content
KetQat

Appearance

Algorithm · introductory

Grover search

Finds one of M marked items among N = 2^n with about (pi/4) sqrt(N/M) queries to a phase oracle, by alternating the oracle with a reflection about the uniform superposition; a special case of amplitude amplification.

Established resultMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

Input. The phase oracle OfO_f on nn qubits; the number MM of solutions.

Procedure. Let θ∈(0,π/2)\theta \in (0, \pi/2) satisfy sin⁡2θ=M/N\sin^2\theta = M/N and k=⌊π/(4θ)⌋k = \lfloor \pi/(4\theta) \rfloor.

  1. Prepare ∣s⟩=H⊗n∣0n⟩=N−1/2∑x∣x⟩\ket{s} = H^{\otimes n}\ket{0^n} = N^{-1/2}\sum_x \ket{x}.
  2. Repeat kk times: apply OfO_f, then the diffusion operator D=2∣s⟩⟨s∣−I=H⊗n(2∣0n⟩⟨0n∣−I)H⊗nD = 2\ketbra{s}{s} - I = H^{\otimes n}(2\ketbra{0^n}{0^n} - I)H^{\otimes n}.
  3. Measure in the computational basis and output the result xx (optionally check f(x)=1f(x) = 1 with one more query).

Guarantee. With A=H⊗nA = H^{\otimes n} and Π\Pi the projector onto marked strings, Of=I−2Π=SΠO_f = I - 2\Pi = S_\Pi and DOf=QD O_f = Q is the operator of amplitude amplification (the sign convention Q=−AS0A†SΠQ = -A S_0 A\dagg S_\Pi gives exactly DOfD O_f). Hence after jj iterations the probability of measuring a marked string is sin⁡2((2j+1)θ)\sin^2((2j+1)\theta), and for the chosen kk it is at least 1−M/N1 - M/N. The number of oracle queries is k≤π/(4θ)≤(π/4)N/Mk \le \pi/(4\theta) \le (\pi/4)\sqrt{N/M}.

Cost. kk oracle calls plus kk diffusion steps; each diffusion is two layers of Hadamards and a reflection about ∣0n⟩\ket{0^n}, which is an nn-controlled ZZ conjugated by XX gates: O(n)O(n) elementary gates with ancillas. Total O(N/M)O(\sqrt{N/M}) queries and O(nN/M)O(n\sqrt{N/M}) further gates.

Remarks. If MM is unknown, running with a random number of iterations drawn from a range that grows geometrically finds a solution in expected O(N/M)O(\sqrt{N/M}) queries (Boyer, Brassard, Høyer and Tapp). Iterating past kk is harmful: the probability oscillates with period about π/(2θ)\pi/(2\theta) iterations.

The algorithm is due to Grover; the exact analysis with sin⁡2((2j+1)θ)\sin^2((2j+1)\theta) is from Boyer, Brassard, Høyer and Tapp, and section 6.1 of Nielsen and Chuang gives a textbook account.

Holds when

  • Access to f:{0,1}n→{0,1}f:\{0,1\}^n \to \{0,1\} through the phase oracle Of∣x⟩=(−1)f(x)∣x⟩O_f\ket{x} = (-1)^{f(x)}\ket{x} (obtainable from the bit oracle with one ancilla in ∣−⟩\ket{-}).
  • The number M=∣f−1(1)∣M = \lvert f^{-1}(1)\rvert of marked items satisfies 1≤M<N=2n1 \le M < N = 2^n and is known; for unknown MM see the remarks.

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. Lov K. Grover (1996). A fast quantum mechanical algorithm for database search. Proceedings of the 28th Annual ACM Symposium on Theory of Computing (STOC '96), 212-219. doi:10.1145/237814.237866arXiv:quant-ph/9605043
  2. Michel Boyer, Gilles Brassard, Peter Høyer, Alain Tapp (1998). Tight bounds on quantum searching. Fortschritte der Physik 46, 493-505. arXiv:quant-ph/9605034
  3. Gilles Brassard, Peter Høyer, Michele Mosca, Alain Tapp (2002). Quantum amplitude amplification and estimation. Quantum Computation and Quantum Information, AMS Contemporary Mathematics 305, 53-74. doi:10.1090/conm/305/05215arXiv:quant-ph/0005055
  4. Michael A. Nielsen, Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press. doi:10.1017/CBO9780511976667

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Identification D O_f = -A S0 A^dag S_Pi with A = H^n re-derived; success probability sin^2((2j+1) theta), the bound 1 - M/N at k = floor(pi/(4 theta)) and the query count k <= (pi/4) sqrt(N/M) checked by state-vector simulation for n = 2..8 and several M. Compared with Boyer-Brassard-Hoyer-Tapp, arXiv:quant-ph/9605034 (exact sin^2 analysis, m = floor(pi/(4 theta)), unknown-M algorithm with expected O(sqrt(N/t)) time) and Brassard-Hoyer-Mosca-Tapp, arXiv:quant-ph/0005055, Section 2; Nielsen-Chuang Section 6.1 via the publisher's table of contents.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e
  2. 2026-11-30KetQat Commons: free learning paths, knowledge records, research problems, literature intake (#14)571c9b10

Current revision 6b88da32d9858d4f. Source file knowledge/records/algorithm/grover-search.md in the content repository (readable there once it is public).