MATH39001 Generating functions. 1 Ordinary power series generating functions

Similar documents
1 Basic Combinatorics

Generalized Near-Bell Numbers

are the q-versions of n, n! and . The falling factorial is (x) k = x(x 1)(x 2)... (x k + 1).

PROBABILITY VITTORIA SILVESTRI

= 1 2 x (x 1) + 1 {x} (1 {x}). [t] dt = 1 x (x 1) + O (1), [t] dt = 1 2 x2 + O (x), (where the error is not now zero when x is an integer.

Euler-Maclaurin summation formula

Generating Functions

2 Generating Functions

Harmonic sets and the harmonic prime number theorem

Generating Functions

Taylor Series and Asymptotic Expansions

Introduction to Techniques for Counting

MATH 802: ENUMERATIVE COMBINATORICS ASSIGNMENT 2

Model Paper WITH ANSWERS. Higher Maths

SYLLABUS FOR ENTRANCE EXAMINATION NANYANG TECHNOLOGICAL UNIVERSITY FOR INTERNATIONAL STUDENTS A-LEVEL MATHEMATICS

Definition: A sequence is a function from a subset of the integers (usually either the set

Problem Solving in Math (Math 43900) Fall 2013

Fall 2017 Test II review problems

Peter Bala, Nov

2. Higher-order Linear ODE s

Review problems solutions

Generating Functions

y + α x s y + β x t y = 0,

On a Balanced Property of Compositions

The Inclusion Exclusion Principle

What you learned in Math 28. Rosa C. Orellana

Solutions to the 77th William Lowell Putnam Mathematical Competition Saturday, December 3, 2016

Solutions Quiz 9 Nov. 8, Prove: If a, b, m are integers such that 2a + 3b 12m + 1, then a 3m + 1 or b 2m + 1.

6 CARDINALITY OF SETS

Topics in Algorithms. 1 Generation of Basic Combinatorial Objects. Exercises. 1.1 Generation of Subsets. 1. Consider the sum:

Flat primes and thin primes

SOLUTION SETS OF RECURRENCE RELATIONS

PROBABILITY. Contents Preface 1 1. Introduction 2 2. Combinatorial analysis 5 3. Stirling s formula 8. Preface

Algorithmic Approach to Counting of Certain Types m-ary Partitions

Stirling Numbers of the 1st Kind

The incomplete gamma functions. Notes by G.J.O. Jameson. These notes incorporate the Math. Gazette article [Jam1], with some extra material.

Lecture 3: Probability Measures - 2

Fourier Analysis Fourier Series C H A P T E R 1 1

Advanced Counting Techniques

Math 192r, Problem Set #3: Solutions

CSCE 222 Discrete Structures for Computing. Dr. Hyunyoung Lee

1 Solving Linear Recurrences

Answer Key 1973 BC 1969 BC 24. A 14. A 24. C 25. A 26. C 27. C 28. D 29. C 30. D 31. C 13. C 12. D 12. E 3. A 32. B 27. E 34. C 14. D 25. B 26.

and the compositional inverse when it exists is A.

10.4: WORKING WITH TAYLOR SERIES

12 Sequences and Recurrences

On the Convergence of the Summation Formulas Constructed by Using a Symbolic Operator Approach

2014 Mathematics. Advanced Higher. Finalised Marking Instructions

Basic methods to solve equations

Discrete Mathematics. Kishore Kothapalli

MCS 256 Discrete Calculus and Probability Exam 5: Final Examination 22 May 2007

A Symbolic Operator Approach to Several Summation Formulas for Power Series

1/100 Range: 1/10 1/ 2. 1) Constant: choose a value for the constant that can be graphed on the coordinate grid below.

COFINITE INDUCED SUBGRAPHS OF IMPARTIAL COMBINATORIAL GAMES: AN ANALYSIS OF CIS-NIM

Winkler s Hat Guessing Game: Better Results for Imbalanced Hat Distributions

Every subset of {1, 2,...,n 1} can be extended to a subset of {1, 2, 3,...,n} by either adding or not adding the element n.

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

0.1. Linear transformations

Lecture 1: An introduction to probability theory

ACCUPLACER MATH 0310

Solutions to Problem Sheet for Week 11

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

The Greatest Common Divisor of k Positive Integers

WBHS Algebra 2 - Final Exam

Math 353 Lecture Notes Week 6 Laplace Transform: Fundamentals

Combinatorial Analysis of the Geometric Series

Extension of Summation Formulas involving Stirling series

Economics 205 Exercises

Applications. More Counting Problems. Complexity of Algorithms

Basic counting techniques. Periklis A. Papakonstantinou Rutgers Business School

Using the TI-92+ : examples

Standard forms for writing numbers

COUNCIL ROCK HIGH SCHOOL MATHEMATICS. A Note Guideline of Algebraic Concepts. Designed to assist students in A Summer Review of Algebra

Brief Revision Notes and Strategies

The well-known Fibonacci sequence is defined by a recurrence. Specifically,letF i denote the ith number. Then, we have:

CMSC Discrete Mathematics SOLUTIONS TO FIRST MIDTERM EXAM October 18, 2005 posted Nov 2, 2005

Enumerative Combinatorics 7: Group actions

FUNDAMENTALS OF REAL ANALYSIS by. IV.1. Differentiation of Monotonic Functions

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.

Summing Series: Solutions

Probabilistic Aspects of the Integer-Polynomial Analogy

Advanced Counting Techniques. Chapter 8

Solutions to Math 41 First Exam October 12, 2010

Several Generating Functions for Second-Order Recurrence Sequences

HW2 Solutions Problem 1: 2.22 Find the sign and inverse of the permutation shown in the book (and below).

NOTES ON DIOPHANTINE APPROXIMATION

Applications of Chromatic Polynomials Involving Stirling Numbers

Named numbres. Ngày 25 tháng 11 năm () Named numbres Ngày 25 tháng 11 năm / 7

ON THE POSSIBLE QUANTITIES OF FIBONACCI NUMBERS THAT OCCUR IN SOME TYPES OF INTERVALS

Section 7.2: One-to-One, Onto and Inverse Functions

CHAPTER 4. Series. 1. What is a Series?

Solving and Graphing Polynomials

Week 9-10: Recurrence Relations and Generating Functions

CONTINUITY AND DIFFERENTIABILITY

#A69 INTEGERS 13 (2013) OPTIMAL PRIMITIVE SETS WITH RESTRICTED PRIMES

Discrete Mathematics & Mathematical Reasoning Chapter 6: Counting

Introduction to Series and Sequences Math 121 Calculus II Spring 2015

PRIME NUMBERS YANKI LEKILI

Massachusetts Institute of Technology Handout J/18.062J: Mathematics for Computer Science May 3, 2000 Professors David Karger and Nancy Lynch

3.2 Logarithmic Functions and Their Graphs

Transcription:

MATH3900 Generating functions The reference for this part of the course is generatingfunctionology by Herbert Wilf. The 2nd edition is downloadable free from http://www.math.upenn. edu/~wilf/downldgf.html, all references in these notes refer to this edition. (There are two versions available, the second, internally hyperlinked version is nicer to read online.) Ordinary power series generating functions (Wilf, Chapters and 2) Definition. The ordinary power series generating function of a sequence {a n } is the formal power series f() a n n. Notation: f() {a n }. Theorem. Let {a n } be a sequence and let f() {a n }. (i) (Wilf, p. 8) Let k be a positive integer and let { 0 if n < k, b n a n k otherwise.. ({b n } is the sequence {a n } shifted by k places to the right and padded by 0 s on the left.) Then {b n } k f(). (ii) (Wilf, p. 34, Rule ) {a n+k } f() a 0 a... a k k k for any positive integer k. (iii) (Wilf, p. 35, Rule 2) {na n } f (). Proof. (i) k f() k a n n 0 + 0 +... + 0 k + a 0 k + a k+..., which is eactly the ordinary power series generating function of {b n }. (ii) Let g() {a n+k }. Then k g() k a n+k n a n+k n+k a n n nk k a n n a n n f() a 0 a... a k k.

Hence g() f() a 0 a... a k k, as claimed. (iii) f() as claimed. k a n n, therefore f () f () na n n na n n and na n n {na n }, Taking ordinary power series generating function is a linear operation. If {a n } f(), then {λa n } λf() for any scalar λ. Similarly, if {a n } f() and {b n } g(), then {a n +b n } f()+g(). Warning: The ordinary power series generating function of the product of two sequences is NOT the product of the generating functions. Eamples.. {} 2. {a n } {2 n } a n n 2, {( 3)n } n. a for any real number a, so, for eample, ( 3) + 3. 3. By Theorem. (iii) applied to the constant sequence {} we obtain that {n} d ( ). By applying Theorem. (iii) d ( ) 2 repeatedly we can calculate the ordinary power series generating function of any positive integer power of n and hence the ordinary power series generating function of any polynomial in n. {n 2 } d ( ) ( + ) d ( ) 2 ( ) 3 and {n 3 } d ( ) ( + ) d ( ) 3 (2 + 4 + ) ( ) 4. 4. By using the results of eamples and 3, we can calculate the ordinary power series generating function of {n + } : {n + } ( ) 2 + ( ) 2. 2

Another possibility is to use Theorem. (ii) with a n n and k to calculate the ordinary power series generating function of {n + } from that of {n} : {n + } ( ) 2 0 ( ) 2. 5. Let {F n } be the Fibonacci sequence, defined by F 0 F and the recurrence relation F n+2 F n+ + F n for n 0. Find an eplicit formula for F n. Let f() {F n }, then {F n+ } {F n+2 } f() F 0 F 2 f() f() F 0 2 f() by Theorem. (ii). Hence the recurrence relation F n+2 F n+ + F n for n 0 can be written as f() f() + f(). 2 After multiplying this equation by 2 and rearranging it, we obtain therefore f()( 2 ), f() 2. Let α + 5 and β 5, so that 2 ( α)( β), 2 2 then the partial fraction decompostion of f() is f() α β. 2 5( α) 5( β) Hence f() α (α) n β (β) n 5 5 and α n+ β n+ n, therefore 5 [ ( F n αn+ β n+ ) n+ ( ) ] n+ + 5 5. 5 5 2 2 This is the required eplicit formula. (One of the advantages of generating functions is that we did not need to guess this formula in advance, we obtained it as part of the solution.) 3

6. Let {a n } be the sequence defined by a 0 0, a and the recurrence relation a n+2 5a n+ 6a n for n 0. Find an eplicit formula for a n. Let f() {a n }, then {a n+ } f() a 0 f() a 0 a f() by Theorem. (ii). 2 2 f() and {a n+2} Hence the recurrence relation a n+2 5a n+ 6a n for n 0 can be written in terms of generating functions as f() 2 5f() 6f(). After multiplying this equation by 2 and rearranging it, we obtain therefore f()( 5 + 6 2 ), f() 5 + 6 2. 5 + 6 2 ( 2)( 3), so the partial fraction decomposition of f() is of the form 5 + 6 A 2 2 + B ( 3) for some suitable A and B. By multiplying this equation by 2 we obtain A( 3) + B( 2). By equating the coefficients or by substituting /2 and /3, we find the solution A and B, so f() 2 + 3 2 n n + therefore a n 3 n 2 n for all integers n 0. 3 n n (3 n 2 n ) n, 7. Let {b n } be the sequence defined by b 0 0, b and the recurrence relation b n+2 5b n+ 6b n + n for n 0. Find an eplicit formula for b n. Let g() {b n }, then just as in the previous eample, {b n+ } g() b 0 g() and {b n+2} g() b 0 b g() by Theorem. 2 2 (ii). We calculated the ordinary power series generating function of {n} in Eample 3, it is /( ) 2. (This is very important, any term not involving 4

elements of the sqeuence in the recurrence relation also has to be converted to a generating function, since taking the ordinary power series generating function means multiplying the recurrence relation by n and summing from n 0 to.) Therefore we get the following equation for g(), g() 2 5g() 6g() + ( ) 2. By multiplying it by 2 and collecting all the terms containing g() on one side a all the terms not containing g() on the other side we obtain hence g() g()( 5 + 6 2 ) + 3 ( ) 2, 5 + 6 2 + 3 ( ) 2 ( 5 + 6 2 ) 2 3 2 2 + ( ) 2 ( 5 + 6). The denominator factorises as ( ) 2 ( 2)( 3), so the partial fraction decomposition is of the form 2 3 2 2 + ( ) 2 ( 2)( 3) A + B ( ) + C 2 2 + D 3. By multiplying by ( ) 2 ( 2)( 3) and solving for the coefficients we find that hence. g() 4( ) + 2( ) 2 2 2 + 5 4( 3) n + (n + ) n 2 2 n n + 5 3 n n 4 2 4 b n 4 + n + 2 2 2 n + 5 4 3n 5 3n 2 n+3 + 2n + 3 4 Theorem.2 (Product formula, Wilf, p. 36, Rule 3) Let {a n }, {b n } be sequences and let f() {a n }, g() {b n }. Then { f()g(). 5 a k b n k}

Proof. f() a n n and g() b n n by the definition of the ordinary power series generating function, therefore ( ) ( ) f()g() a n n b n n ( ) a k b n k n, and this{ is clearly the ordinary power series generating function of the se- quence a k b n k}. Corollary.3 (Wilf, p. 37, Rule 4) Let {a n } be a sequence, let f() {a n }, and let s n a k for n 0. Then {s n } f(). Proof. s n {} (a k ), so we can apply Theorem.2 with with b n., so by Theorem.2, {s n} f() f(). Eamples.. Let {F n } be the Fibonacci sequence, defined by F 0 F, F n+2 F n+ + F n for n 0. Then F k F n+2 for any n 0. Let f() {F n }. By Corollary.3, by Theorem. (ii), {F n+2 } therefore we need to prove that { F k} f() and {} 2 f(), while, f() f() 2. (.) (Note that when converting the recurrence relation into an equation for the generating function, the terms not involving the sequence, in this case, also have to replaced by their generating function.) (.) can be proved by substituting for f() and the carrying out 2 appropriate algebraic manipulation, but it is easier treat it as an equation for f() and to solve it and to note that the solution is f(). 2 2. Let c n (n ) + 2(n 2) + 3(n 3) + (n 2)2 + (n ) for n 0. Find an eplicit formula for c n. 6

Let h() {c n }. We can write c n as c n k(n k), therefore we can apply Theorem.2 with a n b n n. As we already know that {n} ( ), we obtain h() 2 2 ( ). 4 ( ) ( ) n + 3 n is one of the standard generating functions on 4 3 ( ) 2 3 the handout. By Theorem. (i), generates the sequence 0, 0,, ( ) 4 ( ) ( ) ( ) ( ) ( 3 ) 4 5 2 n +,,.... As 0, we can write this sequence as 3 3 3 3 3 for all n 0. Therefore ( ) n + (n + )n(n ) c n. 3 6 3. Let d n k 2 for n 0. Find an eplicit formula for d n. We calculated in Eample 3 after Theorem. that {n 2 } therefore by Corollary.3, {d n } into partial fractions as We have that ( + ) ( ), 3 ( + ). This can be decomposed ( ) 4 ( + ) ( ) 4 2 ( ) 4 3 ( ) 3 + ( ) 2. ( ) k+ ( n + k for any natural number k, therefore d n ( ) ( ) ( ) n + 3 n + 2 n + 2 3 + 3 2 2(n + 3)(n + 2)(n + ) 3(n + 2)(n + ) + n + 6 2 2n3 + 3n 2 + n n(n + )(2n + ), 6 6 which is the well-known formula for k 2. 7 k )

4. Let e n k3 n k. We can apply Theorem.2 with a n n and b n 3 n. We calculated in Eample 3 after Theorem. that {n} and {3 n } ( 3), therefore {e n} can be decomposed into partial fractions as Now ( 3) therefore ( ) 2 ( ) 2 ( 3). This ( ) 2 ( 3) 3 4( 3) 2( ) 2 4( ). {3 n }, e n 3 3n 4 ( ) 2 {n+} and n + 2 4 3n+ 2n 3. 4 {}, 5. Let the sequence {a n } be defined by a 0 0, a 2 and a n+2 2a n+ a n + for n 0. (i) Find an eplicit formula for a n. (ii) Prove by using generating functions that 3 a k (n + 3)a n 2n. (i) Let f() {a n }. Then {a n+ } f() 2 f() a 0 f() {a n+2 } f() a 0 a by Theorem. (ii). {} 2 2 /( ), therefore we can write the recurrence relation in terms of generating functions as f() 2 2f() f() + 2. (Note that when converting the recurrence relation into an equation for the generating function, the terms not involving the sequence, in this case, also get replaced by their generating function.) Hence f() 2 2f() 2 f() + 2, f()( 2 + 2 ) 2 + 2, f()( ) 2 f() 2 2, 2 2 ( ). 3 8 and

To find the formula for a n, we decompose f() into partial fractions. The form of the decomposition is 2 2 ( ) A 3 + B ( ) + C 2 ( ). 3 Therefore 2 2 A( ) 2 +B( )+C, and since 2 2 ( ) 2, we can deduce that A, B 0 and C. Hence f() ( ) 3 ( ) ( n + 2 2 ) n n, therefore ( ) n + 2 a n 2 (n + 2)(n + ) 2 n2 + 3n. 2 (ii) Let s n a k. Then by Corollary.3, {s n } f() ( {na n } 2 2 f () ( ) + 3(2 ) 2 ) 3 ( ) 4 2 2 ( ) 4, 2 ( ) + 3(2 2 ) 2 ( ) 4 by Theorem. (iii), and {2n} 2. Therefore the ordinary ( ) 2 power series generating function of {(n + 3)a n 2n} is {(n + 3)a n 2n} 2 ( ) + 3(2 2 ) + 3(2 2 ) 2 2 ( ) 4 ( ) 3 ( ) 2 3(2 2 ) + 3( )(2 2 ) ( ) 4 ( ) 4 3(2 2 ) ( ) 4 {3s n }, so we conclude that (n + 3)a n 2n 3s n. A financial application Assume that a bank account has a fied interest rate i per time period and that you pay in a fied amount d each time period. Let a n be the balance of the account at time n. (a n < 0 means that you owe the bank money.) Find a formula for a n. 9

a n satisfies the recurrence relation a n+ (+i)a n +d. Let f() {a n }, then {a n+ } f() a 0 by Theorem. (ii) and {d} d so the above recurrence relation can be written in terms of generating functions as Hence therefore a n f() f() a 0 ( + i)f() + d. a 0 ( + i) + d ( ( + i))( ) a 0 ( + i) + d/i ( + i) d/i ( a 0 + d i [( ) (( + i)) n d i ) ( + i) n d i a 0 + d i ] n, ( a 0 + d ) ( + i) n d i i a 0( + i) n + d i (( + i)n ). n Eample. Assume that you have a mortgage of 73300 at a fied monthly interest rate of 0.626%, and you make a monthly payment of 680. How long will it take to pay off this mortgage? In this case a 0 73300, a n 0, d 680, i 0.00626 and we want to find d/i n. The formula for a n can be rearranged as a 0 + (d/i) ( + i)n. hence ( ) d/i ln a 0 + (d/i) n. ln( + i) ( 3.07495, ln ) d/i a 0 + (d/i) d/i By substituting the numbers in, we obtain a 0 + (d/i).2329, ln( + i) 0.62405, hence n 80 (accurate with an error of less than 0 6 ), so it would take 80 months or 5 years to pay off the mortgage. 0

2 Other types of generating functions (Wilf, Chapters and 2) 2. Eponential generating functions Definition. The eponential generating function of a sequence {a n } is the a n formal power series f() n! n. Notation: f() {a n }. Eamples.. {} a n n e a. n! n n! e. More generally, {a n } 2. Let r be an integer. The sequence of binomial coefficients also has a nice eponential generating function. {( )} n r r r! nr ( ) n n r n! nr n r (n r)! r r! n! r!(n r)! m0 n n! m m! e r r! {( )} n r Theorem 2. Let {a n } be a sequence and let f() {a n }. Then (i) {na n } f(), (ii) (Wilf, p. 40, Rule ) {a n+k } dk f() for k, and d k (iii) (Wilf, p. 4, Rule 2 ){na n } f (). Proof. (i) Note that a may not be defined, but 0a 0, so the sequence {na n } makes sense. {na n } n na n n n! n a n (n )! n na n n n! a n n! n f().

(Warning: If you repeat this k times to get k f(), the corresponding sequence is not n k a n k, but n(n ) (n k + )a n k, however, in practice only k is important.) (ii) f() f () a n n! n, therefore na n n! n n a n (n )! n By doing it k times we obtain that {a n+k } (iii) f () na n n! n a n+ n {a n+ } n!. dk f(). d k na n n {na n } n!. Eamples.. Let {F n } be the Fibonacci sequence, defined by F 0 F, F n+2 F n+ + F n for n 0. Find an eplicit formula for F n by using eponential generating functions. Let f() {F n }, then {F n+ } f () and {F n+2 } f (). Thus from the recurrence relation we obtain the 2nd order ordinary differential equation f () f () f() 0 for f(). The roots of the auiliary equation λ 2 λ 0 are α (+ 5)/2 and β ( 5)/2, therefore the general solution of the ODE is f() Ae α +Be β, where A and B are constants. The degree 0 and degree terms of f() are (A + B) and (Aα + Bβ), resp., therefore A + B F 0 and Aα + Bβ F. By solving these equations for A and B we obtain A α/ 5 and B β/ 5. Hence f() α e α β e β α (α) n β (β) n 5 5 5 n! 5 n! α n+ β n+ and therefore [ ( F n αn+ β n+ ) n+ ( ) ] n+ + 5 5, 5 5 2 2 n! 5 which agrees with the formula obtained by using ordinary power series generating functions. 2 n

(Note that in case of eponential generating functions, the nth term of the sequence is n! times the coefficient of n in the power series.) 2. We have already calculated {} Theorem 2. (iii) we obtain {n} e. By successive application of (e ) e, and {n 2 } (e ) (e + e ) ( 2 + )e {n 3 } (( 2 + )e ) ( 2 + 3 + )e ( 3 + 3 2 + )e. In principle this method can be used to calculate the eponential generating function of any positive integer power of n and hence any polynomial in n. Similarly, {3 n } e 3, so {n3 n } (e 3 ) 3e 3. 3. The sequence {a n } is defined by the recurrence relation a n+ na n n 2 + 2 for n 0 and a 0. Find an eplicit formula for a n. Let f() {a n }, then {a n+ } and {na n } f () Theorem 2. (iii). We have already calculated 2e, therefore we obtain the follow- {n 2 } ( 2 + )e and {2} ing equation for f from the recurrence relation. f () by Theorem 2. (ii) f () f () ( 2 + )e + 2e ( )f () (2 2 )e f () 2 2 e ( + 2)e f() ( + 2)e d ( + )e + C f(0) a 0, therefore C 0 and f() ( + )e. We calculated previously that e {} and e {n}, therefore ( + )e {n + }, hence a n n +. 4. Derangements (permutations without fied points) (Wilf, p. 69, Eercise 27). Let D n be the number of permutations of {, 2,..., n} without a 3

fied point, i. e., the number of permutations σ : {, 2,..., n} {, 2,..., n} such that σ(i) i for any i, i n. We set D 0. Calculate D n. First we need to find a recurrence relation. Any permutation can be written as the product of disjoint cycles and the permutation has no fied point if and only if there are no cycles of length in it cycle decomposition. Let s now consider a fied-point-free permutation of {, 2,..., n, n+}. There are two possibilities, n + is either in a cycle of length 2 or it is in a cycle of length greater than 2. Case. n + is in a cycle of length 2, (i n + ). If we delete this cycle, the remaining cycles give a fied-point-free permutation of the n elements of {, 2,..., n} \ {i}. There are n choices for i and D n choices for the fied-point-free permutation of of {, 2,..., n} \ {i}, nd n in total. Case 2. n + is in a cycle of length at least 3, (... i n + j...). In this case we can delete n + from this cycle and it still has length at least 2, so we obtain a fied-point-free permutation of {, 2,..., n}. There are D n possibilities for this permutation and n possibilities for the position of n + in the original permutation (the number i preceding n + determines it uniquely), nd n possibilities in total. Hence we obtain the recurrence relation D n+ nd n + nd n for n 0. (For n 0 the right-hand side involves D but with coefficient 0, so we can just set D 0.) Let D() {D n }. Then {D n+ } D () by Theorem 2. (ii), {nd n } D () by Theorem 2. (iii) and {nd n } D() by Theorem 2. (i). Hence from the recurrence relation for D n we obtain an ordinary differential equation for D(), which is variable separable and easily solvable. D () D () + D(), ( )D () D(), D () D(), D () D() d d, log D() log( ) + C, e D() C 2 e log( ) C 2. 4

D(0) D 0, therefore C 2 and D() e ( ) n n, n! D() e n, so e. ( ) ( ( ) n n ) n n! ( ) ( ) k n. k! As we are dealing with eponential generating functions, D n is n! times the coefficient of n in this epression, From this we can deduce that D n lim n n! lim n D n n! ( ) k. k! ( ) k k! ( ) k e. k! For large n the probability that a randomly chosen permutation has no fied point is approimately e 0.368. See question 6 on problem sheet 7 for a different solution. Theorem 2.2 (Product formula, Wilf, p. 42, Rule 3 ) Let {a n }, {b n } be sequences and let f() {a n }, g() {b n }. Then { ( ) } f()g() n a k b n k. k Proof. By definition, f() f()g() ( a n n! n ( a n n! n and g() ) ( b n n! n n!a k b n k k!(n k)! ) ) ( n n! b n n! n. Hence ( a k b n k k!(n k)! ( n k ) n )a k b n k ) n n!, and { this series is clearly the eponential generating function of the sequence ( ) } n a k b n k k. 5

Eample. Bell numbers (Wilf, p. 42, Eample 2). Let b n be the number of ways of partitioning the set {, 2,..., n} into subsets (the order of the subsets does not matter). We set b 0. For eample, if n 3 there are the following possibilities: {, 2, 3}; {, 2}, {3}; {, 3}, {2}; {2, 3}, {}; {}, {2}, {3}. Hence b 3 5. What is the eponential generating function B() of {b n }? First we need to find a recurrence relation. Let s consider a partition of the set {, 2,..., n, n + }. Let r be the number of elements containing of the subset containing n +. Then there are ( r ) elements other than n + n in this subset, they can be chosen in ways. The other n + r r numbers can be partitioned in b n+ r ways. Knowing the r numbers in the same subset as n + and the partition of the other n + r numbers, we can reconstruct uniquely the partition of {, 2,..., n, n + }. ( Therefore ) for n a fied r, the number of partitions of {, 2,..., n, n + } is b n+ r. r r can take any integer between and n +, inclusive, so get the recurrence relation n+ ( ) n b n+ b n+ r. r r If we let k n + r, then by using the fact that ( ) n, we can re-write this as r b n+ ( ) n b k. k ( ) ( n k n n + r ) Let B() {b n }. Then {b n+ } B () by Theorem 2. (ii). We ( ) n can write the right-hand side as b k, so we can apply Theorem 2.2 k with {b n } and {} to deduce that the eponential generating function of the right-hand side is B()e. Hence we obtain an ordinary differential equation for B(), which is variable separable and can be solved easily. B () B()e B () B() e 6

B () B() d e d log B() e + C B() C 2 e e B(0) b 0, therefore C 2 e and B() e e. Unfortunately, there is no closed form epression for b n, but see question 5 on problem sheet 7 for a formula for b n as an infinite sum. 2.2 Dirichlet series Definition. The Dirichlet series of a sequence {a n } n is the series f() a n Ds. Notation: f() {a n n } n. n Warning: The Dirichlet series is not a power series, but it is still true that the sequence {a n } n is uniquely determined by its Dirichlet series. If a Dirichlet series converges, its region of convergence is either the whole of R or a half-line > 0 or 0 in the real numbers, in the comple numbers it will be either the whole of C or the union of a half plane Re > 0 and a subset of the line Re 0 for some real number 0. Eamples.. {} Ds n ζ(), this is the famous Riemann ζ- n n function. (See http://en.wikipedia.org/wiki/riemann_zeta for properties of the Riemann ζ-function and the Riemann hypothesis, or attend MATH3022 Analytic number theory in the 2nd semester.) Ds 2. {n} n n n n n ζ( ). n Theorem 2.3 (Product formula, Wilf, p. 57, Rule ) Let {a n } n, {b n } n be sequences and let f() Ds {a n } n, g() Ds {b n } n. Then f()g() Ds a d b n/d. d, d n a n Proof. f() n and g() b n by definition. In the region where n n n they both converge absolutely, we can multiply them together every term by 7 n

every term and rearrange the terms any way we like. In the product we get terms with n in denominator from multiplying a d d and b n/d (n/d) dividing n, therefore the coefficient of in f()g() is n d, d n for some d a d b n/d. Eample. Let σ(n) be the sum of the divisors of n, including and n, e. g., σ(6) + 2 + 3 + 6 2. What is the Dirichlet series of σ(n)? σ(n) d d. We can apply Theorem 2.3 with a n n and b n d n d n to deduce that {σ(n)} Ds n ζ( )ζ(), since {n} Ds n ζ( ) and Ds ζ(). {} n 8

3 The Sieve Formula (Wilf, section 4.2) Eample. MATH00 Problem Sheet 4, Question 8 (http://www.maths. manchester.ac.uk/~nige/00probs4.pdf): Each of a collection of 44 tiles is either triangular or square, either red or blue, and either wooden or plastic. There are 68 wooden tiles, 69 red tiles, 75 triangular tiles, 36 red wooden tiles, 40 triangular wooden tiles, 38 red triangular tiles, and 23 red wooden triangular tiles. Use the inclusioneclusion principle to compute the number of blue plastic square tiles. We shall set up a model to solve this type of problems efficiently by using generating function methods and we shall also obtain the usual sieve formula or inclusion-eclusion formula as a special case. General setup and notation: Let Ω be a finite set and A, A 2,..., A n subsets of Ω. For any I {, 2,..., n}, let A I A i, where A Ω. For r i I 0,,..., n, let N r A I. Let e t be the number of elements of Ω which I r are contained in eactly t of the sets A, A 2,..., A n. Let N() and let E() e t t. t0 N r r, Theorem 3. (Sieve formula, Wilf 4.2.5 and 4.2.7) E() N( ) and ( ) r e t ( ) r t N r for 0 t n. t rt Proof. Consider an element ω Ω( which ) is contained in eactly t of the t subsets A, A 2,..., A n. There are ways of choosing r of the t subsets r ( ) t which contain ω, therefore it will be counted times in N r, so N r r ( ) t e t. Therefore r tr N() N r r r0 r0 tr ( ) t e t r r t0 e t t r0 ( ) t r r r0 e t (+) t E(+). t0 9

Hence E() N( ), and so E() N( ) N r ( ) r r0 r0 N r r t0 ( ) r t ( ) r t t As the coefficient of t in E() is e t, we obtain the required formula for e t. Eamples. Let Ω be the set of tiles, A the set of wooden tiles, A 2 the set of red tiles and A 3 the set of triangular tiles. Then with the standard notation, N 0 44, N 68 + 69 + 75 22, N 2 36 + 40 + 38 4 and N 3 23, and the number we want to calculate is e 0. By Theorem 3., e o N 0 N + N 2 N 3 44 22 + 4 23 23. 2. In general, the theorem gives the formula ( ) r e 0 ( ) r 0 N r ( ) r N r N 0 N + N 2... + ( ) n N n, 0 r0 r0 therefore the number of elements of Ω contained in at least one of the sets A, A 2,..., A n is Ω e 0 N 0 e 0 N N 2 +... + ( ) n N n, which is the formula usually called sieve formula or inclusion-eclusion formula. 3. Counting derangements and permutations with a given number of fied points ((Wilf, p. 3, Eample ). Let Ω be the set of all permutations of {, 2,..., n}, let A i {σ Ω σ(i) i}. Then for any I {, 2,..., n}, A( I ) {σ Ω σ(i) i i I}, so( A I ) (n r)!, where r I. There are n n choices for I, therefore N r (n r)! n!. By Theorem 3., the r r r! number of permutations with eactly t fied points is ( ) r e t ( ) r t N r t rt n! t! rt rt ( ) r t (r t)! n! n t t! ( ) r t r! (r t)!t! ( ) k. k! If t 0, we obtain the number of derangements of {, 2,..., n}, e 0 ( ) k n!, cf. (2.). k! t!e t We can also deduce that for a fied t, lim e, and n n! ( ) k n ( ) k e 0 e n! n! n! ( )n ( ) n. k! k! n! n! r! t0 t rt ( ) r ( ) r t N r. t 20

4 Generating functions in two variables (Wilf, sections.5.6 and 3.4 3.7) Definition. Let a(n, m) (n, m 0) be a function of two integer variables. The 2-variable generating function of a(n, m) is F (, y) a(n, m) n y m. m0 There are also two sequences of -variable ordinary power series generating functions, G n (y) a(n, m)y m for each n, n 0, and H m () m0 a(n, m) n for each m, m 0. Clearly, F (, y) G n (y) n Eamples. (Wilf, section.5) Let a(n, m) H m ()y m. m0 ( ) n, then it satisfies m a(n, m) a(n, m ) + a(n, m) (4.) unless n m 0. (If n < 0 or m < 0, we set a(n, m) 0.) We shall use this recurrence relation to calculate the 2-variable generating function of a(n, m). Let s fi n and calculate G n (y). By multiplying (4.) by y m and summing over m we obtain a(n, m)y m m0 a(n, m )y m + m0 a(n, m)y m The left-hand side is G n (y) and the second term on the right-hand side is G n (y). The first term on the right-hand side is a(n, m )y m y m0 y m a(n, m )y m m0 a(n, m)y m y a(n, m)y m yg n (y), m0 therefore G n (y) yg n (y) + G n (y) (y + )G n (y). 2

Now G 0 (y) hence and F (, y) a(0, m)y m, since a(0, 0) and a(0, m) 0 if m > 0, m0 G n (y) n G n (y) (y + ) n (y + ) n n (y + ) n m y. Alternatively, we can prove that H m () (see question 3 on ( ) m+ problem sheet 8) and use this to calculate F (, y). In this case it is also possible to give a direct proof that F (, y) y without using G n or H m, but this is an eception. 2. (Wilf, section.6) Let b(n, m) the number of ways of partitioning {, 2,..., n} into eactly m subsets (b(0, 0) 0, b(n, m) 0 if m < 0 or n < 0). These numbers are called the Stirling numbers of the 2nd kind. Given a partition of {, 2,..., n} into m subsets, if n is in a subset on its own, by omitting it we obtain a a partitioning of {, 2,..., n } into m subsets, if n is in a subset of at least 2 elements, by omitting it we obtain a a partitioning of {, 2,..., n } into m subsets and n can be added to any of the m subsets, therefore b(n, m) b(n, m ) + mb(n, m) for n. Let s fi n and let s try to calculate G n (y). By multiplying the recurrence relation by y m and summing over m we obtain b(n, m)y m m0 b(n, m )y m + m0 mb(n, m)y m The left-hand side is G n (y), the first term on the right-hand side is yg n (y) just like in the previous eample and mb(n, m)ym yg n (y) by Theorem. (iii), hence G n (y) yg n (y) + yg n (y). G 0 (y) b(0, m)y m, since b(0, 0) and b(0, m) 0 if m > 0, m0 ( ( therefore G n (y) y + d )) n (). This can be used to calculate G n (y) for dy 22

any particular n, for eample, G (y) y, G 2 (y) y 2 +y, G 3 (y) y 3 +3y 2 +y, G 4 (y) y 4 +6y 3 +7y 2 +y, it does but this does not give an eplicit epression for G n (y), F (, y) or b(n, m). There is a connection with the eponential generating function of powers of n, {n k } G k ()e, because the polynomials occurring in the eponential generating function of n k satisfy eactly the same recurrence relation. 4. Cards, decks and hands: the unrestricted problem (Wilf, 3.4 3.7) Definition. A family F is a set of objects called cards. The weight is a function w : F Z + associating a positive integer to each card. (In applications the weight is usually a measure of size or value.) A deck is a set of cards of the same weight, D r { w() r} is the set of cards of weight r for each positive integer r, and d r D r is the number of cards of weight r. We shall assume that d r is finite for each r, but F may be infinite. A hand is a finite collection of cards with possible repetitions, so the same card may be used several times. The weight of a hand is the sum of the weights of the cards in it. h(n, k) is the number of hands of weight n consisting of k cards. h(n) h(n, k) is the total number of hands of weight n. The 2-variable hand enumerator of F is H(, y) h(n, k) n y k, and the -variable hand enumerator is H() h(n) n H(, ). Note: Wilf uses prefab instead of family in this contet and reserves the term family for the labelled cards used in the rest of Chapter 4. Lemma 4. (Wilf, p. 93, Fundamental lemma of unlabelled counting) Let F and F 2 be disjoint families of cards with 2-variable hand enumerators H (, y) and H 2 (, y), respectively. Let F F F 2 and let H(, y) be its 2-variable hand enumerator. Then H(, y) H (, y)h 2 (, y). 23

Proof. Key idea: Given a hand of weight n consisting of k cards from F and a hand of weight n 2 consisting of k 2 cards from F 2, their union is a hand of weight n + n 2 consisting of k + k 2 cards from F. Conversely, any hand of weight n consisting of k cards from F can be split uniquely into the union of a hand containing cards from F and a hand containing cards from F 2, and if these hands have parameters n, k and n 2, k 2, respectively, then n n + n 2 and k k + k 2. Therefore h(n, k) h(n, k )h(n 2, k 2 ). Hence H(, y) n +n 2 n k +k 2 k n 0,n 2 0 k 0,k 2 0 h(n, k) n y k n +n 2 n k +k 2 k n 0,n 2 0 k 0,k 2 0 n +n 2 n k +k 2 k n 0,n 2 0 k 0,k 2 0 n 0 k 0 h(n, k ) n y k H (, y)h 2 (, y). h(n, k )h(n 2, k 2 ) n y k h(n, k ) n y k h(n 2, k 2 ) n 2 y k 2 n 2 0 k 2 0 h(n 2, k 2 ) n 2 y k 2 Theorem 4.2 (Wilf, Theorem 3.4.) Let F be a family of cards and let d r be the number of cards of weight r in F, as usual. Then the hand enumerators of F are H(, y) r ( r y) dr and H() r ( r ) dr. Proof. It is sufficient to prove the theorem for the 2-variable hand enumerator H(, y), by substituting y into it we obtain the formula for the -variable hand enumerator H(). The proof consists of three steps, proving the theorem gradually for more and more general cases. Step. Assume that F consists of a single card of weight s. Then d s 24

and d r 0 for r s. The only possibly hand of k cards consists of k copies of the only card and therefore has weight ks, so { if n ks, h(n, k) 0 otherwise. Hence H(, y) ks y k ( s y) k s y. Step 2. Assume that F is finite. We shall use induction on q F. If q 0, then F, h(0, 0) and h(n, k) 0 if (n, k) (0, 0), so H(, y). d r 0 for all r, therefore, too, so the ( r dr y) r theorem holds in this case. Let now q and let s assume that the theorem holds for families consisting of q cards. Let F be a family consisting of q cards. Let s choose an arbitrary card from F, let F be the family consisting of this single card and let F 2 be the family consisting of all the other cards in F. Let s be the weight of the chosen card, and let d s d s and d r d r if r s. d r is eactly the number of cards of weight r in F 2. By Step, the 2-variable hand enumerator of F is s y. F 2 contains q cards, so by the induction hypothesis, its hand enumerator is. ( r y) d r r Hence by Lemma 4., the 2 variable hand enumerator of F F F 2 is s y r ( r y) d r r ( r y) dr, since d s d s and d r d r if r s. Therefore the theorem holds for families consisting of q cards and by induction, it holds for all finite families. Step 3. Now F can be arbitrary, possibly infinite. Let s fi n and k. A hand of weight n can only contain cards of weight at most n, therefore h(n, k) is the coefficient of n y k in the power series epansion of the 2-variable hand n enumerator of D D 2... D n, which is by Step 2. ( r dr y) rn+ ( r y) dr has constant term, all the other terms have degree at least n + in, therefore h(n, k) is also equal to the coefficient of n y k in 25 r

the power series epansion of n ( r y) dr r rn+ ( r y) dr ( r y). dr r As this is true for all n, k, we have H(, y), as claimed. As ( r dr y) r we remarked at the beginning, the result for the -variable hand enumerator follows by substituting y. Eamples: See pages 4 of http://www.maths.manchester.ac.uk/~gm/ teaching/math3900/cards.pdf and http://www.maths.manchester.ac. uk/~gm/teaching/math3900/ecursion_ticket.pdf. 4.2 Cards, decks and hands: the restricted problem The family, cards, weight and decks are defined as before, but now there is a set of non-negative integers W such that 0 W and the multiplicity of each card in a hand must be an element of W. Let h(n, k) be the the number of hands of weight n consisting of k cards which satisfy the restriction on the multiplicities and let h(n) h(n, k) be the total number of hands of weight n satisfying the restriction. The restricted 2-variable hand enumerator of F is H(, y) h(n, k) n y k, and the restricted -variable hand enumerator is H() h(n) n H(, ). Theorem 4.3 (Not eaminable) (Wilf, Theorem 3.4.2) Let F be a family of cards and let d r be the number of cards of weight r in F, as usual. Let W be a subset of non-negative integers containing 0. Then the restricted hand enumerators of F are ( ) dr ( ) dr H(, y) ( r y) m and H() mr. r m W 26 r m W

Sketch of proof. Prove the analogue of Lemma 4. for the restricted case and then follow the steps of the proof of Theorem 4.2. Note that for a family consisting of a single card of weight s in Step, H(, y) ( s y) m by m W direct calculation. Remarks.. If W Z 0, m W( r y) m ( r y) m r y and mr m0 m W mr, so we obtain Theorem 4.2 as a special case. r m0 2. If the restriction is that each card can be used at most l times for a fied l, then W {0,, 2,..., l} and m W( l l y) m ( r y) m (r y) l+. r y Eamples: See pages 5 6 of http://www.maths.manchester.ac.uk/~gm/ teaching/math3900/cards.pdf. m0 27

5 The Snake Oil Method (Wilf, section 4.3) Summary of the method. Identify the free variable, say n, if there are several free variables, choose one and fi the others. Call the sum a n. 2. Write down the ordinary power series generating function of a n, which will be a double sum. 3. Interchange the order of summation, paying attention to the limits. 4. Evaluate the inner sum over n in a closed form. 5. Evaluate the whole sum in a closed form and identify the coefficient of n, which will be a n. The success of the method depends on the ability to carry out steps 4 and 5, for which of a good knowledge of standard power series is necessary. Eamples: See Eamples, 2, 4 and 6 in section 4.3 of Wilf s book. 28