A good item must exist, so assume ; if , the requested search is impossible, while makes every output good. Put and . Normalize the good and bad components of the uniform superposition state as
The Boolean phase oracle negates and fixes . The Grover diffusion operator is . Its implementation is independent of : conjugate the reflection about by Hadamard gates. One Grover search algorithm iteration is
Hence, by the Grover rotation angle formula,
Choose the nonnegative integer nearest to . Its final angle differs from by at most , so a computational-basis measurement succeeds with probability at least . The allowed small-density regime includes , giving the requested bound. Each iteration uses one Boolean phase oracle query, and .
For , and one iteration reaches exactly. Thus one query gives a good outcome with certainty:
This is exact Grover search on four entries applied to a marked fraction of one quarter, not only to a four-element register.
Assume first . Define the orthonormal quantum states
and by . The relevant invariant subspace is the two-dimensional span of these quantum states, not the entire Hilbert space. The uniform quantum superposition is .
In the ordered orthonormal basis , the marked-state phase oracle is the reflection operator . Since , conjugation by the Walsh-Hadamard transform gives the Grover diffusion operator
It is the reflection in the line through . The product of these two reflection operators is a rotation matrix by toward the marked quantum state:
Thus the Born rule gives . Choose a nonnegative integer nearest to . Rounding changes the angle from by at most , so
Each Grover search algorithm iteration uses one marked-state phase oracle query; all other gates are known. A final quantum measurement in the computational basis therefore produces a uniformly chosen marked item, conditional on success, with probability better than one half when . This uses the supplied marked count to select the stopping time; an unknown needs an additional search schedule or counting procedure. If , no oracle query is needed; if , no marked item exists, so a successful search is impossible.
Let
where is the Hadamard gate. For a computational-basis string , define the phase reflection
Thus changes the sign of , while changes the sign of the marked state.
Conjugating by reflects in the hyperplane perpendicular to , so
is the Grover diffusion operator, the reflection about . The Grover iteration operator
is the product of two reflections. It acts as a rotation through in the plane spanned by the marked state and the normalized uniform superposition of unmarked states, where
It is the identity up to sign on the orthogonal complement of that plane.
Uniform superposition state Created 2026-10-05 Updated 2026-10-06
In an -dimensional computational basis, the uniform superposition state is
Measurement in that basis gives the uniform distribution on a finite set. For , Hadamard gates prepare it from . Its reflection is a Grover diffusion operator.