Multiple choice
Execute the circuit and measure. How likely is the outcome |10⟩?
const c = circuit(2); // Subroutine A: Ry(pi/3) on qubit 0 c.ry(Math.PI / 3, 0); // Oracle: phase-flip the good state |10> // |10> has qubit 0 = 1 and qubit 1 = 0. // Strategy: X on qubit 1 turns |10> into |11>; CZ phase-flips |11>; X restores. c.x(1); c.cz(0, 1); c.x(1); // Diffuser: reflect about A|00> = Ry(pi/3)|0> x |0> // = A_dag, phase-flip |00>, A c.ry(-Math.PI / 3, 0); // A_dag c.x(0); c.x(1); // map |00> to |11> c.cz(0, 1); // phase-flip |11> (= phase-flip |00> up to global phase) c.x(0); c.x(1); // restore c.ry(Math.PI / 3, 0); // A return c;
Commit your prediction for P(|10⟩) — then run it.