Alphabet insensitivity lemma Created 2026-10-05 Updated 2026-10-14
For a finite coloring of , a combinatorial subspace is -insensitive if replacing by , or conversely, in any of its variable coordinates leaves the color unchanged. For every number of colors, alphabet size , and dimension , sufficiently large guarantees such a -dimensional combinatorial subspace for any specified distinct letters .
A proof uses the pigeonhole principle on chains in consecutive coordinate blocks. Choose block lengths from left to right, making each long enough to pigeonhole the vector of colors for every earlier word and every later variable assignment. Process the blocks from right to left. Two equal color vectors give a nonempty variable interval insensitive to . Insensitivity already obtained in later blocks survives all restrictions of earlier coordinates. This lemma proves the Hales-Jewett theorem by induction on alphabet size.
Birthday problem Created 2026-10-13 Updated 2026-10-14
The birthday problem asks for the probability that at least two members of a group share a birthday. Use the explicit model of independent random variables taking labels with a uniform distribution on a finite set. Let and be integers. For calendar examples below, stipulate equally likely labels and omit leap days. For , the probability of at least one matching pair is
At , the empty product is one and . At , a repeat is certain by the pigeonhole principle. Count the complement to obtain the formula: the first label has choices, then a distinct second label has , and so forth, out of equally likely label sequences.[ref]
For the stipulated calendar, and . Only 23 people suffice to put the probability above one half. There are possible pairs, each with matching probability . The many comparison opportunities explain why a small group can contain a repeat.
Figure 1.
Any matching pair becomes likely much sooner than a match with one specified person
. Original exact computations under the independent uniform 365-label model. The solid curve allows every pair in a group of total size ; the lower curve requires a match with one designated member. The dashed curve is the exponential lower bound for any-pair collision probability. This is a model calculation, not observed birthday data. Details.
The distinction also matters for hash collisions. If independently generated outputs of a hash function are uniformly distributed over possible labels, the same counting formula governs repeats. The birthday square-root scale explains why looking for any repeated output requires far fewer labels than trying to match one predetermined output. The uniform-independent model is an assumption about those outputs; the birthday problem does not itself establish that a particular implementation meets it.
For any sequence of integers, some nonempty consecutive block has sum divisible by . Form the prefix sums . There are only residue classes modulo , so the pigeonhole principle gives for some . Subtraction proves that is the required block sum. Negative entries and repeated entries cause no difficulty. Applied after any ordering of a finite set, it also gives a nonempty subset whose sum is divisible by the size of the set.
Cyclic permutation Created 2026-10-14 Updated 2026-10-20
A cyclic permutation, also called a permutation cycle, sends distinct elements and fixes every element outside this list. Its notation is . For example, is the permutation with image list : all four labels lie on one directed loop. In contrast,
has two separate loops, exchanging with and with . It is a permutation composed of two transpositions, rather than a single cyclic permutation.
Figure 1.
Two permutations on four labels: one cyclic permutation and two disjoint permutation cycles , with arrows showing every image
. Details.
Starting at a different point of the same loop changes the written list but preserves the cyclic permutation: . Reversing the direction generally changes the permutation; it gives the inverse function, here . A transposition is a cyclic permutation of length two; a one-element permutation cycle records a fixed point. In a cycle decomposition of a permutation, one-element permutation cycles are usually omitted, with the underlying set understood.
The beauty of this representation is that repeated rearrangements become motion around independent loops. Applying four times returns every label to its start, while applying twice already does so. Disjoint permutation cycles commute under function composition, since each moves only labels the others fix. On labels, there are cyclic permutations whose single loop contains every label: fix as the first written entry and order the other labels freely, giving a factorial. This is also the count of cyclic orderings; choosing a starting position would otherwise count each loop times. Rotations are identified here, while reversing direction is allowed to give a different cyclic ordering.
Proof outline for decomposition. Starting at any label in a finite set, repeatedly apply the permutation. The pigeonhole principle forces a repeated label. If the first repetition were at a label other than the starting one, its two predecessors would be different labels with the same image, contradicting the injective function property. This produces a permutation cycle returning to the start. Start again at a label not yet visited; the new permutation cycle cannot meet an earlier one, since the bijection gives every label a unique predecessor. Continue until every label belongs to a loop. The resulting cycle decomposition of a permutation is unique up to the order of the disjoint permutation cycles and the starting point written in each one. [ref]
For every irrational number and positive integer , there are integers with such that
The proof applies the pigeonhole principle to the fractional parts of .
Every finite-sums set generated by an infinite sequence of positive integers contains another finite-sums set generated by a strictly increasing sequence satisfying . Consequently the divisibility requirement can be added to the conclusion of Hindman theorem.
Choose each as a sum over a finite block of indices of the original sequence, with these index blocks disjoint and successive. Given , take two fresh groups of terms. In either group the partial sums, including , give two equal congruence classes modulo by the pigeonhole principle. Their difference is a nonempty consecutive sum divisible by , and hence at least . Add the two such sums to obtain divisible by . Its index block is the union of the two selected subblocks. Discard the rest of these groups and continue after them. Because the blocks are disjoint, every finite sum of the is a finite sum of distinct original terms. This proves both the finite-sums set containment and the strictly increasing divisibility chain.
Suppose has degree in and a nonzero constant leading coefficient . Among the heights , at least one satisfies
at each real . Factor into linear factors with multiplicity. Each root's imaginary part can be within distance less than one of at most one candidate height. The pigeonhole principle leaves a height whose distance from every root is at least one, proving the product bound. The height can be chosen measurably: the set where a candidate succeeds is the closed intersection of over rational , and selecting the first successful candidate gives a Borel set partition. This avoids any need for continuous global root labels.
Finite Ramsey theorem Created 2026-09-24 Updated 2026-10-14
Fix positive integers with . There is an integer , depending only on , such that every finite coloring
has a subset of size for which the restriction of a function to is a constant function. Here , and denotes the collection of all -element subsets of , rather than its binomial coefficient cardinality. The notation abbreviates this property. Thus is a homogeneous set for a colouring; when , the monochromatic set consists of its -element subsets, not its individual elements. This is the finite assertion in Ramsey's original Theorem B, p. 267.
For , this is the pigeonhole principle, with sharp threshold . For instance, every red-blue coloring of five objects has three of one color; four objects can split two and two. For , and , the sharp threshold is six, as shown by the Ramsey number for triangles. Coloring pairs makes this a problem about edges of a complete graph. For larger , the analogous viewpoint uses a hypergraph.
The finite Ramsey theorem lets an existence argument discard most of a large finite set while retaining a prescribed amount of uniform structure. Its threshold applies to every coloring; one does not need an assumption that colors were assigned randomly. A diagonal compactness argument deduces finite existence from Ramsey's theorem, but does not by itself identify the smallest threshold. For pairs, a Ramsey number makes that optimization explicit.
Function collision Created 2026-10-06 Updated 2026-10-14
A function collision is a pair of distinct inputs with . An injective function has no collisions. For a two-to-one function every nonempty fiber has two elements and hence one unordered collision pair. Finding such a pair through an oracle is the task of quantum collision finding.
In the finite example under image and preimage of a function, the pair is a function collision: both inputs give zero. The function retains their shared output but loses the distinction between them. If a finite set has more inputs than the number of available outputs, the pigeonhole principle forces a function collision. Equal source and target cardinalities alone do not prevent one.
For a finite function, let be the cardinality of its fiber of a function over . The number of unordered function collisions is , because each pair must lie in one common fiber. The example's nonempty fiber sizes are , giving exactly one collision pair.
Hall obstruction 2026-10-14
A Hall obstruction is a left subset with fewer distinct neighbours than vertices. At most members of can be matched, so at least must remain unmatched. The pigeonhole principle proves failure without enumerating every proposed assignment.
For a stronger counterexample than an isolated vertex, take and with
Every vertex has positive degree of a vertex, the sides have equal cardinality, and . Every two-vertex left subset also passes the Hall condition. Nevertheless has only , so rules out matching saturation of .
Figure 1.
A three-vertex Hall obstruction has only two neighbours, despite enough slots in total
. Red boundaries identify and . Thick blue edges give the maximum-size matching in a graph ; and slot are unmatched. Details.
All sixteen left subsets can be checked by writing and if , otherwise . Then
Only violates the Hall condition. Every matching in a graph uses at most two edges incident to and at most one incident to , so the matching number is three. There are exactly twelve size-three matchings in a graph: choose two of in three ways, assign them to in two ways, and choose or for . Thus the obstruction identifies the bottleneck: adding availability only for cannot help; allowing to use slot permits , a perfect matching.
Hash collision Created 2026-10-13 Updated 2026-10-31
A hash collision is a function collision of a hash function : two distinct inputs have the same output, . Repeating the same input is not a hash collision. Unequal hash values prove the keys differ; equal hash values only identify candidates that might be equal. This makes a hash function useful as a compact filter before comparing the original data.
Here is a deliberately simple example using modular arithmetic. Let for nonnegative integer keys, and let a four-bucket hash table use the further bucket index . For keys , the hash values are , while all three bucket indices are . Thus and form a hash collision for ; and share a table bucket even though their full hash values differ. Always specify which function is being compared: a table collision concerns the bucket-index function, which may discard more information than the original hash function.
Figure 1.
A shared hash value and a shared table bucket discard different distinctions
. Constructed integer keys pass through and . Orange highlights the hash collision between and ; blue key joins them only after bucket reduction. Separate chaining retains all three keys. This is a toy calculation, not a measured workload or a cryptographic hash function. Details.
With separate chaining, bucket holds all three records in a linked list. A search for visits that bucket and compares the stored keys until it finds ; a search for visits the same bucket but rejects every stored key. A hash collision changes the search work, while key comparison preserves correctness. Storing only one record per hash value would incorrectly merge distinct keys. This is the purpose of collision handling in a hash table.[ref]
The pigeonhole principle explains inevitability: if a hash function has only possible outputs, any distinct inputs contain a hash collision. In particular, a function whose domain of a function is larger than its finite codomain cannot be an injective function. This is an existence statement; it gives neither an efficient way to find the pair nor a probability for a smaller collection of keys. A particular small collection might have no hash collision at all.
For a cryptographic hash function, collision resistance asks that finding any two distinct messages with equal full digests be computationally infeasible under the specified model and resources. It does not mean that hash collisions do not exist. Preimage resistance asks a different question: given a target digest , how hard is it to find a message with ? The collision finder may choose both messages and their common digest; the preimage finder is given the digest in advance. These definitions distinguish two search tasks, independently of how a hash table stores records.[ref]
Hash function 2026-10-13
A hash function is a function assigning each key in an input set a value in an output set . Usually is much smaller: a long name or large integer becomes a small bucket index. Equal keys must receive equal values from the same hash function; different keys may also receive equal values. Such a hash collision means "look in the same place", and does not establish key equality. If , the pigeonhole principle makes some collisions unavoidable.
For example, modular arithmetic gives the hash function , with seven bucket indices . Store the seven keys : their values are respectively . In particular, although . A hash table is a data structure that uses these indices to locate records. With separate chaining, each bucket holds a linked list of records, so bucket retains all four keys . Inserting must not overwrite merely because their hash function values agree.
Figure 1.
Seven keys stored in seven buckets using the hash function h(k) = k mod 7
. Orange arrows identify four colliding keys. Bucket 3 keeps all four records in a linked list; equality is checked on the stored keys. Details.
Searching for computes bucket , then compares the actual keys until it reaches . Searching for absent key reaches that same bucket and must reject every stored key. This data structure trades a search through all records for a search through one short chain, provided the hash function distributes keys adequately. A fixed hash function can perform poorly on patterned keys: already demonstrate the problem. A universal hash family introduces controlled randomness to limit the expected value of this extra work. Neither indexing nor a small collision probability inherently supplies encryption or message authentication; a cryptographic hash function has additional requirements such as collision resistance.
A strict partial order that is a serial relation has no finite nonempty first-order model. If the domain had elements, seriality would produce a chain of successive elements. The pigeonhole principle supplies a repeated element, and transitivity along the resulting cycle contradicts irreflexivity. An infinite example is the usual strict order on the natural numbers: every element has its successor. The nonempty-domain convention is essential; the displayed universal conditions hold vacuously on an empty domain if such domains are permitted.
Missing-value search by deficient value intervals Created 2026-10-24 Updated 2026-10-31
Suppose a candidate integer interval contains possible values and an active array segment contains exactly all occurrences from that interval, with entries. The pigeonhole principle guarantees a missing value. Split the value interval into widths and use array partitioning to obtain occurrence counts . If , retain the left side. Otherwise , so retain the right side. This works with duplicate entries because it needs only the inequality between occurrences and possible values.
Balancing the value widths gives , while the active scan length remains less than . The total work is bounded by a geometric series and logarithmic loop overhead, hence time complexity. On reaching width one, the retained occurrence count is zero, proving that the sole candidate is absent globally. This is a binary search over deficient value intervals, with local in-place array partitioning, rather than repeated full-array scans.
A Hermitian operator on a -dimensional Hilbert space, with distinct eigenvalues all belonging to , must occupy this entire grid. This follows from the pigeonhole principle: the set of possible values and the set of distinct eigenvalues have the same cardinality. Its minimum eigenvalue is zero, so the operator is necessarily singular. Distinctness therefore does not imply invertibility; it forces a one-dimensional kernel in this specific complete-grid setting.
In a cyclic group of arbitrary order , a Bohr set with frequencies, defined by , contains an arithmetic progression of distinct residues of length at least . Partition the -dimensional cube into boxes, with . The pigeonhole principle supplies with simultaneously. The residues , , remain in the Bohr set and do not wrap around the cyclic group. The weaker exponent permits composite moduli without assuming that every nonzero step has large order.
N-queens problem 2026-10-25
Place queens on an chessboard so that none share a row, column or diagonal. One constraint satisfaction problem encoding uses a column variable for each row, with and whenever . The pigeonhole principle explains why one queen per row loses no solutions. Prescribed occupied cells give the queens completion problem.
Always true. An all-different constraint of arity requires distinct values. If , the pigeonhole principle makes even one such constraint impossible. Since , at least one is present, and consequently
Assume the standard nonempty instance convention , and set . Start with no centers. Pick any city still farther than from every selected center, add it as a center, and mark every city within distance of it as covered. Stop when all cities are covered.
Distinct chosen centers have pairwise distance greater than . Fix an optimal set of centers and assign each city to one optimal center within distance . Two cities assigned to the same center have distance at most by the triangle inequality. Thus no two chosen centers can be assigned to that same optimal center. The pigeonhole principle shows that the greedy procedure selects at most centers and has radius at most . If fewer than are selected, add arbitrary distinct cities; this cannot worsen the radius.
With the supplied radius, a straightforward implementation updates coverage in time per selected center, hence takes distance tests. The argument also handles . It is the packing bound underlying the metric k-center problem.
Write for the prescribed occupied cells, with . The source’s lowercase in its coordinate bound is read as the stated board size . If two prescribed queens already attack each other, no completion exists. Each model below correctly expresses that impossibility as well as consistent inputs.
Model 1: one Boolean variable per cell. Let indicate occupancy. Require
and impose for every two distinct cells sharing a row, a column or a diagonal. Equivalently, impose exactly one queen in each row and column and at most one on each diagonal. Explicit diagonal constraints are
Together with the total-count constraint and the attacking-pair binary constraints, these force exactly the intended boards. The count and diagonal-sum constraints are legitimate many-variable constraints; this model need not be binary.
Model 2: one variable per labeled queen. Let for . Enumerate and restrict for . For every , impose the binary constraint
There are exactly variables and distinct rows, so these are distinct queens. Labeling the prescribed queens does not lose a board completion: the queens are physically indistinguishable, and any completion can be labeled to give the prescribed ones those indices. It does create redundant assignments for the remaining labels.
Model 3: one variable per row. Let be the queen’s column in row . For every , require
and impose for every . These restrictions give queens, one per row; the all-different constraint on the columns gives one per column. For nonattacking queens on rows, exactly one per row is forced by the pigeonhole principle, so no solutions are lost. Inconsistent prescribed positions in a single row give incompatible unary restrictions. All three are exact constraint satisfaction problem encodings of the queens completion problem.