
\input amstex


\magnification=1400


\loadmsbm

\input colordvi

\nopagenumbers
\parindent=0pt

\def\cgy{\GreenYellow}     % GreenYellow  Approximate PANTONE 388
\def\cyy{\Yellow}	  % Yellow  Approximate PANTONE YELLOW
\def\cgo{\Goldenrod}	  % Goldenrod  Approximate PANTONE 109
\def\cda{\Dandelion}	  % Dandelion  Approximate PANTONE 123
\def\capr{\Apricot}	  % Apricot  Approximate PANTONE 1565
\def\cpe{\Peach}		  % Peach  Approximate PANTONE 164
\def\cme{\Melon}		  % Melon  Approximate PANTONE 177
\def\cyo{\YellowOrange}	  % YellowOrange  Approximate PANTONE 130
\def\coo{\Orange}	  % Orange  Approximate PANTONE ORANGE-021
\def\cbo{\BurntOrange}	  % BurntOrange  Approximate PANTONE 388
\def\cbs{\Bittersweet}	  % Bittersweet  Approximate PANTONE 167
%\def\creo{\RedOrange}	  % RedOrange  Approximate PANTONE 179
\def\cma{\Mahogany}	  % Mahogany  Approximate PANTONE 484
\def\cmr{\Maroon}	  % Maroon  Approximate PANTONE 201
\def\cbr{\BrickRed}	  % BrickRed  Approximate PANTONE 1805
\def\crr{\Red}		  % Red  VERY-Approx PANTONE RED
\def\cor{\OrangeRed}	  % OrangeRed  No PANTONE match
\def\paru{\RubineRed}	  % RubineRed  Approximate PANTONE RUBINE-RED
\def\cwi{\WildStrawberry}  % WildStrawberry  Approximate PANTONE 206
\def\csa{\Salmon}	  % Salmon  Approximate PANTONE 183
\def\ccp{\CarnationPink}	  % CarnationPink  Approximate PANTONE 218
\def\cmag{\Magenta}	  % Magenta  Approximate PANTONE PROCESS-MAGENTA
\def\cvr{\VioletRed}	  % VioletRed  Approximate PANTONE 219
\def\parh{\Rhodamine}	  % Rhodamine  Approximate PANTONE RHODAMINE-RED
\def\cmu{\Mulberry}	  % Mulberry  Approximate PANTONE 241
\def\parv{\RedViolet}	  % RedViolet  Approximate PANTONE 234
\def\cfu{\Fuchsia}	  % Fuchsia  Approximate PANTONE 248
\def\cla{\Lavender}	  % Lavender  Approximate PANTONE 223
\def\cth{\Thistle}	  % Thistle  Approximate PANTONE 245
\def\corc{\Orchid}	  % Orchid  Approximate PANTONE 252
\def\cdo{\DarkOrchid}	  % DarkOrchid  No PANTONE match
\def\cpu{\Purple}	  % Purple  Approximate PANTONE PURPLE
\def\cpl{\Plum}		  % Plum  VERY-Approx PANTONE 518
\def\cvi{\Violet}	  % Violet  Approximate PANTONE VIOLET
\def\parp{\RoyalPurple}	  % RoyalPurple  Approximate PANTONE 267
\def\cbv{\BlueViolet}	  % BlueViolet  Approximate PANTONE 2755
\def\cpe{\Periwinkle}	  % Periwinkle  Approximate PANTONE 2715
\def\ccb{\CadetBlue}	  % CadetBlue  Approximate PANTONE (534+535)/2
\def\cco{\CornflowerBlue}  % CornflowerBlue  Approximate PANTONE 292
\def\cmb{\MidnightBlue}	  % MidnightBlue  Approximate PANTONE 302
\def\cnb{\NavyBlue}	  % NavyBlue  Approximate PANTONE 293
\def\crb{\RoyalBlue}	  % RoyalBlue  No PANTONE match
%\def\cbb{\Blue}		  % Blue  Approximate PANTONE BLUE-072
\def\cce{\Cerulean}	  % Cerulean  Approximate PANTONE 3005
\def\ccy{\Cyan}		  % Cyan  Approximate PANTONE PROCESS-CYAN
\def\cpb{\ProcessBlue}	  % ProcessBlue  Approximate PANTONE PROCESS-BLUE
\def\csb{\SkyBlue}	  % SkyBlue  Approximate PANTONE 2985
\def\ctu{\Turquoise}	  % Turquoise  Approximate PANTONE (312+313)/2
\def\ctb{\TealBlue}	  % TealBlue  Approximate PANTONE 3145
\def\caq{\Aquamarine}	  % Aquamarine  Approximate PANTONE 3135
\def\cbg{\BlueGreen}	  % BlueGreen  Approximate PANTONE 320
\def\cem{\Emerald}	  % Emerald  No PANTONE match
\def\cjg{\JungleGreen}	  % JungleGreen  Approximate PANTONE 328
\def\csg{\SeaGreen}	  % SeaGreen  Approximate PANTONE 3268
\def\cgg{\Green}	  % Green  VERY-Approx PANTONE GREEN
\def\cfg{\ForestGreen}	  % ForestGreen  Approximate PANTONE 349
\def\cpg{\PineGreen}	  % PineGreen  Approximate PANTONE 323
\def\clg{\LimeGreen}	  % LimeGreen  No PANTONE match
\def\cyg{\YellowGreen}	  % YellowGreen  Approximate PANTONE 375
\def\cspg{\SpringGreen}	  % SpringGreen  Approximate PANTONE 381
\def\cog{\OliveGreen}	  % OliveGreen  Approximate PANTONE 582
\def\pars{\RawSienna}	  % RawSienna  Approximate PANTONE 154
\def\cse{\Sepia}		  % Sepia  Approximate PANTONE 161
\def\cbr{\Brown}		  % Brown  Approximate PANTONE 1615
\def\cta{\Tan}		  % Tan  No PANTONE match
\def\cgr{\Gray}		  % Gray  Approximate PANTONE COOL-GRAY-8
\def\cbl{\Black}		  % Black  Approximate PANTONE PROCESS-BLACK
\def\cwh{\White}		  % White  No PANTONE match


