Which primes does a quadratic form represent?
Suppose we want to know which primes can be written in the form , where
and
are integers. We can find a few examples by trying small values. For instance,
. But what if someone gives us a very large prime? Is there a way to decide whether such a representation exists without having to find the two integers first?
Here is a rather beautiful answer: an odd prime other than five can be written in this form exactly when its remainder on division by twenty is one or nine. There is a similar rule for another expression, . This expression represents seven, for example, by taking both variables equal to one. The primes it represents, apart from those dividing twenty, are precisely those congruent to three or seven modulo twenty.
Why should the remainder of a prime tell us whether an equation has an integral solution? And can we expect a rule like this for every quadratic form? We shall see that congruences give a great deal of information, but that there is a definite limit to what the quadratic-residue tests can tell us. Understanding that limit is the subject of genus theory. We will approach the problem through two small examples, with discriminants and
. The first shows why congruences can be so effective; the second shows why they sometimes leave us with more than one possibility. Only after seeing these examples will we introduce the general theory and prove Gauss’s duplication theorem. We will use quadratic reciprocity, the theorem on primes in arithmetic progressions, and Gauss composition in the course of the argument.
Leading coefficients
Start with an expression with integral coefficients. We assume
and
. The number
is called the discriminant. Completing the square gives
, so the form takes positive values except at the origin. We also assume
; such a form is called primitive. There is a useful freedom in writing down a quadratic form. We can replace its two variables by integral linear expressions, provided the matrix of the substitution has determinant one. The substitution can then be reversed over the integers. Consequently the new expression represents exactly the same integers as the old one. Its discriminant is also unchanged. We call two forms related in this way properly equivalent. Instead of studying one expression in isolation, we can work with whichever equivalent expression makes a calculation easiest.
Suppose a prime is represented by our form, say
. We would like to make this prime appear as a coefficient of the form itself. Why is that useful? A coefficient is tied directly to the discriminant equation, whereas an arbitrary represented value is not so easy to work with.
The coordinates must be coprime. Otherwise their common divisor squared would divide the prime
. By Bezout’s identity we can find integers
with
. Now substitute
and
. Setting
immediately shows that the coefficient of
is
. If we write the new form as
, expansion gives
Conversely, if an equivalent form begins with the coefficient , it represents
simply by taking
. Thus finding a representation of a prime and finding an equivalent form with that prime as its leading coefficient are the same problem. The argument works just as well for any positive integer represented by coprime coordinates. Such a representation is called primitive.
Let us see the change of variables in our first example. We already know that . The pair
will be the first column of our substitution matrix. We can take
as the second column, since
. This gives
The new coefficients may look less pleasant than the original ones, but the new form has exactly the same discriminant: . We can do the same thing with the representation of seven by
. Taking
and
gives
. In both examples the represented prime has become the first coefficient. We can now ask what the discriminant tells us about that coefficient.
Representation by some form
If a form of discriminant represents a prime
, we can write an equivalent form as
. Its discriminant satisfies
. In particular,
must be a square modulo
. If it is not, there is no need to search for a representation: none exists.
What happens if the congruence does have a solution? We can reverse the calculation. Choose an integer with
and define
. Then
is a form of discriminant
which represents
. It is primitive when
. So the entire existence question, for some form of the prescribed discriminant, reduces to
For an odd prime not dividing , we only need to check whether
is a nonzero square modulo
. Indeed, a discriminant is either zero or one modulo four. Having found a square root modulo the odd prime
, we can choose its parity so that its square also agrees with
modulo four. The two congruences then hold together modulo
. In Legendre-symbol notation, the condition is
This is already a useful result, but notice what it does not tell us. It tells us that a prime is represented by some form of discriminant . We still do not know whether that form is equivalent to the particular one we started with. For example, the two expressions in our opening question both have discriminant
. How many genuinely different forms have this discriminant? If we could make a complete list, we could try to distinguish them. That is what reduction allows us to do.
Reduction of forms
Suppose we are given a form with very large coefficients. We can often make them smaller using just two simple substitutions. First, replace
by
. The middle coefficient becomes
, so by choosing the integer
suitably we can bring it into the interval
. Next, if
, use
to exchange the first and third coefficients and reverse the sign of the middle one.
Repeat the two operations whenever necessary. Each interchange made because strictly decreases the positive integer in the first position. The procedure must therefore stop, leaving a form satisfying
. We call such a form reduced. If
or
, there is still a sign choice for the middle coefficient; we take
on these boundaries.
Why is this useful for making a complete list? The discriminant gives . Since a reduced form has
and
, we get
. Hence the first coefficient can only lie in the finite interval
For every integer in this interval, try the integers
between
and
. The discriminant equation determines
, so there is nothing else to search for. Retain the triples for which
is integral,
, and the form is primitive, with our convention on signs at the boundary.
A basic fact of reduction theory is that this procedure gives one representative of every proper equivalence class, with no repetitions. The idea behind uniqueness is that the least positive value of a reduced form is its first coefficient. In the interior, where , the only vectors giving this minimum are
. A substitution between reduced forms must preserve that shortest direction; the restriction on the middle coefficient then leaves no further choice. The boundary cases are handled by the additional symmetries and the sign convention. We can now study all the classes of a fixed discriminant by working with a finite list of small triples.
Let us carry out this procedure for . The bound gives
, so we only need to try one and two. The middle coefficient must be even. Substituting the possible values into the discriminant equation leaves exactly two reduced forms:
We now know something that was not apparent from the original expressions: there are only two classes of discriminant . Every odd prime away from the discriminant with
belongs to at least one of these two forms. How can we distinguish them?
Look first at modulo five. Every nonzero value of this expression modulo five is a square, because the second term disappears. Could it be that the other form always gives nonsquares modulo five? We can investigate this by comparing two arbitrary values of a form. A direct expansion gives the following identity, valid for any form of discriminant
:
The significance of the identity is that the second term on the right contains the discriminant. Take an odd prime dividing
and reduce the identity modulo
. That term disappears, leaving a square. Since four is itself a nonzero square modulo
, the product of any two nonzero represented values must be a square modulo
.
But the product of a square and a nonsquare is a nonsquare. So a single form cannot represent both kinds of nonzero residues. Once we find the quadratic-residue sign of one represented value prime to , we know the sign of every other such value. This is a property of the form, not of the particular integers substituted into it. Equivalent forms also have the same sign because they represent the same integers.
Apply this observation with . The first form represents one, so all its values coprime to five are squares modulo five. The second form represents two, which is a nonsquare modulo five; all its values coprime to five must therefore be nonsquares as well.
By quadratic reciprocity, the condition allows precisely the four remainders
for primes away from twenty. Of these, one and nine are squares modulo five, while three and seven are nonsquares. We know that every prime in the four allowed residue classes belongs to some form, and we have only two forms in our list. The sign modulo five tells us which one it must be. This proves the two rules announced at the beginning:
Here the prime is odd and different from five. The excluded primes are easy to check separately: and
for the respective forms. Notice why the argument works so well. One congruence test tells us whether a prime belongs to any form, and another distinguishes the only two available classes. Could we always proceed in this way? The next example shows where the difficulty begins.
Take . This time the bound is
. Trying the four possible leading coefficients and the even middle coefficients gives the following complete list:
As before, we can use quadratic reciprocity to decide which odd primes away from the discriminant belong to some form. The condition gives the twelve remainders
modulo fifty-six.
There is now an interesting difference. Look at the odd values represented by the four forms modulo eight. For and
, the only possible odd residues are one and seven. For
and
, they are three and five. This can be checked by substituting the square residues zero, one and four modulo eight, or by using the product identity above. In the notation of quadratic reciprocity, the first pair has sign
and the second pair has sign
. The twelve allowed residue classes split accordingly:
We can tell which pair of forms represents a prime, but the test does not distinguish the two forms within a pair. To see that this is a real issue, take the primes and
. Both have remainder one modulo fifty-six, so they pass exactly the same tests. Nevertheless,
The first prime is represented by , and the second by
. In each case the two possible square roots of the discriminant give inverse classes; here the classes are their own inverses, so the prime does not belong to the other class.
There is also something worth noticing about and
: we have
. These forms represent exactly the same integers, but the substitution has determinant minus one, not one. They are different proper classes. Proper equivalence remembers the orientation of the two variables.
For the moment, call two classes members of the same genus when they give the same quadratic-residue signs. Our example has two genera, and
. Why do the four classes arrange themselves into two pairs? To understand that, we need to see how quadratic forms can be multiplied.
Composition and Class group
There is a familiar identity for sums of two squares: the product of two integers of the form is again of that form. It is natural to ask whether something similar happens when we multiply values of two different quadratic forms with the same discriminant. Gauss’s composition law gives a remarkable answer: the product is represented by another form of that discriminant, and the class of this third form depends only on the classes of the two original forms.
To see where the calculation comes from, write . Multiplying an expression by the one obtained by reversing the sign of the square root gives a rational number, denoted by
. Direct multiplication gives the elementary identity
The notation involving a square root is just a convenient way to organize polynomial multiplication. It is not necessary to introduce ideals. Suppose the leading coefficients of two forms are coprime, and suppose we have arranged that they have the same middle coefficient . Put
and
. Then
. Multiplying
by
gives an expression of the shape
, where
Taking the product with the conjugate expression and dividing by gives
. Thus the new form has leading coefficient
and discriminant
, exactly as we wanted. The identity explains why multiplication of leading coefficients is the natural operation here.
Gauss proved that this construction, with suitable equivalent representatives, defines an associative and commutative operation on proper classes. We use that classical result here. The classes form a finite abelian group, denoted . Its identity is the principal form, namely
for even
and
for odd
. The inverse of
is represented by
. Rather than develop the general composition theorem again, we will use the explicit rule below to see what this group operation does in examples.
Let the two forms be and
, with
. We have seen that it would be convenient to make their middle coefficients equal. A translation changes a middle coefficient by a multiple of twice the leading coefficient. Thus we need an integer
satisfying
and
. Both original middle coefficients have the same parity, so the Chinese remainder theorem gives such an integer. The composition rule is
The third coefficient is an integer: the two congruences imply and
. Since the leading coefficients are coprime,
divides
.
What if the leading coefficients are not coprime? Recall that a primitively represented integer can be moved into the leading position. Given a finite set of primes, we can choose coordinates so that the form’s value is nonzero modulo each of them: a primitive quadratic form is not identically zero modulo any prime, as one sees by testing . Combine these choices by the Chinese remainder theorem, then divide the coordinates by their greatest common divisor, which is coprime to the chosen primes. The resulting value is primitively represented and avoids the chosen primes. This allows us to arrange coprime leading coefficients whenever needed.
Let us multiply by itself. At first the two leading coefficients are equal, but we can replace the second copy by
using the determinant-one interchange of variables. Now the leading coefficients are three and five. To make the middle coefficients agree, solve
and
. We can take
. The composition rule gives
, since
.
This is not reduced yet. Interchange the variables to obtain , then translate to obtain
. So the square of the class of
is the class of
:
The calculation almost determines the whole multiplication table. The form is its own inverse, because reversing the middle coefficient changes nothing. Its square is therefore the principal class
. The two classes
and
are distinct inverses. Consequently the successive powers of
give all four classes, and the group is cyclic of order four.
Now look at the squares of all four classes. We obtain just and
. Multiplying these two square classes by
gives the remaining two classes. These are precisely the two pairs we obtained earlier by examining residues modulo eight! We have arrived at the same partition in two quite different ways: one through congruences, the other through composition. Is this a coincidence peculiar to this small example, or does it reflect a general theorem?
Genus
Fix a negative fundamental discriminant . This means either that
is squarefree and congruent to one modulo four, or that
with
squarefree and congruent to two or three modulo four. We make this restriction so that the counting argument below has a particularly simple form.
For each odd prime dividing , our product identity gives a sign attached to a form: all its represented values coprime to that prime are either squares or nonsquares modulo the prime. If two divides the discriminant, there is a corresponding sign obtained from residues modulo four or eight. In our example
, that sign was
, positive on one and seven modulo eight and negative on three and five. Collect all these signs for a form. Two classes belong to the same genus if their lists agree.
We have already justified the signs for odd primes, but why is there a well-defined sign at two? We cannot simply reduce the earlier identity modulo two, because its left side contains a factor of four. Instead, when the discriminant is even, write and divide the identity by four. Since
, it becomes
Suppose both values on the left are odd, and write . We can now inspect the residues of
. When
, an odd product must be one modulo four: exactly one of
is odd. This gives the sign
.
When , oddness forces
to be odd. According as
is even or odd, the product is one or seven modulo eight. Thus its sign
is positive. When
, the same calculation gives one or three modulo eight, so the sign
is positive. In each case the character of the product of two represented odd values is positive. By multiplicativity, the two individual signs must agree. This is exactly the property we needed.
To organize all the signs without treating the prime two separately every time, we factor the fundamental discriminant into pairwise coprime integers called prime discriminants:
For every odd prime dividing
, take the signed factor
. If two divides
, the remaining factor is one of
. For example,
and
.
For an integer coprime to
, write
for the quadratic character belonging to the factor
. Quadratic reciprocity identifies the character of an odd prime discriminant with the residue sign modulo that prime. The preceding calculations explain the characters at two. We can now attach
to a form class by choosing any represented positive integer coprime to
and evaluating
on it. Such a value exists by the elementary choice of coordinates used in the composition argument. The sign does not depend on the chosen value.
Let us see how these signs behave when we compose forms. Choose equivalent representatives of two classes whose leading coefficients are coprime to each other and to
. This is possible by the same choice-of-coordinates argument. Their signs are
and
, since a form represents its first coefficient. The composed form has leading coefficient
. Therefore
.
This is the connection between congruences and composition that we were looking for. Each sign is a homomorphism from to
. In particular, the sign of a square class is always positive. We call the genus with all signs positive the principal genus. We have proved already that every square class belongs to it.
How many different lists of signs can actually occur? At first, with signs, we might expect
possibilities. But there is a restriction. Choose a representative
with odd leading coefficient
coprime to
. Since
, the discriminant is a nonzero square modulo every prime dividing
. Consequently the quadratic symbol
is positive. On the other hand, it equals the product of the
symbols
. Thus for every class
we have
The first signs determine the last, so there can be at most
genera. Is there perhaps some other hidden restriction? To show that there is not, start with any desired list of signs whose product is positive. For each factor
, choose a residue coprime to
having the required sign. The moduli
are pairwise coprime, so the Chinese remainder theorem combines these separate choices into a single reduced residue class modulo
. By Dirichlet’s theorem, that progression contains an odd prime
. Its signs are precisely the ones we prescribed.
Their product is positive, so . Our very first representation criterion now constructs a form of discriminant
representing
. That form has the desired list of signs. This proves that every admissible list occurs. There are exactly
For there are two genera, each with one class. For
there are again two genera, but each has two classes. Take also
. It has only one prime-discriminant factor and therefore only one genus. Yet reduction gives three classes, represented by
. The signs cannot distinguish any of them.
So the number of genera has a simple formula in terms of the discriminant, even though the number of form classes may be much harder to determine. We know that squares are in the principal genus. To prove that they fill the whole principal genus, it remains to count them.
Ambiguous classes
How can we count the squares in the class group without calculating its entire multiplication table? The useful observation is that two classes have the same square exactly when
. Thus every square has the same number of square roots: the number of classes whose square is the identity. Let us count these classes instead.
We call a class ambiguous if it is equal to its inverse. Since the inverse of is
, we can recognize ambiguity just by looking at a reduced form. If
, the two triples are identical. If
, the substitution
reverses the middle coefficient. If
, the substitution
does the same. In every other case the reversed triple is a different reduced form, so it cannot represent the same proper class. These three simple conditions are all we need.
Look back at our examples. At discriminant , both
and
are ambiguous. At discriminant
, only
and
are ambiguous; the other two forms are distinct inverses. This agrees with the cyclic group of order four that we found by composition. Could we count the ambiguous classes for a large discriminant without first listing all its reduced forms?
The key is to return to the discriminant equation. Each of the three conditions for ambiguity makes this equation factor into a product of two ordinary integers. We will see that the factors determine the form, so the problem becomes one of counting factorizations.
First suppose is odd. Since the discriminant is fundamental,
is squarefree and
. The middle coefficient must be odd, so it cannot be zero. Substitute
and
, respectively, into
. The two possibilities become
Now reverse the calculation. Take a factorization into positive integers and arrange the factors so that
. Because their product is three modulo four, one factor is one modulo four and the other is three modulo four. In particular, their sum is divisible by four.
If we identify and
in the first identity, we get
and
. This is reduced exactly when
, or
. If that inequality fails, use the second identity instead, setting
and
. Solving for the coefficients gives
and
. This is reduced when
, or
. Putting the two constructions together, we get
Every factorization gives a reduced form, whichever side of the inequality it falls on. At equality the two formulas give the same triple. The forms are primitive: a common divisor of the three coefficients would have its square dividing . We can also recover the factors from the form using the original two identities. Therefore there is exactly one ambiguous reduced form for each unordered factorization of
.
If has
prime divisors, we can assign each prime independently to one factor or the other. This gives
ordered factorizations. Interchanging the factors leaves the same unordered pair, and the two factors cannot be equal because
is squarefree. Dividing by two gives
ambiguous classes. Notice how little information about the individual classes we needed.
Now suppose , with
squarefree and
. The middle coefficient is even; write it as
. The discriminant equation becomes
. In this case all three ambiguity conditions must be considered. Substituting them gives
The first equation is particularly easy. Every factorization with
gives the reduced form
. What about the other two equations? Their two factors necessarily have the same parity. They cannot both be even, since
is squarefree. Hence they must both be odd, and these extra forms can occur only when
is odd.
For odd we can reverse the last two identities just as we did for odd discriminants. With
in the second identity, the reduction condition is
. With
in the third, it is
. The corresponding formulas are
Why are these extra forms primitive? The odd prime divisors of any common factor of the coefficients would have their squares dividing . As for two, since
, the odd factors have the same residue modulo four. So
is odd, ruling out a common factor of two.
Suppose has
distinct prime divisors. There are
unordered factorizations. If
is even, each gives just the form with middle coefficient zero, and these are all the ambiguous classes. The discriminant has
distinct prime divisors. If
is odd, each factorization gives two distinct forms, one with zero middle coefficient and one from the extra construction. The count is now
, but the discriminant has
prime divisors because of the additional factor two. The exceptional discriminant
has only the principal form
and obeys the same formula. Hence, in every case,
There is a nice way to see part of this calculation through composition itself. For , denote the form
by
. If
and
are coprime divisors of
, composition gives
. Every such class is its own inverse, so a prime factor appearing twice cancels from the product. Also,
, by interchanging the variables. Thus, for this family, composition amounts to multiplying squarefree divisors, cancelling repeated prime factors and identifying complementary divisors. The counting argument also includes the extra family when
is odd. What looked like a question about the structure of a group has been answered using the discriminant equation and a few elementary substitutions.
Gauss’s duplication theorem
We can now bring together the two parts of the argument. From the congruences we obtained exactly genera. Independently, from reduction we found exactly
ambiguous classes. Why is this equality of numbers important?
Write for the total number of classes. Recall that all square classes have equally many square roots, and that the square roots of the identity are exactly the ambiguous classes. Since there are
of them, the total number of distinct squares must be
On the other hand, the signs are multiplicative. Multiplying all classes in the principal genus by any one class in a given genus produces exactly that genus: the signs become those of the chosen class, and multiplication by its inverse reverses the operation. Therefore all genera have the same size. Since there are genera, the principal genus has
classes.
We already know that every square belongs to the principal genus, because squaring makes each sign positive. Now we know that there are just as many squares as there are classes in the principal genus. There is no room for any other class in it. This is Gauss’s duplication theorem.
Theorem. Let be a fundamental discriminant, and let
be the proper class group of primitive positive definite forms of discriminant
. A class belongs to the principal genus if and only if it is the square of a form class. Two classes lie in the same genus if and only if their quotient is a square class.
Proof in brief. The genus characters are multiplicative, hence trivial on squares. Their common kernel has elements by the count of sign patterns. The square subgroup has the same order by the count of ambiguous classes. They are therefore equal. Two classes have the same signs precisely when their quotient lies in this common kernel.
Here duplication simply means composing a form class with itself. The theorem says something rather stronger than the fact that a square has positive genus signs. It says that whenever all the signs are positive, there must be some form class whose square is the given class. More generally, if we know one class
in a genus, all the classes in that genus can be written as
. We can now understand why the two computations for discriminant
gave the same partition: the pairs were precisely the two cosets of the subgroup of squares.
We should distinguish two ingredients of the proof. The count of ambiguous forms used the assumption that the discriminant is fundamental. For nonfundamental discriminants, the corresponding count needs additional congruence conditions at primes dividing the conductor. The duplication theorem still holds with the appropriate genus theory. The other ingredient was Dirichlet’s theorem, which we used to ensure that every admissible collection of signs actually occurs. These are the limits of the argument as presented here.
Let us return to the question with which we started. When can quadratic-residue tests distinguish every class? This happens exactly when each genus contains a single class. By the duplication theorem, that means the only square class is the principal class, or equivalently that every class satisfies
. In that situation all the classes are ambiguous. There are as many classes as genera, and the list of signs determines the class completely. This is why the congruence test for
was sufficient.
Contrast this with . Here
, so the subgroup of squares has two elements. The signs can only identify a pair of classes. At
the situation is even more striking: there are three classes and just one genus. Since the group has order three, squaring permutes all three classes. Thus the fact that there is only one genus says nothing about whether there is only one class. The quadratic characters see the quotient by the squares, not the entire group.
We can use this observation to find other expressions for which prime representation has a simple congruence criterion. For example, take
, so that
. The reduction procedure gives the four forms
Without doing a single composition calculation, we can see that all four classes are ambiguous. The first and third have , the second has
, and the fourth has
. Thus every square is principal and there is exactly one class per genus. For an odd prime not dividing eighty-four, the principal genus conditions give
To obtain this list, factor and test the three characters on the invertible residue classes modulo eighty-four. The residues one, twenty-five and thirty-seven are precisely those for which all three signs are positive. Because the principal genus contains only the principal form, these congruences are sufficient, not just necessary.
At , the analogous test leaves six residues for the principal genus, but it cannot tell us whether a prime is represented by
or by
. This is the distinction illustrated earlier by the primes
and
.
There is still a practical way to distinguish the forms when the genus tests are inconclusive. Given an odd prime not dividing
, find a root
of
, if one exists. Form the triple
and reduce it. The two roots, considered modulo
with the required parity, give inverse proper classes. Every form representing
belongs to one of these classes, by the leading-coefficient argument. Since inverse forms represent the same integers, either root is enough if we are asking about ordinary representation. This gives a finite algorithm even when a list of simple residue conditions does not settle the question.
Convenient numbers
The positive integers for which every class of discriminant
has square equal to the principal class are traditionally called convenient or idoneal numbers. Their name reflects the useful property we have been discussing: the genus tests distinguish the individual classes.
For a particular , it is easy to test this property. Reduce all the primitive forms of discriminant
, and check whether each satisfies
,
, or
. If they all do, then every class is ambiguous and the square subgroup is trivial. This finite calculation does not require constructing the multiplication table.
The known convenient numbers are
Each number on this list can be checked individually by reduction. Showing that there are no further numbers is a different and much harder class-number problem; we do not claim that the list is unconditionally exhaustive. Also, several of the discriminants on the list are nonfundamental, so the simple formula for the number of genera proved above does not automatically apply to them. The direct test for ambiguous reduced forms, however, still works.
It is useful to summarize what we can now do with a prime, say for discriminant . First the discriminant test
tells us whether any form represents it. The sign
then tells us which of the two genera contains its class. The duplication theorem explains why these two genera are the two cosets of the square subgroup
. Finally, if we need to distinguish the individual classes within a genus, we can construct and reduce the prime form. Each step answers a more precise question than the preceding one.
We began by asking whether a prime could be written as without actually finding
and
. The answer led us to the discriminant, to the finite list of reduced forms, and then to the signs attached to the values represented by a form. What is perhaps most striking is that the partition obtained by these elementary congruence tests is exactly the partition obtained by composing classes with squares. This is the content of genus theory.
There is still a question left open by the theory. Could we find a test, more refined than quadratic-residue signs, that distinguishes individual classes even when a genus contains several of them? One answer leads to the Hilbert class field. In the imaginary quadratic setting, one can construct a polynomial whose roots are associated with the classes of quadratic forms. Its behavior modulo a prime gives additional information about the prime. For instance, two primes with identical genus signs can nevertheless give different factorization patterns of this polynomial. In this way, the original problem of representing primes by quadratic forms leads quite naturally to the study of splitting of primes in extensions of number fields.