Let be an odd prime and let be integers with . The quadratic congruence
has a solution exactly when its discriminant is zero or a quadratic residue modulo .
Indeed, completing the square gives the equivalent equation
Multiplication by and translation by give a bijection of the residue classes, because is invertible modulo . Each square root of therefore gives exactly one solution .
Consequently the number of distinct solutions is , using the Legendre symbol: one for zero discriminant, two for a nonzero quadratic residue, and none for a quadratic nonresidue. The hypotheses matter: if the equation can become linear, while at division by is unavailable.
No. Take , . The Jacobi symbol is
but the squares modulo are . A square root of modulo would reduce to one modulo , which is impossible. A Jacobi symbol of records a product of local signs; it does not assert that every local sign is positive, or that a quadratic congruence is soluble.
Complete the square to obtain the equivalent quadratic congruence
Here : the Euclidean algorithm has successive nonzero remainders . If this modular congruence had a solution, the Jacobi symbol would be , since a square coprime to an odd modulus has Legendre symbol at every prime factor. Calculate instead, using Jacobi reciprocity and reduction of numerators,
Therefore there is no solution. This obstruction does not require a separate primality test for ; the Jacobi symbol suffices.
Square root of minus one modulo a prime Created 2026-10-07 Updated 2026-11-05
The quadratic congruence is soluble exactly when or . At , take .
For an odd prime , any solution is nonzero modulo . Fermat's little theorem gives
so is even and . Conversely, put when . Pairing opposite factors in the factorial gives
Wilson's theorem therefore gives , constructing a solution. For example, at the construction gives and . The criterion is the first supplementary law for quadratic reciprocity expressed as existence of a square root.