\voffset=-.6in
\hoffset=-.5in
\hsize = 7.5 true in
\vsize=10.6 true in

%\voffset=1.2in
%\hoffset=-.5in
%\hsize = 10.2 true in
%\vsize=8 true in

\overfullrule=0pt


\def\ctln{\centerline}
\def\u{\underbar}
\def\ssk{\smallskip}
\def\msk{\medskip}
\def\bsk{\bigskip}
\def\hsk{\hskip.1in}
\def\hhsk{\hskip.2in}
\def\dsl{\displaystyle}

\def\lra{$\Leftrightarrow$ }


\ctln{\bf Math 445 Number Theory}

\smallskip

\ctln{October 27, 2004}

\medskip

{\bf Continued fractions:} Another example: $\sqrt{77}$

\msk

$8 < \sqrt{77} < 9$. so: 

$a_0=\lfloor\sqrt{77}\rfloor = 8, r_0=\sqrt{77}-8$ , 
\hhsk
$\displaystyle a_1 = \lfloor{{1}\over{\sqrt{77}-8}}\rfloor = \lfloor {{\sqrt{77}+8}\over{13}}\rfloor = 1$ , 
$\displaystyle r_1 = {{\sqrt{77}+8}\over{13}} -1 = {{\sqrt{77}-5}\over{13}}$ , 
\hhsk
$\displaystyle a_2 = \lfloor{{13}\over{\sqrt{77}-5}}\rfloor = \lfloor {{\sqrt{77}+5}\over{4}}\rfloor = 3$ , 
$\displaystyle r_2 = {{\sqrt{77}+5}\over{4}} -3 = {{\sqrt{77}-7}\over{4}}$ , 
\hhsk
$\displaystyle a_2 = \lfloor{{4}\over{\sqrt{77}-7}}\rfloor = \lfloor {{\sqrt{77}+7}\over{7}}\rfloor = 2$ , 
$\displaystyle r_2 = {{\sqrt{77}+7}\over{7}} -2 = {{\sqrt{77}-7}\over{7}}$ , 
\hhsk
$\displaystyle a_3 = \lfloor{{7}\over{\sqrt{77}-7}}\rfloor = \lfloor {{\sqrt{77}+7}\over{4}}\rfloor = 3$ , 
$\displaystyle r_3 = {{\sqrt{77}+7}\over{4}} -3 = {{\sqrt{77}-5}\over{4}}$ , 
\hhsk
$\displaystyle a_4 = \lfloor{{4}\over{\sqrt{77}-5}}\rfloor = \lfloor {{\sqrt{77}+5}\over{13}}\rfloor = 1$ , 
$\displaystyle r_4 = {{\sqrt{77}+5}\over{13}} -1 = {{\sqrt{77}-8}\over{13}}$ , 
\hhsk
$\displaystyle a_5 = \lfloor{{13}\over{\sqrt{77}-8}}\rfloor = \lfloor {{\sqrt{77}+8}\over{1}}\rfloor = 16$ , 
$\displaystyle r_5 = {{\sqrt{77}+8}\over{1}} -16 = {{\sqrt{77}-8}\over{1}}$  = $r_0$ , 

