evan's notes
cal 3discreteodeenv systems

On this page

  • The pigeonhole principle
  • Proof by contrapositive
  • Seven points in a hexagon
  • The generalized pigeonhole principle
  • How many cards guarantee three of one suit?
  • Proof by contradiction
  • Proving the generalized pigeonhole principle
  • Example: the square root of two is irrational
  • Proof by cases
  • Example: an integer is no larger than its square

Discrete Structures

§8 Pigeonhole Principle, Contradiction, and Cases

Evan Luo · Oct 1, 2026

Discrete Structures

§8 Pigeonhole Principle, Contradiction, and Cases

Evan LuoToday

8 min read

Sometimes a proof can guarantee that an object exists without telling us which one it is. The pigeonhole principle does this by counting: if there are too many objects for every box to hold just one, some box must hold more. Its proofs also illustrate the difference between contraposition and contradiction.

The pigeonhole principle

Suppose we put five objects into four boxes, assigning each object to exactly one box. We cannot keep all five objects separate: at least one box contains at least two objects. It does not follow that every box contains two objects, or that the shared box contains exactly two.

Five objects assigned to four boxesFour boxes form a two by two grid. The upper-left box contains two objects, and each other box contains one. This is one possible assignment, not the only arrangement.
One possible assignment. At least one box must be shared, but it need not be this box.

The pigeonhole principle, often abbreviated PHP, makes the same claim for any positive integers nnn and mmm:

If nnn objects are distributed among mmm boxes and n>mn>mn>m, then at least one box contains at least two objects.

The objects are the “pigeons,” and the boxes or categories are the “holes.” Every object must be assigned to exactly one hole. The hard part of an application is often choosing holes so that sharing one gives the conclusion we want.

Proof by contrapositive

Instead of assuming there are more objects than holes, assume that every hole contains fewer than two objects. We will show that there can be at most as many objects as holes.

Let xix_ixi​ be the number of objects in hole iii, where i=1,2,…,mi=1,2,\ldots,mi=1,2,…,m. Each xix_ixi​ is a nonnegative integer, so “fewer than two” means xi≤1x_i\le1xi​≤1. Counting all objects once gives

n=x1+x2+⋯+xm≤1+1+⋯+1⏟m terms=m.n=x_1+x_2+\cdots+x_m \le\underbrace{1+1+\cdots+1}_{m\text{ terms}} =m. n=x1​+x2​+⋯+xm​≤m terms1+1+⋯+1​​=m.

We have proved: if every hole contains at most one object, then n≤mn\le mn≤m. This is the contrapositive of the pigeonhole principle, so the original statement is true.

Seven points in a hexagon

Place seven points anywhere in a regular hexagon of side length 111. Show that at least two of the points are at distance at most 111 from each other.

The points are the pigeons. To choose useful holes, divide the hexagon into six equilateral triangles by joining its centre to its vertices. Each triangle also has side length 111, and any two points in one of these triangles are at distance at most 111.

Seven points in six unit equilateral trianglesA regular hexagon of side length one is divided from its centre into six equilateral triangles. One possible placement of seven points has two in the shaded triangle. The segment joining those two points has length at most one.
111
One possible placement. The six triangles are the holes; their side length limits the distance between any two points in the same triangle.

Assign each point to a triangle containing it. A point on a shared edge or at the centre must be assigned to just one of the triangles that contains it; any fixed choice works. This avoids counting a point twice.

There are seven points and only six triangles. By PHP, one triangle contains at least two assigned points. Their distance is therefore at most 111, as required.

This is a guarantee for every placement, not a probability statement. The non-strict bound also allows points on the boundary of the hexagon.

The generalized pigeonhole principle

If there are many more objects than holes, we can guarantee more than two in one hole. At least one hole must hold at least the average number of objects, rounded up to an integer.

For a real number ttt, the ceiling ⌈t⌉\lceil t\rceil⌈t⌉ is the smallest integer greater than or equal to ttt. In particular,

⌈76⌉=2.\left\lceil\frac76\right\rceil=2. ⌈67​⌉=2.

The generalized pigeonhole principle says that distributing nnn objects among mmm holes, with nnn and mmm positive integers, guarantees at least one hole containing at least

⌈nm⌉\left\lceil\frac nm\right\rceil ⌈mn​⌉

objects. This is a lower bound, not an exact occupancy. The ordinary PHP follows whenever n>mn>mn>m, because then n/m>1n/m>1n/m>1 and its ceiling is at least 222.

How many cards guarantee three of one suit?

Draw cards from a standard deck without jokers. What is the smallest number that guarantees at least three cards of the same suit?

