Suppose is a quadratic nonresidue. On the nonzero residue classes modulo , define the involution
It is an involution because . A fixed point would satisfy , which is excluded by the quadratic nonresidue hypothesis. Thus it partitions the classes into disjoint pairs , each with product . Consequently
Now evaluate the same product by pairing every class with its own modular inverse. The only classes equal to their modular inverses solve and hence are and . All other pairs have product one. The complete product is therefore , so
Together with the preceding part, this is Euler's criterion; the pairing argument establishes the converse without assuming it.
For the odd prime , the Fermat-Euler theorem gives . Therefore the residue class obeys . Since a prime number dividing a product divides one of its factors,
If is a quadratic residue, choose with . Then is nonzero modulo , and Fermat's little theorem gives
This proves the quadratic residue direction of Euler's criterion.
The Fermat-Euler theorem states that, for an integer and any integer coprime to ,
where the Euler totient function counts the residue classes coprime to .
Let be representatives of these residue classes. Multiplication by gives a permutation of them: each remains coprime to , and implies by cancellation using the modular inverse of . Multiplying all the resulting modular congruences yields
The product is itself coprime to , so it has a modular inverse and can be canceled. This proves the Fermat-Euler theorem. For , the congruence is trivial; no separate argument is needed.
Reduce using modular congruence: its residue class modulo is , , or . A square number therefore has residue class or , and raising either residue to the positive integer power leaves it unchanged. Consequently
The exponent in the original PDF is ; the polynomial identities in the converted TeX are a transcription error. The argument uses ; it does not assign a value.
The Fermat-Euler theorem states that for an integer and a positive integer with ,
where the Euler totient function counts the residue classes coprime to . For , choose a reduced residue system . Multiplication by the unit modulo n preserves coprimality and is injective on these residue classes: implies , because has a multiplicative inverse modulo . It therefore permutes the reduced residue system, giving
The product is also a unit modulo n, so it can be cancelled. This proves the Fermat-Euler theorem. For every modular congruence is automatic; one may use .
For a prime number , the Euler totient function has value . Thus whenever . Multiplying by , and treating separately, gives the all-integer version of Fermat's little theorem:
Finally, Wilson theorem states that for every prime number , . Its converse is also true: an integer is prime exactly when . For the converse, any proper divisor would divide both and , contradicting that congruence.
Suppose . Then is a unit modulo n for modulus , and Fermat's little theorem implies
Since is an odd prime number, and are distinct residue classes. Therefore is even, and .
Conversely, put . Pair each integer with in the factorial. Wilson theorem yields
When , is even, so satisfies . This proves the first supplementary law for quadratic reciprocity without assuming a primitive root. Hence
The two solutions are and modulo : their difference is nonzero, and factoring shows that a degree-two polynomial over the field of residues modulo has no further roots.
Extend the Dirichlet character periodically to all integers, putting when . Its Dirichlet L-function, initially on , is
The Euler product follows from unique prime factorization and absolute convergence; a Dirichlet character is completely multiplicative on this extension. Write for the principal Dirichlet character, equal to one on units and zero elsewhere.
For a nonprincipal Dirichlet character , character orthogonality gives . Explicitly, multiplication by a unit with permutes the unit residues and multiplies this sum by , forcing it to vanish. For set
The numerator is at zero and the denominator is , so is bounded, indeed analytic, near zero; it decays exponentially at infinity. Initially for , absolute convergence justifies
This Mellin transform integral is holomorphic for , locally uniformly in , and division by the Gamma function proves the requested analytic continuation to the left of the line one.
In fact, the same argument proves Mellin continuation of a nonprincipal Dirichlet L-function to the entire plane. If at zero, subtract this Taylor polynomial on and add its explicit integrals:
The last integral is holomorphic on . Its possible simple poles at nonpositive integers cancel against zeros of . Letting increase shows that is an entire function, without any primitivity assumption.
For real , use the absolutely convergent Euler product logarithm
The higher-power remainder has the uniform estimate
For a nonprincipal Dirichlet character , invoke the allowed nonvanishing of a nonprincipal Dirichlet L-function at one. Its holomorphy and nonvanishing give a holomorphic logarithm on a small disk about one. On the connected real interval , differs from this logarithm by a fixed element of : the difference is continuous with exponential one. Thus the prime-character sum near one is bounded. This branch argument is needed for complex-valued Dirichlet characters.
For ,
The finite product has a positive limit as , and the residue-one pole of the Riemann zeta function gives
Here for nonprincipal Dirichlet characters means bounded complex magnitude.
Finally, for a residue class coprime to , Orthogonality of Dirichlet characters gives
Only primes not dividing occur, so the character orthogonality applies to every term. This sum diverges as . A finite collection of primes would give a bounded sum, a contradiction. Every reduced residue class contains infinitely many primes. This is the Dirichlet theorem on primes in arithmetic progressions; the coprimality hypothesis is essential.
Both forms have discriminant of a binary quadratic form . The reduction algorithm for a positive definite binary quadratic form gives and for a reduced positive definite representative. Enumerating gives
The second and fourth forms are imprimitive and represent only even integers. Every odd prime represented by a form of discriminant of a binary quadratic form must therefore be represented by or .
For a prime , quadratic reciprocity gives
Every prime has this symbol equal to one and hence is represented by one of the two primitive forms, by part (b). But an odd prime represented by and different from three is , so these primes must be represented by . Similarly, primes have both symbols equal to , and are represented by , since a prime represented by is . Both residue classes are coprime to 15, so Dirichlet theorem on primes in arithmetic progressions proves each form represents infinitely many primes.
The same modulo-three distinction excludes every prime other than three from being represented by both. The form does not represent three; represents three and five but neither is represented by , and two is represented by neither. Therefore there are no primes represented by both forms.
In the RSA cryptosystem, choose distinct large prime numbers , set , and choose coprime to . Choose with . A plaintext residue class is encrypted as and decrypted as . Fermat's little theorem modulo and , followed by the Chinese remainder theorem, proves correctness even when is not coprime to .
Textbook RSA cryptosystem is multiplicative: . For a chosen-ciphertext attack, multiply an intercepted by for a known invertible . A decryption oracle returns , from which multiplication by recovers . Likewise, multiplying two textbook RSA signatures produces a signature of their product. These are homomorphism attacks, exploiting algebra rather than factoring .
For an ElGamal signature, choose a prime , a primitive root modulo , a private exponent , and public . To sign a message digest , choose a fresh secret coprime to and set
Verification checks and , which follows because . Authenticating the ciphertext and its context with such a digital signature, before decryption, prevents the simple multiplicative modification from being accepted without a fresh valid signature. One needs an appropriate cryptographic hash function and fresh secret cryptographic nonces: this is not a claim that every algebraic attack is impossible. In particular, the unhashed historical ElGamal signature scheme admits existential forgeries of specially chosen message exponents; mere multiplication of encrypted messages is not an authentication mechanism.
Fermat's little theorem states that for a prime and integer ,
if , equivalently . For the latter form, multiplication by permutes the nonzero residue classes modulo . Multiplying the congruences and cancelling gives . The first form also covers .
Since , the theorem gives
Put . The odd integer is an Euler pseudoprime to the coprime base when
where is the Jacobi symbol.
Let be the unit group of residue classes modulo , and partition it into the set of bases satisfying the displayed congruence and the set of Euler witnesses that do not. If , multiplication by maps injectively into : indeed, if and also lay in , then the multiplicativity of the Jacobi symbol would give
Cancelling the invertible congruence for would say that , a contradiction. Hence , so at least half of the coprime bases are witnesses.
It remains to construct one witness for every odd composite number . If is not squarefree, choose an odd prime number with . The Chinese remainder theorem gives a unit such that for the full power and modulo every other prime-power factor. The binomial theorem gives
Since , this is neither nor modulo , whereas the Jacobi symbol is always or . Thus is a witness.
If is squarefree and composite, choose distinct primes . By the Chinese remainder theorem, choose to be a quadratic nonresidue modulo and to satisfy modulo every other prime divisor of . Then , while , so the Euler congruence again fails. This proves the existence of an Euler witness for every odd composite integer.
Lagrange theorem for polynomial congruences says that a nonzero polynomial of degree over the finite field has at most roots. To prove it, use mathematical induction on . A constant nonzero polynomial has no roots. If , polynomial division in the field gives with . Every root other than is a root of , so the induction hypothesis gives at most roots.
Every nonzero residue class modulo has a unique multiplicative inverse. In the product , pair each class with its inverse. The unpaired classes satisfy , hence . By the theorem these are exactly and , and therefore
This is Wilson theorem.
Now write . By Fermat's little theorem, every nonzero class is a root of
The second factor has degree and hence at most roots. Since their union contains all nonzero classes, has at least roots; Lagrange's theorem gives at most . Thus has exactly solutions.
For each prime number , the congruence removes exactly one residue class of modulo ; for , it removes none. The dimension-one upper-bound sieve therefore gives
Separating the primes that divide bounds the product by
The ratio form of Mertens theorem says that the first product is . Hence
Pigeonhole principle Created 2026-09-24 Updated 2026-10-13
Place objects into boxes, assigning each object to exactly one box. Here is a nonnegative integer and is a positive integer. The pigeonhole principle says that if , some box contains at least two objects. Equivalently, a function from an -element finite set to an -element finite set cannot be an injective function when . The boxes may stand for categories rather than physical containers. [ref]
For thirteen objects and twelve boxes, a box containing at least two is unavoidable. Thinking of thirteen people and their birth months gives the same conclusion: at least two share a birth month. Twelve people could occupy the twelve months one apiece, so thirteen is the smallest number that forces a shared month. The generalized pigeonhole principle quantifies how many objects must share a box when there are still more objects.
The useful surprise is that the pigeonhole principle proves existence without needing to locate the objects involved. Choosing a good assignment rule is often the creative step: equal labels can mean equal remainders, nearby points, or repeated states of an algorithm. Once the rule is chosen, a short count can force a relationship among a much larger collection of objects. The pigeonhole principle itself does not name the crowded box. When the objects and their assignments are explicitly available, a simple algorithm finds one: scan the objects, keep the first object seen in each box, and stop when a later object enters an occupied box. At most scanned objects are needed when .
A geometric example. Any five points in a square of side one contain two whose Euclidean distance is at most . Give each point Cartesian coordinates . Divide both ranges into the intervals and , making four cells. Thus belongs to the left half and to the right half; belongs to the lower half and to the upper half. This convention assigns every boundary point to exactly one cell.
The pigeonhole principle puts two of the five points in the same cell. Their differences in Cartesian coordinates have magnitude at most , so the Pythagorean theorem gives their Euclidean distance the bound
For the plotted points , , , and , the first two occupy the lower-left cell and have Euclidean distance . These Cartesian coordinates exhibit the forced pair; the argument applies to every placement of five points.
Figure 1.
The pigeonhole principle places two of five points in one of four cells of a square, bounding their Euclidean distance by
. Details.
An arithmetic example. Assign eight integers to their seven residue classes modulo the integer modulus . The pigeonhole principle gives two with the same residue class, so is an integer divisor of their difference. In , for example, and satisfy the integer congruence , and . Likewise, assigning fractional parts to short intervals gives the Dirichlet approximation theorem; its existing article explains the approximation bound.
The profinite topology on has basis the residue classes , . These classes are both open and closed, since their complements are finite unions of other residue classes. Set for . Then and every is nonempty. An integer in their intersection would make divisible by every , forcing , impossible. Thus the open complements form an increasing cover with no finite subcover. The topology is Hausdorff because distinct integers are distinct modulo a sufficiently large integer, but is not compact.