and then the process will repeat.
\hhsk
So, $\sqrt{77} = [8,1,3,2,3,1,16,1,3,2,3,1,16,\ldots]$ = $[3,\overline{1,3,2,3,1,16}]$ .

\msk

Some basic facts. Finite, simple, continued fraction $x=[a_0,a_1,\ldots ,a_n]$, $a_i\in {\Bbb N}$ for all $i\geq 1$; 
$a_0\in{\Bbb Z}$.

\ssk

A basic formula: $\displaystyle [a_0,a_1,\ldots ,a_n] = a_0+{{1}\over{[a_1,\ldots ,a_n]}}$ .

\msk

$x$ is a rational number. (Proof: induction on $n$.)

\ssk

Because $a_n=(a_n-1)+{{1}\over{1}}$, $[a_0,a_1,\ldots ,a_n] = [a_0,a_1,\ldots ,a_n-1,1]$ . But this is the only type of equality:

If $[a_0,a_1,\ldots ,a_n] = [b_0,b_1,\ldots ,b_m]$ with $a_n,b_m>1$, then $n=m$ and $a_i=b_i$ for all $i$ . \hhsk The idea: 

$\displaystyle [a_0,a_1,\ldots ,a_n] = a_0+{{1}\over{[a_1,\ldots ,a_n]}}$, and $[a_1,\ldots ,a_n]>1$, so 
$a_0=\lfloor [a_0,a_1,\ldots ,a_n]\rfloor = \lfloor [b_0,b_1,\ldots ,b_m]\rfloor = b_0$. 
So $\displaystyle {{1}\over{[a_1,\ldots ,a_n]}} = {{1}\over{[b_1,\ldots ,b_m]}}$ , so $[a_1,\ldots ,a_n] = [b_1,\ldots ,b_m]$ .
Then continue by induction.

\ssk

Our basic formulas will hold just as well if the $a_i$ are not integers. Another basic formula that we will repeatedly use is

\ssk

\ctln{$\displaystyle [a_0,\ldots ,a_{n-1},a_n] = [a_0,\ldots ,a_{n-2},a_{n-1}+{{1}\over{a_n}}]$}

\ssk

Computing $[a_0,\ldots ,a_n]$ from $[a_0,\ldots ,a_{n-1}]$ :

$\dsl [a_0,\ldots ,a_n] = {{h_n}\over{k_n}}$ , where the $h_n,k_n$ are defined inductively by

\ssk

