Quantum Computing

Grover's
Algorithm

A quantum search algorithm achieving quadratic speedup — searching N items in O(√N) steps instead of classical O(N). Visualize amplitude amplification in real time.

16 Database Size
3 Quantum Steps
8 Classical Avg Steps

Three Core Steps

01
🌀

Superposition

Apply Hadamard gates to all qubits, creating an equal superposition of all N database states. Each state gets amplitude 1/√N.

H⊗ⁿ|0⟩ = 1/√N Σ|x⟩
02
🔮

Oracle (Phase Flip)

The oracle marks the target state by flipping its amplitude from positive to negative — a phase kickback that encodes the solution.

O|x⟩ = (-1)^f(x)|x⟩
03
📡

Diffusion (Amplification)

The Grover diffusion operator reflects amplitudes about the mean, amplifying the target and suppressing others. Repeat √N times.

D = 2|ψ⟩⟨ψ| - I

Quantum Simulator

3
N = 2ⁿ = 8 states
|5⟩
The item we're searching for
Phase Ready
Iteration 0 / 2
Target Probability 12.5%
Success?

Probability Amplitudes

Target State Other States

Iteration Timeline

Quantum Circuit

Simplified quantum circuit for 3-qubit Grover's algorithm. H = Hadamard gate, O = Oracle, D = Grover Diffusion operator.

Classical vs Quantum

💻

Classical Search

O(N)

Linear scan checks each item one by one. On average, finds the target in N/2 checks. Worst case: N checks.

VS
Speedup
√N ×
Quadratic advantage

Grover's Algorithm

O(√N)

Amplitude amplification concentrates probability into the target state after just O(√N) oracle calls.

Steps Required by Database Size

N (Database Size) Qubits (n) Classical (avg N/2) Quantum (≈ π/4 · √N) Speedup

Mathematical Foundation

Geometric Interpretation

Grover's iteration is a rotation of angle 2θ in a 2D subspace spanned by |target⟩ and |uniform⟩. After k = π/(4θ) iterations, we reach near-certainty.

Amplitude Evolution

The target amplitude grows sinusoidally. The optimal iteration count is ⌊π√N / 4⌋ which maximises the probability of measuring the target state.

Optimality

🏆
Proven Optimal

Lower-bound proofs confirm no quantum algorithm can solve unstructured search in fewer than O(√N) oracle queries.

📦
Multiple Solutions

With k solutions, optimal iterations drop to ≈ π√(N/k)/4, offering even greater speedup.

🔗
Applications

Powers attacks on symmetric crypto, SAT solving, constraint satisfaction, and database search.

📅
Discovered 1996

Lov Grover published the algorithm at Bell Labs in 1996 — a landmark in quantum computation.