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
inclusion-exclusion套娃太烧脑了
汉诺塔递推推得人麻了
斐波那契数列这递推看着还挺顺眼
鸽巢原理倒是挺有意思的
我当时也觉得
这生成函数算得我头都大了,有没有更直观的方法啊?