15.4.1 Worked calculations for Grover, QFT, and Shor
Let us now work through the four-part calculation covering Grover search at and , the -qubit QFT phase gears at , Shor order finding for , and the finite Poisson cross-check on .
Steps 1 and 4 instantiate Theorem 15.1, Proposition 15.5, and Corollary K.1. Step 2 expands the three-qubit phases in the positive-exponent, big-endian convention with terminal bit reversal of Theorem 15.3. The hand-derived tensor product explains that convention without certifying every tensor identity. The passage from the true-order Good condition to both proper factors in Step 3 follows from Example K.17. Complete Shor order finding and recursive factorization retain the literature and algorithmic boundaries of Remark 15.7.
This example provides a four-part hand-calculated verification:
Step 1: Grover search for (exact 1-step hit) versus (integer-step residual). For () with one marked state , set , , and , so . Here , , , and . After step of , Theorem 15.1 gives
an exact hit in a single step! By contrast, for with one marked state (, ), , so after step the success probability is
and after steps it reaches , illustrating the integer-step residual when .
Step 2: Three-qubit QFT tensor-factor ordering and phase gears at . We adopt the explicit most-significant-bit (MSB) to least-significant-bit (LSB) output tensor order, meaning the circuit includes the final bit-reversal SWAPs. Writing the input as and binary fractions as , the unitary QFT factors as
Notice that the binary fraction grows from the least significant input bit (), while the first output tensor factor corresponds to the most significant output bit (one must never conflate pre-SWAP and post-SWAP bit orders!). At (), the three equatorial phase angles are:
- First factor (): ;
- Second factor (): ;
- Third factor (): ;
with overall normalization factor .
Step 3: Order finding for , with . For and , cycles through with period . With register size (an exact example), conditioning on outcome in the second register leaves the first register in . Applying the unitary -point QFT gives amplitude (probability ) on and elsewhere:
- or : or recovers ; then , and , factors ;
- : yields and fails to recover the order;
- : yields with reduced denominator (a proper divisor of ), which must be checked via or repeated.
Step 4: Character-sum and Poisson cross-check on . In , let ; then . By Proposition 15.5, for and for . For the indicator , the unnormalized negative-exponent DFT is , and both sides of Corollary K.1 evaluate to .
Look back at Step 1 of the example: for a single step puts the arrow on the target.
: one step onto the target. With one step turns by and the amber arrow lands exactly on the target axis : the cyan shadow has length , the magenta one vanishes, and bar reaches .
For two steps still fall short, and the success probability stops at .
: two steps still fall short. The success probability is after step and after step : the arrow stops at , just past the vertical axis, with a magenta shadow of left.
In Step 3 the periodic state, after the QFT, leaves peaks only at the four frequencies .
The order is then read off a peak: and give the order directly, gives only its proper divisor , and carries no information.
Reading the order from a peak. The same spectrum: and give and , whose denominator is the order ; the amber-framed only gives , and is a proper divisor of the order that must be checked again; carries nothing.
The chapter cites Lean results for uniform amplitude amplification, Weyl conjugation, character cancellation, and finite Poisson summation, together with the actual QFT circuit action and native event counts (Theorem 15.3, Theorem 15.4), the single-phase circular tail (Theorem K.7), the actual-input marginal and pointwise bounds, rational-list length, and conditional candidate membership. Above, combining the actual mixture, the nearest-grid bound, and candidate recovery gives the single-run list-membership bound when . With an explicit independent-reset premise, a sufficient half-density bound for jointly primitive phase pairs then gives for the all-pairs least-common-multiple list event from exactly two observations. The positive-exponent convention reflects both observed labels; the native positive circuit acting on the same controlled state uses this corrected event as well. Separately, Theorem K.16 counts failures in any nonempty finite cyclic family; Example K.17 transports this through actual-unit CRT to a uniform Good bound and proves both proper gcd factors on the same event. The list-selection rule also returns the true order exactly when the full menu contains it, carrying the two-observation membership bound over to exact-output probability; individual returns still carry no exactness flag. Item 1 and the remaining full algorithmic claims in item 3 below remain literature results, not formalized in this book; item 2 summarizes the cited circuit counts and their cost boundaries.
- Grover’s algorithm and query lower bounds (L. K. Grover, A fast quantum mechanical algorithm for database search, Proc. 28th ACM STOC, 212–219, 1996, 10.1145/237814.237866; G. Brassard, P. Høyer, M. Mosca, and A. Tapp, Quantum amplitude amplification and estimation, Contemp. Math. 305, 53–74, 2002, arXiv:quant-ph/0005055): For unstructured search among candidates with a known number of marked items and the promise , start from the uniform superposition and choose the iteration count using the known initial success probability . Amplitude amplification then raises the success probability to using queries to the marking oracle. Under this sparse-solution promise, any quantum black-box algorithm finding a marked item with bounded error requires queries (by reduction from the single-solution black-box lower bound of Bennett, Bernstein, Brassard, and Vazirani, 1997): the quadratic speedup reaches the quantum geometric limit for this oracle task.
- Ideal native gate count of the same QFT circuit: Theorem 15.4 gives Hadamards, controlled phases, and SWAPs, totaling ideal native occurrences. The usual asymptotic count is therefore for ; Theorem 15.3 gives its exact positive-exponent action on a prepared complex vector. Loading arbitrary input data, full classical Fourier-coefficient readout, synthesis of ideal phase gates over a finite discrete gate set, and hardware performance are outside this count.
- Shor’s factoring algorithm and the full correctness conditions for order finding (P. W. Shor, Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer, SIAM J. Comput. 26, 1484–1509, 1997, 10.1137/S0097539795293172): For a general composite that is neither even nor a prime power, and a random coprime base , the multiplicative order need not divide . The full algorithm chooses and prepares the corresponding joint state using a reversible modular-exponentiation circuit with elementary gates, then samples after the QFT. The single-run candidate event and the all-pairs least-common-multiple event for two independent resets above cover their respective list-membership probabilities in the actual modular-multiplication model. They do not certify a gate implementation of modular exponentiation. The subsequent list-selection application returns the true order whenever the menu contains it and bounds that exact-output event; an arbitrary passing return may still be a larger multiple of the order. The asymptotic estimate remains a literature result. The counting ratio in the mixture cannot be recast as an additional random-phase experiment. The classical part is now covered by Theorem K.16 and Example K.17: for odd , uniform sampling of the full unit group gives Good probability at least , and at least when is not a prime power, since then . On that same event, every natural representative of the base gives both proper factors. All actual prime-power exponents and the sampled identity are retained. This classical probability and the quantum candidate event at a fixed base use different sampling laws; they have not been combined here into an end-to-end probability for one common experiment. Efficient unit sampling, certified exact-order selection from the full candidate least-common-multiple list, guarantees for arbitrary correlated repetitions, the exact Euler product for ideal phase sampling, a complete recursive factoring implementation, and bit and gate complexity remain outside these results. Independence of the two resets is an explicit joint sampling premise; matching marginals do not imply it. (Describing period finding as “canceling an infinite period down to ” is a heuristic metaphor, not a formalized mathematical claim.)
The full lab of phase gears and the period: change the register size , the period and the offset, and click a bar to choose a frequency and watch its phase arrows laid head to tail; when divides and the comb is a complete coset (offset ), the off-resonant chains close to zero (Proposition 15.5). This page’s comb does not wrap: truncating it at the boundary changes peak heights and leaves off-resonant weight. When does not divide , the spectrum is still the finite sum over the comb’s actual cells: in Shor’s setting (offset , the comb running to the end of the register, ) the peaks concentrate near ; this aggregate concentration retains its literature status, and the page’s continued-fraction reading must still be checked. Theorem K.11 guarantees only candidate membership under the actual parameter, resolution, and nearestness hypotheses; a truncated comb can lose that concentration, and a single cell gives a flat spectrum.
Seeing how Grover’s planar rotations and the QFT’s Fourier cancellation operate, two deeper questions arise: can we unify search, phase estimation, Hamiltonian simulation, and matrix inversion under a single Chebyshev polynomial recurrence on two-dimensional blocks (Quantum Singular Value Transformation, QSVT)? And when we compile continuous rotations into finite words over a discrete gate set , how do finite-vertex polytopes approximate the sphere? Let us enter the concluding chapter of Part IV — Chapter 16.