%! TEX root = NT.tex % vim: tw=50 % 20/11/2023 10AM \glsnoundefn{quad_irr}{quadratic irrational}{quadratic irrationals} We now study the \glspl{cfe} of \emph{quadratic irrationals} $\theta \in \RR \setminus \QQ$: i.e. irrational $\theta$ such that $\theta$ satisfies an equation \[ a\theta^2 + b\theta + c = 0 \qquad a, b, c \in \ZZ .\] (or equivalently $\theta$ of the form $r + s\sqrt{d}$, $r, s \in \QQ$, $s \neq 0$, $d \in \NN$ not a square). \begin{example*} $d = 6$, $\theta = \sqrt{6}$. $2 < \sqrt{6} < 3$ so $\acf_0 = \left\lfloor \sqrt{6} \right\rfloor = 2$, $\theta_1 = \frac{1}{\sqrt{6} - 2} = \frac{\sqrt{6} + 2}{2} = \frac{\sqrt{6} - 2}{2} + 2$. Hence $\acf_1 = \left\lfloor \theta_1 \right\rfloor = 2$, $\theta_2 = \frac{2}{\sqrt{6} - 2} = \sqrt{6} + 2 = (\sqrt{6} - 2) + 4$, so $\acf_2 = \left\lfloor \theta_2 \right\rfloor = 4$, $\theta_3 = \frac{1}{\sqrt{6} - 2} = \theta_1$. So \begin{align*} \theta &= \contf[\acf_0, \theta_1] \\ &= \contf[\acf_0, \acf_1, \theta_2] \\ &= \contf[\acf_0, \acf_1, \acf_2, \acf_1, \acf_2, \theta_1] \\ &= \contf[2, 2, 4, 2, 4, 2, 4, \ldots] \\ &= \contf[2, \ol{2, 4}] \end{align*} \glssymboldefn{recurring_cfe}{$[1, \overline{2, 3}]$}{$[1, \overline{2, 3}]$} (overline means repeat this pattern indefinitely). \end{example*} \begin{flashcard}[essentially-periodic-defn] \begin{definition*}[Essentially periodic] \glsadjdefn{ess_pdic}{essentially periodic}{\gls{cfe}} \glsadjdefn{ply_pdic}{purely periodic}{\gls{cfe}} \cloze{Let $\theta \in \RR \setminus \QQ$ have \gls{cfe} $\contf[\acf_0, \acf_1, \acf_2, \ldots]$. Then the \gls{cfe} of $\theta$ is \emph{essentially periodic} of period $k$ if it has the form $\contf[\acf_0, \acf_1, \ldots, \acf_{m - 1}, \rcring{\acf_m, \ldots, \acf_{m + k - 1}}]$. It is \emph{purely periodic} if we can take $m = 0$.} \end{definition*} \end{flashcard} \begin{example*} \Gls{cfe} of $\sqrt{6}$ is \gls{ess_pdic}; \gls{cfe} of $\frac{1}{\sqrt{6} - 2}$ is \gls{ply_pdic}. \end{example*} \begin{flashcard}[Lagrange-cfe-thm] \begin{theorem}[Lagrange] % Theorem 5.8 If $\theta \in \RR \setminus \QQ$, \cloze{then \gls{cfe} of $\theta$ is \gls{ess_pdic} $\iff$ $\theta$ is a \gls{quad_irr}.} \end{theorem} \begin{proof} \cloze{ \phantom{} \begin{enumerate}[$\Rightarrow$] \item[$\Rightarrow$] If $\theta = \contf[\rcring{\acf_0, \ldots, \acf_{k - 1}}]$ is \gls{ply_pdic}, then \[ \theta = \contf[\acf_0, \ldots, \acf_{k - 1}, \theta] \implies \theta = \frac{p_{k - 1}\theta + p_{k - 2} \theta}{q_{k - 1}\theta + q_{k - 2}} \] Rearrange: get a quadratic equation satisfied by $\theta$. If $\theta = \contf[\acf_0, \ldots, \acf_{m - 1}, \rcring{\acf_m, \ldots, \acf_{m + k - 1}}]$ is \gls{ess_pdic}, then $\theta = \contf[\acf_0, \ldots, \acf_{m - 1}, \beta]$, where $\beta$ has a \gls{ply_pdic} \gls{cfe}, so $\beta = r + s\sqrt{d}$. Now: \[ \theta = \frac{p_{m - 1} \beta + p_{m - 2}}{q_{m - 1}\beta + q_{m - 2}} \] Rearrange to see $\theta$ has the form $r' + s'\sqrt{d}$, hence $\theta$ is a \gls{quad_irr}. \item[$\Leftarrow$] Now suppose $\theta$ is a \gls{quad_irr}, with \gls{cfe} $\contf[\acf_0, \acf_1, \acf_2, \ldots]$.a We know $\theta$ satisfies an equation $a\theta^2 + b\theta + c = 0$, $a, b, c \in \ZZ$. We define \[ f(x, y) = ax^2 + bxy + cy^2 ,\] a \gls{bqf}, with $f(0, 1) = 0$. For $n \ge 1$, define \[ f_n(x, y) = f \left( \begin{pmatrix} x & y \end{pmatrix} \begin{pmatrix} p_n & q_n \\ p_{n - 1} & q_{n - 1} \end{pmatrix} \right) = f(p_n x + p_{n - 1} y, q_nx + q_{n - 1} y) .\] Claim: As $n$ varies, the sequence $f_n(x, y)$ takes on finitely many distinct \glspl{bqf}. This implies the Theorem: For all $n \ge 1$, \[ \theta = \contf[\acf_0, \ldots, \acf_n, \theta_{n + 1}] = \frac{\theta_{n + 1} p_n + p_{n - 1}}{\theta_{n + 1} q_n + q_{n - 1}} .\] So \begin{align*} f_n(\theta_{n + 1}, 1) &= f(p_n \theta_{n + 1} + p_{n - 1}, q_n\theta_{n + 1} + q_{n - 1}) \\ &= (q_n\theta_{n - 1} + q_{n - 1})^2 f \left( \frac{p_n \theta_{n + 2} + p_{n - 2}}{q_n \theta_{n + 2} + q_{n - 2}}, 1\right) \\ &= (q_n \theta_{n + 1} + q_{n - 1})^2 f(\theta, 1) \\ &= 0 \end{align*} Claim shows that as $n$ varies, $\theta_{n + 1}$ can take on only finitely many distinct values. Hence, there exist $n, k \ge 1$ such that $\theta_n = \theta_{n + k}$, hence \gls{cfe} of $\theta$ is \gls{ess_pdic}. Now we prove the claim: write $f_n(x, y) = A_n x^2 + B_n xy + C_n y^2$. \begin{align*} A_n &= f_n(1, 0) = f(p_n, q_n) \\ C_n &= f_n(0, 1) = f(p_{n - 1}, q_{n - 1}) = A_{n - 1} \end{align*} So \[ \disc f_n = B_n^2 - 4A_n C_n = \disc f \cdot \det \begin{pmatrix} p_n & q_n \\ p_{n - 1} & q_{n - 1} \end{pmatrix}^2 = \disc f \] (as $p_n q_{n - 1} - p_{n - 1} q_n = (-1)^{n - 1}$). To show that claim, it's enough to show $|A_n|$ is bounded as $n$ varies. Let's write $\theta'$ for the other root of $a x^2 + bx + c = 0$, so $f(x, 1) = a(x - \theta)(x - \theta')$. Then \[ |A_n| = |f(p_n, q_n)| = q_n^2 \left| f \left( \frac{p_n}{q_n}, 1 \right) \right| = q_n^2 |a| \left| \frac{p_n}{q_n} - \theta \right| \left| \frac{p_n}{q_n} - \theta' \right| .\] We know $\left| \theta - \frac{p_n}{q_n} \right| \le \frac{1}{q_n q_{n + 1}}$ (proved last time). So \[ |A_n| \le \frac{q_n^2}{q_n q_{n + 1}} |a| \left| \frac{p_n}{q_n} - \theta' \right| \le |a| \left| \frac{p_n}{q_n} - \theta' \right| .\] We know $\left| \frac{p_n}{q_n} - \theta' \right| \to \left| \theta - \theta' \right|$ as $n \to \infty$. Therefore $|a| \left| \frac{p_n}{q_n} - \theta' \right|$ is bounded as $n$ varies. \qedhere \end{enumerate} } \end{proof} \end{flashcard} \begin{flashcard}[galois-ply-pdic-thm] \begin{theorem}[Galois] % Theorem 5.9 \label{galois_thm} \cloze{Let $\theta = r + s\sqrt{d}$ be a \gls{quad_irr}. Let $\theta' = r - s\sqrt{d}$ (``the other root of the quadratic''). Then the \gls{cfe} of $\theta$ is \gls{ply_pdic} $\iff$ $\theta > 1$, $\theta' \in (-1, 0)$. In this case, if $\theta = \contf[\rcring{\acf_0, \ldots, \acf_n}]$, then $-\frac{1}{\theta'} = \contf[\rcring{\acf_n, \ldots, \acf_0}]$.} \end{theorem} \end{flashcard} \begin{proof} Omitted. \end{proof} \textbf{Application:} $\theta = \sqrt{d}$, $d \in \ZZ$ a non-square. Then $\acf_0 = \left\lfloor \sqrt{d} \right\rfloor$, $\theta_1 = \frac{1}{\sqrt{d} - \acf_0} > 1$. \[ \theta_1' = \frac{1}{-(\sqrt{d} + \acf_0)} \in (-1, 0)\] Hence $\theta_1$ satisfies hypothesis of \cref{galois_thm}. Hence \[ \sqrt{d} = \contf[\acf_0, \rcring{\acf_1, \ldots, \acf_n}] ,\] for some $n \ge 1$. \begin{flashcard}[pells-has-sol-thm] \begin{theorem} % Theorem 5.10 Let $d \in \NN$ be a \cloze{non-square}. Then the equation $X^2 - dY^2 = 1$ has a solution with $X, Y \in \NN$. \end{theorem} \begin{proof} \cloze{Let $\sqrt{d} = \contf[\acf_0, \rcring{\acf_1, \ldots, \acf_n}] = \contf[\acf_0, \theta_1]$, $\theta_1 = \contf[\rcring{\acf_1, \ldots, \acf_n}]$ (using the application of \cref{galois_thm} above). Then \[ \sqrt{d} = \contf[\acf_0, \acf_1, \ldots, \acf_n, \rcring{\acf_1, \ldots, \acf_n}] = \contf[\acf_0, \ldots, \acf_n, \theta_1] = \frac{p_n \theta_1 + p_{n - 1}}{q_n \theta_1 + q_{n - 1}} \] where $\theta_1 = \frac{1}{\sqrt{d} - \acf_0}$. Hence \begin{align*} \sqrt{d} &= \frac{p_n + p_{n - 1} (\sqrt{d} - \acf_0)}{q_n + q_{n - 1}(\sqrt{d} - \acf_0)} \\ \implies dq_{n - 1} + (q_n - \acf_0 q_{n - 1}) \sqrt{d} &= (p_n - p_{n - 1} \acf_0) + p_{n - 1} \sqrt{d} \end{align*} Equate $\sqrt{d}$ and rational parts: $dq_{n - 1} = p_n - p_{n - 1} \acf_0$, $p_{n - 1} = q_n - \acf_0 q_{n - 1}$. \[ p_{n - 1}^2 - dq_{n - 1}^2 = p_{n - 1} (q_n - \acf_0 q_{n - 1}) - p_n q_{n - 1} + p_{n - 1} q_{n - 1} \acf_0 = p_{n - 1} q_n - q_n q_{n - 1} = (-1)^n .\] If $n$ is even, then $p_{n - 1}^2 - dq_{n - 1}^2 = 1$, and we've found a solution. If $n$ is odd, we run the same argument using \[ \sqrt{d} = \contf[\acf_0, \rcring{\acf_1, \ldots, \acf_n, \acf_1, \ldots, \acf_n}]. \qedhere \]} \end{proof} \end{flashcard}