Recurrence Relation
Fibonacci Sequence: ; ,
The Tower of Hanoi: ; ,
DEFINITION: A linear recurrence relation of degree with constant coefficients is a recurrence relation of the form , where , are constant real numbers, and .
- degree : every term depends on terms preceding it
- constant coefficients: are independent of
- linear: the right-hand side is a linear combination of .
- linear homogeneous recurrence relation (LHRR):
// - linear nonhomogeneous recurrence relation (LNRR):
// - associated LHRR:
Solving Recurrence Relation with GFs
GF-based Method:
EXAMPLE: Solve with using generating function.
,
THEOREM: Let be polynomials with . If for distinct non-zero numbers and integers , then there exist unique coefficients s.t.
EXAMPLE: Solve with , .
// ;
// compare the numerators of both sides- , , , ,
//
Principle of Inclusion-Exclusion
Two Sets
THEOREM: Let be a finite set. Let be subsets of . Then
- , ;
- is a partition of
- , ;
- is a partition of
Three Sets
THEOREM: Let be a finite set. Let be subsets of . Then
Sets
THEOREM: Let be a finite set. Let . Then
- ;
- .
EXAMPLE: (Euler’s phi function) for .
- ;
,
- for
Pigeonhole Principle
EXAMPLE: Connect 15 workstations to 10 servers such that any workstations have access to all servers. How many cables are needed?
- Solution 1: Connecting every workstation directly to every server. 150
- Solution 2: is connected to for every ; and each of is connected to all servers.
- This solution requires 60 lines.
- Is this solution optimal?
Cover
DEFINITION: A cover of a finite set is a family of subsets of such that .
LEMMA: Let be a cover of a finite set . Then .
- :
- :
- Suppose true when ().
- When ,
THEOREM: (simple form) Let be a set with elements. Let be a cover of . Then , .
- Suppose that for every . Then .
- If objects are distributed into boxes, then there is at least one box containing objects.
THEOREM: (general form) Let be a set with elements. Let be a cover of . Then , .
- If for all , then
- If we distribute objects into boxes, then there is at least one box that contains objects.
EXAMPLE: Connect 15 workstations to 10 servers such that any workstations have access to all servers. How many cables are needed?
- Is Solution 2 optimal?
- Consider an optimal scheme .
- Let in
- for
- is a cover of
- If there are lines in , then .
- such that
- There are 10 workstations not connected to
这个解法里,系数8和10的来源是哪里,能再说说吗?
有点像上课的例子。
看得我脑子嗡嗡的。
好像少了一个边界条件。
鸽子原理这题好像漏了点。
我以前踩过包含排除的坑。
一眼看不懂,求解释。
这题目感觉像在玩纸牌。
塔的递归真的好玩。
我算了一遍,怎么总是出现8的倍数?
生成函数真的好绕啊 😅
这递推公式挺爽的。
H1=1, H2=3 是怎么来的?塔数列不是应该每次翻倍加一吗?
之前搞过这个,解递推式用特征方程还行,生成函数太绕了😂
60条线居然是最优解,绝了
有点东西
f0居然是1,不是0嘛
刚开始我也以为
容斥原理那公式看着头大,例题倒是挺实用。
我也觉得公式有点绕
欧拉函数那个例题推导好长,但挺清晰的
鸽巢原理证明那个划分挺机智的
这个证明思路确实挺巧
汉诺塔递推式一眼秒了,但生成函数算起来真烦
同感,展开那步容易算错
生成函数解递推,通项秒出
工作站那个例题有点绕,得琢磨一下。
递推推导挺清晰
我也看明白了
欧拉函数用容斥推,挺利索
容斥原理从两个集合推到n个,这个推导链条挺顺的
汉诺塔那个递推式以前手推过,现在看生成函数解法还是爽
我也喜欢生成函数的解法
线性递推的解法体系还挺完整的
递推那块确实经典
鸽笼原理最后那个反证法秒了
生成函数解递推太硬核了
那个workstation例子的最优解证明思路有点绝
inclusion-exclusion套娃太烧脑了
汉诺塔递推推得人麻了
斐波那契数列这递推看着还挺顺眼
鸽巢原理倒是挺有意思的
我当时也觉得
这生成函数算得我头都大了,有没有更直观的方法啊?