本篇笔记涵盖了计数原理的基本概念,包括加法原理、乘法原理、容斥原理和树形图等。接着介绍了鸽笼原理及其广义形式,排列组合的定义和计算方法,以及如何处理重复元素的排列和组合。还探讨了将对象分配到盒子中的不同情况,组合恒等式的应用,以及递推关系的定义和解法。最后,生成函数的概念及其在计数问题和递推关系中的应用也得到了阐述。(由 gpt-4o-mini 生成摘要)
1. 计数原理 Counting Principles
1.1. 加法原理 The Sum Rule
加法原理(the sum rule):If and are 不相交的(disjoint) finite sets, then
1.2. 乘法原理 The Product Rule
乘法原理(the product rule):If and are finite sets, then
Here denotes the Cartesian product of sets and .
1.3. 容斥原理 The Inclusion-Exclusion principle
容斥原理(the inclusion-exclusion principle = subtraction rule):If and are finite sets, then
1.4. 树形图 Tree Diagrams
一种用树形图(tree diagram) 来计数的思想:To use trees in counting, we use a branch to represent each possible choice. We represent the possible outcomes by the leaves.
How many bit strings of length four do not have two consecutive 1s?
There are bit strings of length four without two consecutive 1s. Chapter 6.1 - Example 9
Solution
2. 鸽笼原理 The Pigeonhole Principle
If is a positive integer and or more objects are placed into boxes, then there is at least one box containing two or more of the objects. 鸽笼原理(the pigeonhole principle)
If objects are placed into boxes, then there is at least one box containing at least objects. 广义鸽笼原理(the generalized pigeonhole principle)
Every sequence of distinct integers contains a subsequence of length that is either strictly increasing or strictly decreasing.
Dilworth 定理指出,对于任意有限偏序集,其最长反链长度必等于最小链划分中链的数目。故命题“最长上升子序列的长度为 ” 的对偶命题为“非升子序列的最小划分数为 ”。 对于原数列,若其最长上升子序列的大于等于 ,则问题解决;否则存在一组 个下降子序列的划分。根据鸽笼原理,其中至少有一个的长度大于 ,即可找到一个长度大于等于 的下降子序列。 反证法:用 表示第 个位置开始的最长上升子序列长度和最长下降子序列长度,根据鸽笼原理,必存在 满足 ,而 ,故矛盾。 Chapter 6.2 - Example 6
Solution by myself
Solution by teacher
3. 排列组合 Permutations and Combinations
3.1. Introduction
A 排列(permutation) of a set of distinct objects is an ordered arrangement of these objects. An r-permutation is an ordered arrangement of elements of a set, denoted by . Definition: Permutation
A r-组合(combination) of elements of a set is an unordered selection of elements from the set, denoted by . Definition: Combination
3.2. Permutation and Combination with Repetition
-permutation with repetition:The number of -permutations of a set of objects with repetition allowed is
-permutation with limited repetition:The number of different permutations of objects, where there are indistinguishable objects of type1, …, and indistinguishable objects of type , is
-circle permutation:The number of -circle permutations of a set of objects is
-combination with repetition:The number of -combination from a set with elements when repetition of elements is allowed is
这个就是隔板法大家懂的都懂。
3.3. Distributing Objects into Boxes
Distinguishable objects and distinguishable boxes:The number of ways to distribute distinguishable objects into distinguishable boxes so that objects are place into box , , equals
Distinguishable objects and indistinguishable boxes:The number of ways to distribute distinguishable objects into indistinguishable boxes is
4,3,3,2,2 (n,4,3,3,2,2)/2/2
需要引入第二类斯特林数。但一般来说,不搞斯特林数那一套,手动枚举一下可能的隔板情况,并利用组合数进行统计的做法更为高效。
Indistinguishable objects and distinguishable boxes:The number of ways to distribute indistinguishable objects into distinguishable boxes is
还是使用隔板法。
Indistinguishable objects and indistinguishable boxes:The number of ways to distribute indistinguishable objects into indistinguishable boxes is
3.4. 组合恒等式 Combinatorial Indentities
Let and be variables, and let be a nonegative integer. Then Theorem 1: 二项式定理(the binomial theorem)
可以得到以下推论:
Let and be positive integers with . Then Theorem 2: 帕斯卡恒等式(PASCAL's identity)
Let and be nonnegative integer with not exceeding either or . Then Theorem 3: 范德蒙德恒等式(Vandermonde's indentity) ★
可以得到以下推论:
Let and be nonnegative integer with . Then Theorem 4
4. 组合证明 Combinatorial Proofs
A 数两次的证明方法(double counting proof) uses counting arguments to prove that both sides of an identity count the same objects, but in different ways.
A 基于双射的证明方法(bijective proof) shows that there is a bijection between the sets of objects counted by the two sides of the identity.
利用组合方法证明:
5. 递推关系 Recurrence Relations
5.1. 递推关系 Recurrence Relations
A 递推关系(recurrence relation) for the sequence is an equation that expresses in terms of one or more orf the previous terms of the sequence, namely, or all integers with , where is a nonnegative integer. Definition: Recurrence Relations
满足同一组递推关系的数列可能有很多,我们用初始条件(initial conditon) 区分他们。
5.2. 线性递推 Linear Recurrence Relations
It refers to a recurrence relation in the form where are real numbers, and . Definition: Linear Homogeneous Recurrence Relation of Degree with Constant Coefficients
- 线性(linear):linear combination of previous terms
- 常系数(constant coefficient):the coefficients of s are constants
- 阶(degree) : 可以看做一个之和前 项有关的函数。 is a function of the previous terms of the sequence
- 齐次(homogeneous):等式右边没有非零的常数项。If we put all the s on the left side of the equation and everything else on the right side, then the right side is . Otherwise 非齐次(nonhomogeneous)
Some Examples
我们可以从常系数 阶线性齐次递推的递推式中得到他的特征方程(characteristic equation):
和特征根(characteristic root):
5.2.1. 解常系数线性齐次递推 Solve Linear Homogeneous Recurrence Relation With Constant Coefficients
设 为实系数。假设递推关系的特征方程 有 个不同的特征根 且重复次数分别为 。那么常系数线性齐次递推数列 的一个通解(general solution) 是 Theorem
这里通解的系数 一般采用插值(或者说解线性方程组)的方式求得。
5.2.2. 解常系数线性非齐次递推 Solve Linear Nonhomogeneous Recurrence Relation With Constant Coefficients
这一节中我们解决的是形如这样的递推关系(这里 是常实数, 是一个非恒为零且只与 有关的函数):
设 是常系数线性非齐次递推 的一个特解(particular solution),那么他的通解可以被表示为 ,这里 是常系数线性齐次递推 的一个通解。 Theorem 1
Proof
假设常系数线性非齐次递推的非齐次部分可以表示为 那么该非齐次递推的特解遵循以下形式 这里 表示 作为特征方程的解的重数,如果 不是特征根则 。 Theorem 2 ★
一般来说要解的 都符合 Theorem 2 的形式,这种情况下先把特解的形式代入递推式,即可求特一组特解 。随后若给了原数列的初始条件,则将其减去 中的对应项,从而解得 。
6. 生成函数 Generating Functions
Some Mathematical Terms
The 生成函数(generating function) for the sequence of read numbers is the infinite series Definition: (Original) Generating Function
- 在使用生成函数时,我们不关心其定义域,也不关心其的敛散性。
- 本课程中,我们不学习指数生成函数,狄利克雷生成函数等其他类型的生成函数,故直接用“生成函数”一词默认指代 OGF。
Let ,. Then Theorem 1
6.1. 广义二项式定理 The Extended Binomial Theorem
Let be a real number and a nonnegative integer. Then the extended binomial coefficient is defined by Definition: 广义二项式(extended binomial coefficient)
Let be a real number with and let be a real number. Then Theorem: 广义二项式定理(the extended binomial theorem) ★
6.2. Some Common Used Generating Functions
Sequence | Generating Function |
---|---|
6.3. 生成函数的应用 Applications of Generating Function
Suppose that there are red balls, blue balls, and white balls. How many ways to select balls from these balls? 容斥原理+隔板法。先不加限制任取,然后减掉某种颜色选超过 个的情况,按理来说还要加上有两个选超但是这已经超过 了故不需要考虑。所以答案是: Example: Solve Counting Problems with Generating Function
Combinational Solution
Solution by Generating Function
Use generating functions to solve the recurrence relation with initial conditions . Example: Solve Recurrence Relations with Generating Function
Solution
7. 容斥原理 The Principle of Inclusion-Exclusion
and an alternative form: Theorem: The Principle of Inclusion-Exclusion
7.1. Examples
7.1.1. 埃氏筛 The Sieve of Eratoshenes
Example: The sieve of Eratoshenes
Count the permutations for n objects that leave no objects in their original positions. The number of derangements of a set with elements is Example: Derangement
Theorem