The cards are the objects, and the four suits are the holes. If we draw nnn cards, some suit appears at least ⌈n/4⌉\lceil n/4\rceil⌈n/4⌉ times. We want

⌈n4⌉≥3.\left\lceil\frac n4\right\rceil\ge3. ⌈4n​⌉≥3.

The ceiling reaches 333 as soon as the number inside it exceeds 222; that number need not reach 333 itself. Thus

⌈n4⌉≥3⟺n4>2⟺n>8.\left\lceil\frac n4\right\rceil\ge3 \quad\Longleftrightarrow\quad \frac n4>2 \quad\Longleftrightarrow\quad n>8. ⌈4n​⌉≥3⟺4n​>2⟺n>8.

Since nnn is an integer, nine cards suffice. They are also necessary for a guarantee: eight cards could consist of two from each suit, with no suit appearing three times. So the minimum is 999.

Proof by contradiction

To prove a statement PPP by contradiction, assume its negation ¬P\neg P¬P and derive something impossible. The assumption must then be false, so PPP is true. In classical logic,

P≡(¬P⇒False).P\equiv(\neg P\Rightarrow\mathrm{False}). P≡(¬P⇒False).

The impossibility need not contradict an explicitly written hypothesis. For example, deriving n<nn<nn<n is already enough: no number is strictly less than itself.

Proving the generalized pigeonhole principle

Let xix_ixi​ count the objects in hole iii, for i=1,2,…,mi=1,2,\ldots,mi=1,2,…,m. Since every object is assigned to exactly one hole,

n=x1+x2+⋯+xm.n=x_1+x_2+\cdots+x_m. n=x1​+x2​+⋯+xm​.

We want to prove that some hole contains at least ⌈n/m⌉\lceil n/m\rceil⌈n/m⌉ objects. Suppose, for contradiction, that every hole contains fewer:

xi<⌈nm⌉for every i=1,2,…,m.x_i<\left\lceil\frac nm\right\rceil \qquad\text{for every }i=1,2,\ldots,m. xi​<⌈mn​⌉for every i=1,2,…,m.

To compare these counts with their average n/mn/mn/m, use the defining ceiling property:

⌈t⌉−1<t≤⌈t⌉.\lceil t\rceil-1<t\le\lceil t\rceil. ⌈t⌉−1<t≤⌈t⌉.

If ttt is an integer, the right-hand inequality is an equality; the left-hand inequality is still strict.

The ceiling bound on a number lineFor seven objects and six holes, the average is seven sixths, strictly above one and below its ceiling of two. The integer just below the ceiling is always strictly below the average, including when the average is itself an integer.
⌈nm⌉−1\left\lceil\frac nm\right\rceil-1⌈mn​⌉−1
nm\frac nmmn​
⌈nm⌉\left\lceil\frac nm\right\rceil⌈mn​⌉
Shown for seven objects in six holes. If the average is an integer, it coincides with the right-hand tick; the lower bound remains strict.

Each xix_ixi​ is an integer. Being below the integer ⌈n/m⌉\lceil n/m\rceil⌈n/m⌉ therefore puts it at least one whole unit below:

xi≤⌈nm⌉−1<nm.x_i\le\left\lceil\frac nm\right\rceil-1<\frac nm. xi​≤⌈mn​⌉−1<mn​.

Adding this strict inequality over all mmm holes gives

n=x1+x2+⋯+xm<nm+nm+⋯+nm⏟m terms=mnm=n.n=x_1+x_2+\cdots+x_m <\underbrace{\frac nm+\frac nm+\cdots+\frac nm}_{m\text{ terms}} =m\frac nm=n. n=x1​+x2​+⋯+xm​<m termsmn​+mn​+⋯+mn​​​=mmn​=n.

This says n<nn<nn<n, a contradiction. The assumption that every hole falls below the bound is false. Hence

∃i∈{1,2,…,m}xi≥⌈nm⌉.\exists i\in\{1,2,\ldots,m\}\quad x_i\ge\left\lceil\frac nm\right\rceil. ∃i∈{1,2,…,m}xi​≥⌈mn​⌉.

Notice the change from every in the assumption to some in the conclusion. Negating “every hole is below the bound” does not say that every hole reaches the bound.

Example: the square root of two is irrational

Write Z\mathbb ZZ for the set of integers. A rational number can be written as a/ba/ba/b for integers aaa and bbb with b≠0b\ne0b=0. The set of rational numbers is denoted by Q\mathbb QQ. An irrational number is a real number that is not rational. We want to prove

