This is the module checkpoint. You now know every moving part of amplitude amplification:
the geometric interpretation, the oracle, the diffuser, and how to adapt all three to a
custom subroutine. The challenge is to assemble the complete iteration from scratch on a
concrete example and drive a target amplitude from 41 to ≈1.
Setting up the problem
Consider the two-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⟩.
The target (good) state is ∣10⟩. Its initial probability is
sin2(π/6)=(1/2)2=41, so sinθ=21 and θ=6π.
One amplitude-amplification iteration rotates by 2θ=3π, landing the state at
angle (2⋅1+1)θ=3θ=2π: probability 1 on the good state.
What the iteration looks like
The iteration is the composition of two reflections.
OracleO: phase-flip every state in the good subspace.
O∣10⟩=−∣10⟩,O∣00⟩=∣00⟩.
Because the good state has qubit 0 equal to 1 and qubit 1 equal to 0, you build the oracle by
temporarily flipping qubit 1 with X, applying CZ (which marks ∣11⟩), and undoing
the flip:
O=(I⊗X)CZ(I⊗X).
DiffuserD: reflect about ∣ψ⟩=A∣00⟩.
D=A(2∣00⟩⟨00∣−I)A†.
The inner factor 2∣00⟩⟨00∣−I phase-flips everything except ∣00⟩.
Circuit realization: X⊗2CZX⊗2 (which flips the sign of ∣00⟩
up to global phase), sandwiched between A† and A:
D=Ry(3π)(X⊗X)CZ(X⊗X)Ry(−3π).
Try it
The starter code applies subroutine A. Add the oracle and then the diffuser.
The grader checks the output distribution — after one full iteration the probability on
∣10⟩ should be 1.
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.