Continued fractions and rational approximation
Extract rational convergents from Euclidean divisions and use determinant identities to control their approximation error.
On this page
The question for today
What you’ll understand
- Convert a positive real number into successive integer parts and reciprocals.
- Compute convergents using numerator and denominator recurrences.
- Apply a convergent error bound without claiming it for arbitrary rational numbers.
A decimal expansion measures a number in fixed powers of ten. A continued fraction instead repeatedly asks how much integer part remains and then magnifies the reciprocal of the fractional part. The resulting rational convergents can approximate an irrational number remarkably well for their denominator size. The mechanism is exact algebra, not a numerological pattern. It begins with the same quotient-and-remainder process as Euclid, and its consecutive approximations satisfy a determinant identity that controls both reduction and error.
Reciprocals reveal successive scales
For a positive real α, take its integer part a₀. If the remainder is nonzero, invert that remainder, take its integer part a₁, and continue. Every aₙ after the first is a positive integer. A rational input eventually produces a zero remainder and stops, precisely because Euclidean remainders stop. An irrational input cannot terminate, since a finite expression of integer parts and reciprocals would be rational.
The notation [a₀; a₁, a₂, …] records these operations with nested reciprocals. Terminating expansions have an ambiguity: a final entry greater than one can be replaced by one less followed by a final one. Choosing the last entry greater than one gives a standard convention except for integer inputs. This convention changes notation, not the rational value. For irrational inputs the positive-entry expansion is uniquely determined by the floor-and-reciprocal algorithm.
Convergents have an exact recurrence
Truncate after aₙ to obtain the n-th convergent pₙ/qₙ. Initialize p₋₂ = 0, p₋₁ = 1, q₋₂ = 1, and q₋₁ = 0. Then each new numerator and denominator is the current entry times the preceding value plus the value before that. These initial conditions are part of the recurrence, not optional bookkeeping: they produce p₀/q₀ = a₀ correctly.
Consecutive convergents obey pₙqₙ₋₁ − pₙ₋₁qₙ = (−1) to the power n − 1 for n at least one. It follows that each fraction is reduced, because a common divisor of its numerator and denominator would divide the determinant one. Dividing the determinant by the two denominators gives the exact distance between consecutive convergents. Denominators eventually strictly increase, making their separation shrink.
The omitted tail controls the error
For an irrational α, let αₙ₊₁ be the positive complete tail beginning at aₙ₊₁. Substitution expresses α as (pₙαₙ₊₁ + pₙ₋₁)/(qₙαₙ₊₁ + qₙ₋₁). Subtracting pₙ/qₙ and using the determinant identity gives an error of size one divided by qₙ(qₙαₙ₊₁ + qₙ₋₁). Since the tail exceeds its integer part, this is smaller than 1/(qₙqₙ₊₁).
In particular, for n at least one the error is smaller than 1/qₙ². This is a theorem about convergents of an irrational number, not an error guarantee for an arbitrary fraction with denominator qₙ. A large next entry makes the current convergent especially good by enlarging the omitted tail. More refined best-approximation statements require specifying whether one minimizes absolute error or denominator-weighted error; do not blur those different objectives into a slogan about being the best fraction.
Work it through
Compute convergents to the square root of two
Use √2 = [1; 2, 2, …] to compute the first four convergents and bound the error of 7/5.
Begin with a₀ = 1 and the recurrence initial conditions. The first convergent is 1/1. With a₁ = 2, the next numerator is 2 × 1 + 1 = 3 and denominator 2 × 1 + 0 = 2.
Apply the same update again to obtain 7/5, then 17/12. Check the consecutive determinant 7 × 2 − 3 × 5 = −1, confirming the middle fractions are reduced and correctly ordered in the recurrence.
For the convergent 7/5, the next denominator is 12. The theorem gives |√2 − 7/5| < 1/(5 × 12) = 1/60. Its numerical error is about 0.014214, below approximately 0.016667.
The first four convergents are 1, 3/2, 7/5, and 17/12. The error of 7/5 is strictly smaller than 1/60.
The living notebook
Explore the model
Interactive lab · function
Rational inputs and exact square heights
Set coefficient a to one and position x to 1.40, the convergent 7/5. Predict the height 1.96 and compare its gap from two with the gap at x = 1.45. This quadratic converts an input approximation into a visible square-value residual. The control grid cannot generate continued fractions or establish the denominator error theorem; calculate convergents exactly on paper.
- y at chosen x
- 0.608
- Tangent slope · 2ax
- 1.35
- Signed area · ax³/3
- 0.182
This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA small residual in a plotted function can support intuition, while a denominator-dependent approximation guarantee requires an exact theorem.
Pause & reason
Check your understanding
Your turn
Try it yourself
Find the finite continued fraction of 43/19 and verify its final convergent using the recurrence.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Use Euclidean quotients from 43 = 2 × 19 + 5, then continue dividing the previous divisor by the remainder.
Compare with the solution
The divisions are 43 = 2 × 19 + 5, 19 = 3 × 5 + 4, 5 = 1 × 4 + 1, and 4 = 4 × 1. Hence 43/19 = [2; 3, 1, 4]. The convergents are 2/1, 7/3, 9/4, and 43/19: the final recurrence gives numerator 4 × 9 + 7 = 43 and denominator 4 × 4 + 3 = 19. The final approximation error is exactly zero because the original input is rational and the process terminates.
Keep the idea
Take it with you
- The floor-and-reciprocal process terminates exactly for rational inputs.
- Convergent recurrences and a determinant identity make reduction and spacing exact.
- Convergent error bounds do not apply indiscriminately to arbitrary fractions.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.