next up previous
Next: About this document ... Up: Lecture 24: Quadratic Forms Previous: Class Numbers

The Class Group

There are much more sophisticated ways to compute $ h_D$ than simply listing the reduced binary quadratic forms of discriminant $ D$, which is an $ O(\vert D\vert)$ algorithm. For example, there is an algorithm that can compute $ h_D$ for $ D$ having $ 50$ digits in a reasonable amount of time. These more sophisticated algorithms use the fact that the set of primitive positive definite binary quadratic forms of given discriminant is a finite abelian group.

Definition 3.1   Let $ f_1=(a_1,b_1,c_1)$ and $ f_2=(a_2,b_2,c_2)$ be two quadratic forms of the same discriminant $ D$. Set $ s=(b_1+b_2)/2$, $ n=(b_1-b_2)/2$ and let $ u,v,w$ and $ d$ be such that

$\displaystyle u a_1 + v a_2 + w s = d = \gcd(a_1, a_2, s)
$

(obtained by two applications of Euclid's algorithm), and let $ d_0 = \gcd(d,c_1,c_2,n)$. Define the composite of the equivalence classes of the two forms $ f_1$ and $ f_2$ to be the equivalence class of the form

$\displaystyle (a_3, b_3, c_3) = \left(
d_0 \frac{a_1 a_2}{d^2},
b_2 + \frac{2a_2}{d}(v(s-b_2)-w c_2),
\frac{b_3^2-D}{4a_3}\right).
$

This mysterious-looking group law is induced by ``multiplication of ideals'' in the ``ring of integers'' of the quadratic imaginary number field $ \mathbb{Q}(\sqrt{D})$. The following PARI program computes this group operation:
{composition(f1, f2)=
   local(a1,b1,c1,a2,b2,c2,D,s,n,bz0,bz1,u,v,w);
   a1=f1[1]; b1=f1[2]; c1=f1[3];
   a2=f2[1]; b2=f2[2]; c2=f2[3];   
   D = b1^2 - 4*a1*c1;
   if(b2^2 - 4*a2*c2 != D, error("Forms must have the same discriminant."));
   s = (b1+b2)/2;
   n = (b1-b2)/2;
   bz0 = bezout(a1,a2);
   bz1 = bezout(bz0[3],s);
   u = bz1[1]*bz0[1];
   v = bz1[1]*bz0[2];
   w = bz1[2];
   d = bz1[3];
   d0 = gcd(gcd(gcd(d,c1),c2),n);
   a3 = d0*a1*a2/d^2;
   b3 = b2+2*a2*(v*(s-b2)-w*c2)/d;
   c3 = (b3^2-D)/(4*a3);
   f3 = reduce([a3,b3,c3]);
   return(f3);
}
Let's try the group out in the case when $ D=-23$.

? reducedforms(-23)
[1, 1, 6] ----> [1, 1, 6]
[2, 1, 3] ----> [2, 1, 3]
[3, 1, 2] ----> [2, -1, 3]
[6, 1, 1] ----> [1, 1, 6]
%56 = [[1, 1, 6], [2, -1, 3], [2, 1, 3]]
Thus the group has elements $ (1,1,6)$, $ (2,-1,3)$, and $ (2,1,3)$. Since $ h_{-23}=3$, the group must be cyclic of order $ 3$. Let's find the identity element.
? composition([1,1,6],[2,-1,3])
%58 = [2, -1, 3]
Thus the identity element must be $ (1,1,6)$. The element $ (2,-1,3)$ is a generator for the group:
? composition([2,-1,3],[2,-1,3])
%59 = [2, 1, 3]
? composition([2,-1,3],[2,1,3])
%60 = [1, 1, 6]


next up previous
Next: About this document ... Up: Lecture 24: Quadratic Forms Previous: Class Numbers
William A Stein 2001-11-07