2∉Q.\sqrt2\notin\mathbb Q. 2​∈/Q.

Any rational number can be written in lowest terms with a positive denominator: choose b>0b>0b>0 and gcd⁡(a,b)=1\gcd(a,b)=1gcd(a,b)=1. Here gcd⁡(a,b)\gcd(a,b)gcd(a,b) is the greatest common divisor of aaa and bbb; the condition says that they have no common positive divisor other than 111.

Suppose, for contradiction, that 2\sqrt22​ is rational. Choose such a reduced representation:

2=ab,a,b∈Z,b>0,gcd⁡(a,b)=1.\sqrt2=\frac ab, \qquad a,b\in\mathbb Z,\quad b>0,\quad\gcd(a,b)=1. 2​=ba​,a,b∈Z,b>0,gcd(a,b)=1.

Squaring both sides and multiplying by b2b^2b2 gives

2=a2b2⟹a2=2b2.2=\frac{a^2}{b^2} \quad\Longrightarrow\quad a^2=2b^2. 2=b2a2​⟹a2=2b2.

Thus a2a^2a2 is even. The parity result for integer squares says that an integer is even if and only if its square is even. Therefore aaa is even, so a=2ka=2ka=2k for some integer kkk.

Put this back into a2=2b2a^2=2b^2a2=2b2:

(2k)2=2b2⟹4k2=2b2⟹b2=2k2.(2k)^2=2b^2 \quad\Longrightarrow\quad 4k^2=2b^2 \quad\Longrightarrow\quad b^2=2k^2. (2k)2=2b2⟹4k2=2b2⟹b2=2k2.

Now b2b^2b2 is even, so the same parity result makes bbb even. Write b=2ℓb=2\ellb=2ℓ for some integer ℓ\ellℓ.

Both aaa and bbb have the common divisor 222, contradicting gcd⁡(a,b)=1\gcd(a,b)=1gcd(a,b)=1. Our assumption was false, so 2\sqrt22​ is irrational.

Choosing lowest terms at the start is essential to this argument. Finding a common factor in an arbitrary fraction is not a contradiction; finding one in a fraction assumed to be reduced is.

Proof by cases

Sometimes different inputs need different arguments. A proof by cases splits the possibilities into conditions that cover every allowed input, then proves the desired conclusion in each case.

For kkk cases, let A1,…,AkA_1,\ldots,A_kA1​,…,Ak​ be the case conditions and CCC the conclusion. The logical equivalence is

((A1∨⋯∨Ak)⇒C)≡((A1⇒C)∧⋯∧(Ak⇒C)).\bigl((A_1\lor\cdots\lor A_k)\Rightarrow C\bigr) \equiv \bigl((A_1\Rightarrow C)\land\cdots\land(A_k\Rightarrow C)\bigr). ((A1​∨⋯∨Ak​)⇒C)≡((A1​⇒C)∧⋯∧(Ak​⇒C)).

To conclude CCC, we must also know that at least one case applies: A1∨⋯∨AkA_1\lor\cdots\lor A_kA1​∨⋯∨Ak​. The cases must be exhaustive, meaning that they cover all possibilities. They may overlap; they do not have to be mutually exclusive. Choosing useful cases is part of the proof, even when the problem does not suggest them.

Example: an integer is no larger than its square

We want to prove

n≤n2for every n∈Z.n\le n^2\qquad\text{for every }n\in\mathbb Z. n≤n2for every n∈Z.

Let nnn be an arbitrary integer. Split according to its sign.

Case 1: n≤0n\le0n≤0. A square is nonnegative, so

n≤0≤n2.n\le0\le n^2. n≤0≤n2.

Case 2: n>0n>0n>0. Because nnn is an integer, n≥1n\ge1n≥1. Multiply 1≤n1\le n1≤n by the positive number nnn, which preserves the inequality:

n⋅1≤n⋅n,so n≤n2.n\cdot1\le n\cdot n, \qquad\text{so }n\le n^2. n⋅1≤n⋅n,so n≤n2.

Every integer satisfies either n≤0n\le0n≤0 or n>0n>0n>0, and both cases give the required result. This proves the claim.

The integer assumption matters exactly where we used n>0n>0n>0 to get n≥1n\ge1n≥1. It would not be valid for an arbitrary positive real number.

Source: https://notes.ohevan.com/notes/discrete-structures/08-pigeonhole-and-contradiction

© 2026 Evan Luo. All rights reserved.

Back to Discrete Structures

0 reads

  • newsletter

  • about me

  • sponsor

© 2026 Evan Luo. All rights reserved.