For an unknown nonzero period, a collision reveals the period . Birthday problem sampling finds one using queries with bounded error. A matching lower bound follows by choosing the period and output labels randomly: without a collision, queries rule out at most candidate periods. For , almost all periods remain consistent with the transcript. The exponential separation is in query complexity, compared with Simon's algorithm's linear quantum query count.
With a nonzero hidden period, Simon's algorithm samples uniformly from its -dimensional orthogonal complement over the binary field. At rank , a new sample raises the rank with probability . Summing the geometric waiting times gives an expected queries. After samples, the probability of insufficient rank is less than , by a union bound over the nonzero linear functionals that could annihilate all samples.
Now let and choose one representative from each pair . Since and
the unnormalized second-register amplitude for outcome is
If , every paired contribution cancels, so the probability is zero. If , every coefficient has magnitude two. The distinct pair values give orthogonal states, so the squared norm before the overall factor is . The probability is therefore
Thus one run samples uniformly from the strings in the orthogonal complement over the binary field , which is the sampling step in Simon's algorithm.
Prepare , query the oracle, and measure or discard the output register. For , the input register becomes the coset state
Apply , the quantum Fourier transform over . The two amplitudes interfere destructively unless the binary inner product satisfies
and every vector in this orthogonal subspace is sampled uniformly. Repeat until independent equations have been collected, then use Gaussian elimination over to find their one-dimensional null space; its nonzero vector is . This is Simon's algorithm. It uses oracle queries with high probability and polynomial classical work. When , the function is injective and the samples eventually span all of , which distinguishes that case with arbitrarily high probability.