Two-Qubit Grover
Grover's algorithm searches an unstructured space of items in steps. For (two qubits) a single iteration finds the marked item with certainty. Each iteration has two parts:
- Oracle — flip the sign (phase) of the marked basis state. To mark we use a controlled-, since multiplies exactly by .
- Diffuser — reflect every amplitude about their mean ("inversion about the average"), amplifying the marked amplitude. The standard circuit is .
Geometrically the two reflections rotate the state toward the marked item; for that single rotation lands exactly on .
Try it
The starter code has the superposition and the diffuser — add the oracle that marks . The grader checks the output distribution, which should put all probability on .
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.