Algorithm for finding all reduced ternary quadratic forms
of level N and discriminant d.
Larry Lehman
Mary Washington College
If f(x,y,z) = ax2 + by2 + cz2 + ryz + sxz + txy is a positive definite,
primitive, ternary quadratic form, (a ternary form, for short)
then its discriminant is given by
d = 4abc + rst - ar2 - bs2 - ct2, and its level is N = 4d/m where
m is the greatest common divisor of 4bc-r2, 4ac-s2, 4ab-t2, 2st-4ar,
2rt-4bs, and 2rs-4ct. (Since f is positive definite, each of a, b, c,
4bc-r2, 4ac-s2, 4ab-t2, and d is positive.)
Every ternary form is equivalent to exactly one
reduced form, which, by definition, satisfies the following conditions:
- a is less than or equal to b, which is less than or equal to c.
- r, s, and t are all positive or all non-positive.
- |t| is less than or equal to a.
- |s| is less than or equal to a.
- |r| is less than or equal to b.
- If a = b, then |r| is less than or equal to |s|.
- If b = c, then |s| is less than or equal to |t|.
- a + b + r + s + t is non-negative.
- If a + b + r + s + t = 0, then 2a + 2s + t is non-positive.
- If a = -t, then s = 0.
- If a = -s, then t = 0.
- If b = -r, then t = 0.
- If a = t, then s is less than or equal to 2r.
- If a = s, then t is less than or equal to 2r.
- If b = r, then t is less than or equal to 2s.
It can be shown that if f is reduced, then abc is greater than or equal
to d/4 and less than or equal to d/2. Furthermore, the following facts
are easy to establish:
- If m is even, then each of r, s, and t must be even.
- If mu = 4N/m is odd, then each of a, b, and c has the property of being congruent to 0 or to -mu modulo 4.
- ab is greater than or equal to m/4.
Using these facts, we have the following algorithm for finding all
reduced ternary forms having discriminant d and level N.
Algorithm:
Given N and d, let m = 4d/N and mu = 4N/m. (If these are not
integers, then there are no ternary forms of this level and discriminant.)
- Let a vary from 1 to the greatest integer less than or equal to the
cube root of d/2, subject to the condition that if mu is odd, then
a is congruent to 0 or -mu modulo 4. For each a, use the Euclidean Algorithm to
find the greatest common divisor, g, of 4a and m, and integers u and v
such that g = 4au + mv.
- Given a, let t vary from 0 to a, subject to the conditions that if
m is even, then t is even, and that g divides t2.
- Given a and t, let b vary over all integers congruent to ut2/g
modulo m/g, such that b is greater than or equal to the larger of a and
m/4a, b is less than or equal to the square root of d/2a, and subject to
the condition that if mu is odd, then b is congruent to 0 or -mu modulo 4.
(Note: In this step and the previous one, we are using the fact that
4ab-t2 must be divisible by m. Thus b is a solution of the linear
congruence 4ax = t2 (mod m). This congruence has a unique solution
modulo m/g, namely ut2/g, if and only if g divides t2.)
- Given a, t, and b, let s vary from 0 to a, subject to the conditions
that if m is even, then s is even, and that g divides 2st.
- Given a, t, b, and s, let r vary over all integers that are congruent
to 2stu/g modulo m/g, that are less than or equal
to b in absolute value, and such that if m is even, then r is even,
and if st = 0, then r is less than or equal to 0.
(In this step and the previous one, we use the fact that 2st-4ar is
divisible by m.)
- Given a, t, b, s, and r, test whether
c = (d - rst + ar2 + bs2)/(4ab - t2) is an integer. If so,
test whether a, b, c, r, s, and t satisfy all the other properties
of a reduced ternary form of level N and discriminant d. (If
r is less than or equal to 0, replace s and t by their negatives. It is
easy to see that any two of r, s, and t can be changed in sign without
affecting the invariants N and d.)
Return to Research Information - Larry Lehman (List of Tables)