binary.ps
-
Upload
openidaepklajc -
Category
Documents
-
view
215 -
download
0
description
Transcript of binary.ps
Binary and Ternary Quadrati Forms
S. E. Payne
February 4, 2000
1 The Dis riminant of a Binary Quadrati
Form
Let A =
a b=2
b=2
!
and B = A + A
T
=
2a b
b 2
!
, where a; b; 2 Z.
Put
f(x; y) = (x; y)A
x
y
!
= ax
2
+ bxy + y
2
: (1)
Then f(x; y) is a binary quadrati form over Z. The dis riminant of
f(x; y) is de�ned to be
dis (f) = d = b
2
� 4a = �det(B) = �4det(A): (2)
An easy omputation shows that
4af(x; y) = (2ax + by)
2
� dy
2
: (3)
Theorem 1.1 f(x; y) fa tors over Q if and only if f(x; y) fa tors over Z if
and only if its dis riminant d is a square in Z.
Proof: First suppose that
f(x; y) = (Cx +Dy)(Ex+ Fy)
= CEx
2
+ (CF +DE)xy +DFy
2
; (4)
1
with C;D;E; F 2 Z. Then d = (CF + DE)
2
� 4CDEF = (CF � DE)
2
.
Hen e if f(x; y) fa tors over Z its dis riminant is a square.
Conversely, if d = D
2
, from Eq. 3 we see that
f(x; y) =
(2ax+ (b�D)y)(2ax+ (b+D)y)
4a
= a(x� r
1
y)(x� r
2
y); (5)
where r
i
=
�(b�D)
2a
2 Q. Here ar
1
r
2
= 2 Z. It follows that there are integers
h
1
; h
2
for whi h h
1
h
2
= a, h
1
r
1
2 Z, h
2
r
2
2 Z. Hen e
f(x; y) = (h
1
x� h
1
r
1
y)(h
2
x� h
2
r
2
y) fa tors over Z: (6)
Theorem 1.2 Suppose d is not a square, so in parti ular a 6= 0. Then
f(x; y) = 0 if and only if x = y = 0.
Proof: Here 0 = f(x; y) if and only if 0 = 4af(x; y) = (2ax + by)
2
� dy
2
if and only if dy
2
= (2ax + by)
2
. Sin e d is not a square, this last equation
an hold if and only if y = 0 and 2ax = 0, i.e., x = 0 (sin e a 6= 0).
positive de�nite The binary quadrati form f(x; y) is de�ned to be positive
de�nite provided f(x; y) > 0 whenever (x; y) 6= (0; 0).
positive semide�nite If f(x; y) � 0 for all (x; y) 2 Z � Z, we say f is
positive semide�nite.
If >; � are repla ed with <; �, respe tively, in the above de�nitions,
we obtain the de�nitions of negative de�nite and negative semide�nite,
respe tively.
inde�nite If f(x; y) yields both positive and negative values as (x; y) ranges
over Z � Z we say f is inde�nite.
2
Theorem 1.3 Let f(x; y) = ax
2
+ bxy+ y
2
be a binary quadrati form over
Z with dis riminant d. Then
d > 0 =) f is inde�nite;
(7)
d = 0 =) f is semide�nite (and NOT de�nite); (8)
(9)
d < 0 =) f is de�nite.
Proof: Case 1. d > 0. Here f(1; 0) = a, f(b;�2a) = �ad. So f(1; 0)
and f(b;�2a) have opposite signs unless a = 0. Similarly, f(0; 1) = ,
f(�2 ; b) = � d. These have opposite signs unless = 0. So suppose that
a = = 0. Then d = b
2
> 0 implies b 6= 0, so f(x; y) = bxy. Hen e
f(x; x) = b, f(1;�1) = �b, implying f is inde�nite.
Case 2. d = 0. If a 6= 0, then from Eq. 3, 4af(x; y) = (2ax + by)
2
,
implying that all values of f(x; y) have the same sign as a does, so that at
least f(x; y) is semide�nite. Sin e f(b;�2a) = �ad = 0 and �2a 6= 0, learly
f is NOT de�nite. Now suppose that a = 0. So b
2
= d = 0 and f(x; y) = y
2
.
Here f(1; 0) = 0, so f(x; y) is semide�nite and not de�nite.
Case 3. d < 0. Here 4af(x; y) = (2ax + by)
2
+ jdjy
2
> 0 ex ept when
(x; y) = (0; 0). Hen e f is de�nite and the sign of f(x; y) is the same as the
sign of a. Note that sin e d = b
2
� 4a < 0, b
2
< 4a , so that a and must
have the same sign.
Theorem 1.4 Let d 2 Z. Then there exists a binary quadrati form f with
dis riminant d if and only if d � 0 or 1 (mod 4), i.e., if and only if d is a
square modulo 4.
Proof: Suppose f has dis riminant d = b
2
� 4a � b
2
(mod 4). Then
learly d � 0 or 1 (mod 4).
For the onverse, �rst suppose that d � 0 (mod 4). Then x
2
�
�
d
4
�
y
2
has
dis riminant d. Se ond, suppose that d � 1 (mod 4). Then x
2
+xy�
�
d�1
4
�
y
2
has dis riminant d.
De�nition: We say that f represents n properly provided there are integers
(x
0
; y
0
) for whi h g d(x
0
; y
0
) = 1 and f(x
0
; y
0
) = n. More generally, if
k = g d(x
0
; y
0
) and f(x
0
; y
0
) = n, then f(
x
0
k
;
y
0
k
) =
n
k
2
.
3
Put Q(d) = ff(x; y) = ax
2
+ bxy + y
2
: d = b
2
� 4a g.
Theorem 1.5 Let n; d 2 Z, n 6= 0. Then there is an f 2 Q(d) for whi h f
represents n properly if and only if x
2
� d (mod j4nj) has a solution.
Proof: First suppose b
2
� d (mod j4nj), say b
2
�d = 4n . Then f(x; y) =
nx
2
+bxy+ y
2
has dis riminant b
2
�4n = d, and f(1; 0) = n, so f represents
n properly.
Conversely, suppose f 2 Q(d) and f(x
0
; y
0
) = n with g d(x
0
; y
0
) = 1.
Then there are integers m
1
; m
2
for whi h
m
1
m
2
= 4jnj; g d(m
1
; m
2
) = 1; g d(m
1
; y
0
) = 1; g d(m
2
; x
0
) = 1: (10)
For example,
m
1
=
Y
p
�
jj4n
pjx
0
p
�
; m
2
=
4jnj
m
1
:
Then
4an = 4af(x
0
; y
0
) = (2ax
0
+ by
0
)
2
� dy
2
0
� 0 (mod m
1
):
As g d(y
0
; m
1
) = 1, there is a �y
0
for whi h y
0
�y
0
� 1 (mod m
1
). Then
(2ax
0
+ by
0
)
2
�y
2
0
� dy
2
0
�y
2
0
� d (mod m
1
):
So u
1
= (2ax
0
+ by
0
)�y
0
solves u
2
1
� d (mod m
1
). Then
4 n = 4 f(x
0
; y
0
) = (2 y
0
+ bx
0
)
2
� dx
2
0
:
As g d(x
0
; m
2
) = 1, there is an �x
0
for whi h x
0
�x
0
� 1 (mod m
2
). Then
[(2 y
0
+ bx
0
)�x
0
℄
2
� dx
2
0
�x
2
0
� d (mod m
2
):
So u
2
= (2 y
0
+ bx
0
)�x
0
solves u
2
2
� d (mod m
2
). By the Chinese Re-
mainder Theorem we an �nd a w 2 Z for whi h w � u
1
(mod m
1
) and
w � u
2
(mod m
2
). Then w
2
� d (mod m
1
m
2
= 4jnj).
Corollary 1.6 Suppose d � 0 or 1 (mod 4) and p is an odd prime. Then
there is an f 2 Q(d) for whi h f represents p properly (why properly?) if
and only if
�
d
p
�
= +1.
4
Proof: We know f(x
0
; y
0
) = p (ne essarily properly) if and only if x
2
�
d (mod 4p) has a solution; So in parti ular, f(x
0
; y
0
) = p implies
�
d
p
�
= +1.
Conversely, suppose
�
d
p
�
= +1. Sin e d � 0 or 1 (mod 4), d must be a
square modulo 4. Hen e d is a square modulo 4p. By Theorem 1.5, f(x; y)
represents p properly.
2 TheModular Group & Equivalen e of Quadrati
Forms
There is a general theorem in linear algebra that says that if M is a square
matrix with entries from some ommutative ring R with 1, then M has a
multipli ative inverse with entries from R if and only if the determinant
det(M) (whi h is an element of R) is a unit in R, i.e., has a multipli ative
inverse in R. In the present ontext our ring R is just the ring Z of integers
with the usual addition and multipli ation of integers. Hen e we have the
following theorem.
Theorem 2.1 The matrix M =
m
11
m
12
m
21
m
22
!
has a multipli ative inverse
with entries whi h are integers if and only if det(M) = �1.
A omplete proof of the theorem in this spe ial ase of 2� 2 matri es of
integers is given in Se tion 3.5 as part of the proof of the following theorem
(Theorem 3.5 in our text).
Theorem 2.2 Let M be a 2� 2 matrix with integer entries as above. Then
the mapM : Z�Z ! Z�Z :
"
x
y
#
7!
"
u
v
#
=M
"
x
y
#
permutes the points
of Z �Z ( alled latti e points) if and only if M has integral oeÆ ients and
det(M) = �1.
We re ommend that the reader study the proof in Niven, Zu kerman &
Montgomery, but here we assume the result without going through the proof
of it. Also re all from linear algebra that if M and N are two n�n matri es
with real entries (or in fa t with entries from any ommutative ring), then
5
det(MN) = det(M) � det(N). It is easy enough to write out a proof for 2� 2
matri es (see the text), and we also skip the proof of this result. The above
results provide most the details of proving the following:
Theorem 2.3 The set GL(2; Z) of 2�2 matri es with integer entries whi h
have determinant �1 form a (non ommutative) group with binary operation
being ordinay multipli ation of matri es.
Put � = SL
2
(Z) = fM 2 GL(2; Z) : det(M) = +1g. Then it is easy
to show that � is a subgroup of GL(2; Z), whi h will be alled the Modular
Group.
Sin e we are using matri es to multiply times olumn ve tors (latti e
points), we will now hange the notation f(x; y) to f
x
y
!
.
De�nition: If f and g are two (not ne essarily distin t) binary quadrati
forms over Z, we write f � g and say that f and g are equivalent provided
there is an M 2 � for whi h g
x
y
!
= f(M
x
y
!
).
If f
x
y
!
= ax
2
+ bxy+ y
2
, we denote the matrix A =
a b=2
b=2
!
of
f by [f ℄. So f
x
y
!
= (x; y)[f ℄
x
y
!
. Then note the following: if f � g,
so there is a matrix M 2 � for whi h g
x
y
!
= f(M
x
y
!
), then
g
x
y
!
= (x; y)[g℄
x
y
!
= f(M
x
y
!
) = (x; y)M
t
[f ℄M
x
y
!
for all (x; y) 2 Z � Z. This easily for es
M
T
[f ℄M = [g℄: (11)
Sin e (M
T
)
�1
= (M
�1
)
T
, we may simply write M
�T
for this matrix.
Moreover, the following is now an easy exer ise to prove.
Theorem 2.4 The relation \�" on binary quadrati forms is an equivalen e
relation.
6
The next theorem shows that if f and g are \equivalent binary quadrati
forms over Z" they have mu h in ommon.
Theorem 2.5 Suppose that f and g are equivalent quadrati forms, say
M
T
[f ℄M = [g℄. Then the following hold.
f
x
y
!
= (x; y)M
�T
M
T
[f ℄MM
�1
x
y
!
= (x; y)M
�T
[g℄M
�1
x
y
!
=
"
M
�1
x
y
!#
T
[g℄
"
M
�1
x
y
!#
= g(M
�1
x
y
!
): (12)
This is readily interpreted as:
f
x
y
!
= n i� g(M
�1
x
y
!
) = n: (13)
g d
x
y
!
= g d(M
�1
x
y
!
); (14)
implying that f represents n properly if and only if g represents n properly.
det[g℄ = det[f ℄; so dis (f) = dis (g): (15)
De�nition: Let f 2 Q(d), d not a square. Then f is redu ed provided
(i) �jaj < b � jaj < j j;
or
(ii) 0 � b � jaj = j j.
Theorem 2.6 Let d 2 Z, d not a square. Then ea h equivalen e lass of
binary quadrati forms in Q(d) ontains at least one redu ed form.
7
Proof: Put M =
0 1
�1 0
!
. Then M transforms the quadrati form
(a; b; ) to the form ( ;�b; a).
Put M =
1 m
0 1
!
. Then M transforms (a; b; ) into (a; 2am+ b; am
2
+
bm + ). (Here am
2
+ bm + = f(m; 1).)
There is a unique integer m su h that �jaj < 2am + b � jaj. (a > 0 =)
�a�b
2a
< m �
a�b
2a
= 1 +
�a�b
2a
. a < 0 =)
�a�b
2a
� m <
a�b
2a
= 1 +
�a�b
2a
. So
from (a; b; ) we an get a new form (A = a; B; C) with �jAj < B � jAj, but
C might be hanged. If jCj < jAj, use the �rst of the two transformations
given above.
Theorem 2.7 Let f 2 Q(d) be redu ed (and d not a square). If f is indef-
inite (d > 0), then 0 < jaj �
1
2
p
d. If f is positive de�nite, (d < 0), then
0 < a �
q
�d
3
. In all ases the number of redu ed forms with �xed non-square
d is �nite.
Proof: Clearly a 6= 0. If a > 0, then d = b
2
� 4a = b
2
� 4ja j �
a
2
� 4a
2
< 0. So if d > 0, then a < 0 and d = b
2
� 4a = b
2
+ 4ja j � 4a
2
,
implying jaj �
p
d
2
. Finally, if d < 0, then f is de�nite (and we assume positive
de�nite), so a > 0, > 0. Then d = b
2
� 4a � a
2
� 4a � a
2
� 4a
2
= �3a
2
.
Hen e a
2
�
�d
3
, implying 0 < a �
q
�d=3. Clearly if a is bounded then b is
bounded, and as soon as d; a; b are all �xed, there is at most one value of
that works.
Example 1. For an odd prime p, there are integers x and y for whi h
p = x
2
� 2y
2
if and only if p � �1 (mod 8).
Proof: Let f 2 Q(8), f redu ed. Sin e d = 8 > 0, we have 0 < jaj �
1
2
p
8 =
p
2 =) a = �1. Then �jaj < b � jaj =) 0 � b � 1. But
b � d (mod 2) =) b = 0. Then d = 8 = 0
2
� 4a =) = �2a. So
f = x
2
� 2y
2
and �f = �x
2
+ 2y
2
are the only redu ed forms in Q(8).
Put M =
1 �2
1 �1
!
2 �. Then an easy he k shows M
T
[f ℄M = [�f ℄. So
f � �f , and x
2
� 2y
2
represents p properly if and only if x
2
� 8 (mod 4p)
has a solution, i.e., if and only if x
2
� 8 (mod p) has a solution. But
�
8
p
�
=
8
�
2
p
�
= 1 if and only if p � �1 (mod 8).
Note that what was shown in the pre eding example is that Q(8) ontains
only one equivalen e lass of quadrati forms. Consequently what was shown
is that a prime p is represented (properly, of ourse) by some (and hen e
ea h) quadrati form with dis riminant 8 if and only if p � �1 (mod 8).
So for example, given an odd prime p, there are integers x and y for whi h
p = x
2
+ 6xy + 7y
2
if and only if p � �1 (mod 8).
Example 2. We investigate the forms f with dis riminant d = �4 < 0, so
f is de�nite. We may on entrate on the positive de�nite ase, and without
loss of generality may assume that f is redu ed. By Theorem 2.7 we know
that 0 < a �
q
�d
3
=
q
4
3
, whi h for es a = 1. Then d = �4 = b
2
�
4a � b
2
(mod 4) implies b � 0 (mod 2). And jbj � jaj = 1 implies that
b 2 f�1; 0; 1g. Hen e b = 0. Then �4 = �4 determines = 1, so
x
2
+ y
2
is the unique redu ed positive de�nite form in Q(�4). By Theorem 1.4
there is a form f 2 Q(�4) properly representing n (n 6= 0) if and only if
x
2
� �4 (mod j4nj) has a solution. Hen e by Theorem 2.5, with n > 0,
x
2
+ y
2
= n properly if and only if x
2
� �4(mod 4n).
Note that x
2
� �4 (mod 8) has a solution but x
2
� �4 (mod 16) does
not. So if x
2
� �4 (mod 4n) has a solution, 2jn is possible, but not 4jn.
If p is a prime with p � 1 (mod 4), then x
2
� �4 (mod p) has a solution.
Then h(x) = x
2
+ 4 � 0 (mod p) has a solution; h
0
(x) = 2x 6� 0 (mod p),
so any solution of x
2
+ 4 � 0 (mod p) lifts to all powers of p. Then by
the Chinese Remainder Theorem we see that if n = ek, where e = 1 or 2
and k is a produ t of powers of primes all ongruent to 1 modulo 4, then
x
2
+ 4 � 0 (mod n) is solvable, so that n is properly representable in the
form n = x
2
+ y
2
.
But if p � 3 (mod 4), then x
2
� �4 (mod p) has no solution. Hen e
if n is divisible by a prime p with p � 3 (mod 4), then n is not properly
representable in the form n = x
2
+y
2
. We have proved the following theorem.
Theorem 2.8 A positive integer n is preperly representable as n = x
2
+ y
2
if and only if ea h prime p dividing n is ongruent to 1 modulo 4, or p = 2
and 4 does not divide n.
9
We have now all the information needed to give another proof of the
following theorem whi h we proved in lass.
Theorem 2.9 If n is a positive integer, then n = x
2
+ y
2
has a solution if
and only every odd prime dividing the square-free part of n is ongruent to 1
modulo 4.
Proof: We note that if n = x
2
+y
2
and g is any integer, then g
2
n = (gx)
2
+
(gy)
2
. Conversely, if g = g d(x; y) and n = x
2
+ y
2
, then
n
g
2
=
�
x
g
�
2
+
�
y
g
�
2
properly. Now re all that if m and n are integers that an be represented as
sums of two squares, then mn is also su h an integer. The theorem follows.
3 The Number of Representations by Quadrati
Forms
We adopt the following notation:
R(n) = jf(x; y) 2 Z � Z : x
2
+ y
2
= ngj
r(n) = jf(x; y) 2 Z � Z : x
2
+ y
2
= n and g d(x; y) = 1gj
P (n) = jf(x; y) 2 Z � Z : x
2
+ y
2
= n and g d(x; y) = 1 and x > 0; y � 0gj
N(n) = the number of solutions to s
2
� �1 (mod n)
Theorem 3.1 Suppose n > 0. Then the following hold:
r(n) = 4P (n) = 4N(n); (16)
R(n) =
X
d:d
2
jn
d>0
r(
n
d
2
): (17)
Proof: Consider any solution of x
2
+ y
2
= n, where n > 0. Of the four
points (x; y), (�y; x), (�x;�y), (y;�x), exa tly one of them has positive
�rst oordinate and non-negative se ond oordinate. As P (n) is the number
of proper representations x
2
+ y
2
= n for whi h x > 0 and y � 0, this shows
10
that r(n) = 4P (n). We now show that P (n) = N(n) by exhibiting a one-
to-one orresponden e between proper representations of n with x > 0 and
y � 0, and solutions s of the ongruen e s
2
� �1 (mod n).
Suppose that
(x; y) satis�es x
2
+ y
2
= n; x > 0; y � 0; g d(x; y) = 1:
Then g d(x; n) = 1, so there is a unique integer �x modulo n for whi h x�x �
1 (mod n. Put s � �xy. Then sin e x
2
� �y
2
(mod n), s
2
� �x
2
y
2
� �x
2
�x
2
�
�1 (mod n). So F : (x; y) 7! s de�nes a fun tion F from the set of proper
representations (x; y) of n with x > 0; y � 0, to the set of s with s
2
�
�1 (mod n).
Next we show that F is one-to-one. So suppose n = x
2
i
+y
2
i
, x
i
> 0, y
i
� 0,
g d(x; y) = 1, x
i
s
i
� y
i
(mod n), i = 1; 2. Suppose that s
1
� s
2
(mod n).
Then x
1
y
2
s
1
� y
1
y
2
� x
2
y
1
s
2
(mod n). Hen e x
1
y
2
� x
2
y
1
(mod n), sin e
s
1
� s
2
(mod n) and g d(s
i
; n) = 1. But 0 < x
2
i
� n =) 0 < x
i
�
p
n, and
0 � y
2
i
< n =) 0 � y
i
<
p
n. This for es 0 � x
1
y
2
< n and 0 � x
2
y
1
< n
and thus x
1
y
2
= x
2
y
1
. But then x
1
jx
2
y
1
and g d(x
1
; y
1
) = 1 for es x
1
jx
2
.
Similarly, x
2
jx
1
, implying x
1
= x
1
=) y
1
= y
2
.
At this point we know that F is well-de�ned and one-to-one. We want to
show that it is onto. So suppose that s
2
� �1 (mod n). Say s
2
+1 = n . Then
(2s)
2
�4n = �4 so that the binary quadrati form g(x; y) = nx
2
+2sxy+ y
2
has dis riminant �4. Hen e g 2 Q(�4) and g is positive de�nite. In the
pre eding se tion we showed that the unique redu ed positive de�nite binary
quadrati form in Q(�4) is x
2
+ y
2
. This implies that there is a matrix
M =
m
11
m
12
m
21
m
22
!
for whi h
m s
s
!
= [g℄ =M
T
1 0
0 1
!
M:
Writing out this matrix produ t gives
m
2
11
+m
2
21
m
11
m
12
+m
21
m
22
m
11
m
12
+m
21
m
22
m
2
12
+m
2
22
!
=
m s
s
!
:
Also 1 = det(M) = m
11
m
22
�m
12
m
21
, implying g d(m
11
; m
21
) = 1. Hen e
m
11
s = m
2
11
m
12
+m
11
m
21
m
22
11
� �m
2
21
m
12
+m
11
m
21
m
22
(mod n)
= �m
2
21
m
12
+m
21
(1 +m
21
m
12
)
= m
21
Exa tly one of (m
11
; m
21
), (�m
21
; m
11
), (�m
11
;�m
21
), (m
21
;�m
11
) has
positive �rst oordinate and nonnegative se ond oordinate. Also, start-
ing with m
11
s � m
21
(mod n) and s
2
� �1 (mod n), we have (�m
21
s �
�s
2
m
11
� m
11
(mod n). It follows that xs � y mod n) for any one of the
four pairs given above. Hen e F is onto, implying that F is a bije tion and
proving that r(n) = 4P (n) = 4N(n).
Now we prove that R(n) =
P
d:d
2
jn
r
�
n
d
2
�
. But this follows immediately
from the observation that
u
2
+ v
2
=
n
d
2
properly i� (du)
2
+ (dv)
2
= n with d = g d(du; dv):
Theorem 3.2 Fa tor the positive integer n as
n = 2
�
�
Y
p
�
jjn
p�1 (mod 4)
p
�
�
Y
q
jjn
q�3 (mod 4)
q
:
(1) If � 2 f0; 1g and = 0 for all q, then r(n) = 2
t+2
, where t is the
number of primes p � 1 (mod 4) dividing n. Otherwise r(n) = 0.
(2) If all are even, then R(n) = 4
Q
p
�
jjn
p�1 (mod 4)
(� + 1). Otherwise
R(n) = 0.
Proof: Using the Chinese Remainder Theorem we �nd that N(n) =
N(2
�
)
Q
p
N(p
�
)
Q
q
N(q
). Note that N(2) = 1 and N(4) = 0 (sin e s
2
�
�1 (mod 4) has no solution). So N(2
�
) = 0 for all � � 2. SimilarlyN(q) = 0
and N(q
) = 0 for all � 1. Hen e we have
N(n) =
(
2
t
; if � = 0 or 1 and all = 0;
0; otherwise.
This implies r(n) = 4N(n) = 2
t+2
if � = 0 or 1 and all = 0, and
equals 0 otherwise. We know R(n) = 4
P
d
2
jn
N
�
n
d
2
�
. If n = m
1
� m
2
with
12
g d(m
1
; m
2
) = 1, then d
2
jn if and only if d = d
1
� d
2
with d
2
1
jm
1
and d
2
2
jm
2
.
Moreover, d$ (d
1
; d
2
) is a bije tion. Hen e we have the following:
X
d
2
jn
N
�
n
d
2
�
=
X
d
2
1
jm
1
d
2
2
jm
2
N
m
1
d
2
1
�
m
2
d
2
2
!
=
X
d
2
1
jm
1
d
2
2
jm
2
N
m
1
d
2
1
!
�N
m
2
d
2
2
!
=
X
d
2
1
jm
1
N
m
1
d
2
1
!
X
d
2
2
jm
2
N
m
2
d
2
2
!
:
So for n = 2
�
Q
p
�
Q
q
as above, we have
X
d
2
jn
N
�
n
d
2
�
=
X
d
2
j2
�
N
�
2
�
d
2
�
Y
p
0
�
X
d
2
jp
�
N
p
�
d
2
!
1
A
Y
q
0
�
X
d
2
jq
N
�
q
d
2
�
1
A
:
Now onsider the ontributions of the three main fa tors above. For the
�rst fa tor, if � is even, the only nonzero ontribution omes from d
2
= 2
�
.
If � is odd, the only nonzero ontribution omes from d
2
= 2
��1
. So the �rst
fa tor is 1 in any ase. For the se ond fa tor, if � is even, N
�
p
�
d
2
�
= 2 for
d = 1, p; p
2
; : : : ; p
�
2
�1
, and N
�
p
�
d
2
�
= 1 if d
2
= p
�
. So the prime p ontributes
2
�
�
2
�
+ 1 = � + 1. If � is odd, then N
�
p
�
d
2
�
= 2 for d = 1; p; : : : ; p
��1
2
. So
again the prime p ontributes 2
�
1 +
��1
2
�
= � + 1. For the third fa tor, if
is odd, then q divides
q
d
2
for all appropriate q, so N
�
q
d
2
�
= 0 always. If is
even, then N
�
q
d
2
�
=
(
1; d
2
= q
;
0; otherwise.
This implies that q ontributes 1 if is even, and ontributes a fa tor of zero
if is odd. Hen e
R(n) = 4
X
d
2
jn
N
�
n
d
2
�
= 4 � 1 �
Y
p
(� + 1) �
(
1; all even;
0; otherwise.
13
Re apitulation: n = x
2
+ y
2
has a proper solution if and only if
n = 2
�
Y
p�1 (mod 4)
p
�
jjn
p
�
with � = 0 or 1, and in that ase r(n) = 4N(n) = 2
t+2
, where t is the number
of p � 1 (mod 4), pjn.
4 Ternary Quadrati Forms
Let
F =
3
X
k;l=1
a
kl
x
k
x
l
= (x
1
; x
2
; x
3
)A
0
B
�
x
1
x
2
x
3
1
C
A
; A = (a
kl
) with a
kl
= a
lk
: (18)
a
11
F = (a
11
x
1
+ a
12
x
2
+ a
13
x
3
)
2
+K(x
2
; x
3
); (19)
where
[K(x
2
; x
3
)℄ =
a
11
a
22
� a
2
12
a
11
a
23
� a
12
a
13
a
11
a
23
� a
12
a
13
a
11
a
33
� a
2
13
!
: (20)
Now a bit of routine omputation shows that
det([K(x
2
; x
3
)℄) = a
11
� det(A): (21)
Theorem 4.1 F is positive de�nite if and only
(i) a
11
> 0;
(ii) b = det
a
11
a
12
a
21
a
22
!
> 0;
and
(iii) d = det(A) > 0:
.
14
Proof: F (1; 0; 0) = a
11
, so if F is de�nite, then a
11
> 0. F (x
1
; x
2
; 0) =
(x
1
; x
2
)
a
11
a
12
a
21
a
22
!
x
1
x
2
!
, so if F is de�nite then b > 0 by the theory of
binary forms.
So assume that (i) and (ii) hold. Then by Eq. 19, if K is positive de�nite,
learly F is positive de�nite. And if K is not positive de�nite, we an �nd
x
2
; x
3
not bot 0, but both divisible by a
11
, for whi hK(x
2
; x
3
) � 0. And sin e
x
2
� x
3
� 0 (mod a
11
), we an solve for x
1
su h that a
11
x
1
+ a
12
x
2
+a
13
x
3
= 0.
Then F (x
1
; x
2
; x
3
) � 0 with at least one of s
1
; x
2
; x
3
not zero. So if (i) and
(ii) hold, then F is positive de�nite if and only K is positive de�nite. And
this holds if and only if b > 0 and a
11
det(A) > 0, whi h is if and only if
d = det(A) > 0.
Theorem 4.2 If g d(
11
;
21
;
31
) = 1, the six remaining integers
kl
an be
hosen in su h a way that det(
kl
) = 1.
Proof: Put g = (
11
;
21
), so (g;
31
) = 1. We an hoose x
12
;
22
; u; v so
that x
11
22
�
12
21
= g, and gu�
31
v = 1. Then
det
0
B
�
11
12
11
g
v
21
22
2
1
g
v
31
0 u
1
C
A
=
31
12
21
v �
11
22
v
g
!
+ u(
11
22
�
21
21
)(22)
= �
31
v + ug = 1: (23)
Theorem 4.3 Ea h equivalen e lass of positive de�nite ternary forms on-
tains at least one form for whi h a
11
�
4
3
3
p
d, 2ja
12
j � a
11
; 2ja
13
j � a
11
.
Proof: Let F be a �xed form belonging to the given lass. Let a
11
be
the smallest positive integer represented by F , and hen e by any form of the
same lass. Then for suitable
11
;
21
;
31
, we have a
11
= F (
11
;
21
;
31
). Here
g d(
11
;
21
;
31
) = 1, sin e otherwise
a
11
g d(
11
;
21
;
2
31
)
would be representable.
Let C =
0
B
�
11
12
13
21
22
23
31
32
33
1
C
A
be the matrix with det(C) = 1 onstru ted in
Theorem 4.2, and de�ne the form G by
G(�x) = F (C�x) = �x
T
C
T
[F ℄C�x:
15
Then if we say [G℄ = B = (b
ij
) = C
T
[F ℄C, we have b
11
= G(1; 0; 0) =
F (C
0
B
�
1
0
0
1
C
A
) = F (
11
;
21
;
31
) = a
11
. To G apply the transformation (d
kl
) =
0
B
�
1 r s
0 t u
0 v w
1
C
A
where tw � uv = 1. Then for arbitrary r; s we have det(d
kl
) =
1. Put D = (d
kl
), and put H(�y) = G(D�y), so A = [H℄ = D
T
[G℄D =
D
T
BD. The oeÆ ient of y
2
1
in H(�y) is the (1; 1) entry of D
T
BD, whi h is
(1
st
row of D
T
) � B � (1
st
ol of D) = G(1; 0; 0) = a
11
, i.e., (A)
11
= a
11
. IF
A = (A
IJ
) for general i; j, 1 � i; j � 3, then
a
12
= (row 1 of D
T
)(b
ij
)( ol 2 of D
T
) =
= (1; 0; 0)(b
ij
)
0
B
�
r
t
v
1
C
A
= (b
11
; b
12
; b
13
)
0
B
�
r
t
v
1
C
A
= ra
11
+ tb
12
+ vb
13
(sin e a
11
= b
11
): (24)
a
13
= (row 1 of D
T
)B( ol3 of D
T
) = (1; 0; 0)(b
ij
)
0
B
�
r
t
v
1
C
A
= sa
11
+ ub
12
+ wb
13
: (25)
From Eq. 19 we have
a
11
G(x
1
; x
2
; x
3
) = (b
11
x
1
+ b
12
x
2
+ b
13
x
3
)
2
+K(x
2
; x
3
);
a
11
H(y
1
; y
2
; y
3
) = (a
11
y
1
+ a
12
y
2
+ a
13
y
3
)
2
+ L(y
2
; y
3
);
where K and L are de�nite in their respe tive variables.
Sin e H(�y) = G(D�y), the transformation �x = D�y takes G into H. Put
�
D =
t u
v w
!
, then �x = D�y implies
x
2
x
3
!
. SoK(x
2
; x
3
) = K
�
D
y
2
y
3
!!
must equal L
y
2
y
3
!
.
16
By Eq. 21,
det[K(x
2
; x
3
)℄ = a
11
det[G℄ = a
11
det(B);
and
det[L(y
2
; y
3
)℄ = a
11
det(a) = a
11
d:
the �rst oeÆ ient of L is a
11
a
22
� a
2
12
. So we may hoose
t u
v w
!
so
that tw � vu = 1, and
a
11
a
22
� a
2
12
�
2
p
3
q
a
11
d:
Re all: In ea h lass of positive de�nite binary quadrati forms there is
at least one form ax
2
+ 2bxy + y
2
with 2jbj � a �
2
p
3
p
a � b
2
.
From a
12
= ra
11
+ tb
12
+ vb
13
, we may hoose r so that ja
12
�
1
11
2
.
Similarly, from a
13
= sa
11
+ ub
12
+ wb
13
we may hoose s so that ja
13
�
a
11
2
.
Sin e a
22
= H(0; 1; 0) is representable by H, therefore a
22
� a
11
. Then
a
2
11
� a
11
a
22
= (a
11
a
22
� a
2
12
) + a
2
12
�
2
p
3
p
a
11
d +
a
2
11
4
, whi h implies that
3
4
a
2
11
�
2
p
3
p
a
11
d, implying a
3
2
11
�
8
3
p
3
p
d, and �nally a
11
�
4
3
d
1
3
.
Theorem 4.4 Every positive de�nite ternary form f(�x) = �x
T
A�x with A =
A
T
and det(A) = 1 is equivalent to the form f(�x) = x
2
1
+ x
2
2
+ x
2
3
. Conse-
quently, every number representable by su h a form an be written as a sum
of three squares.
Proof: By Theorem 4.3 the given form is equivalent to a form �x
T
(a
ij
)�x
in whi h a
11
�
4
3
, 2ja
12
j � a
11
�
4
3
, 2ja
13
j � a
11
�
4
3
. Hen e a
11
= 1,
a
12
= a
13
= 0. The lass therefore ontains a form
G = x
2
1
+ a
22
x
2
2
+ 2a
23
x
2
x
3
+ a
33
x
2
3
;
where
K(x
2
; x
3
) = a
22
x
2
2
+ 2a
23
x
2
x
3
+ a
33
x
2
3
17
is positive de�nite and has determinant 1. Hen e we know K is equiva-
lent to the form x
2
2
+ x
2
3
by a suitable M =
t u
v w
!
2 �. Consequently
0
B
�
1 0 0
0 t u
0 v w
1
C
A
takes G into x
2
1
+ x
2
2
+ x
2
3
.
Lemma 4.5 If n = x
2
1
+x
2
2
+x
2
3
, n > 0, then n is not of the form 4
a
(8b+7),
a � 0, b � 0.
Proof: Clearly n = 8b + 7 � 7 (mod 8), but ea h perfe t square is on-
gruent to one of 0, 1 or 4 modulo 8. So the sum of three squares is ongruent
to one of 0, 1, 2, 3, 4, 5, 6 modulo 8. So 8b+7 is not a sum of three squares.
Suppose 4
a+1
(8b+ 7) = x
2
1
+ x
2
2
+ x
2
3
� 0 (mod 4). Clearly ea h of x
1
, x
2
and x
3
must be even. Hen e 4
a
(8b+ 7) =
�
x
1
2
�
2
+
�
x
2
2
�
2
+
�
x
3
2
�
2
. The result
follows.
Theorem 4.6 If n > 0 is not of the form 4
a
(8b + 7), a � 0, b � 0, then n
an be written as the sum of three squares.
Proof: If n is not the sum of three squares, neither is 4n. So we may
assume that n is odd or is twi e an odd number. So in fa t it suÆ es to
assume that n � 1; 2; 3; 5 or 6 (mod 8), and for su h an n it suÆ es to
show that there is a positive de�nite ternary form of dis riminant 1 whi h
represents n. So we have to spe ify nine integers a
ij
, 1 � i � j � 3; x
1
; x
2
; x
3
whi h satisfy:
(i) n = a
11
x
2
1
+ 2a
12
x
1
x
2
+ 2a
13
x
1
x
3
+ a
22
x
2
2
+ 2a
23
x
2
x
3
+ a
33
x
2
3
;
(ii) a
11
> 0;
(iii) a
11
a
22
� a
2
12
> 0;
(iv) det(a
ij
) = 1 (where a
ij
= a
ji
for i > j):
We may even take a
13
= 1, a
23
= 0, a
33
= n, x
1
= 0, x
2
= 0, x
3
= 1. Then
(i) automati ally holds, and the three remaining unknown a
ij
must satisfy:
(ii) a
11
> 0;
(iii) b = a
11
a
22
� a
2
12
> 0;
18
(iv) 1 = det
0
B
�
a
11
a
12
1
a
12
a
22
0
1 0 n
1
C
A
=
�
�
�
�
�
a
12
a
22
1 0
�
�
�
�
�
+n
�
�
�
�
�
a
11
a
12
a
12
a
22
+
�
�
�
�
�
= �a
22
+nb,
i.e., a
22
= bn� 1.
Sin e the ase n = 1 is trivial, we assume n > 1. Then b > 0, so
a
22
= bn� 1 > 0. Here b > 0 implies a
11
a
22
> a
2
12
� 0, hen e a
11
> 0. So (ii)
follows from (iii) and (iv). So we need: b = a
11
a
22
�a
2
12
> 0 and a
22
= bn�1.
This is equivalent to saying: b > 0 and �b is a quadrati residue modulo
bn� 1.
Case 1. n � 2 or 6 (mod 8). Sin e g d(4n; n�1), by Diri hlet's Theorem
there is a prime p � n � 1 (mod 4n), say p = 4nv + n � 1 = (4v + 1)n� 1.
If we set 4v + 1 = b, then b > 0, and sin e p � 1 (mod 4),
�b
p
!
=
�
p
b
�
=
bn� 1
b
!
=
�
�1
b
�
= +1 sin e b � 1 (mod 4):
Case 2. n � 1; 3; or 5 (mod 8). Put = 1 if n � 3 (mod 8) and
= 3 if n � 1 or 5 (mod 8). So n � 3 or 7 (mod 8) and
n�1
2
is odd.
Hen e g d(4n;
n�1
2
) = 1. By Diri hlet's Theorem there is a prime p �
n�1
2
(mod 4n), say p =
n�1
2
+ 4nv =
1
2
[(8v + )n� 1℄.
Set b = 8v + . then b > 0 and 2p = bn� 1.
n � 1 (mod 8 =) 2p � b � 1 � � 1 � 3 � 1 � 2 (mod 8) and
p � 1 (mod 4), b � 3 (mod 8).
n � 3 (mod 8) =) 2p � 3b � 1 � 3 � 1 � 3 � 1 � 2 (mod 8), for ing
p � 1 (mod 4) and b � 1 (mod 8).
n � 5 (mod 8) =) 2p � 5b� 1 � 5 � 1 � 6 (mod 8) =) p � 3 (mod 4)
and b � 3 (mod 8).
�
�2
b
�
=
�
�1
b
��
2
b
�
=
(
(�1)(�1) = 1 if b � 3 (mod 8);
(+1)(+1) = 1 if b � 1 (mod 8):
And
�
�b
p
�
= (�1)
[
�b�1
2
℄[
p�1
2
℄
�
p
b
�
=
�
p
b
�
(in all three ases) =
�
p
b
� �
�2
b
�
=
�
�2p
b
�
=
�
1�bn
b
�
=
�
1
b
�
= +1.
So �b is a quadrati residue modulo p. Sin e �b � 1
2
(mod 2), it follows
that �b is a quadrati residue modulo 2p = bn� 1.
19
Corollary 4.7 If n � 1 or 2 (mod 4), then n is a sum of three squares.
If n � 3 (mod 4), then n = (n � 1) + 1
2
, where n � 1 is a sum of three
squares, so that n is a sum of four squares.
If n � 0 (mod 4), then n = 4
a
(4b+ r), r = 1; 2; 3. Sin e 4
a
= (2
a
)
2
and
4b+ r must be a sum of 4 squares, learly n is a sum of 4 squares.
20