$h_{-2}=0, h_{-1}=1, k_{-2}=1, k_{-1}=0$ , and $h_i=h_{i-1}a_i+h_{i-2}$ , $k_i=k_{i-1}a_i+k_{i-2}$

\ssk


Proof: next time.

\vfill
\end

The idea: induction! Check true for $i=0$. Suppose it is true for \underbar{any} continued fraction 
$\dsl [b_0,\ldots ,b_{n-1}]$ . Then 
$\dsl [a_0,\ldots ,a_n] = [a_0,\ldots ,a_{n-2}, a_{n-1}+{{1}\over{a_n}}]$ has length $n$, so 
$\dsl [a_0,\ldots ,a_n] = [a_0,\ldots ,a_{n-2}, a_{n-1}+ {{1} \over {a_n}} ] = {{H_{n-1}}\over{K_{n-1}}} = 
{{ h_{n-2}(a_{n-1}+ {{ 1} \over {a_n}} )+h_{n-3} } \over { k_{n-2}(a_{n-1}+ {{ 1} \over {a_n}} )+k_{n-3} }} = 
{{h_{n-2}(a_{n-1} a_n+1)+h_{n-3} a_n }\over{ k_{n-2} (a_{n-1}a_n+1)+k_{n-3} a_n}} = 
{{(h_{n-2}a_{n-1}+h_{n-3}) a_n+h_{n-2}}\over{((k_{n-2}a_{n-1}+k_{n-3}) a_n+k_{n-2}}} =
{{(h_{n-1} a_n+h_{n-2}}\over{((k_{n-1} a_n+k_{n-2}}} = {{h_n}\over{k_n}}$ , as desired. \hhsk
The real point here is that since
$\dsl [a_0,\ldots ,a_n]$ and $ [a_0,\ldots ,a_{n-2}, a_{n-1}+{{1}\over{a_n}}]$ both agree in the 
inductive definitions of their $h_i$ and $k_i$, through $i=n-2$, this really {\it is} the calculation of 
${{h_n}/{k_n}}$ for $[a_0,\ldots ,a_n]$ .

\msk

There are several important things we can learn from this calculation. First, since $k_{-1}=0, 
k_0=0\cdot a_0+1 = 1$, and $k_{n}=k_{n-1}a_n+k_{n-2}\geq k_{n-1}+k_{n-2} > k_{n-1}$ for $n\geq 2$,
the $k_n$ are a strinctly increasing sequence of integers, and in fact, $k_n\geq n$. 

Second, \hhsk
$(h_n,k_n)=1$ for all $n$ . In fact, \hhsk $h_nk_{n-1}-h_{n-1}k_n = (-1)^n-1$ and $h_nk_{n-2}-h_{n-2}k_n = (-1)^n a_n$ .

\ssk

This follows by induction; check $n=0$, and then $h_nk_{n-1}-h_{n-1}k_n = 
(h_{n-1}a_n+h_{n-2})k_{n-1} - h_{n-1}(k_{n-1}a_n+k_{n-2}) = h_{n-1}k_{n-1}a_n+h_{n-2}k_{n-1} - h_{n-1}k_{n-1}a_n-h_{n-1}k_{n-2}
= h_{n-2}k_{n-1} - h_{n-1}k_{n-2} = (-1)(h_{n-1}k_{n-2} - h_{n-2}k_{n-1}) = (-1)(-1)^{n-2} = (-1)^{n-1}$ , by induction, and then

$h_nk_{n-2}-h_{n-2}k_n = 
(h_{n-1}a_n+h_{n-2})k_{n-2} - h_{n-2}(k_{n-1}a_n+k_{n-2})  = h_{n-1}k_{n-2}a_n+h_{n-2}k_{n-2} - h_{n-2}k_{n-1}a_n-h_{n-2}k_{n-2}
=a_n(h_{n-1}k_{n-2} - h_{n-2}k_{n-1}) = a_n(-1)^{n-2} = (-1)^na_n$. This in turn gives us:

Third: setting $\dsl r_n = [a_0,\ldots , a_n] = {{h_n}\over{k_n}}$ , we have 
$r_n-r_{n-1}$ = $\dsl {{h_n}\over{k_n}} - {{h_{n-1}}\over{k_{n-1}}} = 
{{h_n k_{n-1} - h_{n-1} k_n}\over{k_{n-1} k_n}} = 
{{(-1)^n}\over{k_{n-1} k_n}}$ and similarly, 
$r_n-r_{n-2}$ = $\dsl {{h_n}\over{k_n}} - {{h_{n-2}}\over{k_{n-2}}} = {{(-1)^n a_n}\over{k_{n-2} k_n}}$ . 

\ssk

This tells us many things! Since the $k_n$'s are all positive (and, in fact, increasing), 
if we look at the ``even'' terms, $r_0,r_2,r_4,\ldots$, this is an increasing sequence.
The odd terms, $r_1,r_3,r_5,\ldots$ are a decreasing sequence. And since 
successive terms are getting closer to one another, we have that the sequence
$\{r_n\}_{n=0}^\infty$ converges. We will denote its limit, of course, as $[a_0,a_1,\ldots ,a_n,\ldots ]$ .

\ssk

But to what? If the continued fraction came from our procedure for computing the expansion of a
real number $x$ :: $a_0=\lfloor x\rfloor$, $x_0=x-a_0$, and inductively 
$a_n=\lfloor 1/x_{n-1}\rfloor$ , $x_n=(1/x_{n-1})-a_n$,
we have $x=[a_0,\ldots,a_{n-1},a_n+x_n] < [a_0,\ldots,a_{n-1},a_n]$ for $n$ odd, and
$x> [a_0,\ldots,a_{n-1},a_n]$ for $n$ even (by induction!). So $r_{2n}<x<r_{2n+1}$ , so $r_n$ converges to $x$ !

\ssk

In particular, $\dsl |x-r_n| < |r_{n+1}-r_n| = |{{(-1)^{n}}\over{k_n k_{n+1}}}| = {{1}\over{k_nk_{n+1}}}$ so 
the $r_n$ make good rational approximations to $x$. 

\vfill\end



















\ctln{$\displaystyle {{a}\over{b}} = q_1+{{r_1}\over{b}}$ , 
$\displaystyle {{b}\over{r_1}} = q_2+{{r_2}\over{r_1}}$  , $\ldots$ , 
$\displaystyle {{r_i}\over{r_{i+1}}} = q_{i+2}+{{r_{i+2}}\over{r_{i+1}}}$ , 
$\displaystyle {{r_{n-2}}\over{1}} = q_{n}+0$}

then we can use them to express $\displaystyle {{a}\over{b}}$ as a {\it continued fraction}:

\ssk

$\displaystyle {{a}\over{b}}$ = 
$\displaystyle q_1+{\displaystyle {r_1}\over{b}}$ = 
$\displaystyle q_1+{\displaystyle {1}\over{\displaystyle {b}\over{\displaystyle r_1}}}$ = 
$\displaystyle q_1+{\displaystyle {1}\over{\displaystyle q_2+{\displaystyle {r_2}\over{\displaystyle r_1}}}}$ = 
$\cdots$ = 
$\displaystyle q_1+{\displaystyle {1}\over{\displaystyle q_2+{\displaystyle {1}\over{q_3+{\displaystyle {1}\over{\displaystyle \cdots + {\displaystyle {1}\over{\displaystyle q_n}}}}}}}}$ 


$\displaystyle \sum_{n=1}^{\infty} $

\Big({{}\over{}}\Big)


\cfrac q_1+{{1}\over{{q_2+{{1}\over{{q_3+ {{1}\over{{\cdots +{{1}\over{q_n}}}}}}}}}}}}}\endcfrac

+\cfrac{1}{q_3+ \cfrac{1}{\cdots +\cfrac{1}{q_n}}}}}}}}
