In number theory, Euler's criterion is a formula for determining whether an integer is a quadratic residue modulo a prime.
Precisely, Let p be an odd prime and a be an integer coprime to p. Then[1][2][3] Euler's criterion can be concisely reformulated using the Legendre symbol:[4] The criterion dates from a 1748 paper by Leonhard Euler.
[5][6] The proof uses the fact that the residue classes modulo a prime number are a field.
See the article prime field for more details.
Because the modulus is prime, Lagrange's theorem applies: a polynomial of degree k can only have at most k roots.
This immediately implies that besides 0 there are at least p − 1/2 distinct quadratic residues modulo p: each of the p − 1 possible values of x can only be accompanied by one other to give the same residue.
As a is coprime to p, Fermat's little theorem says that which can be written as Since the integers mod p form a field, for each a, one or the other of these factors must be zero.
Applying Lagrange's theorem again, we note that there can be no more than p − 1/2 values of a that make the first factor zero.
But as we noted at the beginning, there are at least p − 1/2 distinct quadratic residues (mod p) (besides 0).
Therefore, they are precisely the residue classes that make the first factor zero.
The other p − 1/2 residue classes, the nonresidues, must make the second factor zero, or they would not satisfy Fermat's little theorem.
runs through all nonzero remainders modulo
It follows from this fact that all nonzero remainders modulo
according to the rule that the product of the members of each pair is congruent to
, uniquely, and vice versa, and they will differ from each other if
(which is obviously a square) into this formula to obtain at once Wilson's theorem, Euler's criterion, and (by squaring both sides of Euler's criterion) Fermat's little theorem.
In one case, testing p = 3, we have 17(3 − 1)/2 = 171 ≡ 2 ≡ −1 (mod 3), therefore 17 is not a quadratic residue modulo 3.
In another case, testing p = 13, we have 17(13 − 1)/2 = 176 ≡ 1 (mod 13), therefore 17 is a quadratic residue modulo 13.
We can do these calculations faster by using various modular arithmetic and Legendre symbol properties.
If we keep calculating the values, we find: Example 2: Finding residues given a prime modulus p Which numbers are squares modulo 17 (quadratic residues modulo 17)?
We can manually calculate it as: So the set of the quadratic residues modulo 17 is {1,2,4,8,9,13,15,16}.
Note that we did not need to calculate squares for the values 9 through 16, as they are all negatives of the previously squared values (e.g. 9 ≡ −8 (mod 17), so 92 ≡ (−8)2 = 64 ≡ 13 (mod 17)).
We can find quadratic residues or verify them using the above formula.
Euler's criterion is related to the law of quadratic reciprocity.
In practice, it is more efficient to use an extended variant of Euclid's algorithm to calculate the Jacobi symbol
is an odd prime, this is equal to the Legendre symbol, and decides whether
to the Jacobi symbol holds for all odd primes, but not necessarily for composite numbers, calculating both and comparing them can be used as a primality test, specifically the Solovay–Strassen primality test.
Composite numbers for which the congruence holds for a given
The Disquisitiones Arithmeticae has been translated from Gauss's Ciceronian Latin into English and German.
The German edition includes all of his papers on number theory: all the proofs of quadratic reciprocity, the determination of the sign of the Gauss sum, the investigations into biquadratic reciprocity, and unpublished notes.