Mathwords logoMathwords

Euler's Criterion — Definition, Formula & Example

Euler's criterion is a test for whether a whole number has a square root modulo an odd prime. You raise the number to one specific power and check whether the remainder is 1 or −1.

Let pp be an odd prime and aa an integer with p∤ap \nmid a. Then a(p−1)/2≡1(modp)a^{(p-1)/2} \equiv 1 \pmod{p} if there exists an integer xx with x2≡a(modp)x^2 \equiv a \pmod{p} (that is, aa is a quadratic residue), and a(p−1)/2≡−1(modp)a^{(p-1)/2} \equiv -1 \pmod{p} otherwise. In Legendre-symbol form, (ap)≡a(p−1)/2(modp)\left(\frac{a}{p}\right) \equiv a^{(p-1)/2} \pmod{p} for every integer aa. When p∣ap \mid a, both sides are 00.

Key Formula

(ap)≡ap−12(modp)\left(\frac{a}{p}\right) \equiv a^{\frac{p-1}{2}} \pmod{p}
Where:
  • pp = An odd prime modulus
  • aa = The integer you are testing
  • (ap)\left(\frac{a}{p}\right) = The Legendre symbol. It is 1 if a is a nonzero quadratic residue mod p, −1 if a is a nonresidue, and 0 if p divides a

Worked Example

Problem: Use Euler's criterion to decide whether x2≡5(mod19)x^2 \equiv 5 \pmod{19} has a solution.
Step 1: Find the exponent. Since p=19p = 19 and 19∤519 \nmid 5, you need 5(19−1)/2 mod 195^{(19-1)/2} \bmod 19.
19−12=9\frac{19-1}{2} = 9
Step 2: Compute powers of 5 by repeated squaring. Reduce mod 19 after each squaring so the numbers stay small.
52=25≡6,54≡62=36≡17≡−2,58≡(−2)2=4(mod19)5^2 = 25 \equiv 6, \quad 5^4 \equiv 6^2 = 36 \equiv 17 \equiv -2, \quad 5^8 \equiv (-2)^2 = 4 \pmod{19}
Step 3: Multiply one more factor of 5 to reach the ninth power. The remainder is 1, so 5 is a quadratic residue. As a check, 92=81=4⋅19+59^2 = 81 = 4 \cdot 19 + 5.
59=58⋅5≡4⋅5=20≡1(mod19)5^9 = 5^8 \cdot 5 \equiv 4 \cdot 5 = 20 \equiv 1 \pmod{19}
Answer: Because 59≡1(mod19)5^9 \equiv 1 \pmod{19}, the number 5 is a quadratic residue mod 19. The congruence has the solutions x≡9x \equiv 9 and x≡10(mod19)x \equiv 10 \pmod{19}.

Why It Matters

Euler's criterion turns a search through all squares mod p into a single fast modular exponentiation. That speed makes it practical for large primes. The Solovay–Strassen primality test compares it against the Jacobi symbol, and many proofs of quadratic reciprocity in a first number theory course start from it.

Common Mistakes

Mistake: Raising a to the power p − 1 instead of (p − 1)/2.
Correction: By Fermat's little theorem, ap−1≡1(modp)a^{p-1} \equiv 1 \pmod{p} for every aa with p∤ap \nmid a. That result can't separate residues from nonresidues. Use the half exponent (p−1)/2(p-1)/2. Its result is 11 or −1-1 when p∤ap \nmid a, and 00 when p∣ap \mid a.

Related Terms