Grover with more than one correct answer
What changes when several items are marked: a bigger starting angle, fewer iterations, and a trap when half the items are correct.
6 min read · reviewed December 2026
More answers mean a bigger angle
With M marked items the starting angle is θ = arcsin(√(M/N)), which is larger than for a single item. A larger angle means each iteration covers more ground, but the quarter turn is the same, so fewer iterations are needed. The optimal count falls from about (π/4)√N to about (π/4)√(N/M).
The measurement returns one of the marked items, and each marked item is equally likely. If you need all of them, you must repeat the run and collect different answers.
Four items, two of them marked
Here θ = 45° (π/4). Zero iterations already give 50 percent, because half the items are correct. One iteration gives 50 percent again. The state rotates by 90 degrees and lands on the mirror image. Grover’s algorithm cannot help when exactly half the items are correct, because the rotation lands the state where it began.
| Iterations k | Chance of a marked result | Note |
|---|---|---|
| 0 | 50.0% | best count |
| 1 | 50.0% | overshoot |
| 2 | 50.0% | overshoot |
| 3 | 50.0% | overshoot |
Eight items, four marked
This is the same trap as above on a larger search space. The lab will tell you when you are in this situation.
| Iterations k | Chance of a marked result | Note |
|---|---|---|
| 0 | 50.0% | best count |
| 1 | 50.0% | overshoot |
| 2 | 50.0% | overshoot |
| 3 | 50.0% | overshoot |
The fix
If M is N/2 or more, a classical guess already succeeds half the time or more, so no quantum help is needed. If you want to use the algorithm anyway, a common trick is to add one extra qubit that doubles the search space while keeping M fixed. The solution fraction becomes M/(2N), the angle is smaller, and the algorithm works normally.
Example: M = N/4
When exactly a quarter of the items are marked, θ = 30° and one iteration gives exactly 100 percent. This is the same arithmetic as the N = 4 case with one answer.
| Iterations k | Chance of a marked result | Note |
|---|---|---|
| 0 | 25.0% | plain guess |
| 1 | 100.0% | best count |
| 2 | 25.0% | overshoot |
| 3 | 25.0% | overshoot |
Try it
Questions
Does the algorithm return all the marked items?
No. Each run returns one marked item, chosen at random. You need several runs to collect several.
What if I mark every item?
The oracle then flips the sign of everything, which is a global phase with no effect. Every measurement result is correct, so no algorithm is needed.
Read next
Sources and further reading
- L. K. Grover, “A fast quantum mechanical algorithm for database search” (1996)
- C. Bennett, E. Bernstein, G. Brassard, U. Vazirani, “Strengths and weaknesses of quantum computing” (1997)
- M. Boyer, G. Brassard, P. Høyer, A. Tapp, “Tight bounds on quantum searching” (1996/1998)
- G. Brassard, P. Høyer, M. Mosca, A. Tapp, “Quantum amplitude amplification and estimation” (2002)
- R. Babbush et al., “Focus beyond quadratic speedups for error-corrected quantum advantage” (2021)
- M. Nielsen and I. Chuang, Quantum Computation and Quantum Information, chapter 6