Recall warm-up
- Give the contrapositive of “If L is handled by finite memory then L has property X.”
Stuck? Peek at 0.2.3 Proof techniques
- P ⇒ Q false only when P true, Q false. Contrapositive ¬Q ⇒ ¬P ≡ original. Converse/inverse are NOT.
- Contradiction: assume ¬S, derive the impossible. Used for “no machine can…” proofs.
- Induction: base S(n₀) + step S(k) ⇒ S(k+1). Strong induction assumes all S(≤k).
- One counterexample kills a “for all”. Examples never prove it.
- How many functions from a 2-element set to a 3-element set?
Stuck? Peek at 0.2.2 Functions, relations and equivalence classes
- Relation ⊆ A × B. Function: every input exactly one output. Partial function: some inputs have none.
- #functions A→B = |B|^|A|. #one-to-one (|A| ≤ |B|) = |B|·(|B|−1)···. #relations on n-set = 2^(n²).
- Equivalence = reflexive + symmetric + transitive. Classes partition the set; number of classes = index.
- Finer relation (refinement) ⇒ more classes; every fine class sits inside a coarse class.
- Is “same last letter” on non-empty words an equivalence relation?
Stuck? Peek at 0.2.2 Functions, relations and equivalence classes
- Relation ⊆ A × B. Function: every input exactly one output. Partial function: some inputs have none.
- #functions A→B = |B|^|A|. #one-to-one (|A| ≤ |B|) = |B|·(|B|−1)···. #relations on n-set = 2^(n²).
- Equivalence = reflexive + symmetric + transitive. Classes partition the set; number of classes = index.
- Finer relation (refinement) ⇒ more classes; every fine class sits inside a coarse class.
The Hook
Your machine has 5 modes. It reads an input of 6 symbols. Before reading and after each symbol, it is in some mode — that’s 7 moments, but only 5 possible modes. Without knowing anything else about the machine, you can be certain it was in the same mode at two different moments. That certainty is the pigeonhole principle, and it is the engine behind proving that finite-memory machines cannot count forever.
Predict First
How many people must be in a room to guarantee that two share a birth month?
Core Concept
Prediction check
Answer: 13. With 12 people, each could have a different month. With 13, the 12 months are “boxes” and 13 people can’t all be in different boxes.
The principle
It tells you a collision exists, not where. That’s exactly how it is used: “some mode repeats” — we don’t know which, and we don’t need to.
Generalized pigeonhole
If N objects go into k boxes, some box holds at least ⌈N/k⌉ objects (⌈x⌉ = round up). 100 students in 7 sections ⇒ some section has ≥ ⌈100/7⌉ = 15. To guarantee m objects in some box you need (m−1)·k + 1 objects.
The machine version
A machine with n modes reads an input of length m ≥ n. It passes through m + 1 moments (start, after symbol 1, …, after symbol m). Since m + 1 > n, some mode appears twice. Between those two moments the machine read a stretch of input that took it from a mode back to the same mode — a loop. Repeat that stretch and the machine can’t tell the difference: it returns to the same mode again. This is the seed of the “pumping” idea in Phase 2.
How to use it in a proof
- Identify the objects (moments, numbers, people).
- Identify the boxes (modes, remainders, months).
- Show objects > boxes.
- Conclude two objects share a box, and exploit that.
Putting it together
- n + 1 objects in n boxes force a shared box; N objects in k boxes put at least ⌈N/k⌉ in one.
- An n-mode machine reading at least n symbols must repeat a mode.
- A repeated mode means the input between the repeats is a loop that can be repeated — the seed of the pumping lemma.
Visual
Machine with 3 modes {A,B,C} reading "x y z w" (4 symbols → 5 moments)
moment: 0 1 2 3 4
mode: A ─x→ B ─y→ C ─z→ B ─w→ A
▲ ▲
└── same mode B at moments 1 and 3
the stretch "y z" took B back to B → a loop:
reading "x (y z)(y z)(y z) w" passes B, B, B, B ... and ends exactly as before.Worked Examples
A drawer has 10 black and 10 white socks. In the dark, how many must you pull to guarantee a matching pair?
Show the full solution
Boxes = 2 colours. 3 socks ⇒ two share a colour. Answer 3.
Show that among any 5 integers, two have the same remainder when divided by 4.
Show the full solution
Boxes = remainders {0,1,2,3} (4 boxes), objects = 5 integers. 5 > 4 ⇒ two share a remainder, so their difference is divisible by 4. ∎
A machine with 7 modes reads an input of length 7. Is a repeated mode guaranteed? What about input length 6?
Show the full solution
Length 7 ⇒ 8 moments > 7 modes ⇒ guaranteed. Length 6 ⇒ 7 moments = 7 modes ⇒ not guaranteed (each moment could use a different mode). So the threshold is “input length ≥ number of modes”. Remember this exact threshold; it becomes the “pumping length”.
GATE Traps
- Count moments, not symbols: m symbols give m + 1 moments (including the start).
- Pigeonhole proves existence of a collision; it never tells you which box.
- “Guarantee” questions ask for the worst case: one more than the maximum without collision.
Memory Hook
Thirteen people, twelve months: someone has to share. More pigeons than holes ⇒ a crowded hole.
Connect the Dots
We’ve been drawing machines as dots (modes) with arrows (moves). That picture is a directed graph. Next: the vocabulary of graphs — paths, cycles, and which nodes you can reach — which is exactly how we’ll read machine diagrams.
Self-Test
- NAT
Minimum number of integers needed to guarantee two have the same remainder mod 10?
Write your answer before opening the key.
- NAT
50 letters are sorted into 8 mailboxes. At least how many letters must some mailbox hold?
Write your answer before opening the key.
- MCQ
A machine with n modes reads an input of length m. A repeated mode is guaranteed whenever:
- m ≥ n − 1
- m ≥ n
- m ≥ n + 1
- m ≥ 2n
- MSQ
Which conclusions does pigeonhole justify?
- Among 367 people two share a birthday (ignoring leap issues beyond 366 days)
- Among 3 integers two have the same parity (even/odd)
- Among 10 people two were born on the same weekday
- Among 7 people two were born on the same weekday
Rule Card
- n + 1 objects in n boxes ⇒ some box has ≥ 2.
- N objects in k boxes ⇒ some box has ≥ ⌈N/k⌉. To force m in a box: (m−1)k + 1 objects.
- Machine with n modes, input length ≥ n ⇒ some mode repeats ⇒ a loop in the input.
Concept Ledger
- pigeonhole principle
- generalized pigeonhole ⌈N/k⌉
- moments of a run (m symbols ⇒ m+1 moments)
- repeated mode ⇒ loop
Answer Vault
Reveal answers when you’re ready
Warm-up answers
- “If L does not have property X, then L is not handled by finite memory.”
- 3² = 9.
- Yes — reflexive, symmetric, transitive.
Self-test answers
- 11 — 10 remainder boxes; 11 objects force a collision.
- 7 — ⌈50/8⌉ = ⌈6.25⌉ = 7.
- B — m symbols ⇒ m + 1 moments; need m + 1 > n, i.e. m ≥ n.
- A: m = n−1 gives n moments, which can all differ.
- C: True but not the weakest condition; m = n already suffices.
- D: Far more than needed.
- ABC — Each case has more objects than boxes.
- D: 7 people, 7 weekdays: no guarantee.
Flashcards
- Pigeonhole principle?
Reveal answer
n+1 objects in n boxes ⇒ some box has at least 2. - Generalized pigeonhole: N objects, k boxes?
Reveal answer
Some box has at least ⌈N/k⌉. - When must an n-mode machine repeat a mode on an input of length m?
Reveal answer
When m ≥ n (m+1 moments > n modes).