From 044e7aa0a3bdd2a53316500abea37809c4601d49 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 26 Oct 2023 07:54:15 -0700 Subject: [PATCH] Added continued fractions handout --- Advanced/Continued Fractions/main.tex | 28 ++ .../parts/00 euclidean.tex | 65 +++++ .../Continued Fractions/parts/01 part A.tex | 194 +++++++++++++ .../Continued Fractions/parts/02 part B.tex | 262 ++++++++++++++++++ 4 files changed, 549 insertions(+) create mode 100755 Advanced/Continued Fractions/main.tex create mode 100755 Advanced/Continued Fractions/parts/00 euclidean.tex create mode 100644 Advanced/Continued Fractions/parts/01 part A.tex create mode 100644 Advanced/Continued Fractions/parts/02 part B.tex diff --git a/Advanced/Continued Fractions/main.tex b/Advanced/Continued Fractions/main.tex new file mode 100755 index 0000000..64ca4b0 --- /dev/null +++ b/Advanced/Continued Fractions/main.tex @@ -0,0 +1,28 @@ +% use [nosolutions] flag to hide solutions. +% use [solutions] flag to show solutions. +\documentclass[ + solutions, + shortwarning, + singlenumbering +]{../../resources/ormc_handout} +\usepackage{../../resources/macros} + +\usepackage{multicol} + +\uptitlel{Advanced 2} +\uptitler{Fall 2023} +\title{Continued Fractions} +\subtitle{ + Prepared by \githref{Mark} on \today \\ + Based on a handout by Matthew Gherman and Adam Lott +} + +\begin{document} + + \maketitle + + \input{parts/00 euclidean} + \input{parts/01 part A} + \input{parts/02 part B} + +\end{document} \ No newline at end of file diff --git a/Advanced/Continued Fractions/parts/00 euclidean.tex b/Advanced/Continued Fractions/parts/00 euclidean.tex new file mode 100755 index 0000000..ff7e03b --- /dev/null +++ b/Advanced/Continued Fractions/parts/00 euclidean.tex @@ -0,0 +1,65 @@ +\section{The Euclidean Algorithm} + +\definition{} +The \textit{greatest common divisor} of $a$ and $b$ is the greatest integer that divides both $a$ and $b$. \par +We denote this number with $\gcd(a, b)$. For example, $\gcd(45, 60) = 15$. + +\problem{} +Find $\gcd(20, 14)$ by hand. + +\begin{solution} + $\gcd(20, 14) = 2$ +\end{solution} + +\vfill + +\theorem{The Division Algorithm} +Given two integers $a, b$, we can find two integers $q, r$, where $0 \leq r < b$ and $a = qb + r$. \par +In other words, we can divide $a$ by $b$ to get $q$ remainder $r$. + +\vspace{2mm} + +For example, take $14 \div 3$. We can re-write this as $3 \times 4 + 2$. \par +Here, $a$ and $b$ are $14$ and $3$, $q = 4$ and $r = 2$. + +\theorem{} +For any integers $a, b, c$, \par +$\gcd(ac + b, a) = \gcd(a, b)$ + + +\problem{} +Compute $\gcd(668, 6)$ \hint{$668 = 111 \times 6 + 2$} +Then, compute $\gcd(3 \times 668 + 6, 668)$. + +\vfill + +\problem{The Euclidean Algorithm} +Using the two theorems above, detail an algorithm for finding $\gcd(a, b)$. \par +Then, compute $\gcd(1610, 207)$ by hand. \par + +\begin{solution} + Using \ref{gcd_abc} and the division algorthm, + + % Minipage prevents column breaks inside body + \begin{multicols}{2} + \begin{minipage}{\columnwidth} + $\gcd(1610, 207)$ \par + $= \gcd(207, 161)$ \par + $= \gcd(161, 46)$ \par + $= \gcd(46, 23)$ \par + $= \gcd(23, 0) = 23$ \par + \end{minipage} + + \columnbreak + + \begin{minipage}{\columnwidth} + $1610 = 207 \times 7 + 161$ \par + $207 = 161 \times 1 + 46$ \par + $161 = 46 \times 3 + 23$ \par + $46 = 23 \times 2 + 0$ \par + \end{minipage} + \end{multicols} +\end{solution} + +\vfill +\pagebreak \ No newline at end of file diff --git a/Advanced/Continued Fractions/parts/01 part A.tex b/Advanced/Continued Fractions/parts/01 part A.tex new file mode 100644 index 0000000..f480857 --- /dev/null +++ b/Advanced/Continued Fractions/parts/01 part A.tex @@ -0,0 +1,194 @@ +\section{} + + + +\definition{} +A \textit{finite continued fraction} is an expression of the form +\[ +a_0 + \cfrac{1}{a_1+\cfrac{1}{a_2 + \cfrac{1}{a_3 + ... + \cfrac{1}{a_{k-1} + \cfrac{1}{a_k}}}}} +\] +where $a_0, a_1, ..., a_k$ are all in $\mathbb{Z}^+$. +We'll denote this as $[a_0, a_1, ..., a_k]$. + + + + + +\problem{} +Write each of the following as a continued fraction. \par +\hint{Solve for one $a_n$ at a time.} +\begin{itemize} + \item $5/12$ + \item $5/3$ + \item $33/23$ + \item $37/31$ +\end{itemize} + + +\vfill + + +\problem{} +Write each of the following continued fractions as a regular fraction in lowest terms: \par +\begin{itemize} + \item $[2,3,2]$ + \item $[1,4,6,4]$ + \item $[2,3,2,3]$ + \item $[9,12,21,2]$ +\end{itemize} + + +\vfill +\pagebreak + +\problem{} +Let $\frac{p}{q}$ be a positive rational number in lowest terms. +Perform the Euclidean algorithm to obtain the following sequence: +\begin{align*} + p \ &= \ q_0 q + r_1 \\ + q \ &= \ q_1 r_1 + r_2 \\ + r_1 \ &= \ q_2 r_2 + r_3 \\ + &\vdots \\ + r_{k-1} \ &= \ q_k r_k + 1 \\ + r_k \ &= \ q_{k+1} +\end{align*} +We know that we will eventually get $1$ as the remainder because $p$ and $q$ are relatively prime. \par +Show that $p/q = [q_0, q_1, ..., q_{k+1}]$. + + +\vfill + + +\problem{} +Repeat \ref{num2cf} using the method outlined in \ref{euclid}. + + +\vfill +\pagebreak + + + + + + + +\definition{} +An \textit{infinite continued fraction} is an expression of the form +\[ +a_0 + \cfrac{1}{a_1+\cfrac{1}{a_2 + \cfrac{1}{a_3 + \cfrac{1}{a_4 + ...}}}} +\] +where $a_0, a_1, a_2, ...$ are in $\mathbb{Z}^+$. +To prove that this expression actually makes sense and equals a finite number +is beyond the scope of this worksheet, so we assume it for now. +This is denoted $[a_0, a_1, a_2, ...]$. + + + + + + +\problem{} +Using a calculator, compute the first five terms of the +continued fraction expansion of the following numbers. +Do you see any patterns? + +\begin{itemize} + \item $\sqrt{2}$ + \item $\pi \approx 3.14159...$ + \item $\sqrt{5}$ + \item $e \approx 2.71828...$ +\end{itemize} + + +\vfill + + + + +\problem{} +Show that an $\alpha \in \mathbb{R}^+$ can be written as a finite +continued fraction if and only if $\alpha$ is rational. \par +\hint{For one of the directions, use \ref{euclid}} + + + +\vfill +\pagebreak + + +\definition{} +The continued fraction $[a_0, a_1, a_2, ...]$ is \textit{periodic} if it ends in a repeating sequence of digits. \par +A few examples are below. We denote the repeating sequence with a line. +\begin{itemize} + \item $[1,2,2,2,...] = [1, \overline{2}]$ is periodic. + \item $[1,2,3,4,5,...]$ is not periodic. + \item $[1,3,7,6,4,3,4,3,4,3,...] = [1,3,7,6,\overline{4,3}]$ is periodic. + \item $[1,2,4,8,16, ...]$ is not periodic. +\end{itemize} + + + + + +\problem{} +\begin{itemize} + \item Show that $\sqrt{2} = [1, \overline{2}]$. + \item Show that $\sqrt{5} = [1, \overline{4}]$. +\end{itemize} +\hint{use the same strategy as \ref{irrational} but without a calculator.} + + +\vfill + + + +\problem{Challenge I} +Express the following continued fractions in the form $\frac{a+\sqrt{b}}{c}$ where $a$, $b$, and $c$ are integers: \par +\begin{itemize} + \item $[~\overline{1}~]$ + \item $[~\overline{2,5}~]$ + \item $[~1, 3, \overline{2,3}~]$ +\end{itemize} + + + +\vfill + + + + +\problem{Challenge II} +Let $\alpha = [~a_0,~ ...,~ a_r,~ \overline{a_{r+1},~ ...,~ a_{r+p}}~]$ be any periodic continued fraction. \par +Prove that $\alpha$ is of the form $\frac{a+\sqrt{b}}{c}$ for some integers $a,b,c$ where $b$ is not a perfect square. + + + +\vfill + + + +\problem{Challenge III} +Prove that any number of the form $\frac{a+\sqrt{b}}{c}$ where $a,b,c$ are integers +and $b$ is not a perfect square can be written as a periodic continued fraction. + + + +%\begin{rmk} +%Numbers of the form $\frac{a+\sqrt{b}}{c}$ where $a,b,c$ are integers and $b$ is not a perfect square are the ``simplest'' irrational numbers in the following sense. A number is rational if and only if it is the solution to a degree $1$ polynomial equation, $ax+b = 0$. Similarly, a number is of the form $\frac{a+\sqrt{b}}{c}$ if it is the solution to a degree $2$ polynomial equation, $ax^2 + bx + c = 0$ (Bonus exercise: prove this). Such numbers are called \textit{quadratic} irrational numbers or \textit{degree 2} irrational numbers. +%\end{rmk} + + + + + +%\begin{rmk} +%Notice that the results of this worksheet provide a very clean characterization of continued fraction expansions: +%\begin{itemize} +%\item $\alpha$ is a rational number if and only if it has a finite continued fraction expansion. +%\item $\alpha$ is a degree $2$ irrational number if and only if it has an infinite periodic continued fraction expansion. +%\end{itemize} +%\end{rmk} + + +\vfill +\pagebreak \ No newline at end of file diff --git a/Advanced/Continued Fractions/parts/02 part B.tex b/Advanced/Continued Fractions/parts/02 part B.tex new file mode 100644 index 0000000..ad33cb6 --- /dev/null +++ b/Advanced/Continued Fractions/parts/02 part B.tex @@ -0,0 +1,262 @@ +\section{Convergents} + + +\definition{} +Let $\alpha = [a_0, a_1, a_2, ...]$ be an infinite continued fraction (aka an irrational number). \par +The \emph{$n$th convergent to $\alpha$} is the rational number $[a_0, a_1, ..., a_n]$ and is denoted $C_n(\alpha)$. + +\problem{} +Calculate the following convergents and write them in lowest terms: \\ +\begin{itemize} + \item $C_3([~ 1,2,3,4, ... ~])$ + \item $C_4([~ 0,\overline{2,3} ~])$ + \item $C_5([~ \overline{1,5} ~])$ +\end{itemize} + +\vfill + + + + + + +\problem{} +Recall from last week that $\sqrt{5} = [2,\overline{4}]$. +Calculate the first five convergents to $\sqrt{5}$ and write them in lowest terms. +Do you notice any patterns? \par +\hint{Look at the numbers $\sqrt{5}-C_j(\sqrt{5})$ for $1 \leq j \leq 5$} + + +\vfill + + + + + + +\generic{Properties of Convergents} +In this section, we want to show that the $n$th convergent to a real number +$\alpha$ is the best approximation of $\alpha$ with the given denominator. +Let $\alpha = [a_0, a_1, ...]$ be fixed, and we will write $C_n$ instead of +$C_n(\alpha)$ for short. Let $p_n / q_n$ be the expression of $C_n$ as a rational number +in lowest terms. We will eventually prove that $|\alpha-C_n|<\frac{1}{q_n^2}$, +and there is no better rational estimate of $\alpha$ with denominator less than or equal to $q_n$. + +First we want the recursive formulas $p_n=a_np_{n-1}+p_{n-2}$ and $q_n=a_nq_{n-1}+q_{n-2}$ given $p_{-1}=1$, $p_0=a_0$, $q_{-1}=0$, and $q_0=1$. + + +\pagebreak + + + + +\problem{} +Verify the recursive formula for $1\leq j\leq 3$ for the convergents $C_j$ of: \par +\begin{itemize} + \item $[~ 1,2,3,4, ... ~]$ + \item $[~ 0,\overline{2,3} ~]$ + \item $[~ \overline{1,5} ~]$ +\end{itemize} + + +\vfill + + + + +\problem{Challenge IV} +Prove that $p_n = a_np_{n-1} + p_{n-2}$ and $q_n = a_nq_{n-1} + q_{n-2}$ by induction. +\begin{itemize} + \item As the base case, verify the recursive formulas for $n=1$ and $n=2$. + \item Assume the recursive formulas hold for $n\leq m$ and show the formulas hold for $m+1$. +\end{itemize} + + + +\vfill + + + + + +\problem{} +Using the recursive formula from \ref{rec}, +we will show that $p_n q_{n-1} - p_{n-1}q_n = (-1)^{n-1}$. +\begin{itemize} + \item What is $p_1q_0-p_0q_1$? + \item Substitute $a_np_{n-1}+p_{n-2}$ for $p_n$ and $a_nq_{n-1}+q_{n-2}$ for $q_n$ in $p_n q_{n-1}-p_{n-1}q_n$. Simplify the expression. + \item What happens when $n=2$? Explain why $p_n q_{n-1}-p_{n-1}q_n = (-1)^{n-1}$. +\end{itemize} + + +\vfill + + + + + + + +\problem{Challenge VI} +Similarly derive the formula $p_nq_{n-2}-p_{n-2}q_n = (-1)^{n-2}a_n$. + + + +\vfill +\pagebreak + + + + + + + + +\problem{} +Recall $C_n=p_n/q_n$. +Show that $C_n-C_{n-1}=\frac{(-1)^{n-1}}{q_{n-1}q_n}$ +and $C_n-C_{n-2}=\frac{(-1)^{n-2}a_n}{q_{n-2}q_n}$. +\hint{Use \ref{form1} and $p_nq_{n-2}-p_{n-2}q_n = (-1)^{n-2}a_n$ respectively} + +In \ref{sqrt5}, the value $\alpha-C_n$ alternated between negative and positive +and $|\alpha-C_n|$ got smaller each step. Using the relations in \ref{diff}, +we can prove that this is always the case. +Specifically, $\alpha$ is always between $C_n$ and $C_{n+1}$. + + + +\vfill + + + +\problem{} +Let's figure out how well the $n$th convergents estimate $\alpha$. +We will show that $|\alpha-C_n|<\frac{1}{q_n^2}$. +\begin{itemize} + \item Note that $|C_{n+1}-C_n|=\frac{1}{q_nq_{n+1}}$. + \item Why is $|\alpha-C_n|\leq|C_{n+1}-C_n|$? + \item Conclude that $|\alpha-C_n|<\frac{1}{q_n^2}$. +\end{itemize} + +We are now ready to prove a fundamental result in the theory of rational approximation. +\problem{Dirichlet's approximation theorem} +Let $\alpha$ be any irrational number. +Prove that there are infinitely many rational numbers $\frac{p}{q}$ such that $|\alpha - \frac{p}{q}| < \frac{1}{q^2}$. + + + + +\vfill +\pagebreak + + + + + + +\problem{Challenge VII} +Prove that if $\alpha$ is \emph{rational}, then there are only \emph{finitely} many rational numbers $\frac{p}{q}$ +satisfying $|\alpha - \frac{p}{q} | < \frac{1}{q^2}$. + + +The above result shows that the $n$th convergents estimate $\alpha$ extremely well. +Are there better estimates for $\alpha$ if we want small denominators? +In order to answer this question, we introduce the Farey sequence. + + + +\vfill + + + + + + +\definition{} +The \emph{Farey sequence} of order $n$ is the set of rational numbers between +0 and 1 whose denominators (in lowest terms) are $\leq n$, arranged in increasing order. + + +\problem{} +List the Farey sequence of order 4. Now figure out the Farey sequence of order 5 by including the relevant rational numbers in the Farey sequence of order 4. + +\vfill + + + + +\problem{} +Let $\frac{a}{b}$ and $\frac{c}{d}$ be consecutive elements of the Farey sequence of order 5. What does $bc-ad$ equal? + + +\vfill + + + + + +\problem{Challenge VIII} +Prove that $bc-ad=1$ for $\frac{a}{b}$ and $\frac{c}{d}$ consecutive rational numbers in Farey sequence of order $n$. + +\begin{itemize}[itemsep=2mm] + \item In the plane, draw the triangle with vertices (0,0), $(b,a)$, $(d,c)$. + Show that the area $A$ of this triangle is $\frac{1}{2}$ using Pick's Theorem. + Recall that Pick's Theorem states $A=\frac{B}{2}+I-1$ where $B$ is the number of + lattice points on the boundary and $I$ is the number of points in the interior. \par + \hint{B=3 and I=0} + + \item Show that the area of the triangle is also given by $\frac{1}{2}|ad-bc|$. + + \item Why is $bc>ad$? + + \item Conclude that $bc-ad=1$. +\end{itemize} + + + + + + +\vfill +\pagebreak + + + +\problem{} +Use the result of \ref{farey} to show that there is no rational number between +$C_{n-1}$ and $C_n$ with denominator less than or equal to $q_n$. +Conclude that if $a/b$ is any rational number with $b \leq q_n$, then +$|\alpha - \frac ab| \geq |\alpha - \frac{p_n}{q_n}|$ + +%What the above exercise shows is that relative to the size of the denominator, the convergents of the continued fraction expansion of $\a$ are the absolute best rational approximations to $\a$. + + +\vfill + + + + + +\problem{Challenge V} +Prove the following strengthening of Dirichlet's approximation theorem. +If $\alpha$ is irrational, then there are infinitely many rational numbers +$\frac{p}{q}$ satisfying $|\alpha - \frac pq| < \frac{1}{2q^2}$. + +\begin{itemize}[itemsep = 2mm] + + \item Prove that $(x+y)^2 \geq 4xy$ for any real $x,y$. + \item Let $p_n/q_n$ be the $n$th convergent to $\alpha$. Prove that + \[ + |\frac{p_n}{q_n} - \frac{p_{n+1}}{q_{n+1}}|^2 \ \geq \ 4 | \frac{p_n}{q_n} - \alpha | | \frac{p_{n+1}}{q_{n+1}} - \alpha | + \] + \hint{$\alpha$ lies in between $\frac{p_n}{q_n}$ and $\frac{p_{n+1}}{q_{n+1}}$} + + + \item Prove that either $\frac{p_n}{q_n}$ or $\frac{p_{n+1}}{q_{n+1}}$ satisfies the desired inequality (Hint: proof by contradiction). + + \item Conclude that there are infinitely many rational numbers $\frac{p}{q}$ satisfying $|\alpha - \frac pq| < \frac{1}{2q^2}$. +\end{itemize} + + +\vfill +\pagebreak \ No newline at end of file