Skip to main content
Mathematics LibreTexts

7.3: The Pigeonhole Principle

  • Page ID
    19404
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    The word “pigeonhole” can refer to a hole in which a pigeon roosts (i.e. pretty much what it sounds like) or a series of roughly square recesses in a desk in which one could sort correspondence (see Figure \(7.3.1\)).

    clipboard_edac1f534a07db96fd849ecd1f82ffa3a.png
    Figure \(\PageIndex{1}\): Pigeonholes in an old-fashioned roll top desk could be used to sort letters. (Copyright; author via source)

    Whether you prefer to think of roosting birds or letters being sorted, the first and easiest version of the pigeonhole principle is that if you have more “things” than you have “containers” there must be a container holding at least two things.

    If we have \(6\) pigeons who are trying to roost in a coop with \(5\) pigeonholes, two birds will have to share.

    If we have \(7\) letters to sort and there are \(6\) pigeonholes in our desk, we will have to put two letters in the same compartment.

    The “things” and the “containers” don’t necessarily have to be interpreted in the strict sense that the “things” go into the “containers.” For instance, a nice application of the pigeonhole principle is that if there are at least \(13\) people present in a room, some pair of people will have been born in the same month. In this example, the things are the people and the containers are the months of the year.

    The abstract way to phrase the pigeonhole principle is:

    Theorem \(\PageIndex{1}\)

    If f is a function such that \(|\text{Dom}(f)| > |\text{Rng}(f)|\) then \(f\) is not injective.

    The proof of this statement is an easy example of proof by contradiction so we’ll include it here.

    Proof

    Suppose to the contrary that \(f\) is a function with \(|\text{Dom}(f)| > |\text{Rng}(f)|\) and that \(f\) is injective. Of course \(f\) is onto its range, so since we are presuming that \(f\) is injective it follows that \(f\) is a bijection between \(\text{Dom}(f)\) and \(\text{Rng}(f)\). Therefore (since \(f\) provides a one-to-one correspondence) \(|\text{Dom}(f)| = |\text{Rng}(f)|\). This clearly contradicts the statement that \(|\text{Dom}(f)| > |\text{Rng}(f)|\).

    Q.E.D.

    For a statement with an almost trivial proof the pigeonhole principle is very powerful. We can use it to prove a host of existential results – some are fairly silly, others very deep. Here are a few examples:

    There are two people (who are not bald) in New York City having exactly the same number of hairs on their heads.

    There are two books in (insert your favorite library) that have the same number of pages.

    Given \(n\) married couples (so \(2n\) people) if we choose \(n + 1\) people we will be forced to choose both members of some couple.

    Suppose we select \(n + 1\) numbers from the set \(\{1, 2, 3, . . . , 2^n\}\), we will be forced to have chosen two numbers such that one is divisible by the other.

    We can come up with stronger forms of the pigeonhole principle by considering pigeonholes with capacities. Suppose we have \(6\) pigeonholes in a desk, each of which can hold \(10\) letters. What number of letters will guarantee that one of the pigeonholes is full? The largest number of letters we could have without having \(10\) in some pigeonhole is \(9 · 6 = 54\), so if there are \(55\) letters we must have \(10\) letters in some pigeonhole.

    More generally, if we have \(n\) containers, each capable of holding m objects, than if there are \(n · (m − 1) + 1\) objects placed in the containers, we will be assured that one of the containers is at capacity.

    The ordinary pigeonhole principle is the special case \(m = 2\) of this stronger version.

    There is an even stronger version, which ordinarily is known as the “strong form of the pigeonhole principle.” In the strong form, we have pigeonholes with an assortment of capacities.

    Theorem \(\PageIndex{2}\)

    If there are \(n\) containers having capacities \(m_1, m_2, m_3, . . . , m_n\), and there are \(1 + \sum^{n}_{i=1}(m_i − 1)\) objects placed in them, then for some \(i\), container \(i\) has (at least) \(m_i\) objects in it.

    Proof

    If no container holds its full capacity, then the largest the total of the objects could be is \(\sum^{n}_{i=1}(m_i − 1)\).

    Q.E.D.

    Exercises:

    Exercise \(\PageIndex{1}\)

    The statement that there are two non-bald New Yorkers with the same number of hairs on their heads requires some careful estimates to justify it. Please justify it.

    Exercise \(\PageIndex{2}\)

    A mathematician, who always rises earlier than her spouse, has developed a scheme – using the pigeonhole principle – to ensure that she always has a matching pair of socks. She keeps only blue socks, green socks and black socks in her sock drawer – \(10\) of each. So as not to wake her husband she must select some number of socks from her drawer in the early morning dark and take them with her to the adjacent bathroom where she dresses. What number of socks does she choose?

    Exercise \(\PageIndex{3}\)

    If we select \(1001\) numbers from the set \(\{1, 2, 3, . . . , 2000\}\) it is certain that there will be two numbers selected such that one divides the other. We can prove this fact by noting that every number in the given set can be expressed in the form \(2^k · m\) where \(m\) is an odd number and using the pigeonhole principle. Write-up this proof.

    Exercise \(\PageIndex{4}\)

    Given any set of \(53\) integers, show that there are two of them having the property that either their sum or their difference is evenly divisible by \(103\).

    Exercise \(\PageIndex{5}\)

    Prove that if \(10\) points are placed inside a square of side length \(3\), there will be \(2\) points within \(\sqrt{2}\) of one another.

    Exercise \(\PageIndex{6}\)

    Prove that if \(10\) points are placed inside an equilateral triangle of side length \(3\), there will be \(2\) points within \(1\) of one another.

    Exercise \(\PageIndex{7}\)

    Prove that in a simple graph (an undirected graph with no loops or parallel edges) having \(n\) nodes, there must be two nodes having the same degree.


    This page titled 7.3: The Pigeonhole Principle is shared under a GNU Free Documentation License 1.3 license and was authored, remixed, and/or curated by Joseph Fields.

    • Was this article helpful?