Advanced maths

Imaginary quadratic ideal class group calculator from a discriminant

Enumerate ideal classes of an imaginary quadratic field through reduced primitive positive definite binary forms.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Enumerate ideal classes of an imaginary quadratic field through reduced primitive positive definite binary forms. This calculation goes beyond reducing one form: it constructs the entire bounded class set, composes its elements and derives invariant factors from exact element orders.

THE FORMULAb²−4ac=D; |b|≤a≤c; a≤√(|D|/3). Classes compose as primitive positive definite forms modulo SL(2,Z).

A worked example

D=−23 has reduced forms (1,1,6), (2,−1,3), (2,1,3). The principal form is the identity; the other two are inverses and each has order three. Thus the ideal class group is cyclic C3.

Good to know

Negative fundamental discriminants |D|≤10000. Primitive proper classes only; bounded coprime representative search. Safe-integer checks guard form composition, and any growth/search failure is an error. No nonmaximal orders or real quadratic fields.

The discriminant identifies the order

A negative fundamental discriminant identifies the maximal order of an imaginary quadratic field. Not every negative integer is such a discriminant: the parity condition and squarefree conditions must hold before form enumeration begins.

For D congruent to one modulo four, D must be squarefree. Otherwise D=4m with m squarefree and congruent to two or three modulo four. A nonfundamental discriminant describes a nonmaximal order and is deliberately rejected here.

Imaginary quadratic ideal class group calculator from a discriminant worked exampleegg²multiply by gClass group for D = −23e=(1,1,6); g=(2,−1,3); g³=e
Scroll across to see the full diagram.
D=−23 has reduced forms (1,1,6), (2,−1,3), (2,1,3). The principal form is the identity; the other two are inverses and each has order three. Thus the ideal class group is cyclic C3.

Compare this with the Positive definite binary quadratic form reduction calculator. Reducing one positive-definite form does not enumerate or compose all ideal classes.

Why reduced forms enumerate classes

A primitive positive definite form ax²+bxy+cy² has discriminant b²−4ac. Proper equivalence uses determinant-one integral changes of variables, and each class has a canonical reduced representative after boundary signs are fixed.

The inequalities |b|≤a≤c imply 3a²≤|D|. This finite bound makes complete enumeration possible within the supported range. On |b|=a or a=c, require b≥0 to prevent counting equivalent boundary forms twice.

Composition is more than coefficient addition

Form classes multiply under Gauss composition. The implementation first changes one form to an equivalent representative whose leading coefficient is coprime to the other, then solves the compatible middle-coefficient congruences.

The resulting form has leading coefficient aa′ and the original discriminant. Reducing it returns one of the enumerated classes. Failure to reconstruct that class is an arithmetic error, rather than permission to invent an extra class.

Recovering invariant factors

A complete multiplication table determines the order of every class. For each prime p dividing the class number, counts of elements killed by p, p² and higher powers determine the exponents of the p-primary cyclic factors.

The prime-power factors are aligned to obtain invariant factors d1|d2|⋯. An empty factor list means the trivial group. A class number alone is insufficient: groups C4 and C2×C2 both have four elements but different element orders.

The three classes for D minus 23

For −23 the principal form is x²+xy+6y². The two remaining reduced forms are 2x²−xy+3y² and 2x²+xy+3y², and each represents a nonprincipal ideal class.

Their multiplication table has one identity and two elements of order three. This proves the structure C3 within the form model, while the reduced-form list gives a readable certificate of the class number rather than an unexplained numeric answer.

Interpreting nonunique factorization

The class group measures the obstruction to every ideal being principal. A trivial class group implies unique factorization of elements in the ring of integers; a nontrivial group records how nonprincipal ideals combine to become principal.

This statement concerns the full ring of integers of the identified field. It should not be transferred without qualification to a smaller order or to a polynomial coefficient ring, where different notions of units and ideals apply.

Validation and bounded arithmetic

The −23 form list agrees with the published Sage reduced-form example. Additional fixtures cover trivial groups, C2, C4 and C2×C2, with complete associativity, inverse and commutativity checks on their computed tables.

A complete group-law check is valuable but does not replace external comparison for every discriminant. The research package explicitly records that Sage and PARI were not run locally. The interface must disclose any unsupported size or arithmetic-growth case.

A few questions, answered

Is the class number the group structure?

No. It is only the number of classes. The multiplication table and invariant factors provide the structure.

Why is −12 rejected?

It is not a fundamental discriminant. It belongs to a nonmaximal quadratic order, outside the current scope.

What does an empty invariant-factor list mean?

There is only the principal class, so the class group is trivial and has order one.

Are b and −b always different classes?

No. They represent inverse classes and coincide in ambiguous boundary or order-two cases. The reduction convention removes duplicates.

Find your calculator

Start typing to explore the library.