For a generator of a group of order and , the function hides the subgroup of . Each fiber is an affine coset . Measuring the function register gives its normalized coset state. Applying the positive-exponent quantum Fourier transform to both input registers gives amplitude
The finite geometric series vanishes off and equals on that line. Thus each allowed output pair has probability , independently of the coset offset. If , a modular inverse recovers .
Finite trigonometric sum 2026-10-06
Taking the real and imaginary parts of the finite geometric series yields
These formulas apply when . At multiples of , the sums are directly and . Complex exponentials turn two real trigonometric summations into one finite geometric series.
Cyclic periodicity on implies that the least positive period divides : the shifts preserving the function form a subgroup of the cyclic group. Injectivity within one period says that distinct residue classes modulo have distinct function values. Write .
Prepare the uniform superposition state by applying the quantum Fourier transform to , and evaluate reversibly into a second quantum register. This is efficient because the given classical Boolean circuit can be converted into a reversible circuit, with its workspace cleaned by uncomputation. The resulting quantum state is
Measuring the function quantum register leaves a uniform coset state for some . The amplitude at after a quantum Fourier transform is
The finite geometric series is zero unless is a multiple of , and then equals . Thus a computational-basis measurement produces a uniform Fourier sample
The exact period recovery from a Fourier sample computes
A greatest common divisor is computable in time polynomial in . The candidate is always a divisor of the true period, and equals it precisely when is coprime to .
For the success flag, compute and compare with . If , injectivity within the first period makes these unequal. If , periodicity makes them equal, including . Hence accept and output exactly when this comparison succeeds; otherwise report failure. This is heralded exact quantum period finding when the period divides the register size, with no false acceptance. The case succeeds even on the sample .
The exact success probability is
where is the Euler totient function. For , the prime-product formula gives . A Rosser–Schoenfeld totient bound supplies the needed lower bound for large . Every single attempt, including verification, has the assumed polynomial-in- gate cost. Repeating times gives constant success probability with a certified result whenever one is found.
The printed in the totient hint should be a lower-bound statement, . Literally, is false: at primes , . Likewise the exact single-sample success probability need not be ; for prime period it tends to one. The useful intended guarantee is the displayed inverse-log-log lower bound, not a universal upper bound. If an algorithm satisfying the literal success upper bound is desired, one can additionally accept an otherwise certified run only when independent fair bits are all zero. This retains a detectable failure flag and polynomial runtime, and has success at most , but deliberately weakens the useful guarantee. The standard unsuppressed algorithm above gives the stronger intended performance. Small can be handled directly. Primary evidence for the totient lower bound is Theorem 15, equations (3.41)–(3.42), in denisevellachemla.eu/Rosser-Schoenfeld-1962.pdf .
The Roth theorem on three-term arithmetic progressions says that, for each fixed , a sufficiently long interval cannot have a subset of density of a finite subset at least with no nonconstant three-term arithmetic progression. Equivalently, the maximum size of a three-term-progression-free subset of is . Here is a density increment proof, including its analytic ingredients.
Write and embed into the cyclic group of order . For normalized Fourier analysis on a finite abelian group take . The orthogonality of complex exponentials follows from a finite geometric series: its average is zero for a nonzero frequency and one for frequency zero. Expanding in these linear phases consequently proves both Fourier inversion on a finite group and the Parseval identity on a finite group. In particular,
The second identity follows by summing the frequency expansion over : the two constraints leave precisely the frequencies . Since is odd, multiplication by two permutes the frequencies. Also a congruence with is an equality in the integers, since .
Let have subset density , and suppose it contains no nonconstant three-term arithmetic progression. Its balanced indicator function of a finite subset is , extended by zero outside . Then . Counting endpoints with the same parity gives
If , their difference in absolute value is at least . Telescope the difference of the products into three terms, each containing and two factors chosen from . Put . The Cauchy-Schwarz inequality and the Parseval identity on a finite group bound each term by , since the squared normalized norm of either other factor is at most . Therefore some nonzero frequency satisfies
This is the Fourier detection of a progression-free subset of an interval step; it has just been proved rather than assumed.
We now turn this Fourier coefficient on a finite abelian group into a density increment. Set . Partition the unit interval into equal pieces and place the fractional parts of in them. The pigeonhole principle gives with . This proves the particular Dirichlet approximation theorem needed here. Put and . For sufficiently large depending only on , and . Each residue chain modulo in has at least elements. Split each such chain into arithmetic progressions with between and elements, absorbing its final short remainder into the previous block.
The linear phase changes by at most within any block. Freezing the linear phase at the first element of each block therefore changes the preceding correlation by at most , because . The triangle inequality gives
The block sums of the balanced indicator function of a finite subset add to zero, so their positive total is half their absolute total. Some block consequently satisfies
Here is absolute, and shrinking it absorbs the floors. An affine parametrization of identifies with a subset of and preserves arithmetic progressions.
Repeat this Roth density-increment step. Every step raises the subset density by at least , so fewer than steps are possible. All the lengths satisfy while above a threshold depending only on . Choose the initial so large that this lower recursion stays above that threshold for steps; this is possible by working backwards through finitely many squarings. We would then force a subset density greater than one. Thus every fixed positive density eventually forces a nonconstant three-term arithmetic progression. For an infinite subset of the positive integers with positive upper asymptotic density, apply the finite conclusion along initial intervals whose subset density is bounded away from zero; this gives the usual infinite formulation as well.