4 Linear Homogeneous Recurrence Relation 4-1 Fibonacci Rabbits
Total Page:16
File Type:pdf, Size:1020Kb

4 Linear Homogeneous Recurrence Relation 4-1 Fibonacci Rabbits
组合数学 Combinatorics
1 th th The delta of the n month and n-1 In the first month there’s a pair month is given birth by the rabbits in n-2 of newly-born rabbits; month. So If a pair of rabbits could give MonthFn= F1 n-1+Fn-2 birth to a new pair every month (one male, one female); Month 2 New rabbits could start giving birth since the third month; Month 3 The rabbits never die; Month 4 How many rabbits would there be in the 50th month?
Month 5
2 Fibonacci number 1 1 2 3 5 8 13 21 34 55…… OEIS: A000045 http://oeis.org/A000045 Recurrence Relation: F(n)=F(n-1)+F(n-2) n2 Initial values: F(0)=0, F(1)=1 Leonardo of Pisa • In 1150, Indian mathematicians researched the number of Fibonacci,Bonacci’s son arrangements to package items with length 1 and width 2 into Bonacci: good, natural, boxes. And they described this sequence for the first time. simple • In the western world, Fibonacci mentioned a problem about the reproduction of rabbits in Liber Abbaci in 1202. • Fibonacci,Leonardo 1175-1250 – Member of the Bonacci family. – Travelled to Asia and Africa at 22 with his father and learned to calculate with Indian digits; – Played an important role in the recovery of Western Mathematics. And connected Western and Oriental mathematics. – G.Cardano: “We could assume that all mathematics we know except the Ancient Greek ones are gotten by Fibonacci. Fibonacci number 1 1 2 3 5 8 13 21 34 55…… Fibonacci Numbers • The Fibonacci Quarterly founded in 1963 especially publish the newest researches on this sequence. Which includes: –The last digit loops every 60 numbers; the last 2 digits loops every 300 numbers; the last 3 digits loops every 1500 numbers; the last 4 digits loops every 15000 numbers; the last 5 digits loops every 150000 numbers. –Every 3rd number could be divided by 2. Every 4th number could be divided by 3. Every 5th number could be divided by 5. Every 6th number could be divided by 8, etc. These divisors can also construct a Fibonacci Sequence. Fibonacci prime (Sequence A005478 in OEIS) –In the Fibonacci Sequence, there are primes: 2, 3, 5, 13, 89, 233, 1597, 28657, 514229, 433494437, 2971215073, 99194853094755497, –Except n = 4, the indexes of all Fibonacci Primes are primes. –However, not all prime index Fibonacci Numbers are primes. –Conjecture: Are there infinite primes among Fibonacci Numbers? –The largest known prime is the 81839th Fibonacci Number, which has 17103 digits. 2 2 2 F1 F 2 Fn Fn Fn1
Area of the rectangle = Sum of multiple quadrates
Proof without words vs Logic deduction F0 = 0, F1 = 1, F2 = 1 …… Recurrence Relation Fn = Fn - 1 + Fn - 2
2 2 2 Prove the identity: 퐹1 + 퐹2 + ⋯ + 퐹푛 = 퐹푛퐹푛+1
2 Proof: F1 F2F1 2 F2 F2(F3 F1) F2F3 F2F1 2 F3 F3(F4 F2) F3F4 F2F3 ) F 2 F (F F ) F F F F ______n n n 1 ______n 1 n n 1 ____n 1 n
2 2 2 F1 F 2 Fn Fn Fn1 F0 = 0, F1 = 1, F2 = 1 …… Recurrence Relation Fn = Fn - 1 + Fn - 2
퐹 + 퐹 + ⋯ + 퐹푛 = 퐹푛 1 2 + 2 − 1
Proof: F1 F3 F2
F2 F4 F3
Fn1 Fn1 Fn ) F F F ______n ______n2 n____1 퐹 + 퐹 + ⋯ + 퐹푛 = 퐹푛 1 2 + 2 − 1 F0 = 0, F1 = 1, F2 = 1 …… Recurrence Relation Fn = Fn - 1 + Fn - 2
F1 F3 F5 F2n1 F2n Proof: F1 F2 F F F 3 4 2 Detailed Expressions? F5 F6 F4 ) F F F ______2n______1 2n 2n____2
F1 F3 F5 F2n1 F2n 4 Linear Homogeneous Recurrence Relation
4-2 Expressions of Fibonacci Numbers
组合数学 Combinatorics
11 Magic • There’s a 80cm×80cm quadrate tablecloth. How to convert it to a 1.3m×50cm one?
0, 1, 1, 2, 3, 5, 8, 13, 21,………. 5
F(n)*F(n) – F(n-1)F(n+1) = (-1)n 8 n=0,1,2 3 8 Larger tablecloths? 13 F(100)=? 5 Direct expressions? F0 = 0, F1 = 1 , …… Fibonacci Recurrence Fn = Fn - 1 + Fn - 2 2 Assume G(x) F1x F2 x 3 x : F3 F2 F1 4 x : F4 F3 F2 ______) ______G(x) x2 x x(G(x) x) x2G(x) (1 x x2 )G(x) x x x A B G(x) 1 x x2 1 5 1 5 1 5 1 5 (1 x)(1 x) 1 x 1 x 2 2 2 2 Fibonacci Recurrence A B 0 A B 0 1 1 5 2 A , B { (A B) 1 {A B 5 5 2 5 1 1 1 1 Gx()[] [( )x ( 2 2 )x2 ] 5 1 5 1 5 11xx5 22 2 1 5 2 1 5 , 1 5 2 1 5 2 1 1 1 5 1 5 F ( n n ) (( ) n ( ) n ) (2) n 5522 F 1 5 n 1.618 Fn1 2 Fibonacci Sequence 1 1 1 5 1 5 F = F + F F ( n n ) (( ) n ( ) n ) (2) n n - 1 n - 2 n 5522 F 1 5 n 1.618 Fn1 2
15 Applications in Optimization Methods Assume that function 푓(푥) reaches its maximum at 푥 = ξ. ,Design an optimization algorithm to find the extreme point to a certain extent within finite iterations. The simplest way is to trisect the interval (a,b). 1 2 x a (b a), x a (b a) 1 3 2 3 y 如下图: y f (x) f (x1) f (x2 )
x 16 0 a x1 x2 b §2.4 Applications in Optimization Method
Discuss according to the sizes of 푓 1 , 푓(2)
When 푓 푥1 > 푓(푥2), the maximum 휉 must be in 푎, 푥2 , interval (푥2, 푏) could be removed. y y f (x) y f (x ) 1 f (x2 )
0 x a x1 x2 b 0 a x1 x2 x
f (x1) f (x2 ) 17 §2.4 Applications in Optimization Method
When 푓 푥1 < 푓(푥2), the maximum 휉 must be in (푥1, 푏), the range (푎, 푥1) could be removed. y y f (x) y
f (x1) f (x2 ) 0 x a x1 x2 b 0 x1 x2 b x f (x ) f (x ) 1 2 18 §2.4 Application in Optimization Method
When 푓 푥1 = 푓(푥2), the maximum 휉 must be in (푥1, 푥2), so both (푎, 푥1) and (푥2, 푏) could be removed. y y f (x) y
f (x1) f (x2 )
0 x a x1 x2 b 0 x1 x2 x
f (x1) f (x2 ) 19 y y f (x)
f (x ) 1 f (x2 ) x 0 So with 2 tests, at least we could reduce the range to 2/3 of the origin domain. For example 푓 푥1 > 푓(푥2) and we find the maximum in (푎, 푥2). If continue using threefold division method, it’s a fact that 푥1 is not used. So we image to have 2 symmetrical point 푥, 푙 − 푥 in (0,1) to test.。
0 1 x x 1
20 0 1 x x 1
If keep (0, 푥), then we keep testing at points 푥2, 1 − 푥 푥 in (0, 푥). If x2 (1 x) Then the test at (1 − 푥) could be used again. So we save one test. We have: x2 x 1 0 1 5 0.382,0.618 x 0.618 0.236,0.382 2 0.146,0.236
2 0 0.382 (0.618) 0.618 1 21 Application in Optimization Method
This is the 0.618 optimization method. When finding unimodal maximums in (0,1), we could test at:
x1 0.618, x2 1 0,618 0.3832 points. For example keep (0,0.618), as (0.618)2 0.328, we only need to test once at 0.618 0.328 0.236
22 Applications in Optimization Method We could use Fibonacci Sequence in Optimization Method. Its difference from 0.618 method is to decide the number of tests before testing. We introduce in 2 situations.
(a) The possible testing number is some Fn。
0 1 Fn2 Fn1 Fn
23 At this point testing points are division points Fn-1 and Fn-2 . If Fn-1 is better, remove the part smaller than Fn-2; The remained part contains Fn-Fn-2 = Fn-1 division points, In which test pints Fn-2 and Fn-3 are correspondent to former index Fn-2+Fn-2=2Fn-2 and Fn-3+Fn-2=Fn-1. Just right, Fn-1 has been tested in the previous round. Fn-2+Fn-2=2Fn-2 Fn-3+Fn-2=Fn-1
1 0 Fn2 Fn1 Fn If Fn-2 is better, remove the part larger than Fn-1. In the remained part there are Fn-1 division points, in the next step among test points Fn-2 and Fn-3, Fn-2 has been tested.。 So among the Fn possible tests, we could find the extreme with at most n-1 tests.
0 Fn2 Fn1 Fn One difference between the Fibonacci Method and 0.618 method is that Fibonacci Method could be used when the parameters are all integers. If the number of possible tests are smaller than 퐹푛 but larger than 퐹푛−1, we could add several imagine points to make it 퐹푛 points. We could assume these image points to be worse than any other points without actually compare them. Elliott wave
A complete loop includes 8 waves (5 increase, 3 decrease)
Fn-1 A complete period includes 8 waves, in Fn which 5 are increasing, 3 are decreasing. They are all Fibonacci Numbers. In details we could get 34 waves and 144 waves, they are also Fibonacci Numbers. Common retracement ratio are 0.382、0.5 and 0.618. It mainly reflects the psychology of investors. Fibonacci retracement 1 Elliott Wave increase part 푭풏, Fn-2 Fn-1 decrease part 푭 . y x 풏−ퟏ x y Profit= Loss Fn-1 y Fn Profit:y2/2 Loss: (x+y)x/2 x+y=1 0 x=0.382 If always invest uniformly from 0 to 1, and then it decreases by x The sustentation x=? Fibonacci retracement
4 Linear Homogeneous Recurrence Relation 4-3 Linear Homogeneous Recurrence Relation
组合数学 Combinatorics
30 Fn-Fn-1-Fn-2=0 h(n) – 3h(n-1)+2h(n-2)=0
• Summary Def If sequence {푎푛} satisifies: an C1an1 C2an2 Ck ank 0, – Linear summation a0 d0 ,a1 d1,,ak 1 dk 1, – RHS = 0 퐶1, 퐶2, ⋯ , 퐶푘 and 푑0, 푑1, ⋯ , 푑푘−1 are constants, 퐶푘 ≠ – Coefficients are 0, so this expression is called a kth-order linear constants homogeneous recurrence relation of {푎푛}.
h()(),() n2 h n 1 1 h 1 1
an = an - 1 + an – 2 an – 3 an - 1 = an – 2 =an – 3 = 1 F =F +F F =0, F =1 Fibonacci Recurrence n n-1 n-2 0 1
2 2 Assume G(x) F1x F2 x (1 x x )G(x) x x x A B G(x) 1 x x2 1 5 1 5 1 5 1 5 (1 x)(1 x) 1 x 1 x 2 2 2 2 Factoring? 1- 5 1 5 (1ax )1 1 ax a 2 x 2 ..... (1 x x2 ) (1- x)(1 x) 2 2 (Factor Theorem) If 푎 is a root of linear polynomial 푓 푥 , which means 푓 푎 = 0, then polynomial 푓(푥) has a factor 푥 − 푎. We need factor (ퟏ − 풂풙), If 푎 is a root of linear polynomial 푓(푥−1), which means 푓 푎 = 0, then polynomial 푓(푥−1) has a factor x-1-a=(1-ax)/x. 1- 5 1 5 (1ax )1 1 ax a 2 x 2 ..... (1 x x2 ) (1- x)(1 x) 2 2 (1-x-x2)= x2((x-1)2-x-1-1)=x2((m)2-m-1) 2 1 5 Let m=x-1 C(m) = m2-m-1=(m-)(m-) , F = F + F 1 5 2 Substitute m=x-1 in, get n n - 1 n – 2 2 1 5 F(x) = x2(x-1- )(x-1- )=(1- x)(1- x) 1 5 2 Linear Homogeneous Recurrence Relation • The recurrence expression of Fibonacci Sequence x x F = 0, F = 1 , Gx() 0 1 1xx2 (1x)(1 x) Fn = Fn - 1 + Fn – 2 Denominator becomes F(x) = x2((x-1)2-x-1-1)=x2((m)2-m-1) Let m=x-1 2 1 5 1 5 C(m) = m -m-1=(m-)(m-) , Substitute m=x-1in, get 22 F(x) = x2(x-1- )(x-1- )=(1- x)(1- x) x A B Gx() 1 5 1 5 1 5 1 5 (1x )( 1 x ) 1 x 1 x 2 2 2 2 • Recurrence expression of Hanoi Tower xx h(n) 2h(n 1) 1 Hx() ()()1x 1 2 x 1 3 x 2 x 2 h(n 1) 2h(n 2) 1Subtract and get C(x) = x2-3x+2 h(n) 3h(n 1) 2h(n 2) 0 Roots of C(x)=0 are 1 and 2 an C1an1 C2an2 Ck ank 0, Linear Homegeneous Recurrence Relation Assume G(x) is a generating function of {푎푛}: n G(x) a0 a1x an x k x (ak C1ak 1 C2ak 2 Ck a0 ) 0 k 1 x (ak 1 C1ak C2ak 1 Ck a1) 0 n x (an C1an1 C2an2 Ck ank ) 0 Adds up both sides of these equations, get k 1 k 2 i i Gx ai x C1xGx ai x i0 i0 k Ck x Gx 0 Linear Homegeneous Recurrence Realtion k 1 k 1 j 2 k j i 1 C1x C2 x Ck x Gx C j x ai x j0 i0 k1 k1 j j i Let Px C j x ai x , the order of polynomial 푃 푥 ≤ 푘 − 1. j0 i0 (1ax )1 1 ax a 2 x 2 ..... Px Gx k 1 C1x Ck x an C1an1 C2an2 Ck ank 0, k1 k2 ki Cm m a1 m a2 m ai
k k 1 k1 k2 ki k C(m) m C1m Ck 1m Ck m=x-1 Px k1 k2 ki 1 a1x 1 a2 x 1 ai x Linear Homogeneous Recurrence Relation
Fn-Fn-1-Fn-2=0 h(n) – 3h(n-1)+2h(n-2)=0 x2-x-1=0 x2-3x+2=0 Def if sequence {푎푛} satisfies: an C1an1 C2an2 Ck ank 0,
a0 d0 ,a1 d1,,ak 1 dk 1, 퐶1, 퐶2, ⋯ 퐶푘 and 푑0, 푑1, ⋯ 푑푛−1 are constants, 퐶푘 ≠ 0, then this expression is called a kth-order linear homogeneous recurrence relation of {푎푛}. k k 1 C(x) x C1x Ck 1x Ck Characteristic Polynomial Fn-Fn-1-Fn-2=0 h(n) – 3h(n-1)+2h(n-2)=0
Def if sequence {푎푛} satisfies: an C1an1 C2an2 Ck ank 0,
a0 d0 ,a1 d1,,ak 1 dk 1, 퐶1, 퐶2, ⋯ 퐶푘 and 푑0, 푑1, ⋯ 푑푛−1 are constants, 퐶푘 ≠ 0, then this expression is called a kth-order linear homogeneous recurrence relation of {푎푛}. k k 1 C(x) x C1x Ck 1x Ck Characteristic Polynomial Linear Homegeneous Recurrence Relation Now we discuss the calculation by situations (1)Characteristic Polynomial 퐶(푥) has distinct real roots
Assume Cx x 1 x 2 x k
G(x) could be simplified as l1,l2 ,,lk could be solved by l l l l l l d Gx 1 2 k 1 2 k 0 1 x 1 x 1 x 1 2 k l11 l22 lkk d1 k k l n i a l ...... n i i k 1 k 1 k 1 i1 1i x i1 l11 l22 lkk d k 1 (1ax )1 1 ax a 2 x 2 ..... in which d0,d1…dk-1 are initial values of an Linear Homegeneous Recurrence Relation • Fibonacci Sequence Linear Homogeneous Recurrence Relation
F0 = 0, F1 = 1 , Def If sequence {푎푛} satisfies: Fn = Fn - 1 + Fn – 2 an C1an1 C2an2 Ck ank 0,
Characteristic Polynomial a0 d 0 , a1 d1,, ak 1 d k 1, 2 C(x) = x -x-1=(x-)(x-) 퐶 , 퐶 , ⋯ 퐶 and 푑 , 푑 , ⋯ 푑 are constants. 1 5 1 5 1 2 푘 1 2 푛−1 ; Characteristic Polynomial 2 2 k k 1 n n C(x) x C1x Ck 1x Ck Fn A B 1)Characteristic polynomial has distinct real roots, k different real roots Cx x a x a x a F0 = 0, F1 = 1 1 2 k n n n A B 0 an l1a1 l2 a2 lk ak 5 { (A B) 1 1n n 1 1 5 n 1 5 n 2 Fn ( ) (( ) ( ) ) (2) 5522 Generating Function
Def 2-1 For sequence a0, a1, a2…, construct function Laplae G(x)= a +a x+a x2+…, 0 1 2 1812 AD a l a n l a n l a n G(x) is the generating function of a0, an1, 1a1 2…2 2 k k
Seems to be functions but it’s actually a mapping
Berelli 1705- AD Euler 1764- AD a C a C a C a 0, Recurrence n 1 n1 2 n2 k nk Integer Segmentation k k 1 C(x) x C1x Ck 1x Ck n n n Generating function G(x) as a bridgean l1a1 l2 a2 lk ak Linear Homogeneous Recurrence Relation
Def If sequence {푎푛} satisfies:
an C1an1 C2an2 Ck ank 0, 2 5 1
a0 d 0 , a1 d1,, ak 1 d k 1, 2 5 2 퐶1, 퐶2, ⋯ 퐶푘 and 푑0, 푑1, ⋯ 푑푘−1 are constants k k 1 Characteristic Polynomial C(x) x C1x Ck 1x Ck 1)Characteristic polynomial has k distinct real roots
Cx x a1 x a2 x ak n n n an l1a1 l2 a2 lk ak In which 푙1, 푙2, ⋯ 푙푘 are undetermined coefficients. 1 1 k 1 ( )...( n ) n (k 1)x (1 x) x R 2 n0 n! k0 (1 x)
• Characteristic Polynomial has multiple roots
• Eg an 4an1 4an2 0,a0 1,a1 4 • Generating Function Method Characteristic Equation Method x2 :()()() a2 4 a 1 4 a 0 Characteristic Equation:x2-4x+4=(x-2)2 x3 :()()() a3 4 a 2 4 a 1 ax b Generating Function Form:Ax() 2 ______) ____________ ______ ()12 x AB 1 Partial Fractions:Ax() Ax() 2 1 4xx 4 2 ()()1 2xx 1 2 11 Ax() 1 4x 4 x22() 1 2 x n n n an A 2 B ( n 1)2 ( A ' Bn )2 (1 2x )2 C ( k 1, k )2kk x a01 A' 1, a (1 B )2 4 k 0 kk (kx 1)2 AB' 1, 1 k0 n n ann ( 1)2 ann ( 1)2 t ki A G(x) ij j (2 5 4) i1 j1 (1i x) ( 1)...( n 1) (1 x) xn R n0 n! (2)Characteristic Polynomial C(x) has multiple roots k A Assume β is a k-multiple root of C(x), it could be simplified as j j j1 (1 x)
푛 푘 푗+푛−1 푛 푥 ’s coefficients 푎푛 = 푗=1 퐴푗 푛 훽 , in which j n 1 j n 1 n j 1 is a j-1-order polynomial of n. So an is the product of β and a k-1-order polynomial of n. The term related to the solution of recurrence relation is: k1 n (A0 A1n Ak1n )
in which A 0 , A 1 , , A k 1 are k undetermined coefficients. • Eg an 4an1 4an2 0,a0 1,a1 4 Characteristic Equation is :x2 4x 4 (x 2)2
n an (A1 A2n)2
a0 A1 1
a1 (1 A2)2 4, A2 1
n an (1 n)2 Distinct real roots Multiple real rootsConjugate complex roots? x 2 x 1 0 Conjugate Complex Roots
• Quadratic Formula: • When b2-4ac<0, there’s no real root, two complex roots.
1 cos i sin , 2 1 (cos i sin ) Trigonometrical form of complex number z = a + bi: z = ρ(cosθ+ i sinθ)
a2 b2 §2.5 Linear Homogeneous Recurrence Relation (3)Characteristic Polynomial 퐶(푥) has conjugate complex roots
Assume that 푎1, 푎2 are a pair of conjugate complex roots of 퐶(푥).
1 cos i sin , 2 1 (cos i sin ) A A In 1 2 the coefficient of 푥푛 is: 1 1 x 1 2 x n n A11 A22 n n n n A1 (cos i sin ) A2 (cos i sin ) n n A1 (cos n i sin n ) A2 (cos n i sin n ) n n (A1 A2 ) cos n i(A1 A2 ) sin n n n A11 A2 2 n n ( A1 A2 ) cos n i( A1 A2 ) sin n A n cos n B n sin n
In which A A1 A2 , B i( A1 A2 ) When calculating in reality, we could solve the conjugate complex roots at first, then calculate undetermined coefficients 퐴, 퐵 to avoid the intermediate complex number calculations. n n n n A1 1 A2 2 A cosn B sin n
• Eg an an1 an2,a1 1,a2 0 2 Characteristic equation: x x 1 0
1 3 i x cos i sin e 3 2 3 3 n n a A cos A sin n 1 3 2 3 1 3 a A A 1 1 2 1 2 2 3 A1 1; A2 1 3 3 a A A 0 2 2 1 2 2 n 3 n a cos sin n 3 3 3 Summary of Linear Recurrence Relation According to the non-zero roots of C(x)
1) k distinct non-0 real roots Cx x a1 x a2 x ak n n n an l1a1 l2a2 lk ak
In which l1,l2 ,,lk , are undetermined coefficients. i i 2)A pair of conjugate complex root 1 e and 2 e : n n an A cosn B sin n In which A,B are undetermined coefficients. 3)Has root 훼1with multiplicity of k. k1 n (A0 A1n Ak1n )1
In which A0 , A1,, Ak1 are k undetermined coefficients. 4 Linear Homogeneous Recurrence Relation 4-4 Applications
组合数学 Combinatorics
52 Linear Homogeneous Recurrence Relation n Eg:Solve Sn k k0 S n 1 2 3 (n 1) n
S n1 1 2 3 (n 1) Sn Sn1 n
Similarly Sn1 Sn2 n 1
Subtract, get Sn 2Sn1 Sn2 1
Similarly Sn1 2Sn2 Sn3 1
Sn 3Sn1 3Sn2 Sn3 0
S0 0, S1 1, S2 3 Sn 3Sn1 3Sn2 Sn3 0
S0 0, S1 1, S2 3 Corresponding Characteristic Equation is m3 3m 2 3m 1 (m 1)3 0 m 1 is a 3-multiple root 2 n 2 Sn ( A Bn Cn )(1) A Bn Cn
S0 0, A 0 S 1, B C 1 1 1 S 3, 2B 4C 3, B C 2 2 1 1 2 1 So Sn n n n(n 1) 2 2 2 1 This proves 1 2 3 n n(n 1) 2
Linear Homogeneous Recurrence Relation n Eg2: 2 CalculateSn k k0 2 2 2 2 2 Sn 1 2 3 (n 1) n Sn Sn1 n 2 2 2 SimilarlyS S (n 1)2 Sn1 1 2 3 (n 1) n1 n2
Subtract, get Sn 2Sn1 Sn2 2n 1
Similarly Sn1 2Sn2 Sn3 2(n 1) 1
Subtract, get Sn 3Sn1 3Sn2 Sn3 2
Similarly Sn1 3Sn2 3Sn3 Sn4 2
Sn 4Sn1 6Sn2 4Sn3 Sn4 0
S0 0, S1 1, S2 5, S3 14 Sn 4Sn1 6Sn2 4Sn3 Sn4 0
S0 0, S1 1, S2 5, S3 14 Correspondent characteristic equation is: r 4 4r 3 6r 2 4r 1 (r 1) 4 0 r 1is a 4-multiple root 2 3 n Sn ( A Bn Cn Dn )(1) As S0 0, S1 1, S2 5, S3 14 we have a equation group about A、B、C、D: A 0 B C D 1 2B 4C 8D 5 3B 9C 27D 14 1 1 1
x1 x2 xn 2 2 2 Dn x1 x2 xn (xi x j ). ni j1 x n1 x n1 x n1 A 0 1 2 n 1 1 1 =(4-3)(4-2)(4-1)(3-2)(3-1)(2-1) =12 B C D 1 2 4 8 12 2B 4C 8D 5 3 9 27 3B 9C 27D 14 1 1 1 1 1 B 5 4 8 12 6 14 9 27 1 1 1 1 1 C 2 5 8 12 2 3 14 27 1 1 1 1 1 D 2 4 5 12 3 3 9 14 Applications of generating function and recurrence relation
Eg:There’s a point P on the plane. It’s the cross of n fields 퐷1, 퐷2, ⋯ 퐷푛. Color these n fields with k colors. We require the color of two adjacent areas to be different. Calculate the number of arrangements. D D 1 Let 푎 be the number of arrangement n D 푛 D 2 to color these areas. There are n1 P D 2 situations: 3
59 Applications of generating function and recurrence relation
(1) D1 and Dn-1 have the same color; D has k-1 choices, which is all colors D1 n Dn D except the one used by D1 and Dn-1; the 2 的 Dn1 arrangements for Dn-2 to D1 are one- P D to-one correspondent to the 3 (k 1)a Dn2 arrangements for n-2 areas. n2
(2) D1 and Dn-1 have different colors. Dn has k-2 choices; the arrangements D1 Dn from D1 to Dn-1 are one-to-one D2 correspondent to the arrangements for Dn1 (k 2)a P D n-1 areas. n1 3 an (k 2)an1 (k 1)an2 , 60 a2 k(k 1), a3 k(k 1)(k 2). Applications of generating function and recurrence relation
an (k 2)an1 (k 1)an2 ,
a2 k(k 1), a3 k(k 1)(k 2).
a1 0,a0 k. x2 (k 2)x (k 1) 0,
x1 k 1, x2 1. n n an A(k 1) B(1) . A B k, A1, B k 1. (k 1)A B 0. n n an (k 1) (k 1)(1) , n 2. a1 k. 61 Def 2-1 For sequence a0, a1, a2…, construct a function Laplace G(x)= a +a x+a x2+…, 0 1 2 1812 AD Then G(x) is called the generating function
of a0, a1, a2…… Generating functions are a hanger to hang a serires of numbers. — Herbert
x0 x1 x2 x3 x4 x5
a0 a1 a2 a3 a4 a5