The Pigeonhole Principle is a fundamental concept in combinatorics and mathematics that states if more items are put into fewer containers than the number of items, at least one container must contain more than one item. This seemingly simple principle has profound implications and applications in various fields, including mathematics, computer science, and engineering.
This article explores the Pigeonhole Principle, its mathematical formulation, examples, and applications.
Pigeonhole Principle
The Pigeonhole Principle can be formally stated as follows:
If n items are distributed among m containers and n > m, then at least one container must contain more than one item.
The pigeonhole principle is useful in counting methods. In order to apply the principle, one has to decide which objects will play the role of pigeon and which objects will play the role of pigeonholes.
Pigeonhole Principle Example
Suppose that a flock of 20 pigeons flies into a set of 19 pigeonholes to roost. Because there are 20 pigeons but only 19 pigeonholes, at least one of these 19 pigeonholes must have at least two pigeons in it. To see why this is true, note that if each pigeonhole had at most one pigeon, at most 19 pigeons, one per hole, could be accommodated. This illustrates a general principle called the pigeonhole principle, which states that if there are more pigeons than pigeonholes, there must be at least one pigeonhole with at least two pigeons. 
Pigeonhole Principle Theorem
Theorem -I) If “A” is the average number of pigeons per hole, where A is not an integer then
- At least one pigeon hole contains ceil[A] (smallest integer greater than or equal to A) pigeons.
- The remaining pigeon holes contain at most floor[A] (largest integer less than or equal to A) pigeons.
Or II) We can say that, if n + 1 objects are put into n boxes, then at least one box contains two or more objects. The abstract formulation of the principle: Let X and Y be finite sets and let f: A→B be a function.
- If X has more elements than Y, then f is not one-to-one.
- If X and Y have the same number of elements and f is onto, then f is one-to-one.
- If X and Y have the same number of elements and f is one-to-one, then f is onto.
The pigeonhole principle is one of the simplest but most useful ideas in mathematics. We will see more applications that proof of this theorem.
Example 1: If (Kn+1) pigeons are kept in n pigeon holes where K is a positive integer, what is the average no. of pigeons per pigeon hole?
Solution:
Average number of pigeons per hole = (Kn+1)/n = K + 1/n
Therefore there will be at least one pigeonhole which will contain at least (K+1) pigeons i.e., ceil[K +1/n] and remaining will contain at most K i.e., floor[k+1/n] pigeons. i.e., the minimum number of pigeons required to ensure that at least one pigeon hole contains (K+1) pigeons is (Kn+1).
Example 2: A bag contains 10 red marbles, 10 white marbles, and 10 blue marbles. What is the minimum no. of marbles you have to choose randomly from the bag to ensure that we get 4 marbles of same color?
Solution:
Apply pigeonhole principle. No. of colors (pigeonholes) n = 3 No. of marbles (pigeons) K+1 = 4 Therefore the minimum no. of marbles required = Kn+1 By simplifying we get Kn+1 = 10. Verification: ceil[Average] is [Kn+1/n] = 4 [Kn+1/3] = 4 Kn+1 = 10 i.e., 3 red + 3 white + 3 blue + 1(red or white or blue) = 10
Let q1, q2, . . . , qn be positive integers. If q1+ q2+ . . . + qn – n + 1 objects are put into n boxes, then either the 1st box contains at least q1 objects, or the 2nd box contains at least q2 objects, . . ., the nth box contains at least qn objects. Application of this theorem is more important, so let us see how we apply this theorem in problem solving.
Example 1:In a computer science department, a student club can be formed with either 10 members from first year or 8 members from second year or 6 from third year or 4 from final year. What is the minimum no. of students we have to choose randomly from department to ensure that a student club is formed?
Solution:
We can directly apply from the above formula where, q1 =10, q2 =8, q3 =6, q4 =4 and n = 4
Therefore the minimum number of students required to ensure department club to be formed is 10 + 8 + 6 + 4 – 4 + 1 = 25
Example 2:A box contains 6 red, 8 green, 10 blue, 12 yellow and 15 white balls. What is the minimum no. of balls we have to choose randomly from the box to ensure that we get 9 balls of same color?
Solution:
Here in this we cannot blindly apply pigeon principle. First we will see what happens if we apply above formula directly.
From the above formula we have get answer 47 because 6 + 8 + 10 + 12 + 15- 5 + 1 = 47. But it is not correct.
In order to get the correct answer we need to include only blue, yellow and white balls because red and green balls are less than 9.
But we are picking randomly so we include after we apply pigeon principle. i.e., 9 blue + 9 yellow + 9 white – 3 + 1 = 25
Since we are picking randomly so we can get all the red and green balls before the above 25 balls. Therefore we add 6 red + 8 green + 25 = 39
We can conclude that in order to pick 9 balls of same color randomly, one has to pick 39 balls from a box.
Pigeonhole Principle Sample Questions
1. In a group of 13 people, at least two people must share the same birth month, since there are only 12 months in a year.
2. If 11 people each shake hands with 12 others, at least one person must have shaken hands with at least 2 others, because 12 handshakes among 11 people means some people must have more than one handshake.
3. If you have 10 pairs of black socks and 10 pairs of white socks randomly distributed in a drawer, pulling out 3 socks guarantees that at least one pair is of the same color (assuming pairs are distinguishable).
People Also View: Pigeonhole Principle for CP
Applications of the Pigeonhole Principle
The Pigeonhole Principle is used in various fields to solve problems that involve distributing objects into containers. Here are some notable applications:
1. Computer Science: In computer science, the Pigeonhole Principle is used in hashing algorithms, where data items (keys) are assigned to hash values (buckets). The principle guarantees that if there are more items than buckets, collisions will occur, necessitating strategies to handle them.
2. Coding Theory: In coding theory, the Pigeonhole Principle helps in understanding error detection and correction. It implies that if you encode more messages than the number of unique codewords, some messages will share the same codeword, leading to potential errors.
3. Number Theory: In number theory, the Pigeonhole Principle can prove the existence of certain properties within a set of numbers. For instance, it can show that within any set of n+1n+1n+1 integers, there exists a pair of integers whose difference is divisible by nnn.
4. Graph Theory: In graph theory, the Pigeonhole Principle is used to prove properties of graphs, such as the existence of a subgraph with certain characteristics. For example, in any group of people, some subset of individuals will have mutual friendships or mutual non-friendships.
Solved Examples – Pigeonhole Principle
1. Prove that among any 52 integers, there are always two whose difference is divisible by 51.
Solution :
Consider the remainders when each number is divided by 51. There are 51 possible remainders (0 to 50). With 52 numbers, by the Pigeonhole Principle, at least two numbers must have the same remainder. Their difference will be divisible by 51.
2. In a group of 1001 people, show that there are at least two people with the same number of friends within the group.
Solution :
In 1001 people, two have the same number of friends:
Each person can have 0 to 1000 friends. That’s 1001 possibilities. With 1001 people, by the Pigeonhole Principle, at least two must have the same number of friends.
3. Prove that if 5 points are placed inside a unit square, there must be two points that are at most 1/√2 units apart.
Solution :
5 points in a unit square, two at most 1/√2 apart:
Divide the square into four equal squares of side length 1/2. By the Pigeonhole Principle, at least two points must be in the same smaller square. The maximum distance between any two points in a 1/2 × 1/2 square is 1/√2.
4. Show that in any sequence of 101 distinct real numbers, there is always an increasing or decreasing subsequence of length at least 11.
Solution :
In 101 distinct reals, increasing/decreasing subsequence of length 11:
Assign two numbers to each term: its length as a longest increasing subsequence ending at that term, and its length as a longest decreasing subsequence starting at that term. If no term has both numbers ≥ 11, the sum of all these numbers would be at most 20 × 101 = 2020. But the sum must be at least 101 × 11 = 1111, a contradiction.
5. Prove that for any set of 10 integers, there are always two distinct subsets with the same sum of elements.
Solution :
In 10 integers, two subsets with the same sum:
There are 2^10 = 1024 possible subsets. The sum of all elements is at most 10 × 9 = 90 (if the set is {0,1,2,…,9}). By the Pigeonhole Principle, among 1024 subsets, two must have the same sum.
6. In a 8×8 chessboard, prove that if 65 squares are colored, at least one rectangle formed by the grid lines must have all four
corners colored.
Solution :
In 8×8 board with 65 colored squares, a rectangle with colored corners:
Consider the 7 × 7 = 49 possible rectangles formed by grid lines. Each requires 4 corners to be colored. If no rectangle had all corners colored, at most 3 × 49 = 147 squares would be colored. But 65 > 147/2, so by the Pigeonhole Principle, some rectangle must have all corners colored.
7. Show that among any 100 integers, there are always two whose difference is divisible by 99.
Solution :
Among 100 integers, two with difference divisible by 99:
Similar to problem 1. Consider remainders when divided by 99. There are 99 possible remainders, so by the Pigeonhole Principle, two numbers must have the same remainder.
8. Prove that in any group of 6 people, there are either 3 mutual friends or 3 mutual strangers.
Solution :
In 6 people, 3 mutual friends or 3 mutual strangers:
Consider one person. They have 5 relationships, either friend or stranger. By the Pigeonhole Principle, at least 3 must be the same type. If 3 friends, check if any 2 of those 3 are friends. If so, we have 3 mutual friends. If not, those 3 are mutual strangers.
9. Given 2n+1 integers, prove that there are always two whose sum or difference is divisible by 2n.
Solution :
In 2n+1 integers, two with sum or difference divisible by 2n:
Consider pairs (a, b) where a < b. There are (2n+1)n such pairs. The possible remainders when (a+b) is divided by 2n are 0, 1, …, 2n-1, and when (b-a) is divided by 2n are 1, 2, …, 2n-1. Total 4n-1 possibilities. Since (2n+1)n > 4n-1 for n > 1, by the Pigeonhole Principle, two pairs must have the same remainder type
10.In a room of 367 people, prove that at least two people have the same birthday, assuming no leap years.
Solution :
In 367 people, two with the same birthday:
There are only 366 possible birthdays (including Feb 29). With 367 people, by the Pigeonhole Principle, at least two must share a birthday.
Related Articles:
Practice Question on Pigeonhole Principle
1. Prove or disprove that all non-trivial zeros of the Riemann zeta function have a real part equal to 1/2.
2. Determine whether every problem whose solution can be quickly verified by a computer can also be solved quickly by a computer.
3. Prove that for projective algebraic varieties, certain topological classes called Hodge classes are actually algebraic cycles.
4. Relate the rank of an elliptic curve to the order of zero of its L-function at s = 1.
5. Prove that for any positive integer n, the sequence defined by n → n/2 (if n is even) and n → 3n + 1 (if n is odd) always reaches 1.
6. Prove that every even integer greater than 2 can be expressed as the sum of two prime numbers.
7. Prove that there are infinitely many pairs of prime numbers that differ by 2.
8. Prove or disprove this conjecture about the computational hardness of approximately solving certain types of constraint satisfaction problems.
9. Prove that for every positive integer n ≥ 2, the fraction 4/n can be expressed as the sum of three unit fractions.
10. Prove or disprove that every bounded linear operator on a complex Hilbert space has a non-trivial invariant subspace.
Conclusion
The Pigeonhole Principle is a powerful and intuitive concept in mathematics, offering a straightforward method for proving the existence of certain properties within sets. Its applications span across various disciplines, providing solutions to problems in computer science, coding theory, number theory, and graph theory. Understanding and applying this principle can simplify complex problems and yield valuable insights.
Similar Reads
Discrete Mathematics Tutorial
Discrete Mathematics is a branch of mathematics that is concerned with "discrete" mathematical structures instead of "continuous". Discrete mathematical structures include objects with distinct values like graphs, integers, logic-based statements, etc. In this tutorial, we have covered all the topic
4 min read
Mathematical Logic
Propositional Logic
Logic is the basis of all mathematical reasoning and all automated reasoning. The rules of logic specify the meaning of mathematical statements. These rules help us understand and reason with statements such as - [Tex]\exists~x~such~that~x~\neq~a^2~+~b^2,~where~\:x,~a,~b\in~Z[/Tex]Which in Simple En
10 min read
Discrete Mathematics - Applications of Propositional Logic
A proposition is an assertion, statement, or declarative sentence that can either be true or false but not both. For example, the sentence "Ram went to school." can either be true or false, but the case of both happening is not possible. So we can say, the sentence "Ram went to school." is a proposi
11 min read
Propositional Equivalences
Propositional equivalences are fundamental concepts in logic that allow us to simplify and manipulate logical statements. Understanding these equivalences is crucial in computer science, engineering, and mathematics, as they are used to design circuits, optimize algorithms, and prove theorems. This
7 min read
Predicates and Quantifiers
Predicates and Quantifiers are fundamental concepts in mathematical logic, essential for expressing statements and reasoning about the properties of objects within a domain. These concepts are widely used in computer science, engineering, and mathematics to formulate precise and logical statements.
6 min read
Mathematics | Some Theorems on Nested Quantifiers
Quantifiers are expressions that indicate the scope of the term to which they are attached, they are predicates. A predicate is a property the subject of the statement can have. For example, in the statement "the sum of x and y is greater than 5", the predicate 'Q' is- sum is greater than 5, and the
6 min read
Rules of Inference
Rules of Inference: Rules of inference are logical tools used to derive conclusions from premises. They form the foundation of logical reasoning, allowing us to build arguments, prove theorems, and solve problems in mathematics, computer science, and philosophy. Understanding these rules is crucial
10 min read
Mathematics | Introduction to Proofs
Mathematical proof is an argument we give logically to validate a mathematical statement. To validate a statement, we consider two things: A statement and Logical operators. A statement is either true or false but not both. Logical operators are AND, OR, NOT, If then, and If and only if. Coupled wit
7 min read
Sets and Relations
Set Theory
Set theory is a branch of mathematics that deals with collections of objects. These collections are called sets. A set is simply a group of distinct things, like numbers, letters, or even everyday objects, that are grouped based on some common property. A set is a well-defined collection of distinct
3 min read
Types Of Sets
In mathematics, a set is defined as a well-defined collection of distinct elements that share a common property. These elementsâ like numbers, letters, or even other sets are listed in curly brackets "{ }" and represented by capital letters. For example, a set can include days of the week. The diffe
13 min read
Irreflexive Relation on a Set
A relation is a subset of the cartesian product of a set with another set. A relation contains ordered pairs of elements of the set it is defined on. To learn more about relations refer to the article on "Relation and their types". What is Irreflexive Relation? A relation R on a set A is called irre
6 min read
Check Reflexive Relation on Set
A relation is a subset of the cartesian product of a set with another set. A relation contains ordered pairs of elements of the set it is defined on. To learn more about relations refer to the article on "Relation and their types". What is a Reflexive Relation?A relation R on a set A is called refle
7 min read
Check Transitive Relation on a Set
A relation is a subset of the cartesian product of a set with another set. A relation contains ordered pairs of elements of the set it is defined on. To learn more about relations refer to the article on "Relation and their types". What is a Transitive Relation?A relation R on a set A is called tran
9 min read
Set Operations
A set is simply a collection of distinct objects. These objects can be numbers, letters, or even peopleâanything! We denote a set using curly brackets.For example: A = {1, 2, 3} Set Operations can be defined as the operations performed on two or more sets to obtain a single set containing a combinat
11 min read
Types of Functions
Functions are defined as the relations which give a particular output for a particular input value. A function has a domain and codomain (range). f(x) usually denotes a function where x is the input of the function. In general, a function is written as y = f(x). A function is a relation between two
15 min read
Mathematics | Sequence, Series and Summations
Sequences, series, and summations are fundamental concepts of mathematical analysis and it has practical applications in science, engineering, and finance. Table of Content What is Sequence?Theorems on SequencesProperties of SequencesWhat is Series?Properties of SeriesTheorems on SeriesSummation Def
8 min read
Representation of Relation in Graphs and Matrices
Understanding how to represent relations in graphs and matrices is fundamental in engineering mathematics. These representations are not only crucial for theoretical understanding but also have significant practical applications in various fields of engineering, computer science, and data analysis.
8 min read
Relations in Mathematics
Relation in Mathematics is defined as the relationship between two sets. If we are given two sets set A and set B and set A has a relation with set B then each value of set A is related to a value of set B through some unique relation. Here, set A is called the domain of the relation, and set B is c
10 min read
Closure of Relations
Closure of Relations: In mathematics, especially in the context of set theory and algebra, the closure of relations is a crucial concept. It involves extending a given relation to include additional elements based on specific properties, such as reflexivity, symmetry, and transitivity. Understanding
7 min read
Graph Theory
Graph and its representations
A Graph is a non-linear data structure consisting of vertices and edges. The vertices are sometimes also referred to as nodes and the edges are lines or arcs that connect any two nodes in the graph. More formally a Graph is composed of a set of vertices( V ) and a set of edges( E ). The graph is den
12 min read
Mathematics | Graph Theory Basics - Set 1
A Graph is just a way to show connections between things. It is set of edges and vertices where each edge is associated with unordered pair of vertices. Graph is a data structure that is defined by two components : Node or Vertex: It is a point or joint between two lines like people, cities, or webs
5 min read
Types of Graphs with Examples
A graph is a mathematical structure that represents relationships between objects by connecting a set of points. It is used to establish a pairwise relationship between elements in a given set. graphs are widely used in discrete mathematics, computer science, and network theory to represent relation
9 min read
Walks, Trails, Paths, Cycles and Circuits in Graph
Walks, trails, paths, cycles, and circuits in a graph are sequences of vertices and edges with different properties. Some allow repetition of vertices and edges, while others do not. In this article, we will explore these concepts with examples. What is Walk?A walk in a graph is a sequence of vertic
6 min read
Dijkstra's Algorithm to find Shortest Paths from a Source to all
Given a weighted undirected graph represented as an edge list and a source vertex src, find the shortest path distances from the source vertex to all other vertices in the graph. The graph contains V vertices, numbered from 0 to V - 1. Note: The given graph does not contain any negative edge. Exampl
12 min read
Primâs Algorithm for Minimum Spanning Tree (MST)
Primâs algorithm is a Greedy algorithm like Kruskal's algorithm. This algorithm always starts with a single node and moves through several adjacent nodes, in order to explore all of the connected edges along the way. The algorithm starts with an empty spanning tree. The idea is to maintain two sets
15+ min read
Kruskalâs Minimum Spanning Tree (MST) Algorithm
A minimum spanning tree (MST) or minimum weight spanning tree for a weighted, connected, and undirected graph is a spanning tree (no cycles and connects all vertices) that has minimum weight. The weight of a spanning tree is the sum of all edges in the tree. In Kruskal's algorithm, we sort all edges
9 min read
Check whether a given graph is Bipartite or not
Given a graph with V vertices numbered from 0 to V-1 and a list of edges, determine whether the graph is bipartite or not. Note: A bipartite graph is a type of graph where the set of vertices can be divided into two disjoint sets, say U and V, such that every edge connects a vertex in U to a vertex
9 min read
Eulerian path and circuit for undirected graph
Eulerian Path is a path in a graph that visits every edge exactly once. Eulerian Circuit is an Eulerian Path that starts and ends on the same vertex.    How to Find Whether a Given Graph is Eulerian or not? The problem is same as following question. "Is it possible to draw a given graph without l
15+ min read
Group Theory
Mathematics | Graph Theory Basics - Set 1
A Graph is just a way to show connections between things. It is set of edges and vertices where each edge is associated with unordered pair of vertices. Graph is a data structure that is defined by two components : Node or Vertex: It is a point or joint between two lines like people, cities, or webs
5 min read
Homomorphism & Isomorphism of Group
We can say that  "o" is the binary operation on set G if: G is a non-empty set & G * G = { (a,b) : a , bâ G } and o : G * G --> G. Here, aob denotes the image of ordered pair (a,b) under the function/operation o. Example - "+" is called a binary operation on G (any non-empty set ) if & on
7 min read
Group Isomorphisms and Automorphisms
In the study of algebraic structures, group isomorphisms and automorphisms play a fundamental role. By defining internal symmetries inside a group (automorphisms) and when two groups have the same structure (isomorphisms), these ideas aid in our understanding of the structure and symmetry of groups.
7 min read
Group in Maths: Group Theory
Group theory is one of the most important branches of abstract algebra which is concerned with the concept of the group. A group consists of a set equipped with a binary operation that satisfies four key properties: specifically, it includes property of closure, associativity, the existence of an id
13 min read