12.9 Grover’s search algorithm
Source: Ideas from Computational Physics (Landau, Páez, Bordeianu), §12.9–12.9.1. Original prose — no Qiskit oracle listing dumps. Continues 12.8b. Labs: 12.9b.
Classical lookup of one marked index among unsorted items costs queries in the worst case. Grover’s algorithm finds a marked item with oracle calls on a quantum computer.
Database toy model
Suppose entries — e.g. stores . Searching needs 4 qubits. Goal: amplify the computational-basis state that encodes the desired index.
Uniform start + oracle + diffuser
Initialize , apply for a uniform superposition, then iterate oracle + diffuser. Pick the oracle phase-mark, the diffuser , and the iteration count among lookalikes.
For , a multi-controlled sandwiched by Hadamards on the target line implements the mark. Other indices: wrap selected qubits with so the all- pattern of the CCCZ hits the desired bitstring (e.g. ).
Geometrically the diffuser sends each amplitude to . One Grover operator boosts the marked amplitude before over-rotation.
Lab: wire Grover skeleton
Simulator vs hardware
Ideal simulators show a sharp peak (e.g. for ). Physical backends smear that peak — noise, not a failure of the algorithm’s math.
Exercise idea: mark () and check the measured bitstring decodes to .
Takeaway
| Piece | Role |
|---|---|
| uniform superposition | |
| Oracle | phase-flip $ |
| Diffuser | invert about mean |
| rounds | amplify then measure |
Grover
1 / 3The oracle marks the answer by…
Pick an answer to see if you are right.
Next: 12.9b Grover labs.