Generating Functions and Recurrence Relations

Generating Functions and Recurrence Relations

GENERATING FUNCTIONS AND RECURRENCE RELATIONS Generating Functions Recurrence Relations Suppose a0; a1; a2;:::; an;:::;is an infinite sequence. A recurrence recurrence relation is a set of equations an = fn(an−1; an−2;:::; an−k ): (1) The whole sequence is determined by (6) and the values of a0; a1;:::; ak−1. Generating Functions Linear Recurrence Fibonacci Sequence an = an−1 + an−2 n ≥ 2: a0 = a1 = 1. Generating Functions n bn = jBnj = jfx 2 fa; b; cg : aa does not occur in xgj: b1 = 3 : a b c b2 = 8 : ab ac ba bb bc ca cb cc bn = 2bn−1 + 2bn−2 n ≥ 2: Generating Functions bn = 2bn−1 + 2bn−2 n ≥ 2: Let (b) (c) (a) Bn = Bn [ Bn [ Bn (α) where Bn = fx 2 Bn : x1 = αg for α = a; b; c. (b) (c) (b) Now jBn j = jBn j = jBn−1j. The map f : Bn ! Bn−1, f (bx2x3 ::: xn) = x2x3 ::: xn is a bijection. (a) Bn = fx 2 Bn : x1 = a and x2 = b or cg. The map (a) (b) (c) g : Bn ! Bn−1 [ Bn−1, g(ax2x3 ::: xn) = x2x3 ::: xn is a bijection. (a) Hence, jBn j = 2jBn−2j. Generating Functions Towers of Hanoi Peg 1 Peg 2 Peg 3 Hn is the minimum number of moves needed to shift n rings from Peg 1 to Peg 2. One is not allowed to place a larger ring on top of a smaller ring. Generating Functions xxx H n-1 moves 1 move H n-1 moves Generating Functions We see that H1 = 1 and Hn = 2Hn−1 + 1 for n ≥ 2. So, H H 1 n − n−1 = : 2n 2n−1 2n Summing these equations give H H 1 1 1 1 1 n − 1 = + + ··· + = − : 2n 2 2n 2n−1 4 2 2n So n Hn = 2 − 1: Generating Functions A has n dollars. Everyday A buys one of a Bun (1 dollar), an Ice-Cream (2 dollars) or a Pastry (2 dollars). How many ways are there (sequences) for A to spend his money? Ex. BBPIIPBI represents “Day 1, buy Bun. Day 2, buy Bun etc.”. un = number of ways = un;B + un;I + un;P where un;B is the number of ways where A buys a Bun on day 1 etc. un;B = un−1; un;I = un;P = un−2. So un = un−1 + 2un−2; and u0 = u1 = 1: Generating Functions If a0; a1;:::; an is a sequence of real numbers then its (ordinary) generating function a(x) is given by 2 n a(x) = a0 + a1x + a2x + ··· anx + ··· and we write n an = [x ]a(x): For more on this subject see Generatingfunctionology by the late Herbert S. Wilf. The book is available from https://www.math.upenn.edu// wilf/DownldGF.html Generating Functions an = 1 1 a(x) = = 1 + x + x2 + ··· + xn + ··· 1 − x an = n + 1. 1 a(x) = = 1 + 2x + 3x2 + ··· + (n + 1)xn + ··· (1 − x)2 an = n. x a(x) = = x + 2x2 + 3x3 + ··· + nxn + ··· (1 − x)2 Generating Functions Generalised binomial theorem: α an = n 1 X α a(x) = (1 + x)α = xn: n n=0 where α α(α − 1)(α − 2) ··· (α − n + 1) = : n n! m+n−1 an = n 1 1 1 X −m X m + n − 1 a(x) = = (−x)n = x n: (1 − x)m n n n=0 n=0 Generating Functions General view. Given a recurrence relation for the sequence (an), we (a) Deduce from it, an equation satisfied by the generating P n function a(x) = n anx . (b) Solve this equation to get an explicit expression for the generating function. n (c) Extract the coefficient an of x from a(x), by expanding a(x) as a power series. Generating Functions Solution of linear recurrences an − 6an−1 + 9an−2 = 0 n ≥ 2: a0 = 1; a1 = 9. 1 X n (an − 6an−1 + 9an−2)x = 0: (2) n=2 Generating Functions 1 X n anx = a(x) − a0 − a1x n=2 = a(x) − 1 − 9x: 1 1 X n X n−1 6an−1x = 6x an−1x n=2 n=2 = 6x(a(x) − a0) = 6x(a(x) − 1): 1 1 X n 2 X n−2 9an−2x = 9x an−2x n=2 n=2 = 9x2a(x): Generating Functions a(x) − 1 − 9x − 6x(a(x) − 1) + 9x2a(x) = 0 or a(x)(1 − 6x + 9x2) − (1 + 3x) = 0: 1 + 3x 1 + 3x a(x) = = 1 − 6x + 9x2 (1 − 3x)2 1 1 X X = (n + 1)3nxn + 3x (n + 1)3nxn n=0 n=0 1 1 X X = (n + 1)3nxn + n3nxn n=0 n=0 1 X = (2n + 1)3nxn: n=0 n an = (2n + 1)3 : Generating Functions Fibonacci sequence: 1 X n (an − an−1 − an−2)x = 0: n=2 1 1 1 X n X n X n anx − an−1x − an−2x = 0: n=2 n=2 n=2 2 (a(x) − a0 − a1x) − (x(a(x) − a0)) − x a(x) = 0: 1 a(x) = : 1 − x − x2 Generating Functions 1 a(x) = − (ξ1 − x)(ξ2 − x) 1 1 1 = − ξ1 − ξ2 ξ1 − x ξ2 − x ! 1 ξ−1 ξ−1 = 1 − 2 ξ1 − ξ2 1 − x/ξ1 1 − x/ξ2 where p p 5 + 1 5 − 1 ξ = − and ξ = 1 2 2 2 are the 2 roots of x2 + x − 1 = 0: Generating Functions Therefore, −1 1 −1 1 ξ1 X −n n ξ2 X −n n a(x) = ξ1 x − ξ2 x ξ1 − ξ2 ξ1 − ξ2 n=0 n=0 1 −n−1 −n−1 X ξ − ξ = 1 2 xn ξ1 − ξ2 n=0 and so −n−1 −n−1 ξ1 − ξ2 an = ξ1 − ξ2 0 p !n+1 p !n+11 1 5 + 1 1 − 5 = p @ − A : 5 2 2 Generating Functions Inhomogeneous problem 2 an − 3an−1 = n n ≥ 1: a0 = 1. 1 1 X n X 2 n (an − 3an−1)x = n x n=1 n=1 1 1 1 X X X n2xn = n(n − 1)xn + nxn n=1 n=2 n=1 2x2 x = + (1 − x)3 (1 − x)2 x + x2 = (1 − x)3 1 X n (an − 3an−1)x = a(x) − 1 − 3xa(x) n=1 = a(x)(1 − 3x) − 1: Generating Functions x + x2 1 a(x) = + (1 − x)3(1 − 3x) 1 − 3x A B C D + 1 = + + + 1 − x (1 − x)2 (1 − x)3 1 − 3x where x + x2 =∼ A(1 − x)2(1 − 3x) + B(1 − x)(1 − 3x) + C(1 − 3x) + D(1 − x)3: Then A = −1=2; B = 0; C = −1; D = 3=2: Generating Functions So −1=2 1 5=2 a(x) = − + 1 − x (1 − x)3 1 − 3x 1 1 1 1 X X n + 2 5 X = − xn − xn + 3nxn 2 2 2 n=0 n=0 n=0 So 1 n + 2 5 a = − − + 3n n 2 2 2 3 3n n2 5 = − − − + 3n: 2 2 2 2 Generating Functions General case of linear recurrence an + c1an−1 + ··· + ck an−k = un; n ≥ k: u0; u1;:::; uk−1 are given. X n (an + c1an−1 + ··· + ck an−k − un) x = 0 It follows that for some polynomial r(x), u(x) + r(x) a(x) = q(x) where k 2 k Y q(x) = 1 + c1x + c2x + ··· + ck x = (1 − αi x) i=1 and α1; α2; : : : ; αk are the roots of p(x) = 0 where k k k−1 p(x) = x q(1=x) = x + c1x + ··· + c0. Generating Functions Products of generating functions 1 1 X n X n a(x) = anx ; b(x)) = bnx : n=0 n=0 2 a(x)b(x) = (a0 + a1x + a2x + ··· ) × 2 (b0 + b1x + b2x + ··· ) = a0b0 + (a0b1 + a1b0)x + 2 (a0b2 + a1b1 + a2b0)x + ··· 1 X n = cnx n=0 where n X cn = ak bn−k : k=0 Generating Functions Derangements n X n n! = d : k n−k k=0 n Explanation: k dn−k is the number of permutations with n exactly k cycles of length 1. Choose k elements ( k ways) for which π(i) = i and then choose a derangement of the remaining n − k elements. So n X 1 d − 1 = n k k! (n − k)! k=0 1 1 n ! X X X 1 d − xn = n k xn: (3) k! (n − k)! n=0 n=0 k=0 Generating Functions Let 1 X dm d(x) = xm: m! m=0 From (3) we have 1 = ex d(x) 1 − x e−x d(x) = 1 − x 1 n X X (−1)k = xn: k! n=0 k=0 So n k dn X (−1) = : n! k! k=0 Generating Functions Triangulation of n-gon Let an = number of triangulations of Pn+1 n X = ak an−k n ≥ 2 (4) k=0 a0 = 0, a1 = a2 = 1. k +1 n+1 1 Generating Functions Explanation of (4): ak an−k counts the number of triangulations in which edge 1; n + 1 is contained in triangle1 ; k + 1; n + 1. There are ak ways of triangulating1 ; 2;:::; k + 1; 1 and for each such there are an−k ways of triangulating k + 1; k + 2;:::; n + 1; k + 1. Generating Functions 1 1 n ! X n X X n x + anx = x + ak an−k x : n=2 n=2 k=0 But, 1 X n x + anx = a(x) n=2 since a0 = 0; a1 = 1. 1 n ! 1 n ! X X n X X n ak an−k x = ak an−k x n=2 k=0 n=0 k=0 = a(x)2: Generating Functions So a(x) = x + a(x)2 and hence p p 1 + 1 − 4x 1 − 1 − 4x a(x) = or : 2 2 But a(0) = 0 and so p 1 − 1 − 4x a(x) = 2 1 ! 1 1 X (−1)n−1 2n − 2 = − 1 + (−4x)n 2 2 n22n−1 n − 1 n=1 1 X 12n − 2 = xn: n n − 1 n=1 So 12n − 2 a = : n n n − 1 Generating Functions Exponential Generating Functions Given a sequence an; n ≥ 0, its exponential generating function (e.g.f.) ae(x) is given by 1 X an a (x) = xn e n! n=0 x an = 1; n ≥ 0 implies ae(x) = e : 1 a = n!; n ≥ 0 implies a (x) = n e 1 − x Generating Functions Products of Exponential Generating Functions Let ae(x); be(x) be the e.g.f.’s respectively for (an); (bn) respectively.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    49 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us