<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[12pt,reqno]{article}

\usepackage[usenames]{color}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amscd}

\usepackage[colorlinks=true,
linkcolor=webgreen,
filecolor=webbrown,
citecolor=webgreen]{hyperref}

\definecolor{webgreen}{rgb}{0,.5,0}
\definecolor{webbrown}{rgb}{.6,0,0}

\usepackage{color}
\usepackage{fullpage}
\usepackage{float}

\usepackage{psfig}
\usepackage{graphics,amsmath,amssymb}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{epsf}

\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{.1in}
\setlength{\evensidemargin}{.1in}
\setlength{\topmargin}{-.1in}
\setlength{\textheight}{8.4in}

\newcommand{\seqnum}[1]{\href{http://oeis.org/#1}{\underline{#1}}}

\begin{document}

\begin{center}
\epsfxsize=4in
\leavevmode\epsffile{logo129.eps}
\end{center}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{conjecture}[theorem]{Conjecture}

\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}

\begin{center}
\vskip 1cm{\Large\bf Extending Theorems of Serret and Pavone}
\vskip 1cm
Keith R. Matthews\\
School of Mathematics and Physics\\
University of Queensland\\
Brisbane 4072  \\
Australia \\
\href{mailto:keithmatt@gmail.com}{\tt keithmatt@gmail.com}\\
\ \\
John P. Robertson\\
Actuarial and Economic Services Division\\
National Council on Compensation Insurance\\
Boca Raton, FL 33487\\
USA \\
\href{mailto:jpr2718@gmail.com}{\tt jpr2718@gmail.com}\\
\ \\
Anitha Srinivasan\\
Department of Mathematics\\
Saint Louis University-Madrid Campus\\
Avenida del Valle 34\\
28003 Madrid \\
Spain\\
\href{mailto:rsrinivasan.anitha@gmail.com}{\tt rsrinivasan.anitha@gmail.com}\\
\ \\
\end{center}

\vskip .2in
\begin{abstract}
We extend theorems of Serret and Pavone for solving $f(x,y)=ax^2+bxy+cy^2=\mu$, where $a&gt;0$, $\gcd(x,y)=1, y&gt;0$. Here $d=b^2-4ac&gt;0$ is not a perfect square and $0&lt;|\mu|&lt;\sqrt{d}/2$. 
If $\mu&gt;0$, Serret proved that $x/y$ is a convergent to $\rho=(-b+\sqrt{d})/2a$ or $\sigma=(-b-\sqrt{d})/2a$. If $\mu&lt;0$, we  are able to modify Pavone's approach and show that with at most one exception, the solutions are convergents to $\rho$ or $\sigma$.
\end{abstract}

\section{Introduction}
In 1885, Serret \cite{serret} studied the quadratic diophantine equation
\begin{equation}
f(x,y)=ax^2+bxy+cy^2=\mu,\label{eq:1}
\end{equation}
where $a&gt;0, \gcd(a,b,c)=1, d=b^2-4ac$ is positive and nonsquare and $0&lt;|\mu|&lt;\sqrt{d}/2$. 
Serret showed that if $\mu&gt;0$, then any relatively prime solution $(x,y)$ with $y&gt;0$ is a convergent to $\rho=(-b+\sqrt{d})/2a$ or $\sigma=(-b-\sqrt{d})/2a$. However he was unable to deal conclusively with the case $\mu&lt;0$.
This was done by Pavone \cite{pavone} in the special case when $|\mu|=m(f)$ is the least of the absolute values of integers represented by $f$ for integers $x$ and $y$, not both zero. We remark that Lagrange \cite[Thm.\ 86]{dickson} proved $m(f)&lt;\sqrt{d}/2$.  

We modify Pavone's proof when $-\sqrt{d}/2&lt;\mu&lt;0$, to show that either $x/y$ is a convergent to $\rho$ or $\sigma$, or has the form $(p_m-p_{m-1},q_m-q_{m-1})$ or $(P_r-P_{r-1},Q_r-Q_{r-1})$, where
\[
\rho=[a_0,\ldots,a_m,\overline{b_1,\ldots,b_n}], \quad\sigma=[c_0,\ldots,c_r,\overline{d_1,\ldots,d_n}],
\]
where $a_m\neq{}b_n, c_r\neq{}d_n$ and $p_h/q_h$ and $P_k/Q_k$ denote convergents of $\rho$ and $\sigma$, respectively.

Barnes \cite[Lemma 16]{barnes} gave a result that overlaps with Serret's theorem when $a&gt;0&gt;c$.

Finally, we remark that there is a continued fraction algorithm \cite{matthews} for solving \eqref{eq:1}, irrespective of the size of $\mu$. 

\section{Definitions and Lemmas}
\begin{definition}\label{definition:1} We call an indefinite form $g(x,y)=Ax^2+Bxy+Cy^2$ {\em Hermite reduced} if the roots $\theta_1$ and $\theta_2$ of $g(x,1)=0$ satisfy $\theta_1&gt;1$ and $-1&lt;\theta_2&lt;0$. Equivalently, $\theta_1=[\overline{b_1,\ldots,b_n}]$ and $\theta_2=-[0,\overline{b_n,\ldots,b_1}]$, where the $b_i$ are positive integers. See \cite[pp.\ 73--76]{perron}.
\end{definition}
\begin{remark} The term {\em Hermite reduced} was introduced in \cite{gbur}.  Markov had previously used the concept in his Master's dissertation \cite{delone} and \cite{markov}.
\end{remark}
The following sequences were introduced in \cite{gbur} and \cite{pavone}.
\begin{definition}\rm Let $\theta_1=[a_0,a_1,\ldots,]$ and $\theta_2=-[0,a_{-1},a_{-2},\ldots,]$ be as in Definition \ref{definition:1} and let the doubly-infinite sequences  $(S_k), (T_k)$ be defined as follows:
\begin{align}
S_0&amp;=T_{-1}=1,\quad S_{-1}=T_0=0,\notag\\
S_{k+1}&amp;=a_kS_k+S_{k-1},\quad T_{k+1}=a_kT_k+T_{k-1},\quad k\geq0,\label{eq:2}\\
S_{-k-1}&amp;=-a_{-k}S_{-k}+S_{-k+1},\quad T_{-k-1}=-a_{-k}T_{-k}+T_{-k+1},\quad k\geq1.\notag
\end{align}
\end{definition}.

\begin{remark}\label{remark:1} For $k\geq1$, the convergents to $\theta_1$ are given by 
\[
S_k/T_k=A_{k-1}/B_{k-1}=[a_0,\ldots,a_{k-1}].
\]
To determine the convergents to $\theta_2$, we note that
\[
S_{-k-1}/T_{-k-1}=-[0,a_{-1},\ldots,a_{-k}]
\]
and use the following result from \cite{halterkoch}.
\[
\theta_2=\begin{cases}
[-1,1,a_{-1}-1,a_{-2},\ldots], &amp;\text{ if $a_{-1}&gt;1$;}\\
[-1,a_{-2}+1,a_{-3},\ldots], &amp;\text{ if $a_{-1}=1$.}
\end{cases}
\]

Then for $k\geq0$, the convergents to $\theta_2$ are given by
\begin{align}
(A_0,B_0)&amp;=(-1,1)\mbox { and } (A_k,B_k)=(-1)^{k+1}(S_{-k},T_{-k}), k\geq1\mbox{ if } a_{-1}&gt;1,\notag\\
(A_k,B_k)&amp;=(-1)^{k+1}(S_{-k-2},T_{-k-2}), k\geq0,\mbox{ if } a_{-1}=1.\label{eq:(ii)}
\end{align}

We note that for $k\geq1$, $S_{-k-1}$ is positive exactly when $k$ is odd, and $T_{-k-1}$ is negative exactly when $k$ is odd. 
\end{remark}

We now give a simple proof of Serret's theorem.
\begin{proposition} Assume $0 &lt; \mu &lt; \sqrt{d}/2$. Let $(p,q)$ be a relatively prime solution of $f(x,y)=ax^2+bxy+cy^2=\mu$, with $q&gt;0$, where $a&gt;0$. Then $p/q$ is a convergent to $\rho=(-b+\sqrt{d})/2a$ or $\sigma=(-b-\sqrt{d})/2a$.
\end{proposition}
\begin{proof}
 We have
\[
a\biggl(\frac{p}{q}-\rho\biggr)\biggl(\frac{p}{q}-\sigma\biggr)=\frac{\mu}{q^2}.
\]
We cannot have $\sigma &lt; p/q &lt;\rho$. First assume $p/q&gt;\rho$. Then
\begin{align*}
\frac{p}{q}-\rho&amp;=\frac{\mu}{a(\frac{p}{q}-\rho +\rho-\sigma)q^2}\\
                  &amp;&lt;\frac{\sqrt{d}}{2a(\rho-\sigma)q^2}=\frac{1}{2q^2}.
\end{align*}
Hence $p/q$ is a convergent $p_k/q_k, k\geq0$, to $\rho$ by Lagrange \cite[Thm.\ 184]{hw}. There is a similar argument if $p/q&lt;\sigma$.
\end{proof}
We replace Pavone's Lemma $2$ by a more general result:
\begin{lemma}\label{lemma:hermitereduced} Let $g(x,y)$ be a Hermite reduced form $Ax^2+Bxy+Cy^2$, $D=B^2-4AC$ with roots $\theta_1=[\overline{b_1,\ldots,b_n}]$ and $\theta_2=-[0,\overline{b_n,\ldots,b_1}]$ and let $(S_k), (T_k)$ be the sequences defined in \eqref{eq:2}.  Suppose $g(p,q)=\mu$, where $0&lt;|\mu|&lt;\sqrt{D}/2$, with $\gcd(p,q)=1$. Then there exists a $k$ such that
\[
(p,q)=\pm(S_k,T_k).
\]
\end{lemma}
\begin{proof}  If $(p,q)=(\pm1,0)$, we can take $k=0$, whereas if $(p,q)=(0,\pm1)$, we can take $k=-1$. So we assume  $p$ and $q$ are nonzero. Then $p/q$ is a convergent to $\theta_1$ or $\theta_2$.  For if $A$ and $\mu$ have the same sign, the result follows from Serret's theorem.  If $A$ and $\mu$ have opposite signs, then as $A$ and $C$ have opposite sign, $C$ and $\mu$ have the same sign and we instead consider the equation $Cq^2+Bqp+Ap^2=\mu$. We know by Serret's theorem that $q/p$ is a convergent to one of $1/\theta_1$ or $1/\theta_2$, so $p/q$ will be a convergent $A_h/B_h, h\geq0$, to one of $\theta_1$ or $\theta_2$. In the former case, $(p,q)=\pm(S_k,T_k)$ for some $k\geq1$. 
From Remark \ref{remark:1}, the only convergent to $\theta_2$ that is not $S_k/T_k$ is $A_0/B_0=-1/1$, and this occurs when $b_n&gt;1$.  We show that this is impossible here.

We can assume $A&gt;0$ and that $g(-1,1)=\mu$, where $|\mu|&lt;\sqrt{d}/2$.
Then $A(-1-\theta_1)(-1-\theta_2)=\mu$, so $(1+\theta_1)(1+\theta_2)=\mu/A$. Then as $\theta_1&gt;1$ and $-1&lt;\theta_2&lt;0$, we have $\mu&gt;0$. Hence
\[
1+\theta_2=\frac{\mu}{A(1+\theta_1)}&lt;\frac{1}{2},
\]
as $1+\theta_1=1+\theta_2+\theta_1-\theta_2&gt;\theta_1-\theta_2=\sqrt{d}/A$. 
Hence $1/1$ is a convergent to $-\theta_2=[0,\overline{b_n,\ldots,b_1}]$, which means that $b_n=1$.
\end{proof}
We replace Pavone's Lemma $4$ by the following result:
\begin{lemma}\label{lemma:pavonelemma4}  Let $g(x,y)$ be a Hermite reduced form with roots $\theta_1=[\overline{b_1,\ldots,b_n}]$ and $\theta_2=-[0,\overline{b_n,\ldots,b_1}]$. Suppose $b_n&gt;1,b_{n-1}=1$ and that $g(S_{-2},T_{-2}) = \mu$, where $|\mu|&lt;\sqrt{d}/2$. Then $b_{n-2}=1$.
\end{lemma}
\begin{proof} For $1\leq i\leq n$, let
\[
W_i=[\overline{b_i,b_{i+1},\ldots,b_n,b_1,\ldots,b_{i-1}}] + [0,\overline{b_{i-1},\ldots,b_1,b_n,\ldots,b_i}].
\]
Then $W_i=\sqrt{d}/|g(S_{i-1},T_{i-1})$ (see \cite[p.\ 385]{markov}). Hence, as the $W_i$ are periodic with period $n$, we have
\begin{align*}
W_{n-1}&amp;=[b_{n-1},b_n,b_1,\ldots,b_{n-2}]  + [0,b_{n-2},\ldots,b_1,b_n,b_{n-1}]\\
       &amp;=\sqrt{d}/|g(S_{-2},T_{-2})|\\
              &amp;=\sqrt{d}/|\mu| &gt;2.
\end{align*}

Hence if $b_{n-1}=1$, we have
\begin{align*}
W_{n-1}&amp;=[1,b_n,b_1,\ldots,b_{n-2}]  + [0,b_{n-2},\ldots,b_1,b_n,b_{n-1}]\\
       &amp;&lt; 1 + 1/b_n + 1/b_{n-2}.
\end{align*}

 So if $b_n &gt;1$, we have 
\[
2 &lt; W_{n-1} &lt; 1 + 1/b_n + 1/b_{n-2} \leq 1 + 1/2 + 1/b_{n-2}.
\]
Hence  $1/2 &lt; 1/b_{n-2}$ and so $b_{n-2} &lt;2$, giving $b_{n-2} = 1$.
\end{proof}
The next result is due to Pavone \cite{pavone}.
\begin{lemma}\label{lemma:pavonelemma5}
Let $f(x,y)=ax^2+bxy+cy^2$ and let $\rho=[a_0,\ldots,a_m,\overline{b_1,\ldots,b_n}]$ and $\sigma=[c_0,\ldots,c_r,\overline{d_1,\ldots,d_n}]$ be the roots of $f(x,1)=0$.  Also let
 $p_h/q_h$ and $P_h/Q_h$ denote the convergents of $\rho$ and $\sigma$, respectively. We do not
 require the periods to have minimal lengths, but assume $m$ and $r$ are minimal, i.e., $a_m\neq b_n$ and $c_r\neq d_n$. It is also convenient to assume $n \geq 4$.

Let $\theta_1=[\overline{b_1,\ldots,b_n}],\theta_2=-[0,\overline{b_n,\ldots,b_1}]$ and let $S_k, T_k$ be the sequences \eqref{eq:2} for $\theta_1$ and $\theta_2$.  Then

\begin{equation}
\biggl(\begin{array}{cc}p_m &amp; p_{m-1}\\
                       q_m &amp; q_{m-1}\end{array}\biggr)
\biggl(\begin{array}{c}S_k\\
                      T_k
\end{array}\biggr)=
\biggl(\begin{array}{c}p_{m+k}\\
                      q_{m+k}
\end{array}\biggr), \quad k\geq-1.\label{eq:3}
\end{equation}

Moreover, there exists $i, 1\leq i\leq 3$, such that
\begin{equation}
\sigma=[c_0,\ldots,c_r,\overline{b_{n-i},\ldots,b_1,b_n,b_{n-1},\ldots,b_{n-i+1}}],\label{eq:4}
\end{equation}
and
\begin{equation}
\biggl(\begin{array}{cc}p_m &amp; p_{m-1}\\
                       q_m &amp; q_{m-1}\end{array}\biggr)
\biggl(\begin{array}{c}S_{-k}\\
                      T_{-k}
\end{array}\biggr)=\pm
\biggl(\begin{array}{c}P_{r+k-(i+1)}\\
                      Q_{r+k-(i+1)}
\end{array}\biggr), \quad k\geq i.\label{eq:5}
\end{equation}
Also $i=3$ implies $b_{n-1}=1$, while $b_n=b_{n-1}=1$ implies $i=3$.
\begin{remark} A list of the possible continued fraction expansions \eqref{eq:4} for $\sigma$ is given at \cite{appendix}.
\end{remark}
\end{lemma}
\section{Extending Pavone's theorem}
\begin{theorem}\label{theorem:pavone} Let $f(x,y)=ax^2+bxy+cy^2, a&gt;0, d=b^2-4ac&gt;0$ and not square.  Let $p$ and $q&gt;0$ be relatively prime integers, such that $f(p,q)=\mu$.  Let the roots of $f(x,1)=0$ be $\rho =[a_0,\ldots,a_m,\overline{b_1,\ldots,b_n}]$ and $\sigma=[c_0,\ldots,c_r,\overline{d_1,\ldots,d_n}]$, where $a_m\neq b_n$ and $c_r\neq d_n$. Let the convergents of $\rho$ and $\sigma$ be denoted by $p_h/q_h$ and $P_h/Q_h$, respectively.
\begin{enumerate}
\item[(i)] If $0&lt;\mu&lt;\sqrt{d}/2$, then $p/q$ is a convergent to $\rho$ or $\sigma$.
\item[(ii)] If $-\sqrt{d}/2&lt;\mu&lt;0$, then $p/q$ is a convergent to $\rho$ or $\sigma$, or
\begin{equation}
(p,q)=(p_m-p_{m-1},q_m-q_{m-1})\mbox{ or }(P_r-P_{r-1},Q_r-Q_{r-1}).\label{eq:exceptional}
\end{equation}
\end{enumerate}
\end{theorem}
\begin{proof}  We assume $f(p,q)=ap^2+bpq+cq^2=\mu$, where $0&lt;|\mu|&lt;\sqrt{d}/2$ and $\gcd(p,q)=1$.  We follow Pavone's argument closely and define $g(x,y)$ by 
\[
g(x,y)=f(p_mx+p_{m-1}y, q_mx+q_{m-1}y).
\]
Then $g$ is Hermite reduced with roots $\theta_1=[\overline{b_1,\ldots,b_n}]$ and $\theta_2=-[0,\overline{b_n,\ldots,b_1}]$ and with sequences $S_k, T_k$ for $\theta_1$ and $\theta_2$ defined in \eqref{eq:2}.   Define integers $\alpha$ and $\beta$ by 
\[
p_m\alpha+p_{m-1}\beta=p,\quad q_m\alpha+q_{m-1}\beta=q.
\]
Then $g(\alpha,\beta)=\mu$ and by Lemma \ref{lemma:hermitereduced}, there exists an integer 
$k$ such that $(\alpha,\beta)=\pm(S_k,T_k)$. Hence
\[
\biggl(\begin{array}{cc}
p\\
q
\end{array}\biggr)
=\pm\biggl(\begin{array}{cc}
p_m &amp; p_{m-1}\\
q_m &amp; q_{m-1}
\end{array}\biggr)
\biggl(\begin{array}{cc}
S_k\\
T_k
\end{array}\biggr).
\]
Let $i$ be the integer satisfying equations \eqref{eq:4} and \eqref{eq:5}.  If $i=1$ or $2$, then by \eqref{eq:3} and \eqref{eq:5} 
\[
\biggl(\begin{array}{cc}
p\\
q
\end{array}\biggr)
=\pm\biggl(\begin{array}{cc}
p_h\\
q_h
\end{array}\biggr)
\mbox{ or }
\pm\biggl(\begin{array}{cc}
P_h\\
Q_h
\end{array}\biggr)
\]
for some $h$, and $p/q$ is a convergent to $\rho$ or $\sigma$.  If $i=3$, then the pair $\biggl(\begin{array}{cc}
S_k\\
T_k
\end{array}\biggr)$ occurs in \eqref{eq:3} or \eqref{eq:5} for all $k\neq-2$.  Hence either $p/q$ is a convergent to $\rho$ or $\sigma$, or 
\[
\biggl(\begin{array}{cc}
p\\
q
\end{array}\biggr)
=\pm\biggl(\begin{array}{cc}
p_m &amp; p_{m-1}\\
q_m &amp; q_{m-1}
\end{array}\biggr)
\biggl(\begin{array}{cc}
S_{-2}\\
T_{-2}
\end{array}\biggr)=\pm\biggl(\begin{array}{cc}
p_m &amp; p_{m-1}\\
q_m &amp; q_{m-1}
\end{array}\biggr)
\biggl(\begin{array}{cc}
1\\
-b_n
\end{array}\biggr)
\]
and 
\[
(p,q)=\pm(p_m-b_np_{m-1},q_m-b_nq_{m-1}). 
\]

However we can interchange $\rho$ and $\sigma$ and similarly deduce that 
\[
(p,q)=\pm(P_r-b_{n-2}P_{r-1},Q_r-b_{n-2}Q_{r-1}).
\]

If $b_n=1$, we have $q_m-b_nq_{m-1}=q_m-q_{m-1}&gt;0$ and
\[
(p,q)=(p_m-p_{m-1},q_m-q_{m-1}). 
\]

If $b_n&gt;1$, then $b_{n-1}=1$ by Lemma \ref{lemma:pavonelemma5}, and as $g(S_{-2},T_{-2})=\mu$, it follows from Lemma \ref{lemma:pavonelemma4} that $b_{n-2}=1$.  Hence $Q_r-b_{n-2}Q_{r-1}=Q_r-Q_{r-1}&gt;0$ and
\[
(p,q)=(P_r-P_{r-1},Q_r-Q_{r-1}).
\]
\end{proof}

\begin{definition} A solution $(p,q)$ of \eqref{eq:1} with $\gcd(p,q)=1$ and $q&gt;0$ that is not a convergent to $\rho$ or $\sigma$ is called an {\em exceptional} solution. 

\begin{remark}\label{remark:index} From the above proof, we see that if a solution is given by a convergent $p_k/q_k$ to $\rho$, then $k\geq m-1$. Similarly, if a solution is given by a convergent $P_j/Q_j$ to $\sigma$, then $j\geq r-1$.  
\end{remark}
\end{definition}

\section{Fundamental solutions} We need some definitions and lemmas associated with the diophantine equation
\begin{equation}
ax^2+bxy+cy^2=\mu.\label{eq:6}
\end{equation}

The integer solutions  of \eqref{eq:6} divide into equivalence classes under the relation
 $(x_1, y_1)$ and $(x_2, y_2)$ are equivalent if and only if
\[
x_2=\frac{x_1(u-bv)}{2}-cvy_1,\quad y_2=\frac{y_1(u+bv)}{2}+avx_1,
\]
where $u$ and $v$ are integers satisfying $u^2-dv^2=4$.
\begin{definition}\rm A \emph{fundamental} solution $(u,v)$ of a class of solutions $K$ of \eqref{eq:6}, is one where $v$ has least non-negative value when $(u,v)$ belongs to $K$. Let $u'=-(au+bv)/a$ be the conjugate solution to $u$. If $u'$ is not integral, or if $(u',v)$ is not equivalent to $(u,v)$, this determines $(u,v)$. If $u'$ is integral and $(u',v)$ is equivalent to $(u,v)$, where $u\neq u'$, we choose $u&gt;u'$.  There are finitely many equivalence classes, each indexed by a fundamental solution.  
\end{definition}
Reference \cite{mrs} contains more information about the fundamental solutions.
\begin{lemma}\label{lemma:equivalence} {\rm (\cite[p.\ 383]{stolt})}. Solutions $(x_1,y_1)$ and $(x_2,y_2)$ of \eqref{eq:6} are equivalent if and only if $x_1y_2-x_2y_1\equiv0$ ({\rm mod} $|\mu|$).
\end{lemma}
We find the fundamental solutions when $|\mu|&lt;\sqrt{d}/2$, by examining the continued fractions for $\rho$ and $\sigma$. It can be proved that the different classes will be represented in the first period (and second period if the period is odd). We first check to see if an exceptional solution exists. Then we examine the the convergents $p_m/q_m,\ldots$ and $P_r/Q_r,\ldots$ of the first period of $\rho$ and $\sigma$, and additionally the second period, if the period-length is odd, using the equations
\[
aA_{n-1}^2+bA_{n-1}B_{n-1}+cB_{n-1}^2=
\begin{cases}
(-1)^nQ_n/2, &amp; \text{ with $\rho=(-b+\sqrt{d})/2a$;}\\
(-1)^{n+1}Q_n/2, &amp; \text{ with $\sigma=(-b-\sqrt{d})/2a$,}
\end{cases}
\]
to check if for $\rho$, we have $\mu=(-1)^nQ_n/2$, or for $\sigma$, we have $\mu=(-1)^{n+1}Q_n/2$. 

We then use Lemma \ref{lemma:equivalence} to test for equivalence of solutions using $(p_{m-1},q_{m-1}),(P_{r-1},Q_{r-1})$ and any exceptional solution.
\begin{proposition} If $(p,q)$ is an exceptional solution of \eqref{eq:1}, then it is a fundamental solution if $|\mu|&gt;1$.
\begin{proof} Suppose $(p,q)$ is an exceptional solution of \eqref{eq:1}.  Then from the proof of Theorem \ref{theorem:pavone}, we have
\[
(p,q)=(p_m-b_np_{m-1},q_m-b_nq_{m-1})=(P_r-b_{n-2}P_{r-1},Q_r-b_{n-2}Q_{r-1}).
\]
We have to compare $(p,q)$ with the convergents $p_h/q_h$ and $P_k/Q_k$ of $\rho$ and $\sigma$ that give solutions of \eqref{eq:1}.  By Remark \ref{remark:index}, we know that $h\geq m-1$ and $k\geq r-1$.

Now $q=q_m-b_nq_{m-1}&lt;q_m\leq q_k$ if $k\geq m$ and 
$q=Q_r-b_{n-2}Q_{r-1}&lt;Q_r\leq Q_j$ if $j\geq r$. Also $(p,q)$ is not equivalent to $(p_{m-1},q_{m-1})$ or $(P_{r-1},Q_{r-1})$ if $|\mu|&gt;1$.  For 
\begin{align*}
(p,q)\sim (p_{m-1},q_{m-1})
     &amp;\iff p_{m-1}(q_m-b_nq_{m-1})-q_{m-1}(p_m-b_np_{m-1})\equiv0\pmod{|\mu|}\\
     &amp;\iff p_{m-1}q_m-q_{m-1}p_m\equiv0\pmod{|\mu|}\\
     &amp;\iff (-1)^m\equiv0\pmod{|\mu|}.
\end{align*}
Similarly with $(P_{r-1},Q_{r-1})$.
\end{proof}
\end{proposition}
\begin{remark} If $\mu=-1$, the situation is more complicated. For example, the equation $x^2+xy-y^2=-1$ has one solution class, with fundamental solution $(0,1)$ and an exceptional solution $(-1,1)$.
\end{remark}
\section{Examples}
\begin{example} Consider the equation $x^2+xy-100y^2=-10$. Here $d=401,|\mu|=10&lt;\sqrt{d}/2$.  Also
\[
\rho=(-1+\sqrt{401})/2=[9,\overline{1,1,19}],\quad\sigma=(-1-\sqrt{401})/2=[-11,2,\overline{19,1,1}].
\]

The double periods for $\rho$ and $\sigma$ give the solutions
\begin{figure}[h]
\centering
\begin{tabular}{|l|l|}\hline
$(p_0,q_0)=(9,1)$ &amp; $(P_3,Q_3)=(-431,41)$\\\hline
$(p_4,q_4)=(390,41)$ &amp; $(P_5,Q_5)=(-16410,1561)$\\\hline
\end{tabular} 
\end{figure}

Also $(-10,1)=(P_1-P_0,Q_1-Q_0)$ is an exceptional solution, where $P_1/Q_1=-21/2$ and 
$P_0/Q_0=-11/1$;  also neither $(p_{m-1},q_{m-1})=(p_{-1},q_{-1})=(1,0)$ nor $(P_{r-1},Q_{r-1})=(P_0,Q_0)=(-11,1)$ is a solution of $x^2+xy-100y^2=-10$. We also have
\begin{align*}
(9,1)\sim(-431,41)&amp;\not\sim(-10,1),\\
(390,41)\sim(-16410,1561)&amp;\sim(-10,1). 
\end{align*}

Hence the fundamental solutions are $(9,1)$ and $(-10,1)$, and the complete solution is 
\begin{alignat}{2}
x&amp;=(9u+191v)/2;     &amp;x&amp;=(-10u+210v)/2,\\
y&amp;=(u+19v)/2;\qquad &amp;y&amp;=(u-19v)/2,
\end{alignat}
where $u^2-401v^2=4$.
\end{example}

\begin{example} Consider the equation $69x^2+71xy+15y^2=-13$. Here $d=901,|\mu|=13&lt;\sqrt{d}/2$. Then
\begin{align*}
\rho&amp;=(-71+\sqrt{901})/138=[-1,1,2,\overline{2,1,2,1,1,1,1}],\\
\sigma&amp;=(-71-\sqrt{901})/138=[-1,3,\overline{1,2,1,2,1,1,1}],
\end{align*}

and we have the exceptional solution
\[
(-1,2)=(P_1-P_0,Q_1-Q_0)=(p_2-p_1,q_2-q_1),
\]
where $P_1/Q_1=-2/3, P_0/Q_0=-1/1$ and $p_2/q_2=-1/3, p_1/q_1=0/1$.

The double periods for $\rho$ and $\sigma$ give the solutions
\begin{figure}[ht]
\centering
\begin{tabular}{|l|l|}\hline
$(p_6,q_6)=(-11,37)$ &amp; $(P_7,Q_7)=(-71,97)$\\\hline
$(p_{14},q_{14})=(-1141,3842)$ &amp; $(P_{13},Q_{13})=(-2461,3362)$\\\hline
\end{tabular} 
\end{figure}

Also neither $(p_{m-1},q_{m-1})=(p_1,q_1)=(0,1)$ nor $(P_{r-1},Q_{r-1})=(P_0,Q_0)=(-1,1)$ 
is a solution of $69x^2+71xy+15y^2=-13$ and 

\begin{align*}
(-11,37)\sim(-71,97)&amp;\not\sim(-1,2),\\
(-1141,3842)\sim(-2461,3362)&amp;\sim(-1,2). 
\end{align*}

Hence the fundamental solutions are $(-1,2)$ and $(-11,37)$, and the complete solution is given by
\begin{alignat}{2}
x&amp;=(-u+11v)/2;\qquad &amp; x&amp;=(-11u-329v)/2,\\
y&amp;=(2u+4v)/2;\qquad   &amp; y&amp;=(37u+1109v)/2,
\end{alignat}
where $u^2-901v^2=4$.
\end{example}

\begin{example} Consider the equation $2x^2+5xy+y^2=-2$. Here $d=17, |\mu|=2&lt;\sqrt{d}/2$. Then
\[
\rho=(-5+\sqrt{17})/4=[-1,\overline{1,3,1}],\quad\sigma=(-5-\sqrt{17})/4=[-3,1,2,\overline{1,1,3}].
\]

There is no exceptional solution, as $i=2$ here.

The double periods for $\rho$ and $\sigma$ give the solutions

\begin{figure}[H]
\centering
\begin{tabular}{|l|l|}\hline
$(p_0,q_0)=(-1,1)$ &amp; $(P_3,Q_3)=(-9,4)$\\\hline
$(p_2,q_2)=(-1,4)$ &amp; $(P_5,Q_5)=(-57,25)$\\\hline
\end{tabular} 
\end{figure}

Also $(p_{m-1},q_{m-1})=(p_{-1},q_{-1})=(1,0)$ and $(P_{r-1},Q_{r-1})=(P_1,Q_1)=(-2,1)$ are not solutions of $2x^2+5xy+y^2=-2$. We also have
\begin{align*}
(-1,1)\sim(-57,25)&amp;\not\sim(-1,4)\sim(-9,4).
\end{align*}

Hence the fundamental solutions are $(-1,1)$ and $(-1,4)$ and the complete solution is given by
\begin{alignat}{2}
x&amp;=(-u+3v)/2;\qquad &amp; x&amp;=(-u-3v)/2,\\
y&amp;=(u+v)/2;\qquad   &amp; y&amp;=(4u+16v)/2,
\end{alignat}
where $u^2-17v^2=4$.

If instead we consider the equation $2x^2+5xy+y^2=-1$, again there are no exceptional solutions.  Also the double periods for $\rho$ and $\sigma$ now give the solutions
\begin{figure}[ht]
\centering
\begin{tabular}{|l|l|}\hline
$(p_4,q_4)=(-2,9)$ &amp; $(P_1,Q_1)=(-130,57)$\\\hline
\end{tabular} 
\end{figure}

Here $(P_{r-1},Q_{r-1})=(P_1,Q_1)=(-2,1)$ is a solution of  $2x^2+5xy+y^2=-1$, whereas $(p_{m-1},q_{m-1})=(p_{-1},q_{-1})=(1,0)$ is not a solution.  Also
\[
(-2,9)\sim(-130,57)\sim(-2,1).
\]

Hence the fundamental solution is $(-2,1)$ and the complete solution is given by
\[
x=-u+4v,\quad y=(u-3v)/2,
\]
where $u^2-17v^2=4$.
\end{example}
\begin{thebibliography}{xx}
\bibitem{barnes} E. S. Barnes,
The minimum of the product of two values of a quadratic form (I),
{\it J. London Math. Soc.} (2) {\bf 1} (1951) 257--283.

\bibitem{delone} B. N. Delone,
{\em The St.\ Petersburg School of Number Theory\/},
History of Mathematics {\bf 26}, Amer. Math. Soc., 2005.

\bibitem{dickson} L. E. Dickson,
{\em Introduction to the Theory of Numbers\/},
Dover, 1957.

\bibitem{gbur} M. E. Gbur,
The Markoff spectrum and minima of indefinite binary quadratic forms,
\textit{Proc. Amer. Math. Soc.} {\bf 63} (1977) 17--22.

\bibitem{halterkoch} F. Halter--Koch,
Principal ideals in quadratic orders, continued fractions and Diophantine equations,
\textit{J. Comb. Number Theory} {\bf 6} (2014) 17--30.

\bibitem{hw} G. H. Hardy and E. M. Wright,
{\em An Introduction to Theory of Numbers\/},
Oxford University Press, 1962.

\bibitem{markov} A. A. Markov,
Sur les formes binaires ind\'efinies,
\textit{Math. Ann.} {\bf 15} (1879) 381--406.

\bibitem{matthews} K. R. Matthews,
The Diophantine equation $ax^2+bxy+cy^2=N, D=b^2-4ac&gt;0$,
\textit{J. Th\'{e}or. Nombres Bordeaux} {\bf 14} (2002) 257--270.

\bibitem{appendix} K. R. Matthews,
On the continued fractions of
conjugage quadratic irrationalities,
\url{http://www.numbertheory.org/pdfs/appendix.pdf}.

\bibitem{mrs} K. R. Matthews, J. P. Robertson, and A. Srinivasan,
On fundamental solutions of binary quadratic form equations,
\textit{Acta Arith.} {\bf 169} (2015) 291--299.

\bibitem{pavone} M. Pavone,
A remark on a theorem of Serret,
\textit{J. Number Theory} {\bf 23} (1986) 268--278.

\bibitem{perron} O. Perron,
{\em Die Lehre von den Kettenbr\"{u}chen\/},
Band 1, B. G. Teubner, 1954.

\bibitem{serret} J. A. Serret,
{\em Cours d'Alg{\`e}bre sup{\'e}rieure}, Tome 1, Gauthier-Villars, 1885.

\bibitem{stolt} B.~Stolt,
On a Diophantine equation of the second degree, 
\textit{Ark. Mat.} {\bf 3} (1957) 381--390.

\end{thebibliography}


\bigskip
\hrule
\bigskip

\noindent 2000 {\it Mathematics Subject Classification}:
Primary 11A55; Secondary 11A70, 11D09.

\noindent \emph{Keywords: } quadratic diophantine equation, indefinite binary quadratic form, continued fraction, convergent, fundamental solution.

\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received July 18 2017;
revised version received  September 16 2017.
Published in {\it Journal of Integer Sequences}, October 29 2017.

\bigskip
\hrule
\bigskip

\noindent
Return to
\htmladdnormallink{Journal of Integer Sequences home page}{http://www.cs.uwaterloo.ca/journals/JIS/}.
\vskip .1in


\end{document}

                                                                                

</pre></body></html>