Computing Legendre symbols by quadratic reciprocity Created 2026-10-14 Updated 2026-10-31
The practical reward of quadratic reciprocity is a smaller modulus: swap a pair of distinct odd primes, record the required sign, then reduce the numerator by modular arithmetic. Use multiplicativity of the Legendre symbol and the second supplementary law for quadratic reciprocity to handle a factor of two. For example,Here are both modulo , so the first swap changes sign; gives ; the swap involving five has no sign change. An independent square check is . The method determines existence of a square root without itself finding that root.
A composite numerator is allowed in a Legendre symbol; a composite denominator instead calls for a Jacobi symbol. Its Jacobi reciprocity law supports repeated swaps and remainder reductions, in the spirit of the Euclidean algorithm.[ref]
Quadratic Reciprocity by Ben Lynn. Ben Lynn, Quadratic Reciprocity, “The Jacobi Symbol”: product definition and reciprocity for computing symbols without factoring
A final Jacobi symbol of one is not a square-existence certificate for a composite number modulus. For example,yet is impossible: reducing it modulo three would require a square congruent to two, and squares modulo three are only zero or one. The product has hidden two local failures. By contrast, for a prime denominator, a Legendre symbol of one does certify a quadratic residue.
Euler's criterion Created 2026-09-24 Updated 2026-10-18
Thus a quadratic residue gives one and a quadratic nonresidue gives minus one, represented by if a nonnegative remainder is used. The formula also holds when , because and both sides are zero modulo .[ref]
Quadratic Residues by Ben Lynn. Ben Lynn, Quadratic Residues, Euler's Criterion and The Legendre Symbol: exponent test and the zero value
For example, modulo seven the exponent is three: confirms that two is a quadratic residue, while confirms that three is a quadratic nonresidue. Modulo eleven the exponent is five, and confirms that two is a quadratic nonresidue. The test answers whether a square root exists; it does not itself return the roots of .
A short proof needs only Fermat's little theorem and the root bound for a polynomial. Put . If in the prime field, then . There are already such quadratic residues. The nonzero polynomial has polynomial degree , so it has no other polynomial roots. Finally, for every nonzero , Fermat's little theorem gives . Factoring in the field shows ; every quadratic nonresidue must take the remaining value . This proves the criterion without first finding a primitive root.
For a larger original example, decide whether seven is a quadratic residue modulo the prime number . Exponentiation by squaring computes the required power without listing fifty squares:Therefore and has no solution. Each intermediate product is reduced modulo , as in modular exponentiation. The advantage is that exponentiation by squaring uses a number of multiplications proportional to the binary digit length of the exponent rather than testing every potential square root.
The odd prime hypothesis is essential. For the composite modulus nine, , which is neither one nor minus one. Although four is a nonzero square modulo nine, , so even the square-to-one implication fails. The Jacobi symbol and Euler pseudoprime discuss different questions for odd composite moduli; they do not make this a universal square test.
If one Euler witness exists modulo , multiplication by injects the set of nonwitnesses into the set of witnesses. Indeed, the product of with a nonwitness cannot be another nonwitness, because cancellation and multiplicativity of the Jacobi symbol would make a nonwitness. Thus at least half of the units modulo are Euler witnesses.
Every odd composite integer has an Euler witness. For a nonsquarefree integer, a base congruent to modulo a repeated prime factor fails the Euler congruence by the binomial theorem. For a squarefree integer, use the Chinese remainder theorem to choose a base that is a quadratic nonresidue modulo one prime factor and modulo another. Its Jacobi symbol is , while its power is modulo the second factor.
For an odd positive nonsquare integer , there are infinitely many primes with Legendre symbol . Choose a residue modulo with Jacobi symbol by making it a quadratic nonresidue at one prime occurring to odd multiplicity and a square at every other prime. The Chinese remainder theorem also imposes and at any finite list of previously found primes. Then Jacobi reciprocity gives , so a prime factor of has and is outside that list.
Jacobi reciprocity law 2026-10-14
For coprime positive odd integers , the Jacobi symbol satisfies . It follows by factoring and into primes and multiplying the quadratic reciprocity for each prime pair; the parity of the sums of prime half-differences agrees with and . A Jacobi symbol equal to one does not imply that its numerator is a quadratic residue for a composite denominator.
Kronecker symbol Created 2026-09-28 Updated 2026-10-03
The Kronecker symbol extends the Jacobi symbol to all integer denominators. For a fundamental discriminant , the function is the primitive quadratic Dirichlet character associated with .
Legendre symbol Created 2026-09-24 Updated 2026-10-18
Its value depends only on the congruence class of modulo ; the displayed notation is a symbol, not division. The value zero handles separately from quadratic residues and quadratic nonresidues.[ref]
Quadratic Residues by Ben Lynn. Ben Lynn, Quadratic Residues, The Legendre Symbol: three values and dependence on an odd prime
For example, , , , and . The equality illustrates that choosing a different integer representative does not change the answer. An arbitrary odd composite denominator uses the Jacobi symbol, not the Legendre symbol. For instance,but two is not a square modulo fifteen: any such square root would also give a square root modulo three, where the only nonzero square is one. A Jacobi symbol of one therefore cannot replace the Legendre symbol's square test.
The Legendre symbol also counts square roots compactly. For every congruence class in the prime field ,The three cases give two, one and zero solutions for a quadratic residue, zero and a quadratic nonresidue, respectively. This is useful when counting solutions of modular congruences involving polynomials: a solvability question becomes a sum of Legendre symbols, as in the complete Legendre-symbol sum and quadratic Legendre-symbol correlation.
Multiplicativity of the Jacobi symbol Created 2026-09-29 Updated 2026-10-14
For odd positive , the Jacobi symbol is multiplicative in its numerator:It is also multiplicative in an odd denominator: .
Past exam of the mathematics course of the University of Cambridge 2006 ii Paper 4 11H Solution 2026-10-14
For odd coprime to , the Fermat pseudoprime test is . The Euler pseudoprime test meant here is the Euler–Jacobi test,where the right side is the Jacobi symbol. Write , with odd. The strong pseudoprime test passes when , or when for some . Terminology often reserves “pseudoprime” for composite numbers; the question uses it for passing the respective test, including primes.
For the final example, is composite and , so . It passes the Fermat primality test. However , whereas the supplementary law for the Jacobi symbol gives since . Thus 341 is Fermat but not Euler–Jacobi pseudoprime to base two. A weaker convention defining an Euler test merely by would not give the claimed distinction, which is why the Jacobi convention matters.
Past exam of the mathematics course of the University of Cambridge 2007 ii Paper 3 11F Solution Created 2026-09-24 Updated 2026-10-14
The Chinese remainder theorem says that for pairwise coprime positive moduli , the map is an isomorphism; in particular prescribed residues have a unique solution modulo the product.
Write , with and . Choose and . The Chinese remainder theorem supplies . The binomial theorem gives , since every nonconstant term is divisible by ; also . Thus , whereas . Its multiplicative order is exactly .
For odd define the Jacobi symbol , using the Legendre symbol, with . It is zero if shares a prime factor with . For example , but the square residues modulo nine are , so two is not a square.
For positive odd coprime , Jacobi reciprocity isFactor and and multiply quadratic reciprocity for each prime pair. Its sign exponent is . For odd numbers, , so this exponent has the same parity as . Multiplicativity of the Legendre symbol gives the two Jacobi products, proving the formula. If are not coprime, both sides of the displayed reciprocity equality are zero.
For the previously constructed , every prime divisor of sees residue one, so . But , because and is odd. The order- unit therefore has . This supplies a unit failing the proposed test.
Finally the passing units form the kernel of the homomorphismMultiplicativity makes this a homomorphism, and the failing unit shows its kernel is proper. A proper subgroup has index at least two. Hence the test fails on at least half the units modulo .
Past exam of the mathematics course of the University of Cambridge 2008 ii Paper 3 11H Solution Created 2026-09-24 Updated 2026-10-14
For positive odd coprime integers , the Jacobi reciprocity law isFactor . Since is not a square, some is odd. Choose a quadratic nonresidue modulo that , and choose residue one modulo each other . The Chinese remainder theorem provides a positive with these residues and with . Multiplicativity of the Jacobi symbol then gives .
Suppose only finitely many primes satisfy . They are coprime to . Repeat the preceding Chinese remainder theorem construction, additionally imposing at every odd and taking to avoid two. Since , Jacobi reciprocity gives . Factoring this Jacobi symbol over the prime factors of shows that at least one such prime has . But none of the listed primes divides , a contradiction. This proves the infinitely many prime quadratic nonresidues of a nonsquare integer assertion.
Past exam of the mathematics course of the University of Cambridge 2009 ii Paper 2 1G Solution Created 2026-09-24 Updated 2026-10-14
For odd positive coprime integers, quadratic reciprocity for the Jacobi symbol isIf the integers are not coprime, both symbols vanish; equivalently the usual signed reciprocity identity still holds. To deduce it from quadratic reciprocity for the Legendre symbol, factor and . Multiplication of the prime reciprocity identities gives the sign exponentModulo two, each bracket is respectively and : for odd , . This proves the composite-denominator law, including repeated prime factors.
Now , and 9 contributes a square factor. Since , reciprocity and reduction of the numerator giveA second reciprocity step gives . Thus the requested Jacobi symbol is .
Past exam of the mathematics course of the University of Cambridge 2010 ii Paper 4 11G Solution Created 2026-09-24 Updated 2026-10-14
Write and associate the symmetric matrix . Define the left group action of by ; using instead describes the same equivalence classes. The transformed matrix is , so its determinant is unchanged. Hence the discriminant of a binary quadratic formis invariant under proper equivalence of binary quadratic forms.
A proper representation here means with . Such a vector extends to the first column of an integer determinant-one matrix by Bezout identity. After that change of variables the form has leading coefficient , and discriminant , so its middle coefficient satisfies . Conversely, such a congruence gives the positive definite integral formwhich represents at . It is primitive: a common divisor of all three coefficients would have its square dividing the squarefree discriminant 35.
For clarity, enumerate all the proper equivalence classes at this discriminant. Substitutions first arrange ; if , the determinant-one substitution makes the leading coefficient smaller. Repeating terminates because this coefficient is a positive integer. Thus every class has a reduced representative with . From it follows that , giving . Checking , with odd, yieldsThe two signs in the first pair are equivalent by replacing with , and in the second pair by the determinant-one swap. Thus the two forms in the question exhaust the classes.
The primitive representation criterion at discriminant minus thirty-five now follows. For odd prime to 35, the congruence modulo is solvable exactly when is a square modulo every prime divisor of . Necessity is immediate. For sufficiency, a nonzero root modulo each odd prime lifts to all required prime powers because its derivative is invertible; combine the lifts by the Chinese remainder theorem, also imposing . This gives the modulus-four condition since . We concludeBy quadratic reciprocity, the symbol equals . In particular each prime divisor must be a quadratic residue at both 5 and 7, or a nonresidue at both. The condition is on each prime divisor, not merely on the product Jacobi symbol of .
Past exam of the mathematics course of the University of Cambridge 2011 ii Paper 4 11I i Solution Created 2026-09-24 Updated 2026-10-14
For odd coprime positive integers and , define the Jacobi symbol by multiplying Legendre symbols over the prime factorization of the denominator. Multiplicativity in the numerator givesBy quadratic reciprocity for the Legendre symbol, this is , where and . For odd , , since is even. Thus and . We obtainIf are not coprime, both symbols are zero and the equivalent identity still holds. The convention handles denominator one.
Past exam of the mathematics course of the University of Cambridge 2015 ii Paper 4 9H Created 2026-09-24 Updated 2026-10-06
The Chinese remainder theorem says that for pairwise coprime positive moduli , arbitrary residue classes modulo each specify one residue class modulo . For an odd positive integer , the Jacobi symbol is , where each factor is a Legendre symbol; for the empty product is one. The Jacobi symbol is multiplicative in , and is zero exactly when and have a common prime factor.
Past exam of the mathematics course of the University of Cambridge 2015 ii Paper 4 9H ii Solution Created 2026-09-24 Updated 2026-10-06
True. Since is not a square, some exponent is odd. Choose a quadratic nonresidue modulo that and choose residue one at every other prime. The Chinese remainder theorem produces a unit modulo with . Multiplication by permutes the residue classes modulo . Thus, by multiplicativity of the Jacobi symbol,The sum is therefore . Nonunits contribute zero, so the permutation argument covers every term.
Past exam of the mathematics course of the University of Cambridge 2015 ii Paper 4 9H i Solution Created 2026-09-24 Updated 2026-10-06
False. The Jacobi symbol , yet is not a quadratic residue modulo three. A solution modulo fifteen would give one modulo three, which is impossible. A positive Jacobi symbol need not indicate a square modulo a composite modulus.
Past exam of the mathematics course of the University of Cambridge 2015 ii Paper 4 9H iv Solution Created 2026-09-24 Updated 2026-10-06
True. First suppose with maximal. By the Chinese remainder theorem, choose and modulo all other prime-power factors. This is a unit, with Jacobi symbol one, because it is one modulo every prime. For , the binomial theorem givesbecause and all higher terms contain . It is therefore a witness to the desired failure.
If is square-free and composite, it has at least two prime factors. Choose to be a quadratic nonresidue at one prime and one at every other prime, again using the Chinese remainder theorem. Then . At a different odd prime , however, . These two cases prove that every odd composite has an Euler-Jacobi witness, unlike the situation for the ordinary Fermat primality test.
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 3 1G Solution Created 2026-09-24 Updated 2026-10-05
An Euler pseudoprime is an odd composite number with satisfying , where the right side is the Jacobi symbol. A weaker convention requires only ; it is distinguished below. A strong pseudoprime, with and odd, satisfies or for some .
By the Chinese remainder theorem for unit groups, the unit group modulo is . Modulo , . Thus the only possible sign in is positive. Modulo , writing for a primitive root, the condition is , equivalently . Consequently has multiplicative order dividing in each factor. Its square is either or in each factor, but these signs must agree: modulo , the Legendre symbol is for square and for square , and the same is true modulo . The Euler pseudoprime condition additionally requires the product of those Legendre symbols to be . HenceEach sign has two roots modulo each prime, hence four roots modulo . There are eight pseudoprime bases modulo under the Jacobi symbol convention. Under the weaker sign-only convention there are instead sixteen pseudoprime bases, since the two signs of the squares need not agree; the stated equivalence therefore specifically uses the Jacobi symbol convention.
For the strong pseudoprime condition, . Since the unit group has exponent of a finite group , the only possibilities are or . The six pseudoprime bases are . For example , while has but . Thus the strong-pseudoprime pseudoprime bases are not a subgroup.