Finds the multiplicative order r of a modulo N by phase estimation of the modular multiplication unitary on the state |1>, which returns a random multiple s/r of 1/r to 2L+1 bits, followed by the continued-fraction algorithm; O(L^3) gates per run with schoolbook arithmetic.
Established resultMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01
AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.
The unitary. On an L-qubit register let Ua∣y⟩=∣aymodN⟩ for
0≤y<N and Ua∣y⟩=∣y⟩ for N≤y<2L. It permutes basis states
(because a is invertible modulo N), so it is unitary, and Ua2j=Ua2jmodN
costs no more than Ua.
Its eigenvectors. For s=0,…,r−1 let
∣us⟩=r1k=0∑r−1e−2πisk/r∣akmodN⟩.
Since Ua∣ak⟩=∣ak+1⟩ and ar≡1, re-indexing the sum gives
Ua∣us⟩=e2πis/r∣us⟩. Summing over s, the phases cancel except at
k=0: r−1/2∑s=0r−1∣us⟩=∣1⟩. So the easily prepared state
∣1⟩ is a uniform superposition of eigenvectors whose phases are s/r.
Procedure.
Run phase estimation on Ua with target
∣1⟩ and t=2L+1+⌈log2(2+1/(2ε))⌉ control qubits;
read the result as x=m/2t.
Compute the continued-fraction convergents of x; for each denominator q<N in
increasing order, test whether aq≡1(modN), and output the first such q.
Correctness. By the superposition remark in the phase estimation record, step 1
behaves as phase estimation on ∣us⟩ for an s uniform in {0,…,r−1}. By
the accuracy theorem with n=2L+1, with
probability at least 1−ε,
∣x−s/r∣≤2−(2L+1)≤1/(2N2)<1/(2r2), using r<N≤2L (for
s≥1 the distance modulo 1 coincides with the ordinary distance, as s/r is at least
1/r away from 0 and 1; s=0 is a failed run).
The convergent theorem then puts s/r in
lowest terms, s′/r′, among the convergents of x. If gcd(s,r)=1 then r′=r and
step 2 returns r; otherwise r′ is a proper divisor of r and the test
ar′≡1 fails for it. The probability that a uniform s is coprime to r is
φ(r)/r=Ω(1/loglogr), so O(loglogN) repetitions suffice; combining the
denominators of two runs by their least common multiple reduces this to a constant
expected number of runs (section 5.3.1 of Nielsen and Chuang).
Cost. The quantum part is dominated by the t=O(L) controlled modular
multiplications. With schoolbook arithmetic each costs O(L2) gates, giving O(L3)
gates per run; with fast multiplication Shor obtains
O(L2logLloglogL). The inverse QFT on t qubits costs O(L2) gates, or
O(LlogL) approximately. The classical continued-fraction step costs O(L3) bit
operations.
Claude (AI drafting assistant)Writing, original draft (CRediT roles)
Review history
Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)
Eigenvector identities and |1> = r^(-1/2) sum_s |u_s> re-derived; the chain |x - s/r| < 2^-(2L+1) <= 1/(2N^2) < 1/(2r^2) and the modulo-1 remark checked; also checked that no later convergent with denominator below N exists in the good event. Numerical check: for every N in 3..39 and every a coprime to N, the exact outcome distribution with t = 2L+1 was computed and the record's step 2 applied; whenever x was within 2^-(2L+1) of some s/r with s >= 1 the output was r or nothing, and the per-run success probability was at least 0.25. Cost O(l^2 log l log log l) with fast multiplication compared with Shor arXiv:quant-ph/9508027 Section 3; eigenvector formulation with Cleve-Ekert-Macchiavello-Mosca arXiv:quant-ph/9708016 Section 6 and Kitaev's abstract; Nielsen-Chuang Section 5.3.1 via the publisher's table of contents.
Revision history
2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e
2026-11-30KetQat Commons: free learning paths, knowledge records, research problems, literature intake (#14)571c9b10
Current revision 44766eb48e7bf867. Source file knowledge/records/algorithm/order-finding.md in the content repository (readable there once it is public).