Skip to content
Current section
The Quantum Computing Enthusiast’s Hub
Saved
All sections

All sections

Saved
Skip Learn navigation
Encyclopedia
Topic

Continued fractions in quantum order finding

A classical postprocessing method that recovers candidate rational phases from finite-precision quantum measurements.

Edition released Coverage: Overview · Technical
On this page

Definition and significance

Order finding produces a finite-precision approximation to a rational s/r. Continued fractions identify good rational approximants and supply candidate denominators. This classical stage is essential, but its output still requires verification against the modular arithmetic problem.

Mechanism and mathematical treatment

A standard sufficient approximation condition is |x-s/r|<1/(2r^2) for coprime s and r; then s/r appears among the convergents of x. If s and r share a factor, the recovered denominator can be a proper divisor of the true order. Candidate denominators must be tested and combined or retried as appropriate.

Fully worked reference example

For x=3/8, the continued fraction is [0;2,1,2], with convergents 0,1/2,1/3,3/8. The final denominator is 8. But if an order-r=8 experiment samples s=2, the fraction 2/8 reduces to 1/4; its denominator 4 does not alone reveal the full order. Checking a^4 mod N distinguishes a valid order from an insufficient candidate.

Limitations and common misconceptions

Insufficient phase precision can produce unrelated convergents. A successful small example does not remove the need for probability analysis and retries. The method estimates a rational structure promised by the quantum problem, not arbitrary real-number information.

Scientific relationships

Classical rational recovery proposes candidate orders from measured phases.

Recovering a nontrivial rational from a finite register

For base two modulo twenty-one, the true multiplicative order is six. Consider a phase sample near 5/6 obtained with a register of size 1024. The measured value 853 corresponds to x=853/1024. Its difference from 5/6 is exactly 1/3072, approximately 0.000325521. This is smaller than 1/(2 times 6 squared)=1/72, satisfying the standard sufficient continued-fraction recovery condition for the reduced fraction 5/6.

The Euclidean divisions are 1024=1 times 853+171; 853=4 times 171+169; 171=1 times 169+2; 169=84 times 2+1; and 2=2 times 1. They give the continued fraction [0;1,4,1,84,2]. The successive convergents are 0/1, 1/1, 4/5, 5/6, 424/509, and 853/1024. The desired denominator appears before the exact fraction with the register's full denominator, illustrating why simply returning the denominator of the measured rational is wrong.

The order must be below twenty-one for this valid instance. Testing the relevant small candidate denominators gives 2 to the first power equal to two, 2 to the fifth congruent to eleven, and 2 to the sixth congruent to one modulo twenty-one. Six passes the defining congruence. The fractions with denominators 509 and 1024 lie outside the stated order range and need not be pursued as order candidates.

Combining reduced denominators

A different eigenphase numerator can hide factors of the order. A sample near 2/6=1/3, such as 341/1024, leads to denominator three. Yet 2 cubed is eight modulo twenty-one, so three is not a valid order. A sample at 3/6=1/2 leads exactly to denominator two, which also fails because 2 squared is four. Taking the least common multiple of the correct reduced denominators three and two gives six, and modular verification then succeeds.

This combination is justified when those denominators are established as plausible reduced divisors, not merely because they occurred in a list of convergents. A noisy or poorly resolved phase can produce an unrelated fraction whose denominator introduces spurious factors. The combined candidate remains a hypothesis until checked. The zero phase numerator gives the reduced fraction zero and carries no useful denominator information about the nonzero order.

Passing the congruence does not by itself prove minimality. Twelve also satisfies 2 to the twelfth congruent to one. However, using twelve directly in the factoring step gives 2 to the sixth congruent to one, so the two gcd calculations yield the trivial outcomes twenty-one and one. Reducing the passing candidate by testing its factors recovers the order six. Then 2 cubed is eight, and gcd(8-1,21)=7 while gcd(8+1,21)=3, yielding the nontrivial factors.

Precision and probability are separate requirements

The rational-recovery theorem concerns the actual distance between a measured fraction and a reduced rational. The quantum phase-estimation distribution supplies the probability of obtaining such a fraction. A register dimension larger than the square of an order bound makes a nearest-grid sample sufficiently precise, but the nearest-grid sample does not occur with certainty. Additional precision or repeated trials can improve an overall procedure's success guarantee, with the accompanying controlled-evolution cost.

For this example, 1024 exceeds 21 squared. A nearest-grid estimate of any fraction with denominator below twenty-one has error at most 1/2048, smaller than 1/(2r squared) for those denominators. That establishes a conditional reconstruction statement. It does not mean every possible measurement result has that error, or that every sampled numerator is coprime to the true order.

The continued-fraction computation uses integer arithmetic on the register output. Euclidean division decreases the operands, producing only logarithmically many division steps in their magnitude, while the bit cost of each division must still be accounted for. Candidate verification uses modular exponentiation through repeated squaring, and gcd calculations complete the classical recovery. These operations are efficient in the input bit length and are essential parts of the algorithm rather than incidental postprocessing.

Original reconstruction table

Provide a table with each Euclidean quotient, remainder, convergent, denominator-bound decision, and modular verification result. Show the separate 1/3 and 1/2 samples joining to denominator six, followed by the successful gcd calculations. Include the passing but nonminimal candidate twelve as a boundary case. Every value should be labeled as exact arithmetic for the chosen instance, with no claim that the sample 853 was produced on hardware.

Sources