Quadratic Irrationals Have Periodic Continued Fractions

# Quadratic Irrationals Have Periodic Continued Fractions

On the Periodic Continued Fractions are Quadratic Irrationals page we proved that if $\theta$ is an irrational and $\theta = \langle a_0; a_1, a_2, ... \rangle$ is a periodic continued fraction then $\theta$ is a quadratic irrational. The converse is also true, that is, if $\theta$ is a quadratic irrational then $\theta$ is a periodic continued fraction.

 Lemma 1: If $\epsilon$ is a quadratic irrational then $\epsilon$ can be written in the form $\displaystyle{\epsilon = \frac{a + b\sqrt{d}}{c}}$ where $c \mid [d - a^2]$.
• Proof: Suppose that $\epsilon$ is a quadratic irrational. Then $\epsilon$ is of the form:
(1)
\begin{align} \quad \epsilon = \frac{a + \sqrt{b}}{c} \end{align}
• Where $b$ is not a perfect square (otherwise $\epsilon$ would be a rational number). Suppose that we multiply the numerator and denominator of $\epsilon$ by $|c|$. Then:
(2)
\begin{align} \quad \epsilon = \frac{a|c| + |c| \sqrt{b}}{c|c|} = \frac{a|c| + \sqrt{c^2b}}{c|c|} \end{align}
• Note that if $\epsilon$ is written this way, then:
(3)
\begin{align} \quad c^2b - (a|c|)^2 = c^2b - a^2c^2= c^2(b - a^2) \end{align}
• And so $c|c| \mid [c^2b - (a|c|)^2]$. Thus, if $\epsilon$ is a quadratic irrational then $\epsilon$ can be written in the form $\frac{a +\sqrt{b}}{c}$ where $c \mid [b - a^2]$.
 Theorem 2: Let $\theta \in \mathbb{R} \setminus \mathbb{Q}$. If $\theta$ is a quadratic irrational then $\theta$ is a periodic continued fraction.

Lemma 1 is useful in the proof of Theorem 2 but we will omit the proof of Theorem 2 for now as it is rather technical.

For Theorem 2, we can show that $\displaystyle{\theta = \frac{m_0 + \sqrt{d}}{q_0}}$ has a continued fraction expansion $\langle a_0; a_1, a_2, ...\ rangle$ as follows. For each $0 \leq i < \infty$ let:

(4)
\begin{align} \quad \theta_i = \frac{m_i + \sqrt{d}}{q_i} \end{align}

Where:

(5)
\begin{align} m_{i+1} &= a_iq_i - m_i \\ q_{i+1} &= \frac{d - m_{i+1}^2}{q_i} \end{align}

And then $a_i = \lfloor \theta_i \rfloor$. It can be shown that $\theta = \langle a_0; a_1, a_2, ... \rangle$ with these definitions.