Problem solved in full
-
Two iterations to find a marked item among 8 5 steps
Grover's algorithm finds a marked item among 8 in two iterations. Work out where the two comes from — and what happens if you run a third.
-
Before anything runs, the state is a uniform superposition: every item equally likely, so the marked one carries 1/8 of the probability. That is the same as a classical random guess, and the panel prints both to make the point.
-
Each Grover iteration is a rotation by a fixed angle in a two-dimensional plane spanned by the marked state and everything else. The angle comes from the amplitude, and for N = 8 it is about 20.7°.
-
So the probability is not a curve that climbs and levels off — it is a sine squared, and it climbs steeply: 12.5%, then 78.1%, then 94.5%.
-
The optimal stopping point is the rotation that lands nearest 90°, which is π/4 times the square root of N. For eight items that is 2.22, and you cannot do a fractional iteration, so it is 2.
-
Run a third and the rotation overshoots. The probability falls to 33.0% — worse than after one iteration, and heading back toward the starting point.
Answer
The tool prints 12.50% for both the starting superposition and the classical 1-in-N, and stops the automatic run at 2, though the step and skip-to-end controls carry it to 5. More iterations make it worse, because amplitude amplification is a rotation and rotations come back round. That is also why Grover's speed-up is only quadratic and not exponential — you need about √N rotations to reach 90°, so 8 items take 2 and a million take 785. Useful, and nothing like the exponential advantage the phrase 'quantum search' suggests.
-
References (1)
- The algorithm this tool steps through: L. K. Grover, "A fast quantum mechanical algorithm for database search." Proceedings of the 28th Annual ACM Symposium on Theory of Computing, 212–219, 1996.