第 01 章
鸽巢原理:抽屉、碰撞与证明的写法
从一个袜子问题出发,把鸽巢原理写成可证明的命题,再用它解决聚会中的度数碰撞、20 个四位数的同和子集、Erdős–Szekeres 最长子序列定理与家谱中的近亲问题,最后给出概率论的基本形式化。
The Pigeonhole Principle: Pigeons, Holes, and the Craft of Proof
Starting from a sock-drawer problem, we state and prove the pigeonhole principle, then use it on degree collisions at a party, equal-sum subsets among twenty four-digit numbers, the Erdős–Szekeres subsequence theorem and inbreeding in family trees, ending with the basic formalism of probability.
篇内目录
- A problem everyone faces each morning
- Timeline
- Where this course is going
- The precise statement
- Proof of the quantitative form
- Application 1: two people who know equally many others
- Model: people are vertices, acquaintance is an edge
- First attempt: why it falls just short
- The key observation: degrees and cannot coexist
- Application 2: equal-sum subsets among twenty four-digit numbers
- Choosing pigeons and holes
- The catch: and may intersect
- Why and are nonempty
- Existence is not construction
- Application 3: every permutation has a long monotone subsequence
- Proof: two labels per position
- Finish: count the holes
- Where the construction comes from
- A playful application: every family tree contains a close-relative marriage
- Model: ancestor slots are vertices
- The formalism of probability: groundwork for the next lectures
- Sample space
- Probability
- Events and complements
- What this lecture establishes
- Comprehension check
- Relation to neighbouring lectures
一个每天早上都会遇到的问题
抽屉里有五种颜色的袜子。天还没亮,你要摸黑找出一双配对的袜子。问题是:至少要摸出多少只,才能保证无论运气多差都有一双同色的?
答案是 。最坏的情况是前五只恰好各是一种颜色,那么第六只无论是什么颜色,都会与已经摸出的某一只配成一对。
这个推理之所以成立,是因为只有 种颜色,而你拿出了 只。课程用鸽子和鸽笼来命名这件事:把 只鸽子放进 个笼子,只要 ,就一定有至少两只鸽子挤在同一个笼子里。
原理本身简单得像废话,但它的力量来自换一个角度看问题:难点从来不是原理,而是判断「什么是鸽子、什么是笼子」。这一讲用五个越来越难的例子反复训练这件事。
时间轴
| 时间 | 内容 |
|---|---|
| 0:00 | 课程介绍:18.200 的主线与目标——把证明写得让人看得懂 |
| 1:58 | 沟通密集型课程(CIM)的要求 |
| 4:47 | 鸽巢原理:袜子问题 |
| 6:56 | 一般陈述: 只鸽子、 个笼子 |
| 9:39 | 反证法证明;顺带示范证明的写法 |
| 12:31 | 应用一:聚会上总有两个认识同样多的人(图论建模) |
| 21:01 | 应用二:20 个四位数中存在两个不相交的非空子集同和 |
| 36:50 | 应用三:Erdős–Szekeres 最长递增/递减子序列定理 |
| 55:11 | 趣味应用:每个人的家谱里都有一对近亲 |
| 1:02:21 | 概率的基本形式化:样本空间、事件、补事件 |
课程定位
这门课的目标不只是讲数学,还要教怎样把证明写得清楚。课程把好的证明比作好的代码:模块化、把复杂的部分抽成引理、让读者在读到细节之前就看见整体蓝图。
这一讲一边讲鸽巢原理,一边示范三件事:
- 先声明证明方法(例如「我们用反证法」),别让读者读到最后才知道在干什么。
- 给记号起有意义的名字( 里的 代表 increasing)。
- 区分「数学上必需的步骤」与「帮助读者理解的教学性步骤」。
原理的精确陈述
鸽巢原理(基本形式)。 设 只鸽子被放进 个笼子。若 ,则至少有一个笼子里至少有两只鸽子。
鸽巢原理(定量形式)。 若 只鸽子放进 个笼子,则至少有一个笼子里至少有 只鸽子。
用反证法证明定量形式
假设结论不成立,即每个笼子里至多有 只鸽子。设第 个笼子里有 只,则
对每个 成立。把所有笼子加起来:
得到 ,矛盾。所以必有某个笼子装有至少 只鸽子。
证明的关键只有一步:用两种方式数同一批鸽子。一边按笼子求和,一边知道总数是 。这个「双重计数」的套路会在整门课里反复出现。
课程把证明过程本身当作教学材料:开头就写明「用反证法」,让读者提前知道方向;证明结束时明确宣布矛盾来自哪里。这些细节不影响正确性,却决定读者能不能跟上。
应用一:聚会上认识同样多的人
命题。 一个聚会上有 个人(包括你自己)。那么无论谁在场,总能找到两个人,他们认识的其他人的数目相同。
这看起来和抽屉毫无关系。把它翻译成图论就好了。
建模:人 = 顶点,认识 = 边
把每个人画成一个顶点,两人认识就画一条边。这样得到一个有 个顶点的简单图。
顶点的度数是与之相连的边数,也就是这个人认识的人数。于是原命题变成:任意 个顶点的简单图中,必有两个顶点度数相同。
第一次尝试:为什么差一点
用度数当笼子、顶点当鸽子。每个顶点的度数在 中,共 个可能的取值;而顶点也有 个。鸽子和笼子一样多,原理用不上——它要求严格大于。
关键观察: 与 不能同时出现
- 若有人认识其余所有人,则他的度数为 ;这意味着他认识每一个人,因此没有人是「谁都不认识」的,度数 不可能出现。
- 若没有人度数为 ,那么所有度数都在 中,只有 个可能值。
分两种情况:
情形一:存在度数为 的顶点。 此时度数 不出现,笼子只有 个; 只鸽子进 个笼子,必有两个同度数。
情形二:不存在度数为 的顶点。 所有度数落在 中,同样只有 个笼子,结论相同。
两种情形合起来覆盖了所有可能,命题得证。
这个例子的价值在于:鸽子和笼子不是天然存在的,需要先找到正确的抽象(图),再修正笼子的数量。课程特意保留了「第一次尝试失败」的过程,因为真实的证明就是这样摸索出来的。
应用二:20 个四位数里的同和子集
命题。 给定任意 个严格正的四位数 ,一定存在两个不相交的非空子集,其元素之和相等。
三句话就能说清的问题,证明却不显然。先把英文陈述翻译成数学:
要找集合 ,满足
选鸽子与笼子
- 鸽子:非空子集。共有 个。
- 笼子:可能出现的和。最大的和小于 ,而每个和都是非负整数,所以笼子不到 个。
为什么非空子集有 个?每个元素有两种命运——被选入或不被选入,对应一个 位的 0-1 串;共有 个串,再减去「一个都不选」的空集。这个「子集 ↔ 0-1 串」的对应就是最朴素的双射,后面讲计数时会正式展开。
数一下:。鸽子远多于笼子,于是存在两个不同的非空子集 ,其和相等。
陷阱: 与 可能相交
鸽巢原理只保证「两个不同子集同和」,没有保证它们不相交。如果 与 都含有 ,结论就不符合要求。
修正办法:把公共部分同时删掉。令
这两个集合显然不相交。又因为
两边同时减去公共部分 ,得到
所以 与 仍然同和。
为什么 、 非空
还需要检查最后这个技术条件。假设 ,则 ,且
由于所有 都是正数,若干正数之和为零只能是一个都没取,即 。于是 且 ,得 ,与 矛盾。所以 ;同理 。
存在不等于找得到
这个结论有个耐人寻味的地方:它保证了同和子集存在,却没有给出找它们的办法。要从 个子集里挑出碰撞的一对,直接搜索是指数级的。课程提到,国家人口这类现实数据中确实存在人口数完全相同的国家子集,但没有人知道更快的算法;这与密码学中的一些问题相关。
用这节课的话说:证明存在性,比构造出对象容易得多。
应用三:每个排列都有很长的单调子序列
定理(Erdős–Szekeres)。 任意 个不同实数的排列中,要么存在长度为 的递增子序列,要么存在长度为 的递减子序列。
先解释术语:
- 排列:把 打乱顺序排成一列。
- 子序列:从原序列中按原顺序选出的若干项,不要求相邻。
取 ,考虑 个数的排列
递增子序列 的长度是 ,正好达到定理的承诺。这个例子也是紧的:最长的递减子序列只有长度 (例如 ),达不到 。
证明:给每个位置记两个数
这是本讲最精细的构造。对序列的第 个位置,定义
- :以第 项结尾的最长递增子序列的长度;
- :以第 项结尾的最长递减子序列的长度。
注意「以第 项结尾」这个限制很重要。它让每个位置都有一对唯一的「进度标记」。
引理。 若 ,则 。
证明。 不妨设 (否则交换两者)。记第 项为 ,第 项为 。由于所有项互不相同,只有两种可能:
- 若 :取以第 项结尾、长度为 的递增子序列,再接上 。因为 ( 在后面)且 ,得到的仍是递增子序列,长度为 。所以 。
- 若 :同理,取以第 项结尾、长度为 的递减子序列,再接上 ,得到长度 的递减子序列,所以 。
两种情况都使两个有序对至少有一个坐标不同,故 。
收尾:计算笼子的数量
用反证法。假设定理不成立,即不存在长度为 的递增子序列,也不存在长度为 的递减子序列。于是对每个位置 ,
有序对 至多有 种取值——这就是 个笼子。而序列共有 个位置,也就是 只鸽子。由鸽巢原理,必有两个不同位置 落在同一个笼子里,即
与引理矛盾。因此假设不成立,定理得证。
为什么这个构造能想到
课程坦率地说:在考场上凭空想出这个定义几乎不可能。它的来源是动态规划的思路——如果想知道「以这里结尾的最长递增子序列有多长」,就要把前面子问题的答案拼起来。而一旦固定了结尾元素,只需要知道「长度」和「是否递增」这两条信息,就足以判断能否接上下一项。
这也解释了这个证明为什么优雅:它把「子序列的长度」这个看似需要记住整条序列的信息,压缩成了一对数。
趣味应用:每个人的家谱里都有近亲
命题。 每个人的祖先中,都存在一个人的父母是血亲。
证明只用四条关于生物学的、几乎无法反驳的假设:
- 每个人都有两位生物学父母。
- 没有人能在 岁以后生育。
- 人类至少已有 年历史。
- 历史上存在过的人类总数至多 。
建模:祖先位置 = 顶点
从你出发向上追溯:父母 人,祖父母 人,曾祖父母 人……第 代祖先有 个「位置」。这些位置是角色,不是具体的人——「母亲的父亲」和「父亲的母亲」是两个不同的位置,可能恰好是同一个人。
由假设 2 和 3,向上追溯的代数至少是
所以祖先位置的数目至少是
而在整部人类历史中,活过的人至多 个。角色比人多了至少约 ,由鸽巢原理,至少有两个不同的祖先位置由同一个人占据。
同一个人出现在你祖先树的两个不同位置,说明你的祖先谱系中出现了「汇合」:沿着两条不同的路径向上追溯会走到同一个人。这意味着这个人的两条后代线最终结合,也就意味着存在某位祖先,其父母之间有血缘关系。
严格地说,最后一步还需要一个小论证:若两条路径在某人处汇合,则这个人的两个不同后代(沿两条线)后来结合,这两条线的另一端共享同一个祖先,从而构成近亲繁殖。课程把它作为直观结论给出,重点在于展示「把生物学事实翻译成计数」的威力。
概率的形式化:为后面几讲做准备
课程在最后给出概率论的基本框架,为下一讲的条件概率做铺垫。
样本空间
样本空间 是所有可能结果的集合。掷一枚普通骰子,。
样本空间可以是无限的。例如「一直抛硬币,直到第一次出现正面」所需的次数,理论上可以是任意正整数,。
概率
对每个结果 指定一个实数 ,满足两条公理:
公平骰子取 。无限样本空间同样可以满足这两条:例如
它恰好描述「第 次才抛出正面」的概率。
事件与补事件
事件是样本空间的子集 ,其概率定义为其中各结果概率之和:
例如掷出偶数对应 ,概率为 。
补事件 (也写作 )是 中不属于 的一切。因为 与 不相交且并为 ,
于是
这条简单公式后面会频繁使用:正面算不清楚时,就算反面。
本节结论
- 鸽巢原理: 只鸽子进 个笼子,若 则某笼至少两只;定量版本给出 。
- 证明的核心是双重计数:按笼子求和与按总数计算必须一致。
- 应用的关键从来不是原理,而是选出正确的「鸽子」与「笼子」:
- 聚会问题:顶点是鸽子,度数是笼子;再用「 与 互斥」把笼子减一。
- 子集和问题:非空子集是鸽子,可能的和是笼子;相交时删去公共部分。
- 最长子序列:位置是鸽子,有序对 是笼子。
- 家谱问题:祖先位置是鸽子,历史总人口是笼子。
- 存在性证明不等于构造算法:同和子集确实存在,但快速找出它们仍是难题。
- 概率的三件套:样本空间、概率公理、事件与补事件。
理解检验
1. 抽屉里有 5 种颜色的袜子,为什么摸出 6 只就能保证有一双?如果要保证有 3 只同色,需要摸出几只?
参考答案:前 5 只最坏情况下各是一种颜色,第 6 只必然与其中之一同色,这是 的直接应用。若要保证 3 只同色,用定量形式:需要 ,即 ,最小整数 。检验:最坏情况是每种颜色各取 2 只,共 只仍可能没有 3 只同色;第 11 只必然使某种颜色达到 3 只。
2. 证明定量鸽巢原理: 只鸽子、 个笼子,必有某笼至少 只鸽子。
参考答案:反设每个笼子至多 只。因为 ,所以每个笼子的鸽子数都严格小于 。设第 个笼子有 只,则
得到 ,矛盾。故结论成立。(这里用到 是整数,所以 等价于 的整数化。)
3. 在「聚会上两人认识同样多的人」的证明里,为什么不能直接把度数 当作 个笼子就用鸽巢原理?
参考答案:因为鸽子数也是 ( 个人),鸽巢原理要求鸽子数严格大于笼子数, 不成立,用不上。必须把笼子减少到 个。关键观察是度数 与 不可能同时出现:若某人认识其余所有人(度数 ),就没有人是谁都不认识的(度数 )。于是分两种情形——存在度数 时,度数只能取 共 个值;不存在度数 时,度数只能取 共 个值。两种情形下都是 只鸽子进 个笼子,结论成立。
4. 子集和问题中,鸽巢原理给出的两个同和子集 为什么可能相交?相交时如何处理,处理之后为什么仍然非空?
参考答案:鸽巢原理只保证「两个不同的非空子集落在同一个和上」,并未附加「不交」的条件,所以 可能非空。处理办法是令 、,把公共元素从两边同时删掉。由于两个和相等,减去同一个量 后仍然相等;而 由构造直接得到。非空性:若 ,则 ,且 ;所有 ,正数之和为零只能是 ,于是 ,与 矛盾。所以 ,同理 。
5. Erdős–Szekeres 定理的证明中,为什么必须用有序对 ,只用 不行吗?
参考答案:只用 不够。若两个位置有相同的 ,并不能推出矛盾——它们只是「以各自结尾的最长递增子序列等长」,完全可能合法共存。真正需要的是让每个位置携带足够的信息,使得任意两个不同位置必然至少有一个坐标不同。引理证明的正是这件事:对 ,若 则 ,若 则 。两种情况下有序对都不同。于是 个位置必须占据 个不同的有序对;但若定理不成立,、,只有 个有序对可用,矛盾。有序对的第二个坐标正是补上「递减」这一半信息的关键。
6. 家谱问题中, 推出的结论到底是什么?为什么它能说明「父母是血亲」?
参考答案: 是向上追溯 代时祖先位置的数目——每一位祖先是一个角色,例如「母亲的父亲的母亲」。历史上活过的人至多 个,而位置多于人,由鸽巢原理,必有同一个真人占据两个不同的位置。同一个人出现在两条不同的祖先路径上,意味着这两条路径在这一点汇合:这个人的两条后代线后来结合,因而存在某位祖先,其父母在血缘上相关。需要注意,鸽巢原理直接给出的是「某人在祖先树中重复出现」,最后一层「因此父母是血亲」依赖祖先树的树状结构,属于直观推断而非纯计数结论。
与前后课的关系
这一讲建立了全课的第一个工具,也定下了写证明的基调:先声明方法、给记号起有意义的名字、把读者的理解路径设计进证明里。
接下来两讲转向概率:先讲条件概率与独立性,再用容斥原理处理「至少一个事件发生」的计数。计数与概率会在此后反复出现——生成函数、尾界、编码理论、线性规划,几乎每一个主题都要回到「数一数有多少种可能」这个动作上。
A problem everyone faces each morning
Your drawer holds socks in five colours. It is still dark, and you want a matching pair. How many socks must you pull out to guarantee a pair, no matter how unlucky you are?
The answer is . The worst case is five socks, one of each colour; whatever the sixth is, it matches one already in your hand.
The reasoning works because there are only colours and you took socks. The course names this after pigeons and holes: put pigeons into holes; if , some hole contains at least two pigeons.
The principle sounds trivially obvious, yet its power comes from seeing the problem from a different angle. The difficulty is never the principle — it is deciding what counts as a pigeon and what counts as a hole. The lecture trains exactly that skill with five examples of increasing difficulty.
Timeline
| Time | Topic |
|---|---|
| 0:00 | Course overview: 18.200 and its goal of writing proofs people can follow |
| 1:58 | Requirements of the communication-intensive subject (CIM) |
| 4:47 | The pigeonhole principle: the sock problem |
| 6:56 | General statement: pigeons, holes |
| 9:39 | Proof by contradiction, as a model of proof writing |
| 12:31 | Application 1: two people at a party know equally many others (graph model) |
| 21:01 | Application 2: twenty four-digit numbers contain two disjoint nonempty equal-sum subsets |
| 36:50 | Application 3: the Erdős–Szekeres increasing/decreasing subsequence theorem |
| 55:11 | A playful application: every family tree contains a close-relative marriage |
| 1:02:21 | The basic formalism of probability: sample space, events, complements |
Where this course is going
The aim is not only to teach mathematics but to teach how to write a proof clearly. The course compares a good proof to good code: modular, with the complicated part extracted into a lemma, and with the overall blueprint visible before the details.
This lecture demonstrates three habits while proving things:
- Announce the method up front (for instance "we argue by contradiction"), so the reader is never lost until the final line.
- Choose notation with meaning ( in stands for increasing).
- Distinguish steps that are mathematically necessary from steps that merely help the reader understand.
The precise statement
Pigeonhole principle (basic form). Let pigeons be placed in holes. If , then some hole contains at least two pigeons.
Pigeonhole principle (quantitative form). If pigeons are placed in holes, then some hole contains at least pigeons.
Proof of the quantitative form
Suppose the claim fails: every hole contains at most pigeons. Let be the number in hole . Since ,
for every . Summing over all holes,
This gives , a contradiction. Hence some hole holds at least pigeons.
Only one idea is at work: count the same pigeons two ways — once hole by hole, once by knowing the total is . This double-counting pattern returns throughout the course.
The lecture treats the write-up itself as teaching material: state the method first, then name the contradiction explicitly at the end. None of this affects correctness, but all of it affects whether a reader can follow.
Application 1: two people who know equally many others
Claim. At a party with people (yourself included), there are always two people who know the same number of other people.
This looks nothing like a pigeonhole problem. Translating it into graph theory fixes that.
Model: people are vertices, acquaintance is an edge
Draw each person as a vertex, and connect two vertices when those people know each other. The result is a simple graph with vertices.
The degree of a vertex is the number of edges meeting it — here, the number of people that person knows. The claim becomes: every simple graph with vertices has two vertices of equal degree.
First attempt: why it falls just short
Use vertices as pigeons and degrees as holes. Each degree lies in , giving possible values, while there are vertices. Pigeons and holes are equal in number, and the principle requires strictly more pigeons than holes.
The key observation: degrees and cannot coexist
- If someone knows everybody else, that person has degree ; then nobody knows no one, so degree does not occur.
- If nobody has degree , all degrees lie in , only possible values.
Now split into cases.
Case 1: a vertex of degree exists. Then degree is absent, leaving holes. With pigeons and holes, two vertices share a degree by the pigeonhole principle.
Case 2: no vertex of degree exists. All degrees lie in , again holes, and the same conclusion follows.
The two cases exhaust all possibilities, so the claim holds.
The lesson: pigeons and holes do not come for free. One must first find the right abstraction (a graph), then correct the count of holes. The lecture deliberately keeps the failed first attempt, because real proofs are found this way.
Application 2: equal-sum subsets among twenty four-digit numbers
Claim. Given any strictly positive four-digit integers , there exist two disjoint nonempty subsets with equal sums.
Three sentences to state, yet the proof needs care. First translate the English into mathematics: find with
Choosing pigeons and holes
- Pigeons: nonempty subsets. There are of them.
- Holes: possible sums. The largest possible sum is less than , and every sum is a nonnegative integer, so there are fewer than holes.
Why ? Each element has two fates — chosen or not — corresponding to a -bit string. There are strings; discard the empty subset and remain. This "subset ↔ bit string" correspondence is the simplest bijection, to be developed formally when counting begins.
Numerically, . Pigeons greatly outnumber holes, so two distinct nonempty subsets have equal sums.
The catch: and may intersect
The principle only guarantees "two different subsets with the same sum"; it says nothing about disjointness. If both and contain , the conclusion is not yet what was promised.
Fix it by removing the common part from both: set
These are disjoint by construction. Because
subtracting the shared contribution from both sides gives
So and still have equal sums.
Why and are nonempty
Suppose . Then and
A sum of positive numbers is zero only when nothing is summed, so . Then and , hence , contradicting . Therefore ; the same argument gives .
Existence is not construction
The result has a striking feature: it guarantees that equal-sum subsets exist without saying how to find them. Searching subsets for a colliding pair is exponential. The lecture notes that subsets of countries with literally equal populations exist in real data, yet no fast algorithm is known; the problem is connected to cryptography.
In the language of the lecture: proving that something exists is far easier than constructing it.
Application 3: every permutation has a long monotone subsequence
Theorem (Erdős–Szekeres). In any permutation of distinct real numbers, there is either an increasing subsequence of length or a decreasing subsequence of length .
Definitions first:
- A permutation is an arrangement of in any order.
- A subsequence selects terms in their original relative order; the chosen positions need not be adjacent.
Take and the permutation
The increasing subsequence has length , exactly what the theorem promises. The example is also tight: the longest decreasing subsequence has length only (for instance ), short of .
Proof: two labels per position
This is the delicate construction of the lecture. For the -th position of the sequence define
- : the length of the longest increasing subsequence ending at position ;
- : the length of the longest decreasing subsequence ending at position .
The phrase "ending at position " matters: it assigns each position a unique pair of progress markers.
Lemma. If , then .
Proof. Assume without loss of generality that . Write and for the corresponding terms. Since all terms are distinct, exactly one of two cases holds.
- If : take the increasing subsequence of length ending at and append . Because (so comes later) and , the result is still increasing, of length . Hence .
- If : similarly, take the decreasing subsequence of length ending at and append , obtaining a decreasing subsequence of length . Hence .
In either case the two ordered pairs differ in at least one coordinate, so .
Finish: count the holes
Argue by contradiction. Suppose the theorem is false: there is no increasing subsequence of length and no decreasing subsequence of length . Then for every position ,
The pair therefore takes at most values — those are the holes. But the sequence has positions, that is, pigeons. By the pigeonhole principle, two distinct positions land in the same hole:
contradicting the lemma. Hence the theorem holds.
Where the construction comes from
The lecture admits that inventing this definition on the spot in an exam would be extraordinary. Its origin is dynamic programming: to learn the length of the longest increasing subsequence ending here, combine answers to earlier subproblems. Once the ending element is fixed, two pieces of information — length, and whether the run is increasing — suffice to decide whether the next term can extend it.
This explains the elegance: the proof compresses "the length of a subsequence", which seems to require remembering the whole sequence, into a single pair of numbers.
A playful application: every family tree contains a close-relative marriage
Claim. Every person's ancestry contains someone whose parents are blood relatives.
The proof uses four biological assumptions that are hard to dispute:
- Every person has two biological parents.
- Nobody has children after age .
- The human species is at least years old.
- At most humans have ever lived.
Model: ancestor slots are vertices
Trace upward from yourself: two parents, four grandparents, eight great-grandparents, and so on. Generation has slots. A slot is a role, not a person — "mother's father" and "father's mother" are different slots that may happen to be filled by the same individual.
By assumptions 2 and 3, the ancestry extends back at least
generations. Hence there are at least
ancestor slots. But at most humans have ever lived. Slots outnumber people by roughly ten percent, so by the pigeonhole principle at least two distinct ancestor slots are occupied by the same person.
One person appearing in two distinct slots means the ancestry tree "merges": two different upward paths meet at the same individual. That means the two lines of descent from that person eventually came together, so some ancestor had parents who were blood relatives.
Strictly speaking, the last step needs a small argument: if two paths merge at someone, two distinct descendants of that person later produced a child together, making their shared ancestry the source of consanguinity. The lecture gives this as the intuitive conclusion; the point is to display the power of translating biological facts into counting.
The formalism of probability: groundwork for the next lectures
The lecture closes with the basic framework, preparing for conditional probability.
Sample space
The sample space is the set of all possible outcomes. Rolling an ordinary die gives .
The sample space may be infinite. For "flip a coin until the first head appears", the number of flips can be any positive integer, so .
Probability
Assign a real number to each outcome , subject to two axioms:
A fair die takes . Infinite sample spaces satisfy the axioms too: for example
which is exactly the distribution of "the first head appears on flip ".
Events and complements
An event is a subset , with probability equal to the sum of the probabilities of its outcomes:
Rolling an even number corresponds to , with probability .
The complement (also written ) consists of everything in outside . Since and are disjoint and together cover ,
so
This simple identity will be used constantly: when the event itself is hard to count, count its complement.
What this lecture establishes
- Pigeonhole principle: pigeons in holes with force a repeat; the quantitative form gives .
- The proof is double counting: summing by hole must agree with the known total.
- The work is always in choosing pigeons and holes:
- Party problem: vertices are pigeons, degrees are holes, and " and are exclusive" removes one hole.
- Subset sums: nonempty subsets are pigeons, attainable sums are holes; intersections are deleted.
- Longest subsequences: positions are pigeons, pairs are holes.
- Family trees: ancestor slots are pigeons, the historical population is the hole.
- An existence proof is not a construction: equal-sum subsets exist, but finding them quickly is hard.
- Probability rests on three objects: a sample space, the probability axioms, and events with complements.
Comprehension check
1. With socks in 5 colours, why do 6 socks guarantee a pair? How many are needed to guarantee three socks of one colour?
Reference answer: In the worst case the first 5 socks are one of each colour, so the 6th must match one of them — a direct application with . For three of one colour use the quantitative form: we need , i.e. , so the least integer is . Check: two socks of each colour give socks with no colour reaching three; the 11th forces some colour to three.
2. Prove the quantitative pigeonhole principle: pigeons in holes force some hole to hold at least pigeons.
Reference answer: Suppose every hole holds at most . Since , every hole holds strictly fewer than pigeons. With pigeons in hole ,
so , a contradiction. (The step uses integrality: is the integer version of .)
3. In the party problem, why can we not simply use the possible degrees as holes?
Reference answer: Because there are also pigeons, and the principle needs strictly more pigeons than holes; fails. The number of holes must be reduced to . The key observation is that degrees and cannot both occur: if someone knows everybody (degree ), nobody knows no one (degree ). Case 1: a vertex of degree exists, so degrees range over — only values. Case 2: no vertex of degree , so degrees range over — again values. Either way, pigeons enter holes.
4. Why may the two equal-sum subsets produced by the pigeonhole principle intersect, and why does deleting the intersection preserve both disjointness and nonemptiness?
Reference answer: The principle only guarantees two distinct nonempty subsets with the same sum; it imposes no disjointness. Set and . Since the two sums are equal, subtracting the shared amount from both leaves them equal, and by construction. For nonemptiness: if then and ; a sum of positive terms is zero only if , giving and contradicting . Hence , and symmetrically .
5. In the Erdős–Szekeres proof, why must the pair be used? Would alone not suffice?
Reference answer: No. Two positions with equal can coexist perfectly legally — they merely have equally long increasing subsequences ending there, which is no contradiction. What is needed is a label rich enough that any two distinct positions must differ in at least one coordinate. The lemma proves exactly that: for , if then , and if then ; either way the pairs differ. Then positions must occupy distinct pairs, whereas if the theorem failed we would have and , only pairs. The second coordinate supplies the missing "decreasing" half of the information.
6. In the family-tree argument, what exactly does establish, and how does it imply that someone's parents were blood relatives?
Reference answer: counts ancestor slots forty generations back — each slot is a role such as "mother's father's mother". At most humans have ever lived, and slots outnumber people, so by the pigeonhole principle one real person occupies two distinct slots. A person appearing on two different upward paths means the paths merge: two distinct descendant lines from that person later produced a child together, so some ancestor had parents who were related by blood. Note that the principle directly yields "someone repeats in the ancestor tree"; the final step to "the parents were blood relatives" uses the tree structure and is an intuitive inference beyond pure counting.
Relation to neighbouring lectures
This lecture supplies the course's first tool and sets the tone for proof writing: announce the method, choose meaningful notation, and design the reader's path through the argument.
The next two lectures turn to probability — first conditional probability and independence, then inclusion–exclusion for counting when at least one event occurs. Counting and probability recur everywhere afterwards: generating functions, tail bounds, coding theory and linear programming all return to the same act of counting how many possibilities exist.