Two integral binary quadratic forms are properly equivalent when one is obtained from the other by a change of variables in . For a negative discriminant , the class number of binary quadratic forms is the number of proper equivalence classes of primitive positive-definite forms of discriminant .
If properly represents , then for coprime . Extend to a matrix in ; after the associated variable change, the coefficient of is , so the transformed form is
The converse follows by evaluating this form at .
Such a form has discriminant precisely when
so it exists exactly when . Thus is properly represented by some form of discriminant exactly when is a square modulo .
Now let . If is composite for , it has a prime divisor , and
Conversely, if is a square modulo for a prime , choose an odd square root with . Then and , so that value is composite.
Finally, reduction theory says that every nonprincipal positive-definite class of discriminant has a reduced representative whose leading coefficient has a prime divisor for which is a square modulo . Conversely such a prime produces a represented form not equivalent to the principal form . Combining this with the preceding equivalence gives
Write an integral binary quadratic form as
A positive definite form is a reduced positive definite binary quadratic form when
with on the boundary or . The class number of a negative discriminant is the number of proper equivalence classes of primitive positive definite integral forms of discriminant .
Every such class has a reduced representative. For a reduced form,
so
There are only finitely many possible integers and , and then
is determined. Hence . There is at least one class: the principal form is
and
Thus , in agreement with the enumeration of reduced binary quadratic forms.
Now let be prime. The two forms
are primitive, positive definite, reduced, and have discriminant . They are not properly equivalent: represents one, while the least positive value of is two. Therefore
Assume henceforth that , so these are the only two classes. If
for a prime , then is odd and
Moreover , so is a quadratic residue modulo . This proves the necessity.
Conversely, suppose and is a quadratic residue modulo . By quadratic reciprocity, these two conditions imply
Indeed, for both relevant signs are positive, while for the signs from and reciprocity with cancel. Choose an even integer such that
Then
is a primitive positive definite integral form of discriminant and represents . It belongs to one of the two classes .
The second form cannot represent such a prime. If
then is odd and, since ,
This contradicts . Hence lies in the principal class , and proper equivalence of binary quadratic forms preserves represented integers. Therefore
This is the prime representation when h of minus eight q equals two.
A reduced positive definite binary quadratic form satisfies
with when either or . For or , the class number of a negative discriminant is the number of proper equivalence classes of primitive positive definite integral forms of discriminant , equivalently the number of their reduced representatives.
Write
Partitioning the complete prime-power factors between and gives ordered factorizations with . After identifying with , there are choices with . Each gives the primitive reduced form
whose discriminant is . The uniqueness of reduced representatives makes these classes distinct, proving the coprime-factorization lower bound for a quadratic-form class number
The inequality can be strict. For , there is one distinct prime factor, while the reduced primitive forms of discriminant are
Thus .