Grover's search is a special case of a much more general technique: amplitude amplification. Any quantum subroutine A that succeeds with some probability p=sin2θ can be repeatedly amplified until p approaches 1, using roughly ⌊π/(4θ)⌋ iterations — a quadratic speedup over classical repetition.
The Setup
Let A be a quantum circuit on n qubits that transforms ∣0⟩⊗n into a state
∣ψ⟩=A∣0⟩=sinθ∣good⟩+cosθ∣bad⟩,
where ∣good⟩ is the subspace of "successful" computational outcomes and ∣bad⟩ is its orthogonal complement. The success probability after a single run of A is
p=sin2θ.
Amplitude amplification replaces repeated classical sampling with a unitary iteration that rotates the state inside the two-dimensional plane spanned by ∣good⟩ and ∣bad⟩.
One Amplification Iteration
A single iteration consists of two reflections:
OracleO: reflect about ∣bad⟩ — phase-flip every "good" basis state by −1.
O=I−2Πgood,
where Πgood projects onto the good subspace.
Diffuser (reflection about ∣ψ⟩):
D=A(2∣0⟩⟨0∣−I)A†.
The composition DO is a rotation by 2θ in the good/bad plane. Starting at angle θ from ∣bad⟩, after k iterations the state is at angle (2k+1)θ, giving success probability sin2((2k+1)θ).
A Concrete Example
Consider the 2-qubit subroutine
A=Ry(π/3)⊗I,
which acts only on qubit 0 and leaves qubit 1 in ∣0⟩:
A∣00⟩=cos6π∣00⟩+sin6π∣10⟩=23∣00⟩+21∣10⟩.
Here sinθ=21, so θ=π/6 and the initial success probability on ∣10⟩ is 41.
The oracle phase-flips ∣10⟩. Because ∣10⟩ has qubit 0 equal to 1 and qubit 1 equal to 0, we build it as: flip qubit 1 (X), apply CZ, flip qubit 1 back (X):
O=(I⊗X)CZ(I⊗X).
The diffuser rebuilds A∣00⟩ from the zero state:
D:A†,2∣00⟩⟨00∣−I,A.
The phase-flip of ∣00⟩ is: X on both qubits, then CZ, then X on both qubits.
After one full iteration the state becomes −∣10⟩, putting all probability on the good state ∣10⟩.
Try it
The starter code applies the subroutine A. Add the oracle that phase-flips the good state ∣10⟩, then add the diffuser that reflects about A∣00⟩. The grader checks the output distribution — it should put all probability on ∣10⟩.
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.