# 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:

- 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:

- Note that if $\epsilon$ is written this way, then:

- 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)Where:

(5)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.