
\input amstex


\magnification=1300


\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\hskp{\hskip1.5in}

\def\lra{$\Leftrightarrow$ }


\ctln{\bf Math 445 Number Theory}

\smallskip

\ctln{November 10, 2004}

\medskip

What can $h_s^2-nk_s^2$ equal?

\ssk


Wherever we choose to stop the continued fraction expansion of 
$\sqrt{n} = [\lfloor\sqrt{n}\rfloor,\overline{a_1,\ldots,a_{m-1},2\lfloor\sqrt{n}\rfloor}]$, 
$\dsl \sqrt{n} = [a_0,\ldots,a_s,\zeta_{s+1}] = [a_0,\ldots,a_s,{{\sqrt{n}+m_s}\over{q_{s+1}}}]$, we find that 

$\dsl \sqrt{n} = 
{{{{\sqrt{n}+m_s}\over{q_{s+1}}}h_s+h_{s-1}}\over{{{\sqrt{n}+m_s}\over{q_{s+1}}}k_s+k_{s-1}}}
= {{(\sqrt{n}+m_s)h_s+q_{s+1} h_{s-1}}\over{(\sqrt{n}+m_s)k_s+q_{s+1}k_{s-1}}}$ . Then

$\sqrt{n}(m_sk_s+q_{s+1}k_{s-1} - h_s) = (m_sk_s + q_{s+1} h_{s-1} - nk_s)$ so both sides 
of this equation are $0$ (otherwise $\sqrt{n}$ is rational!), so
$h_s=m_sk_s+q_{s+1}k_{s-1}$ and $nk_s=m_sk_s + q_{s+1} h_{s-1}$ Then

\ssk

\crr{$h_s^2-nk_s^2 = h_s(m_sk_s+q_{s+1}k_{s-1})-k_s(m_sk_s + q_{s+1} h_{s-1}) 
= q_{s+1}(h_sk_{s-1})-h_{s-1}k_s) = (-1)^{s-1}q_{s+1}$ . }

\ssk

So the only $N$ with $|N|\leq \sqrt{n}$ for which $x^2-ny^2=N$
can be solved are (squares and) those for which $N = (-1)^{s-1}q_{s+1}$ where 
$\dsl \zeta_{s+1} = {{\sqrt{n}+m_{s}}\over{q_{s+1}}}$ . 

Focusing on $N=1$, note that since $\dsl \zeta_0={{\sqrt{n}+\lfloor\sqrt{n}\rfloor}\over{1}}$, 
$m_0=\lfloor\sqrt{n}\rfloor$
and $q_1=1$ . Then since $\zeta_0=\zeta_m=\zeta_{2m} = \cdots$ , we have
$q_{mt+1} = 1$ for all $t\geq 0$. 
So $h_{m-1}^2-nk_{m-1}^2 = (-1)^m$ . 

If $m$ is even, then we have found a solution to
$x^2-ny^2=1$ . If $m$ is odd, then apply the same reasoning, except with \underbar{two}
periods of the continued fraction: 
$\sqrt{n} = [a_0,\ldots,a_{m-1},a_m,\ldots,a_{2m-1},\sqrt{n}+a_0]$, and the same argument shows
that $h_{2m-1}^2-nk_{2m-1}^2 = (-1)^{2m} = 1$ . In general, taking $t$ periods, we get
\crr{$h_{tm-1}^2-nk_{tm-1}^2 = (-1)^{tm}$} . So we have shown that $x^2-ny^2=1$ always has a solution;
$x=h_{2m-1}, y=k_{2m-1}$ where $m$ = the period of the continued fraction of $\sqrt{n}$ , will
always work.

\msk

This is best illustrated with an example! Taking $n=19$, we have

$a_0=4$ , $\dsl x_0=\sqrt{19}-4, \zeta_1 = {{\sqrt{19}+4}\over{3}}$ , 

\hskp $a_1=2$ , $\dsl x_1={{\sqrt{19}-2}\over{3}}, \zeta_2 = {{\sqrt{19}+2}\over{5}}$ , 

$a_2=1$ , $\dsl x_2={{\sqrt{19}-3}\over{5}}, \zeta_3 = {{\sqrt{19}+3}\over{2}}$ ,

\hskp $a_3=3$ , $\dsl x_3={{\sqrt{19}-3}\over{2}}, \zeta_4 = {{\sqrt{19}+3}\over{5}}$ ,

$a_4=1$ , $\dsl x_4={{\sqrt{19}-2}\over{5}}, \zeta_5 = {{\sqrt{19}+2}\over{3}}$ ,

\hskp $a_5=2$ , $\dsl x_5={{\sqrt{19}-4}\over{3}}, \zeta_6 = {{\sqrt{19}+4}\over{1}}$ ,

$a_6=8$ , $\dsl x_6=\sqrt{19}-4 = x_0$ , and we can compute

\ssk

$h_0=4, h_1=9, h_2=13, h_3=48, h_4=61, h_5=170, h_6=1421, \ldots$

$k_0=1, k_1=2, k_2=3, k_3=11, k_4=14, k_5=39, k_6=325, \ldots$

\ssk

From our analysis above, $(h_5)^2-19(k_5)^2= (-1)^6=1$ , so
$(170,39)$ is a solution to $x^2-19y^2=1$ . Also, the values of $(-1)^{s-1}q_{s+1}$
are $-3, 5, -2, 5, -3, 1, -3, 5, -2, 5, \ldots$, so among $-4, -3, \ldots, 3, 4$ , the only $N$
for which $x^2-19y^2=N$ has a solution are $N=-3,-2,$ and 1 (and 4, because it is a perfect
square).  By continuing to compute
convergents, we can find infnitely many solutions for each such equation.

\vfill\end


\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}}}}}}}}
