A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Quadratic Residues and the Legendre Symbol

Graduate Depth 89 in the knowledge graph I know this Set as goal
5topics build on this
399prerequisites beneath it
See this on the map →
Modular Arithmetic and CongruencesProperties of Congruences+1 moreEuler's CriterionLaw of Quadratic Reciprocity+1 more
quadratic-residues legendre-symbol

Core Idea

For odd prime p and a not divisible by p, the Legendre symbol (a/p) is +1 if a is a quadratic residue mod p (i.e., x2 ≡ a mod p solvable) and -1otherwise. Exactly (p-1)/2 residues among 1, 2, ..., p-1 are quadratic residues.

Explainer

A quadratic residue mod p is an integer congruent to a perfect square mod p. More precisely, a (with p ∤ a) is a quadratic residue if x² ≡ a (mod p) has a solution. You already know from modular arithmetic that the nonzero residues mod p form a group under multiplication — the group (ℤ/pℤ)×, which has p−1 elements. A fundamental fact is that among these p−1 nonzero residues, exactly half are quadratic residues.

Why exactly half? The squaring map x ↦ x² sends (ℤ/pℤ)× to itself, but is 2-to-1: both x and −x square to x². Since gcd(m,p) = 1, x ≢ −x (mod p) when p is odd (as x ≡ −x would give 2x ≡ 0, so p | x), so x and −x are genuinely distinct. Each quadratic residue is hit exactly twice, and there are p−1 elements total, giving (p−1)/2 distinct squares — exactly half the nonzero residues. The Legendre symbol packages this: (a/p) = +1 if a is a quadratic residue (QR), −1 if a is a non-residue (QNR), and 0 if p | a.

The Legendre symbol is multiplicative: (ab/p) = (a/p)(b/p). This follows from the group structure. QR × QR = QR (the product of two squares is a square); QNR × QNR = QR (the product of two non-residues turns out to be a residue, since the squaring map's kernel — the QRs — forms an index-2 subgroup of (ℤ/pℤ)×, and the coset product of two non-residues lands in the subgroup); QR × QNR = QNR. The sign pattern is identical to multiplying +1 and −1, which is why the Legendre symbol is a group homomorphism from (ℤ/pℤ)× to {±1}.

Euler's criterion connects the Legendre symbol to direct computation: (a/p) ≡ a(p−1)/2 (mod p). To see why: by Fermat's little theorem, ap−1 ≡ 1 (mod p), so a(p−1)/2 is a square root of 1 mod p, meaning it equals ±1. If a = x² is a QR, then a(p−1)/2 = xp−1 ≡ 1. If a is a QNR, the value is −1. This criterion lets you determine quadratic residuosity by fast exponentiation, without searching for square roots. For example, is 3 a quadratic residue mod 11? Compute 3⁵ = 243 = 22 × 11 + 1 ≡ 1 (mod 11), so (3/11) = +1, confirming that x² ≡ 3 (mod 11) is solvable (x = 5 and x = 6 both work). The Legendre symbol and Euler's criterion together set up the machinery for the law of quadratic reciprocity, which relates (p/q) and (q/p) for distinct odd primes p and q.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesSet Operations: Union, Intersection, and ComplementProof by CasesProving by Cases and ExhaustionVacuous Truth and Trivial CasesProof by Cases (Proof by Exhaustion)Mathematical InductionDivisibility and Greatest Common DivisorThe Fundamental Theorem of ArithmeticDivisibility Theory (Formal Treatment)Fundamental Theorem of Arithmetic (Rigorous Proof)Arithmetic Functions and MultiplicativityDirichlet Series and L-FunctionsPrimes in Arithmetic Progressions (Dirichlet's Theorem)Distribution of PrimesIntroduction to the Riemann Zeta FunctionDirichlet Series and L-FunctionsPrimes in Arithmetic Progressions (Dirichlet's Theorem)Wilson's TheoremFermat's Little TheoremEuler's Criterion for Quadratic ResiduesLaw of Quadratic ReciprocityQuadratic Residues and the Legendre Symbol

Longest path: 90 steps · 399 total prerequisite topics

Prerequisites (3)

Leads To (3)