J
OURNAL DE
T
HÉORIE DES
N
OMBRES DE
B
ORDEAUX
K
EITH
M
ATTHEWS
The diophantine equation ax
2+ bxy + cy
2= N,
D
= b
2− 4ac > 0
Journal de Théorie des Nombres de Bordeaux, tome
14, n
o1 (2002),
p. 257-270
<http://www.numdam.org/item?id=JTNB_2002__14_1_257_0>
© Université Bordeaux 1, 2002, tous droits réservés.
L’accès aux archives de la revue « Journal de Théorie des Nombres de Bordeaux » (http://jtnb.cedram.org/) implique l’accord avec les condi-tions générales d’utilisation (http://www.numdam.org/conditions). Toute uti-lisation commerciale ou impression systématique est constitutive d’une infraction pénale. Toute copie ou impression de ce fichier doit conte-nir la présente mention de copyright.
Article numérisé dans le cadre du programme Numérisation de documents anciens mathématiques
The
Diophantine equation
ax2
+
bxy
+
cy2 = N,
D = b2 -
4ac
>0
par KEITH MATTHEWS
RÉSUMÉ. Nous revisitons un
algorithme
dû àLagrange,
basé sur ledéveloppement
en fraction continue, pour résoudrel’équation
ax2 +bxy
+cy2
= N en les entiers x, ypremiers
entre eux, oùN ~
0,
pgcd(a,
b,
c)
=pgcd(a, N)
=1 et D = b2 - 4ac > 0 n’estpas un carré.
ABSTRACT. We make more accessible a
neglected simple
contin-ued fraction based
algorithm
due toLagrange,
fordeciding
thesolubility
of ax2 +bxy
+cy2
= N inrelatively
prime
integers
x,y,
where
N ~
0,gcd(a,
b,
c)
=gcd(a, N)
=1 and D = b2 - 4ac > 0 isnot a
perfect
square. In the case ofsolubility,
solutions with least positive y, from eachequivalence class,
are also constructed.Our paper is a
generalisation
of an earlier paperby
the authoron the
equation x2 - Dy2
= N. As in that paper, we use alemma on unimodular matrices that
gives
a muchsimpler proof
thanLagrange’s
for thenecessity
of the existence of a solution.Lagrange
did not discuss anexceptional
case which can arise when D = 5. This was doneby
M. Pavone in1986,
when N =±03BC,
where 03BC =
min(x,y)~(0,0) |ax2+bxy+cy2l.
Weonly
need thespecial
case 03BC =1 of his result and
give
a self-containedproof,
using
our unimodular matrixapproach.
1. Introduction The standard
approach
tosolving
theequation
in
relatively
prime
integers
x, y, is via reduction ofquadratic forms,
as inMathews
([6,
p97]).
There is aparallel approach
in Faisant’s book([2,
pp106-113])
which uses continued fractions.However,
in a memoir of1770,
Lagrange
([11,
OeuvresII,
pp655-726]),
gave a more direct method forsolving
(l.l)
whengcd(a,
b,
c)
=gcd(a, N) =
1 and D =
b2 -
4ac > 0 is not aperfect
square. This paper seems to havebeen
largely
overlooked.(Admittedly,
thenecessity
part
of hisproof
islong
and not easy tofollow.)
M. Pavone
([10,
p271])
solved(1.1)
when N = whereHe had
essentially
solved( 1.1 )
ingeneral,
asLagrange
showed how toreduce the
problem
to the case N = ~1.(See (4.2)
and(4.6)).
Strangely
Pavone made no mention ofLagrange’s
paper,referring
insteadto Serret
([12,
p80]),
who had earlier drawn attention to thepossibility
ofan
exceptional
case.A.
Nitaj
has also discussed theequation
in histhesis,
([9,
pp57-88]),
using
a standardconvergent
sufficiency
condition ofLagrange,
whichre-sulted in a restriction D >
16,
thusmaking rigorous
thenecessity
part
ofLagrange’s
discussion.Nitaj
discussedonly
the case b = 0 indetail, along
the lines of Cornacchia(~l,
pp66-70])~
Our contribution in this paper is to use the
convergent
criterion of Lemma2,
which results in no restriction onD,
whileallowing
us to deal with thenon-convergent
case, withouthaving
toappeal
to the case p =1 ofPavone,
whoseproof
is somewhatcomplicated.
The continued fractions
approach
also has the attraction that itproduces
the solution(x, y)
with leastpositive y
from eachclass,
ifgcd(a,
N)
=1.Our treatment
generalises
an earlier paperby
the author on theequation
x2 -
Dy2
= N(See
Matthews[7]).
The
assumption
thatgcd(a, N)
= 1 involves no loss ofgenerality.
For aspointed
outby
Gauss in hisDisquisitiones
(see
[3,
p221]
(also
see Lemma2 of Hua
[5,
pp311-312]),
there existrelatively
prime
integers
such thataa2
+ba,
+cy2
=A,
wheregcd (A, N) =
1. Then if a6 -{3,
=1,
the unimodular transformation x = aX +#Y, y
=~yX
+ 6Y convertsax2
+bxy
+cy2
toAX2
+ BXY +CY2.
Also the two formsrepresent
thesame
integers.
2. The structure of the solutions
We outline the structure of the
integer
solutions of( 1.1 )
asgiven
inSkolem
([13,
pp42-45]).
The
primitive
solutions x +of ax2
+bxy
+cy2
= N(i.e.
withgcd(x,
y)
=1)
fall intoequivalence classes,
with x +yVD
and x’ +being
equivalent
if andonly
ifThis is
equivalent
to theequations
It is easy to
verify
that(2.1)
holds if andonly
if thefollowing
congruences hold:Each
primitive
solutiongives
rise to a root n of the congruenceIn fact if
(a, 7)
is a solution of(1.1)
and a6 -,~7
=1,
thenEquivalent
solutionsgive
rise tocongruent
n(mod
Conversely,
primitive
solutions whichgive
rise tocongruent n
(mod
are
equivalent.
This follows from theequations
and congruences
(2.3)
and(2.4).
It is also
straightforward
toverify
that isreplaced by
anequivalent
formAX2
+ BXY +Cy2
under a unimodulartransformation,
then
equivalent
primitive representations
(x, y)
and(x’, y’)
of N map intoequivalent primitive representations
(X, Y)
and(X’, Y’).
In fact the nof
equation
(2.5)
isreplaced by An,
where A is the determinant of the transformation.(See
Gauss[3,
pp130-131].)
3. Some lemmas
Lemma 1. Assume D > 0 is not a
perfect
square andQo I (PO2 -
D).
the n-th
complete
convergent
in thesimples
continuedfraction for x =
(Po
and =QOAn-1 - POBn-1,
wheredenotes a
convergent
to x, thenor
equivalently
Lemma 2.
If w
=I
where
> 1 andP, Q, R, S
areintegers
such thatQ
>0, S
> 0 and PS -QR
=tl,
or S = 0 andQ
= 1 =R,
thenP/Q is
aconvergent
An/Bn
to w. Moreoverif Q ~
S >0,
thenRIS
= + +kBn), k
> 0.Also (+
k is the(n
+l)-th
complete
convergent
to c~. Here k =0 if Q
>S,
while k > 1if
Q
S.Proof.
This is an extension of Theorem172,
Hardy
andWright
([4,
pp140-141)),
who dealt with the caseQ
> S > 0. See Matthews[7,
pp325-326].
0The
following
result is aspecial
case(p( f)
=1)
of a result due to M.Pavone,
[10,
p271].
Pavone’sproof
is rathercomplicated
and wegive
aself-contained
proof using
our Lemma 2 as cases(ii)
and(iii) (c)
of theproof
of Lemma 3 below and in the
Appendix.
Lemma 3.
Suppose
X,
y >0, Q,
n, R areintegers
andwhere D
= n2 -
4QR
> 0 is not aperfect
square. Also let ca= - 2~
andw* _ be the roots
of
QB2
+ R = 0. Then either(i) X/y
is aconvergent
Ai-1IBi-1 to
w(resp. w*)
and if
(Fi
+denotes the i-th
complete
convergent
to w(resp.
w*),
thenQi
=(-1)z2
(resp.
Q,
=l /-l~i+12~~
or(ii)
D =5,
Q
0 andwhere and
As/Bs
denoteconvergents to
w andw*, respectively
andwhere
MoreoverX/y is
not aconvergent
to c.r or cv*.Conversely,
if
(i)
or(ii)
hold,
thenX/y
is a solutionof
(3.3).
Remarks.
(a)
In theAppendix,
we prove that if D = 5 andQ
0,
then r - 1 - s(mod
2)
andthe latter
being
obtaineddirectly by
anappeal
tosymmetry
by
Pavone([10,
p277]).
The
corresponding equations
hold if w isreplaced by w*,
eachAr
isreplaced
by As
and eachBr
isreplaced by
Bs
etc.Consequently,
A,-A,-,
is not aconvergent
to w or w*.Br-Br-i
(c)
If n is even, say n =2P,
then w =(-P
+ and w* _(-P -
where A =p2 -
QR.
If we then denote then-th
complete
convergent
to w(resp. w*)
by
(P~
+ condition(i)
becomesQi
=(-1)z
(resp
Qi
=(-1)z+1).
Proo f . Suppose
(3.3)
holds. Consider the matrixwhere t =
-PX - Ry if n = 2P,
Then in both cases,Also it is
straightforward
toverify
thatwhere
Case
(i).
Suppose QX
+Py
> 0. Then as a >1,
Lemma 2applies
andX/y
is aconvergent
to ar.Case
(ii).
Suppose QX
+Py
= 0. Onsubstituting
forQX
in(3.4),
weget
Hence
Hence
Hence
X/y
=Lw* J
is aconvergent
to c~* ifD ~
5. ,Then
Also
QX2
+(2P
+1)X
+ R = 1 and P= -QX
together
give
Hence
- I - - -,
-and hence
Q
0.Case
(iii) (a)
Suppose QX
+Py
0.Then -(QX
+Py)
> 0 andwhere -a* > 1 if
D ~
5.Hence
X/y
is aconvergent
tow*,
unless D = 5.(b)
If D = 5and -(QX
+Py) >
y, thenand
again
X/y
is aconvergent
to w*by
Lemma 2.In all cases where
X/y
is theconvergent
to cv(resp. w*),
itfollows from
(3.3)
andequation
(3.2)
of Lemma1,
withPo
= -n,Qo
=2Q
(resp.
Po
=n, Qo
=-2Q),
thatand
consequently
(-l)’Q,,
= 2(resp. -2)
in all cases.(c)
Now suppose D = 5 and y> -(QX
+Py)
> 0.Now,
from(3.5),
Lemma 2 tells us thatHence w* =
~ao, ... ,
where s = i + 1and as
= k + 1.Hence (3.6)
gives
Next we prove that
Q
0. We have fromequation
(1.1)),
However
so
and hence
Then
equation
(3.7)
gives Q
0.4. The main result Theorem 1.
Suppose
where
N ~
0,
gcd(x, y) = 1 = gcd(a, N)
and y
> 0 and D =b2 -
4ac > 0is not a
perfect
square.which is not a
convergent
to w or w*. Also aN 0.Conversely,
then
(x,
y),
with x =yO
+INIX,
will be a solution to(4.1),
possibly
im-primitive.
Proof. Suppose
where
gcd (x, y)
= 1 =gcd(a, N)
and y > 0. Thenclearly
gcd(y, I N 1)
= 1. Let x -y8
(mod
andThen
Also
where
Q
=aiNI,
R =(ao2
+ b8 +c)/INI
andn2 -
4QR
= D.The conclusions of the theorem then follow from Lemma
3,
applied
tothe
equation
+n’Xy
+R’y2
=1,
whereQ’
=EQ, n’
= en,R’
= eR5. The
algorithm
Let A =
D/4
if b is even and let the i-thcomplete
convergent
to W orW* be denoted
by
+-,/A-)/Qi
or(Pi
according
as b is even or odd.If
equation
(4.1)
is soluble with x =-y0
(mod
>0,
there will beinfinitely
many solutions because ofequations
(2.2).
It follows that ifw and w* are not
purely periodic,
we needonly
examine the firstperiod
the continued fractions for w and w* to determine
solubility
of(4.1).
For,
with cv(resp. w*)
being
(-P :f:
(resp.
(-(2P
+1)
tVD)/2Q),
theequation
Qi =
(resp.
f2)
will hold forinfinitely
many iby periodicity
and so there will be at least one such i inthe range m i m + l.
Any
such i must haveQi
= 1(resp. 2),
as(Pi
+01) /Qj
(resp. (P~
+ is reduced for i in this range and soQi
> 0. Moreover if I is even, thesign
of ispreserved
fromone
period
to the next. If I isodd,
then the first or secondperiod
willproduce
a solution. If w or w* ispurely periodic,
we must examineQ2,
whichcorresponds
to the thirdperiod.
Moreover there can be at most one i in a
period
for whichQi
= 1(resp.
2).
For ifPi
+ d1 (resp. (Pi
+VD)/2
isreduced,
thenPi
=(resp.
Pi
=2L(VD -1)/2J
+1)
and hence two such occurrences ofQi
= 1(resp.
2)
within aperiod
wouldgive
a smallerperiod.
Hence we have the
following algorithm essentially
due toLagrange,
apart
from
stage
1:1. If
gcd(a, N)
>1,
find a unimodular transformation of thegiven
quadratic
form into one in whichgcd(a, N)
= 1.(See
the lastparagraph
ofthe
Introduction.)
2. Find all solutions 0 of the congruence
(4.3)
in the range 0 0(This
can be done as follows:First
solve t2
=b2 -
4ac(mod
4INt), -INI
t(If
there are nosolutions
t,
then there is noprimitive
solution of(4.1)
corresponding
tot.)
Then solve a8 -
t26
(mod
INI),
0 0For each
0,
let n = 2aO +b,
P =Ln/2j
andQ
=3. For each of the numbers c~ =
(resp.
-~2P2Q+‘~),
test the firstperiod
to see ifQi
= 1(resp.
2)
occurs. If 1 is even, testadditionally
for 1 =
(-I)iN/INI
(resp.
2 = to hold.Similarly
for each of the numbers w* --p- A
(resp.
-~2
, with ireplaced by
i + 1.If D =
5,
testadditionally
to see if aN 0 holds.4. For each 0 and
corresponding
for which test 3succeeds,
find the least i for which the conditionQi
=(resp.
Qi
=holds. If 1 is even, this will occur in or before the first
period,
while if I isodd,
this will occur in or before the secondperiod.
Similarly
for W*.For the
corresponding
convergent
to w orw*,
write X =y =
B$_1.
If D = 5 and aN0,
in relation tow, write X =
Ar -
Ar-l,
y =
Br - Br-i .
Then x =y0
+produces
a solution of(4.1)
with x -y8
(mod IND.
Choose the solution
(x, y)
with lesser ofthe y
values.The
algorithm
willproduce
a solution(x, y)
from eachclass,
with theadditional feature that the least
positive y
ischosen,
if thequadratic
form satisfiesgcd (a, N)
= 1.6.
Examples
Example
1(Gauss,
Article205).
[3,
p189]
As
gcd
(42, 585)
= 3 =gcd (21, 585),
we make a suitable transformationwhich
gives
The latter form has A = 79 and
gcd(2, 585)
= 1.We list the roots of
262
+ 180 + 1 - 0(mod 585)
andcorresponding
values P = 20 + 9:
We find that
only
P = 157 and 1013give
solutions ofequation
(6.1):
(i)
or =(-157
+Jfi) /l170
gives Q3 = l,
A2/B2 = -1/7.
Then y’
= 7and x’
= 7 - 74 - 585 ~ 1 = -67. Hence(x, y) = (74, -141)
is a solution of(6.1).
c~* =
(-157 -
79)/1170
alsogives
the solution(74, -141).
(ii)
c~ =(-1013
+79)/1170
gives
Q2
=1,
AI/ B1
=-6/7.
Then y’
= 7and x’ = 7 - 502 - 585 6 = 4. Hence
(x,
y) = (3,1)
is a solution of(6.1).
w* =
(-1013 -
v’79)/1170
alsogives
the solution(3,1).
In fact Gauss gave solutions
(83, -87)
and(3,1).
In the notation of(2.2),
the solutions
(x,
y) =
(83,
-87)
and(x’, y’)
=(74, -141)
are relatedby
thesolution
(u, v) = (-80, 9)
of the Pellequation
x2 - 79y2
= 1.Summarising:
Example
2.3x2 - 3xy - 2y2
= 202. Here D = 33.The solutions of
392 -
30 - 2 - 0(mod 202)
are39, 63,140,1fi4,
withcorresponding n
values231, 375, 837, 981.
Summarising:
There are 4
equivalence
classes of solutions.Example
3.=19x2 -
85xy
+95y2
= -671. Here D = 5.The solutions of
1982 -
850 + 95 - 0(mod
671)
are443,454,504,515,
with
corresponding n
values16749,17167,19067,19485.
The
exceptional
solutionsgive
the solutions with smallest y:(i) 8
= 443: w =(-16749
+V5)/25498
=[-1,2,1,10,1,1,2, I],
Exceptional
solution: . -- .... _Exceptional
solution:Exceptional
solution:Exceptional
solution:Summarising:
There are 4
equivalence
classes of solutions.7.
Appendix
Lemma 4. LetProof.
We haveand hence
Then
(7.1)
gives
and
(7.2)
and(7.3)
give
Hence
Also
(7.2)
and(7.3)
imply
Hence
It follows from cases
(ii)
and(iii)(c)
in theproof
of Lemma3,
thatand
Acknowledgement
The author is
grateful
to John Robertson forimproving
thepresentation
of the paper.The
algorithm
has beenimplemented
in the author’s numbertheory
cal-culator program
CALC,
available athttp : //www . maths . uq.
edu.au/ ~krm/
References
[1] G. CORNACCHIA, Su di un metodo per la risoluxione in numeri interi dell’ equazione
Chxn-h = P. Giornale di Matematiche di Battaglini 46 (1908), 33-90.
[2] A. FAISANT, L ’equation diophantienne du second degré. Hermann, Paris, 1991.
[3] C. F. GAUSS, Disquisitiones Arithmeticae. Yale University Press, New Haven, 1966.
[4] G. H. HARDY, E. M. WRIGHT, An Introduction to Theory of Numbers, Oxford University
Press, 1962.
[5] L. K. HuA, Introduction to Number Theory. Springer, Berlin, 1982.
[6] G. B. MATHEWS, Theory of numbers, 2nd ed. Chelsea Publishing Co., New York, 1961.
[7] K. R. MATTHEWS, The Diophantine equation x2 - Dy2 = N, D > 0. Exposition. Math. 18 (2000), 323-331.
[8] R. A. MOLLIN, Fundamental Number Theory with Applications. CRC Press, New York,
1998.
[9] A. NITAJ, Conséquences et aspects expérimentaux des conjectures abc et de Szpiro. Thèse,
Caen, 1994.
[10] M. PAVONE, A Remark on a Theorem of Serret. J. Number Theory 23 (1986), 268-278.
[11] J. A. SERRET (Ed.), Oeuvres de Lagrange, I-XIV, Gauthiers-Villars, Paris, 1877.
[12] J. A. SERRET, Cours d’algèbre supérieure, Vol. I, 4th ed. Gauthiers-Villars, Paris, 1877.
[13] T. SKOLEM, Diophantische Gleichungen, Chelsea Publishing Co., New York, 1950. Keith MATTHEWS
Department of Mathematics
University of Queensland 4072 Brisbane, Australia