Euler's criterion states that for an odd prime number and ,
where the right-hand side is the Legendre symbol.
Let be a primitive root modulo . Its multiplicative order is , so . This power has square , and the only roots of modulo the odd prime are . Therefore
Euler's criterion now gives , so every primitive root is a quadratic nonresidue.
Now let be a Fermat prime, with . The number of primitive roots modulo is
There are also exactly quadratic nonresidues. Since every primitive root is a nonresidue, these equally large sets coincide. Thus every quadratic nonresidue modulo is a primitive root, as summarized by Quadratic nonresidues modulo a Fermat prime.
Finally, and . Quadratic reciprocity therefore gives
Hence is a quadratic nonresidue modulo , and consequently
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.
Write with odd primes . The Jacobi symbol is
where each factor on the right is a Legendre symbol. The supplementary law is
For coprime positive odd , quadratic reciprocity gives
Applying this with gives
Finally, factor with odd. The supplementary laws for and , followed by reciprocity on every odd prime factor of , express solely in terms of the residue class of the positive odd integer modulo when or . If , all those factors, including the zero cases, agree; hence
For an odd prime , the Legendre symbol is
For distinct odd primes and , quadratic reciprocity states that
For odd, define . Multiplying quadratic reciprocity for all prime-factor pairs gives
for positive odd coprime ; the sign exponents add modulo two, proving Jacobi reciprocity from Legendre reciprocity. Since , and , so . Nevertheless is a nonresidue modulo both prime factors, so has no solution.