Skip to content

Discrete Mathematics

University Computer Science Topic 2 5:38 English narration · English and 中文 subtitles you can switch

space play · ←/→ 5s · j/l 10s · f fullscreen · c subtitles · ,/. speed

Chapters

Transcript
Discrete mathematics is the mathematics of objects you can list: statements, sets, graphs and arrangements. 离散数学研究的是可以逐一列举的对象,例如命题、集合、图和排列。
The first three units build the proof engine: logic, sets and induction. 前三个单元构建证明工具:逻辑、集合和归纳法。
The last three build the counting engine: combinatorics, graphs and probability. 后三个单元构建计数工具:组合数学、图和概率。
Every proof in this course names its strategy, and every identity is first checked on a small example. 本课程中的每个证明都会说明所用的策略,每个恒等式都会先用一个小例子检验。
p implies q means the same as not p or q, and also the same as not q implies not p, its contrapositive. p 蕴含 q 等价于非 p 或 q,也等价于非 q 蕴含非 p,后者是它的逆否命题。
De Morgan's laws flip and into or under negation. 根据德摩根律,取否定时“且”会变成“或”。
There are three proof shapes: direct, contrapositive and contradiction. 证明有三种形式:直接证明、逆否证明和反证法。
To prove that if n squared is even then n is even, assume n is odd, and n squared comes out odd. 要证明如果 n 的平方是偶数,那么 n 是偶数,可以假设 n 是奇数,从而得出 n 的平方是奇数。
Read the truth table first: it checks an equivalence row by row, for every combination of true and false. 先看真值表:它逐行检查所有真值组合,验证一个等价关系。
Then climb the proof tree. 然后沿着证明树向上看。
Each branch is a proof shape, and each shape turns the goal into different assumptions you can use. 每个分支都是一种证明形式,每种形式都会把目标转化为不同的可用假设。
Choosing the shape decides what data you have to work with. 选择哪种形式,决定了你有哪些条件可以使用。
A set with n elements has 2 to the n subsets, because each element is either in or out. 一个含有 n 个元素的集合有 2 的 n 次方个子集,因为每个元素要么在子集中,要么不在。
Functions can be injective, surjective or both. 函数可以是单射、满射,或者两者都是。
Doubling an integer is injective but not surjective, while negating it is a bijection and its own inverse. 将整数乘以 2 是单射但不是满射,而将整数取负是双射,并且它的逆函数就是它自身。
A relation is symmetric if its matrix equals its transpose, and reflexive if the diagonal is all ones. 如果一个关系的矩阵等于它的转置,那么这个关系是对称的;如果对角线上全是 1,那么它是自反的。
Here are three arrow diagrams and three verdicts. 这里有三张箭头图和三个判断。
If no two arrows land on the same target, the function is injective. 如果没有两个箭头指向同一个目标,函数就是单射。
If every target is hit, it is surjective. 如果每个目标都有箭头指向它,函数就是满射。
If both hold, it is a bijection, with an inverse. 如果两者都成立,它就是双射,并且有逆函数。
Beside them, the relation's matrix shows reflexive and symmetric properties at a glance. 旁边的关系矩阵让我们一眼就能看出这个关系是否具有自反性和对称性。
Induction is a ladder. 数学归纳法就像一架梯子。
The base case plants the ladder by checking the first value by hand. 基础情形通过手动验证第一个值,把梯子立起来。
The step assumes the claim for k and proves it for k plus 1, actually using that assumption. 归纳步骤假设命题对 k 成立,并利用这个假设证明它对 k 加 1 也成立。
The sum 1 plus 2 up to n equals n times n plus 1 over 2. 1 加 2 一直到 n 的和等于 n 乘以 n 加 1,再除以 2。
The famous proof that all horses are the same colour fails at k plus 1 equals 2. 那个著名的“所有马的颜色都相同”的证明在 k 加 1 等于 2 时失效。
Stand on the hypothesis, then climb one rung. 以归纳假设为立足点,再往上爬一级。
The base case shows the first rung exists. 基础情形说明第一级梯级存在。
The inductive step shows that from any rung you can reach the next. 归纳步骤说明从任意一级都能到达下一级。
Together they reach every rung. 两者结合,就能到达每一级。
Without a base, the ladder stands on air; if the step never uses the hypothesis, you have not really done induction. 没有基础情形,梯子就悬在空中;如果归纳步骤从未使用假设,就不是真正做了归纳证明。
Two rules start all counting. 计数的基础是两条法则。
Alternatives that cannot both happen add; choices made in sequence multiply: 4 routes and 3 vehicles give 12 trips. 不能同时发生的选项用加法;依次作出的选择用乘法:4 条路线和 3 种交通工具可以组成 12 种行程。
Permutations count ordered arrangements; combinations divide by r factorial because order no longer matters. 排列计算有顺序的安排;组合要除以 r 的阶乘,因为顺序不再重要。
Inclusion-exclusion fixes overlaps: 45 plus 35 plus 30, minus the pairs, plus the triple, gives 85. 容斥原理修正重叠:45 加 35 加 30,减去两两重叠的部分,再加上三者重叠的部分,得到 85。
Read the counting tree. 来看这棵计数树。
Choosing two of three items in order gives 3 branches, then 2, so 6 ordered pairs. 从三个元素中按顺序选择两个,先有 3 个分支,再有 2 个,所以有 6 个有序对。
If order does not matter, each pair has been counted twice, so divide by 2 factorial to get 3. 如果顺序无关紧要,每一对都被算了两次,所以除以 2 的阶乘,得到 3。
Branches multiply, alternatives add, and overcounts are divided or subtracted. 分支用乘法,互斥选项用加法,重复计数则通过除法或减法消除。
Counting two ways is the best check. 用两种方法计数是最好的检验方式。
A graph can be stored as an adjacency matrix, which uses n squared space but tests an edge instantly, or as an adjacency list, which suits sparse graphs. 图可以存储为邻接矩阵,它需要 n 的平方大小的空间,但能立即判断一条边是否存在;也可以存储为邻接表,它适合稀疏图。
The handshake lemma says the degrees add to twice the number of edges. 握手定理指出,所有顶点的度数之和等于边数的两倍。
A tree with V vertices always has V minus 1 edges, so a 12-vertex tree has 11. 具有 V 个顶点的树总有 V 减 1 条边,所以一棵有 12 个顶点的树有 11 条边。
Here is the same graph three ways: as a picture, as a matrix and as a list. 这是同一个图的三种表示:图形、矩阵和邻接表。
Check the handshake lemma on it: the degrees are 3, 2, 2, 2 and 3, which add to 12, twice its 6 edges. 用它来检验握手定理:各顶点的度数是 3、2、2、2 和 3,加起来是 12,等于其 6 条边的两倍。
That is why the number of odd-degree vertices in any graph is always even. 这就是为什么任何图中奇度顶点的数量总是偶数。
With equally likely outcomes, probability is counting: favourable outcomes over all outcomes. 当各种结果等可能时,计算概率就是计数:有利结果数除以所有结果数。
Two dice give 36 pairs, and 6 of them sum to 7, so the probability is one sixth. 两个骰子可以产生 36 个点数组合,其中 6 个的点数之和为 7,所以概率是六分之一。
Conditioning on B keeps only B's branch and rescales it. 以 B 为条件,就是只保留 B 的分支并重新调整概率。
With a disease affecting 1 per cent and a 90 per cent accurate test, a positive result means only an 8.3 per cent chance of disease. 某种疾病的患病率为 1%,检测准确率为 90% 时,检测结果呈阳性的人患病的概率只有 8.3%。
Follow the positive branch of this outcome tree. 沿着这棵结果树的阳性分支来看。
Positive results make up 0.108 of all outcomes: 0.009 from true positives and 0.099 from false positives among the healthy. 阳性结果占所有结果的 0.108:其中 0.009 来自真阳性,0.099 来自健康人中的假阳性。
Conditioning throws away the negative branch and rescales what remains, so the chance of disease given a positive test is 0.009 over 0.108: one in twelve. 条件化会舍弃阴性分支,并重新调整剩余结果的概率,所以检测呈阳性时患病的概率是 0.009 除以 0.108,也就是十二分之一。
Now test yourself from memory. 现在凭记忆测试一下自己。
How many members does the power set of a 3-element set have? 一个含有 3 个元素的集合,其幂集有多少个元素?
What are P of 7, 2 and C of 7, 2? P(7, 2) 和 C(7, 2) 分别是多少?
How many edges does a tree with 12 vertices have? 一棵有 12 个顶点的树有多少条边?
What is the probability that two dice sum to 7? 两个骰子的点数之和为 7 的概率是多少?
Pause, answer each one, then find it on the figure. 暂停,逐一回答,然后在图中找到答案。

Comments

    Log in or create account

    IGCSE, A-Level & AP