Mathwords logoMathwords

Periodic Continued Fraction — Definition, Formula & Examples

A periodic continued fraction is a continued fraction in which the sequence of partial quotients eventually repeats in a cycle. Every quadratic irrational (like 2\sqrt{2} or 3\sqrt{3}) has a periodic continued fraction expansion, and conversely, every periodic continued fraction represents a quadratic irrational.

A continued fraction [a0;a1,a2,][a_0; a_1, a_2, \ldots] is called periodic if there exist integers k0k \geq 0 and p1p \geq 1 such that an+p=ana_{n+p} = a_n for all nkn \geq k. It is written [a0;a1,,ak1,ak,ak+1,,ak+p1][a_0; a_1, \ldots, a_{k-1}, \overline{a_k, a_{k+1}, \ldots, a_{k+p-1}}], where the overline denotes the repeating block. If k=0k = 0, the fraction is called purely periodic. By Lagrange's theorem, a continued fraction is periodic if and only if it represents a quadratic irrational — a root of a quadratic equation with integer coefficients that is not rational.

Key Formula

d=[a0;a1,a2,,ap1,2a0]\sqrt{d} = [a_0;\, \overline{a_1, a_2, \ldots, a_{p-1}, 2a_0}]
Where:
  • dd = A positive integer that is not a perfect square
  • a0a_0 = The integer part, equal to $\lfloor \sqrt{d} \rfloor$
  • pp = The period length of the repeating block

How It Works

To find the periodic continued fraction of d\sqrt{d} (where dd is a positive non-square integer), you repeatedly compute floor values and remainders using the standard continued fraction algorithm. At each step, you track the irrational remainder. Eventually, one of these remainders will repeat a previous value, at which point the partial quotients cycle. The integer part a0=da_0 = \lfloor \sqrt{d} \rfloor appears first, followed by a repeating block that always ends with 2a02a_0.

Worked Example

Problem: Find the periodic continued fraction expansion of 3\sqrt{3}.
Step 1: Compute the integer part.
a0=3=1a_0 = \lfloor \sqrt{3} \rfloor = 1
Step 2: Compute the first remainder and its reciprocal. We have 310.732\sqrt{3} - 1 \approx 0.732, so take the reciprocal: 131=3+12\frac{1}{\sqrt{3}-1} = \frac{\sqrt{3}+1}{2}.
131=3+121.366\frac{1}{\sqrt{3}-1} = \frac{\sqrt{3}+1}{2} \approx 1.366
Step 3: The integer part of this is a1=1a_1 = 1. The remainder is 3+121=312\frac{\sqrt{3}+1}{2} - 1 = \frac{\sqrt{3}-1}{2}. Taking the reciprocal: 231=3+12.732\frac{2}{\sqrt{3}-1} = \sqrt{3}+1 \approx 2.732, so a2=2=2a0a_2 = 2 = 2a_0. The remainder after subtracting 2 is 31\sqrt{3}-1, which is the same as the original remainder from Step 2.
a2=2,remainder=31(cycle restarts)a_2 = 2,\quad \text{remainder} = \sqrt{3}-1 \quad \text{(cycle restarts)}
Answer: 3=[1;1,2]\sqrt{3} = [1;\, \overline{1, 2}]

Why It Matters

Periodic continued fractions are central to solving Pell's equation x2dy2=1x^2 - dy^2 = 1, a classical problem in number theory. The convergents of d\sqrt{d} at the end of each period provide the fundamental solution. This technique also appears in cryptographic algorithms and in computing best rational approximations to irrational quantities.

Common Mistakes

Mistake: Assuming all continued fractions are periodic.
Correction: Only quadratic irrationals produce periodic continued fractions. Rational numbers have finite continued fractions, and transcendental numbers like π\pi and ee have infinite non-periodic continued fractions.