Skip to main content
KetQat

Appearance

Theorem · intermediate

Good rational approximations are continued-fraction convergents

If a fraction s/r approximates a real number x with error less than 1/(2 r^2), then s/r (in lowest terms) is one of the convergents of the continued fraction of x, so it can be found in polynomial time from x.

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.

Write x=[c0;c1,c2,… ]x = [c_0; c_1, c_2, \dots] for its continued fraction, c0=⌊x⌋c_0 = \lfloor x \rfloor, and pk/qk=[c0;c1,…,ck]p_k/q_k = [c_0; c_1, \dots, c_k] for its convergents. If

∣sr−x∣  <  12r2,\Big\lvert \frac{s}{r} - x \Big\rvert \;<\; \frac{1}{2r^{2}},

then s/rs/r, written in lowest terms, equals pk/qkp_k/q_k for some kk. (With ≤\le in place of << the statement can fail in the trivial case r=1r = 1, x=c+12x = c + \tfrac12: then (c+1)/1(c+1)/1 is a convergent only of the expansion [c;1,1][c; 1, 1], not of [c;2][c; 2]. In order finding the inequality is strict.)

For a rational x=u/vx = u/v with 0≤u<v≤2L′0 \le u < v \le 2^{L'} the expansion has O(L′)O(L') terms and all convergents can be computed with O(L′3)O(L'^{3}) bit operations (Euclid's algorithm). In order finding, xx is the phase-estimation output with L′=O(log⁡N)L' = O(\log N) bits, and the theorem recovers s/rs/r from it. It is used in Section 5.3.1 of Nielsen and Chuang (continued fractions are treated in their Appendix 4.4); it is a classical result of number theory used for this purpose by Shor.

Holds when

  • xx is a real number, ss and r≥1r \ge 1 are integers.
Part of
Used by
Stated in

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. Michael A. Nielsen, Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press. doi:10.1017/CBO9780511976667
  2. Peter W. Shor (1997). Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM Journal on Computing 26(5), 1484-1509. doi:10.1137/S0097539795293172arXiv:quant-ph/9508027

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass with notes · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Statement checked by exhaustive enumeration: 20,000 random rationals x = u/v (v <= 2^16) against every s/r with r < 40, comparing with the canonical-expansion convergents (no failure under strict inequality; 819 failures with non-strict inequality, all at equality with r = 1); term count O(L') checked in the same run. Strict form agrees with Hardy-Wright's Theorem 184 as quoted in a web-search summary of order-finding literature; Shor's use of continued fractions compared with Shor arXiv:quant-ph/9508027 Section 5; Nielsen-Chuang sections 5.3.1 and A4.4 confirmed in the publisher's table of contents.

    The record stated the theorem with a non-strict inequality, which fails for the canonical expansion when r = 1 and x = c + 1/2 (found numerically). Changed to the strict inequality (the classical form), added a one-sentence note on the boundary case, and adjusted the summary. The pointer 'Theorem 5.1 of Nielsen and Chuang' could not be checked against the book and was replaced by the section pointers confirmed from the table of contents.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e
  2. 2026-11-30KetQat Commons: free learning paths, knowledge records, research problems, literature intake (#14)571c9b10

Current revision 42829b1e46d8b3c4. Source file knowledge/records/theorem/continued-fraction-convergents.md in the content repository (readable there once it is public).