Week 9-10: Recurrence Relations and Generating Functions

Similar documents
Generating Functions (Revised Edition)

ELEMENTARY LINEAR ALGEBRA

Partition of Integers into Distinct Summands with Upper Bounds. Partition of Integers into Even Summands. An Example

3. Vector spaces 3.1 Linear dependence and independence 3.2 Basis and dimension. 5. Extreme points and basic feasible solutions

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

{ 0! = 1 n! = n(n 1)!, n 1. n! =

ELEMENTARY LINEAR ALGEBRA

A matrix over a field F is a rectangular array of elements from F. The symbol

1 Sequences and Summation

Introduction to Combinatorial Mathematics

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

ax 2 + bx + c = 0 where

Generating Functions

ELEMENTARY LINEAR ALGEBRA

Advanced Counting Techniques. Chapter 8

Moreover this binary operation satisfies the following properties

Exercise Solutions to Functional Analysis

Generating Functions

Advanced Counting Techniques

Linear Systems and Matrices

1. General Vector Spaces

What you learned in Math 28. Rosa C. Orellana

ARCS IN FINITE PROJECTIVE SPACES. Basic objects and definitions

Chapter 1. Sets and Numbers

DETERMINANTS. , x 2 = a 11b 2 a 21 b 1

Chapter 2 - Basics Structures

Examples of Finite Sequences (finite terms) Examples of Infinite Sequences (infinite terms)

COMBINATORIAL COUNTING

Equality: Two matrices A and B are equal, i.e., A = B if A and B have the same order and the entries of A and B are the same.

Algorithmic Approach to Counting of Certain Types m-ary Partitions

Algebraic Methods in Combinatorics

Test Codes : MIA (Objective Type) and MIB (Short Answer Type) 2007

PUTNAM TRAINING PROBLEMS

Review of Linear Algebra

PUTNAM PROBLEMS SEQUENCES, SERIES AND RECURRENCES. Notes

. As the binomial coefficients are integers we have that. 2 n(n 1).

PUTNAM TRAINING MATHEMATICAL INDUCTION. Exercises

SUMS PROBLEM COMPETITION, 2000

Binomial Coefficient Identities/Complements

COM S 330 Lecture Notes Week of Feb 9 13

2016 EF Exam Texas A&M High School Students Contest Solutions October 22, 2016

Analysis-3 lecture schemes

IB Mathematics HL Year 2 Unit 11: Completion of Algebra (Core Topic 1)

Generating Functions

Discrete Mathematics -- Chapter 10: Recurrence Relations

Chapter 9: Systems of Equations and Inequalities

Notes on generating functions in automata theory

ELEMENTARY LINEAR ALGEBRA

1 Matrices and Systems of Linear Equations. a 1n a 2n

) = nlog b ( m) ( m) log b ( ) ( ) = log a b ( ) Algebra 2 (1) Semester 2. Exponents and Logarithmic Functions

Chapter Summary. Mathematical Induction Strong Induction Well-Ordering Recursive Definitions Structural Induction Recursive Algorithms

AS PURE MATHS REVISION NOTES

CHINO VALLEY UNIFIED SCHOOL DISTRICT INSTRUCTIONAL GUIDE ALGEBRA II

Discrete Structures Homework 1

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2

MATH 304 Linear Algebra Lecture 10: Linear independence. Wronskian.

Applications. More Counting Problems. Complexity of Algorithms

Course 311: Michaelmas Term 2005 Part III: Topics in Commutative Algebra

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

Some Review Problems for Exam 2: Solutions

Week 15-16: Combinatorial Design

Algebraic Methods in Combinatorics

DS-GA 1002 Lecture notes 0 Fall Linear Algebra. These notes provide a review of basic concepts in linear algebra.

Induction and Recursion

1 Basic Combinatorics

Mathathon Round 1 (2 points each)

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

Fall 2017 Test II review problems

ACI-matrices all of whose completions have the same rank

Fundamentals of Engineering Analysis (650163)

Basic counting techniques. Periklis A. Papakonstantinou Rutgers Business School

Introduction to Real Analysis Alternative Chapter 1

IVA S STUDY GUIDE FOR THE DISCRETE FINAL EXAM - SELECTED SOLUTIONS. 1. Combinatorics

MATH 117 LECTURE NOTES

Chapter 4 - MATRIX ALGEBRA. ... a 2j... a 2n. a i1 a i2... a ij... a in

Notes on the Matrix-Tree theorem and Cayley s tree enumerator

Instructions. 2. Four possible answers are provided for each question and only one of these is correct.

Linear Algebra M1 - FIB. Contents: 5. Matrices, systems of linear equations and determinants 6. Vector space 7. Linear maps 8.

EXAMPLES OF PROOFS BY INDUCTION

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

Climbing an Infinite Ladder

Chapter Generating Functions

PUTNAM TRAINING EASY PUTNAM PROBLEMS

Real Analysis Math 131AH Rudin, Chapter #1. Dominique Abdi

Math 3108: Linear Algebra

Linear Algebra March 16, 2019

Sydney University Mathematical Society Problems Competition Solutions.

correlated to the Washington D.C. Public Schools Learning Standards Algebra II

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

Solution. That ϕ W is a linear map W W follows from the definition of subspace. The map ϕ is ϕ(v + W ) = ϕ(v) + W, which is well-defined since

12.1 Arithmetic Progression Geometric Progression General things about sequences

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

CSCE 222 Discrete Structures for Computing. Dr. Hyunyoung Lee

1 Matrices and Systems of Linear Equations

Induction and recursion. Chapter 5

MAT 570 REAL ANALYSIS LECTURE NOTES. Contents. 1. Sets Functions Countability Axiom of choice Equivalence relations 9

EIGENVALUES AND EIGENVECTORS 3

Generating Functions of Partitions

N E W S A N D L E T T E R S

Chapter 1 Vector Spaces

Transcription:

Week 9-10: Recurrence Relations and Generating Functions April 3, 2017 1 Some number sequences An infinite sequence (or just a sequence for short is an ordered array a 0, a 1, a 2,..., a n,... of countably many real or complex numbers, and is usually abbreviated as (a n ; n 0 or just (a n. A sequence (a n can be viewed as a function f from the set of nonnegative integers to the set of real or complex numbers, i.e., f(n a n, n 0, 1, 2,... We call a sequence (a n an arithmetic sequence if it is of the form a 0, a 0 + q, a 0 + 2q,..., a 0 + nq,... The general term of such sequences satisfies the recurrence relation a n a n 1 + q, n 1. A sequence (a n is called a geometric sequence if it is of the form a 0, a 0 q, a 0 q 2,..., a 0 q n,... The general term of such sequences satisfies the recurrence relation a n qa n 1, n 1. 1

The partial sums of a sequence (a n are the summations: s 0 a 0, s 1 a 0 + a 1, s 2 a 0 + a 1 + a 2,. s n a 0 + a 1 + + a n,. The partial sums form a new sequence (s n ; n 0. For an arithmetic sequence a n a 0 + nq (n 0, we have the partial sum s n n (a 0 + kq (n + 1a 0 + k0 qn(n + 1. 2 For a geometric sequence a n a 0 q n (n 1, we have { n q n+1 1 s n a 0 q n q 1 a 0 if q 1 (n + 1a 0 if q 1. k0 Example 1.1. Determine the sequence a n, defined as the number of regions which are created by n mutually overlapping circles in general position on the plane. (By mutually overlapping we mean that each pair of two circles intersect in two distinct points. Thus non-intersecting or tangent circles are not allowed. By general position we mean that there are no three circles through a common point. We easily see that the first few numbers are given as a 0 1, a 1 2, a 2 4, a 3 8. It seems that we might have a 4 16. However, by try-and-error we quickly see that a 4 14. Assume that there are n circles in general position on a plane. When we take one circle away, say the nth circle, there are n 1 circles in general position on the same plane. By induction hypothesis the n 1 circles divide the plane 2

into a n 1 regions. Note that the nth circle intersects each of the n 1 circles in 2(n 1 distinct points. Let the 2(n 1 points on the nth circle be ordered clockwise as P 1, P 2,..., P 2(n 1. Then each of the 2(n 1 arcs P 1 P 2, P 2 P 3, P 3 P 4,..., P 2(n 2+1 P 2(n 1, P 2(n 1 P 1 intersects one and only one region in the case n 1 circles and separate the region into two regions. There are 2(n 1 more regions produced when the nth circle is drawn. We thus obtain the recurrence relation a n a n 1 + 2(n 1, n 2. Repeating the recurrence relation we have a n a n 1 + 2(n 1 a n 2 + 2(n 1 + 2(n 2 a n 3 + 2(n 1 + 2(n 2 + 2(n 3. a 1 + 2(n 1 + 2(n 2 + 2(n 3 + + 2 (n 1n a 1 + 2 2 2 + n(n 1 n 2 n + 2, n 2. This formula is also valid for n 1 (since a 1 2, although it doesn t hold for n 0 (since a 0 1. Example 1.2 (Fibonacci Sequence. A pair of newly born rabbits of opposite sexes is placed in an enclosure at the beginning of a year. Baby rabbits need one moth to grow mature; they become an adult pair on the first day of the second month. Beginning with the second month the female is pregnant, and gives exactly one birth of one pair of rabbits of opposite sexes on the first day of the third month, and gives exactly one such birth on the first day of each next month. Each new pair also gives such birth to a pair of rabbits on the first day of each month starting from the third month (from its birth. Find the number of pairs of rabbits in the enclosure after one year? 3

Let f n denote the number of pairs of rabbits on the first day of the nth month. Some of these pairs are adult and some are babies. We denote by a n the number of pairs of adult rabbits and denote by b n the number of pairs of baby rabbits on the day of the nth month. Then the total number of pairs of rabbits on the first day of the nth month is f n a n + b n, n 1. n 1 2 3 4 5 6 7 8 9 10 11 12 13 a n 0 1 1 2 3 5 8 13 21 34 55 89 144 b n 1 0 1 1 2 3 5 8 13 21 34 55 89 f n 1 1 2 3 5 8 13 21 34 55 89 144 233 If a pair is adult on the first day of the nth month, then it gives one birth of one pair on the first day of the next month. So b n+1 a n, n 1. Note that each adult pair on the first day of the nth month is still an adult pair on first day of the next month and each baby pair on the first day of the nth month becomes an adult pair on the first day of the next month, we have a n+1 a n + b n f n, n 1. Thus f n a n + b n f n 1 + a n 1 f n 1 + f n 2, n 3. Let us define f 0 0. The sequence f 0, f 1, f 2, f 3,... satisfying the recurrence relation f n f n 1 + f n 2, n 2 f 0 0 (1 f 1 1 is known as the Fibonacci sequence, and its terms are known as Fibonacci numbers. Example 1.3. The partial sum of Fibonacci sequence is s n f 0 + f 1 + f 2 + + f n f n+2 1. (2 This can be verified by induction on n. For n 0, we have s 0 f 2 1 0. Now for n 1, we assume that it is true for n 1, i.e., s n 1 f n+1 1. Then s n f 0 + f 1 + + f n s n 1 + f n f n+1 1 + f n (by the induction hypothesis f n+2 1. (by the Fibonacci recurrence 4

Example 1.4. The Fibonacci number f n is even if and only if n is a multiple of 3. Note that f 1 f 2 1 is odd and f 3 2 is even. Assume that f 3k is even, f 3k 2 and f 3k 1 are odd. Then f 3k+1 f 3k + f 3k 1 is odd (even + odd odd, and subsequently, f 3k+2 f 3k+1 +f 3k is also odd (odd+even odd. It follows that f 3(k+1 f 3k+2 + f 3k+1 is even (odd + odd even. Theorem 1.1. The general term of the Fibonacci sequence (f n is given by ( f n 1 1 + n ( 5 1 1 n 5, n 0. (3 5 2 5 2 Example 1.5. Determine the number h n of ways to perfectly cover a 2-by-n board with dominoes. (Symmetries are not counted in counting the number of coverings. We assume h 0 1 since a 2-by-0 board is empty and it has exactly one perfect cover, namely, the empty cover. Note that the first few terms can be easily obtained such as h 0 1, h 1 1, h 2 2, h 3 3, h 4 5. Now for n 3, the 2-by-n board can be covered by dominoes in two types: 1 2 n 1 n 1 2 n 2 n There are h n 1 ways in the first type and h n 2 ways in the second type. Thus h n h n 1 + h n 2, n 2. Therefore the sequence (h n ; n 0 is the Fibonacci sequence (f n ; n 0 with f 0 0 deleted, i.e., h n f n+1, n 0. Example 1.6. Determine the number b n of ways to perfectly cover a 1-by-n board by dominoes and monominoes. 5

b n b n 1 + b n 2, b 0 b 1 1, b 2 2. Theorem 1.2. The Fibonacci number f n can be written as Proof. Let g 0 0 and f n g n n 1 2 k0 n 1 2 k0 ( n k 1, n 0. k ( n k 1, n 1. k Note that k > ( n 1 2 is equivalent to k > n k 1. Since m p integers m and p such that p > m, we may write g n as g n n 1 k0 ( n k 1, n 1. k 0 for any To prove the theorem, it suffices to show that the sequence (g n satisfies the Fibonacci recurrence relation with the same initial values. In fact, g 0 0, 6

g 1 ( 0 0 1, and for n 0, n ( n k n 1 ( n k 1 g n+1 + g n + k k k0 k0 ( n n ( n k n ( n k + + 0 k k 1 k1 k1 ( n n [( ( ] n k n k + + 0 k k 1 k1 ( n n ( n k + 1 + (By the Pascal formula 0 k k1 ( n + 1 n ( ( n k + 1 0 + + 0 k n + 1 k1 n+1 ( (n + 2 k 1 g n+2. k k0 We conclude that the sequence (g n is the Fibonacci sequence (f n. 2 Linear recurrence relations Definition 2.1. A sequence (x n ; n 0 of numbers is said to satisfy a linear recurrence relation of order k if x n α 1 (nx n 1 +α 2 (nx n 2 + +α k (nx n k +β n, α k (n 0, n k, (4 where the coefficients α 1 (n, α 2 (n,..., α k (n and β n are functions of n. The linear recurrence relation (4 is said to be homogeneous if β n 0 for all n k, and is said to have constant coefficients if α 1 (n, α 2 (n,..., α k (n are constants. The recurrence relation x n α 1 (nx n 1 + α 2 (nx n 2 + + α k (nx n k, α k (n 0, n k (5 is called the corresponding homogeneous linear recurrence relation of (4. 7

A solution of the recurrence relation (4 is a sequence (u n satisfying (4. The general solution of (4 is a solution x n u n (c 1, c 2,..., c k (6 with some parameters c 1, c 2,..., c k, provided that for arbitrary initial values u 0, u 1,..., u k 1 there exist constants c 1, c 2,..., c k such that (6 is the unique sequence satisfying both the recurrence relation (4 and the initial conditions. Let S denote the set of all sequences (a n ; n 0. Then S is an infinitedimensional vector space under the ordinary addition and scalar multiplication of sequences. Let N k be the set all solutions of the nonhomogeneous linear recurrence relation (4, and H k the set of all solutions of the homogeneous linear recurrence relation (5. We shall see that H k is a k-dimensional subspace of S, and N k a k-dimensional affine subspace of S. Theorem 2.2. (Structure Theorem for Linear Recurrence Relations (a The solution space H k is a k-dimensional subspace of the vector space S of sequences. Thus, if (a n,1, (a n,2,..., (a n,k are linearly independent solutions of the homogeneous linear recurrence relation (5, then the general solution of (5 is x n c 1 a n,1 + c 2 a n,2 + + c k a n,k, n 0, where c 1, c 2,..., c k are arbitrary constants. (b Let (a n be a particular solution of the nonhomogeneous linear recurrence relation (4. Then the general solution of (4 is x n a n + h n, n 0, where (h n is the general solution of the corresponding homogeneous linear recurrence relation (5. In other words, N k is a translate of H k in S, i.e., N k (a n + H k. Proof. (a To show that H k is a vector subspace of S, we need to show that H k is closed under the addition and scalar multiplication of sequences. Let (a n 8

and (b n be solutions of (5. Then For scalars c, a n + b n [α 1 (na n 1 + α 2 (na n 2 + + α k (na n k ] +[α 1 (nb n 1 + α 2 (nb n 2 + + α k (nb n k ] α 1 (n(a n 1 + b n 1 + α 2 (n(a n 2 + b n 2 + + α k (n(a n k + b n k, n k. ca n c[α 1 (na n 1 + α 2 (na n 2 + + α k (na n k ] α 1 (nca n 1 + α 2 (nca n 2 + + α k (nca n k, n k. This means that H k is closed under the addition and scalar multiplication of sequences. To show that H k is k-dimensional, consider the projection π : S R k, defined by π(x 0, x 1, x 2,... (x 0, x 1,..., x k 1. We shall see that the restriction π H k : H k R k is a linear isomorphism. For each (a 0, a 1,..., a k 1 R k, define a n inductively by a n α 1 (na n 1 + α 2 (na n 2 + + α k (na n k, n k. Obviously, we have π(a 0, a 1, a 2,... (a 0, a 1,..., a k 1. This means that π H k is surjective. Now let (u n H k be such that π(u 0, u 1, u 2,... (0, 0,..., 0, i.e., u 0 u 1 u k 1 0. Applying the recurrence relation (5 for n k, we have u k 0. Again applying (5 for n k + 1, we obtain u k+1 0. Continuing to apply (5, we have u n 0 for n k. Thus (u n is the zero sequence. This means that π is injective. We have finished the proof that π H k is a linear isomorphism from H k onto R k. So dim H k k. (b For each solution (v n of (4, we claim that the sequence h n : v n u n (n 0 is a solution of (5. So v n u n + h n, n 0. 9

In fact, since (u n and (v n are solutions of (4, applying the recurrence relation (4, we have h n [α 1 (nv n 1 + α 2 (nv n 2 + + α k (nv n k + β n ] [α 1 (nu n 1 + α 2 (nu n 2 + + α k (nu n k + β n ] α 1 (n(v n 1 u n 1 + α 2 (n(v n 2 u n 2 + + α k (n(v n k u n k α 1 (nh n 1 + α 2 (nh n 2 + + α k (nh n k, n k. This means that (h n is a solution of (5. Conversely, for any solution (h n of (5, we have u n + h n [α 1 (nu n 1 + α 2 (nu n 2 + + α k (nu n k + β n ] +[α 1 (nh n 1 + α 2 (nh n 2 + + α k (nh n k ] α 1 (n(u n 1 + h n 1 + α 2 (n(u n 2 + h n 2 + + α k (n(u n k + h n k + β n for n k. This means that the sequence (u n + h n is a solution of (4. Definition 2.3. The Wronskian W k (n of k solutions (u n,1, (u n,2,..., (u n,k of the homogeneous linear recurrence relation (5 is the determinant u n,1 u n,2 u n,k u W k (n det n+1,1 u n+1,2 u n+1,k..., n 0. u n+k 1,1 u n+k 1,2 u n+j 1,k The Wronskian of (u n,1, (u n,2,..., (u n,k is also an infinite sequence (W k (n; n 0. Theorem 2.4. The solutions (u n,1, (u n,2,..., (u n,k of the homogeneous linear recurrence relation (5 are linearly independent if and only if there is a nonnegative integer n 0 such that the Wronskian W k (n 0 0. In other words, the solutions (u n,1, (u n,2,..., (u n,k are linearly dependent if and only if W k (n 0 for all n 0. 10

Proof. We show that the sequences (u n,1, (u n,2,..., (u n,k are linearly dependent if and only if W k (n 0 for all n 0. If (u n,1, (u n,2,..., (u n,k are linearly dependent, then for n 0 the columns of the matrix u n,1 u n,2 u n,k u n+1,1 u n+1,2 u n+1,k... u n+k 1,1 u n+k 1,2 u n+j 1,k are linearly dependent because the columns are part of the sequences (u n,1, (u n,2,..., (u n,k respectively. It follows from linear algebra that the determinant of the matrix is zero, i.e., the Wronskian W k (n 0 for all n 0. Conversely, if W k (n 0 for all n 0, in particular, W k (0 0, then there are constants c 1, c 2,..., c k, not all zero, such that c j u i,j c 1 u i,1 + c 2 u i,2 + + c k u i,k 0, 0 i k 1. j1 We claim that k j1 c ju n,j 0 for all n by induction. Assume it is true for n m 1. Applying the recurrence relation (5 to the sequences (u m,1, (u m,2,..., (u m,k, we have c j u m,j c j α i (ku m i,j j1 j1 α i (k c j u m i,j 0. This means that the sequences (u n,1, (u n,2,..., (u n,k are linearly dependent. j1 3 Homogeneous linear recurrence relations with constant coefficients In this section we only consider linear recurrence relations of the form x n α 1 x n 1 + α 2 x n 2 + + α k x n k, α k 0, n k, (7 11

where α 1, α 2,..., α k are constants. We call this kinds of recurrence relations as homogeneous linear recurrence relations of order k with constant coefficients. Sometimes it is convenient to write (7 as of the form α 0 x n + α 1 x n 1 + + α k x n k 0, n k (8 where α 0 0 and α k 0. The following polynomial equation α 0 t k + α 1 t k 1 + + α k 1 t + α k 0, (9 is called the characteristic equation associated with the recurrence relation (8, and the polynomial on the left side of (9 is called the characteristic polynomial. Example 3.1. The Fibonacci sequence (f n ; n 0 satisfies the linear recurrence relation f n f n 1 + f n 2, n 2 of order 2 with α 1 α 2 1 in (7. Example 3.2. The geometric sequence (x n ; n 0, where x n q n, satisfies the linear recurrence relation of order 1 with α 1 q in (7. x n qx n 1, n 1 It is quite heuristic that solutions of the first order homogeneous linear recurrence relations are geometric sequences. This hints that the recurrence relation (7 may have solutions of the form x n q n. The following theorem confirms the speculation. Theorem 3.1. (a For any number q 0, the geometric sequence x n q n is a solution of the kth order homogeneous linear recurrence relation (8 with constant coefficients if and only if the number q is a root of the characteristic equation (9. (b If the characteristic equation (9 has k distinct roots q 1, q 2,..., q k, then the general solution of (8 is x n c 1 q n 1 + c 2 q n 2 + + c k q n k, n 0. (10 12

Proof. (a Put x n q n into the recurrence relation (8. We obtain α 0 q n + α 1 q n 1 + + α k q n k 0. (11 Since q 0, dividing both sides of (11 by q n k, we have α 0 q k + α 1 q k 1 + + α k 1 q + α k 0 (12 This means that (11 and (12 are equivalent. This finishes the proof of Part (a. (b Since q 1, q 2,..., q k are roots of the characteristic equation (9, x n q n i are solutions of the homogeneous linear recurrence relation (8 for all i (1 i k. Since the solution space of (8 is a vector space, the linear combination x n c 1 q n 1 + c 2 q n 2 + + c k q n k, n 0 are also solutions (8. Now given arbitrary values for x 0, x 1,..., x k 1, the sequence (x n is uniquely determined by the recurrence relation (8. Set c 1 q i 1 + c 2 q i 2 + + c k q i k x i, 0 i k 1. The coefficients c 1, c 2,..., c k are uniquely determined by Cramer s rule as follows: c i det A i det A, 1 i k where A is the Vandermonde matrix A 1 1 1 q 1 q 2 q k q1 2. q2 2. qk 2. q1 k 1 q2 k 1 q k 1 k and A i is the matrix obtained from A by replacing its ith column by the column [x 0, x 1,..., x k 1 ] T. The determinant of A is given by det A (q j q i 0. This finishes the proof of Part (b. 1 i<j k 13,

Example 3.3. Find the sequence (x n satisfying the recurrence relation x n 2x n 1 + x n 2 2x n 3, n 3 and the initial conditions x 0 1, x 1 2, and x 2 0. Solution. The characteristic equation of the recurrence relation is Factorizing the equation, we have x 3 2x 2 x + 2 0. (x 2(x + 1(x 1 0. There are three roots x 1, 1, 2. By Theorem 3.1, we have the general solution x n c 1 ( 1 n + c 2 + c 3 2 n. Applying the initial conditions, c 1 +c 2 +c 3 1 c 1 c 2 +2c 3 2 c 1 +c 2 +4c 3 0 Solving the linear system we have c 1 2, c 2 2/3, c 3 1/3. Thus x n 2 2 3 ( 1n 1 3 2n. Theorem 3.2. (a Let q be a root with multiplicity m of the characteristic equation (9 associated with the kth order homogeneous linear recurrence relation (8 with constant coefficients. Then the m sequences x n q n, nq n,..., n m 1 q n are linearly independent solutions of the recurrence relation (8. (b Let q 1, q 2,..., q s be distinct nonzero roots with the multiplicities m 1, m 2,..., m s respectively for the characteristic equation (9. Then the sequences x n q n 1, nq n 1,..., n m 1 1 q n 1 ; q n 2, nq n 2,..., n m 2 1 q n 2 ;.. q n s, nq n s,..., n m s 1 q n s ; n 0 14.

are linearly independent solutions of the homogeneous linear recurrence relation (8. Their linear combinations form the general solution of the recurrence relation (8. Proof. The falling factorial polynomial of degree i is the polynomial (t i : t(t 1 (t i + 1. Let q be a root of the characteristic polynomial P (t α 0 t k + α 1 t k 1 + + α k 1 t + α k (t q m Q(t with multiplicity m. Then q is a root of the ith derivative P (i (t, where 0 i m 1. We claim that x n (n i q n, where 0 i m 1, is a solution of the recurrence relation. In fact, LHS of (8 α 0 (n i q n + α 1 (n 1 i q n 1 + + α k (n k i q n k di dt i q ( i α 0 t n + α 1 t n 1 + + α k t n k tq di dt i q i (t q m Q(tt n k 0. tq So x n (n i q n is a solution. It follows that x n n i q n is a solution, where 0 i m 1. Next we show that q n, nq n,..., n m 1 q n are linearly independent. Set c 0 q n + c 1 nq n + + c m 1 n m 1 q n 0, n 0. Since q 0, we have c 0 + c 1 n + + c m 1 n m 1 0 for all n. Consider c 0, c 1,..., c m 1 as variables and let n 1, 2,..., m. We have a system of linear equations about c 0, c 1,..., c m 1. The coefficient matrix A 1 1 1 2 1 m 1 2 2 2 2 m 1 3 3 2 3 m.... 1 m m 2 m m and det A 1 i<j m (j i 0. Hence c 0 c 1 c m 1 0. 15

Proof of Linear Independence: Consider the linear combination s (c j,0 qj n + c j,1 nqj n + + c j,mj 1n mj 1 qj n 0 (13 j1 with coefficients c j,0, c j,1,..., c j,mj 1, where j 1,..., s. We may assume that q 1 q r 1 q r q s, m m r m s, r s, where m r 1 < m r whenever q r 1 q r. Let ω j q j /q s for j 1,..., s. Then ω r,..., ω s are distinct roots of unity. We have s c j,m 1 ωj n ε(n 0 (n. jr Let A(n be the (s r + 1 (s r + 1 matrix ωr n ωr+1 n ωs n ωr A(n n+1 ωr+1 n+1 ωs n+1... ωr n+s r ωr+1 n+s r ωs n+s r and A j (n the matrix obtained from A(n by replacing its jth column with [ε(n, ε(n + 1,..., ε(n + s r] T. Then det A(n ωr n ωr+1 n ωs n r i<j s (ω j ω i. By Cramer s rule, we have c j,m 1 det A j(n 0 (n, j r,..., s. det A(n It follows that c j,m 1 0 for j r,..., s. Likewise, applying the same method to other nonzero coefficients with highest order, we see that all coefficients in (13 are zero. 4 Nonhomogeneous linear recurrence relations with constant coefficients Theorem 4.1. Given a nonhomogeneous linear recurrence relation of the first order x n αx n 1 + β n, n 1. (14 16,

(a Let β n cq n be an exponential function of n. Then (14 has a particular solution of the following form. If q α, then x n Aq n. If q α, then x n Anq n. (b Let β n k b in i be a polynomial function of n with degree k. If α 1, then (14 has a particular solution of the form x n A 0 + A 1 n + A 2 n 2 + + A k n k, where the coefficients A 0, A 1,..., A k are recursively determined as A k b k 1 α, 1 A i b i + α 1 α ( j ( 1 j i i ji+1 A j If α 1, then the solution of (14 is given by n x n x 0 + β i., 0 i k 1. Proof. (a We may assume q 0; otherwise the recurrence (14 is homogeneous. For the case q α, put x n Aq n in (14; we have Aq n αaq n 1 + cq n. The coefficient A is determined as A cq/(q α. For the case q α, put x n Anq n in (14; we have Anq n αa(n 1q n 1 + cq n. Since q α, then αaq n 1 cq n. The coefficient A is determined as A cq/α. (b For the case α 1, put x n k j0 A jn j in (14; we obtain A j n j α j0 A j (n 1 j + j0 17 b j n j. j0

Then A j n j α j0 A i n i α j0 A j n i A i b i α j ( j n i ( 1 j i + i b j n j. j0 ( j ( 1 j i A j + b i n i. i ( j ( 1 j i A j n i 0. i The coefficients A 0, A 1,..., A k are determined recursively as A k b k 1 α, 1 A i b i + α 1 α ji ji ( j ( 1 j i i ji+1 A j, 0 i k 1. As for the case α 1, iterate the recurrence relation (14; we have x n x n 1 + β n x n 2 + β n 1 + β n x n 1 + β n 2 + β n 1 + β n x 0 + β 1 + β 2 + + β n. Example 4.1. Solve the difference equation { xn x n 1 + 3n 2 5n 3, n 1 Solution. x n x 0 + 2 + 3 x 0 2. n b i 2 + n i 2 5 2 + 3 n n ( 3i 2 5i 3 i 3 n(n + 1(2n + 1 6 ( 2 n(n + 1 5. 2 18

We have applied the following identities n i 2 n(n + 1(2n + 1, 6 n ( 2 n(n + 1 i 3. 2 Example 4.2. Solve the equation { xn 3x n 1 4n, n 1 x 0 2. Solution. Note that x n 3 n c is the general solution of the corresponding homogeneous linear recurrence relation. Let x n An + B be a particular solution. Then An + B 3[A(n 1 + B] 4n Comparing the coefficients of n 0 and n, it follows that A 2 and B 3. Thus the general solution is given by x n 2n + 3 + 3 n c. The initial condition x 0 2 implies that c 1. Therefore the solution is x n 3 n + 2n + 3. Theorem 4.2. Given a nonhomogeneous linear recurrence relation of the second order x n α 1 x n 1 + α 2 x n 2 + cq n. (15 Let q 1 and q 2 be solutions of its characteristic equation x 2 α 1 x α 2 0. Then (15 has a particular solution of the following forms, where A is a constant to be determined. (a If q q 1, q q 2, then x n Aq n. (b If q q 1, q 1 q 2, then x n Anq n. 19

(c If q q 1 q 2, then x n An 2 q n. Proof. The homogeneous linear recurrence relation corresponding to (15 is x n α 1 x n 1 + α 2 x n 2, n 2. (16 We may assume q 0. Otherwise (15 is homogeneous. (a Put x n Aq n into (15; we have Then Aq n α 1 Aq n 1 + α 2 Aq n 2 + cq n. A(q 2 a 1 q a 2 cq 2. Since q is not a root of the characteristic equation x 2 q 2 α 1 q α 2 0, the coefficient A is determined as A cq 2 q 2 α 1 q α 2. α 1 x + α 2, that is, (b Since q q 1 q 2, then x n q n is a solution of (16 but x n nq n is not, that is, q 2 α 1 q α 2 0 and nq n α 1 (n 1q n 1 + α 2 (n 2q n 2. It follows that nq 2 α 1 (n 1q α 2 (n 2 n(q 2 α 1 q α 2 + α 1 q + 2α 2 α 1 q + 2α 2 0. Put x n Anq n into (15; we have Then Anq n α 1 A(n 1q n 1 + α 2 A(n 2q n 2 + cq n. A [ nq 2 α 1 (n 1q α 2 (n 2 ] cq 2. Since α 1 q + 2α 2 0, the coefficient A is determined as A cq 2 α 1 q + 2α 2. 20

(c Since q q 1 q 2, then both x n q n and x n nq n are solutions of (16, but x n n 2 q n is not. It then follows that q 2 α 1 q α 2 0, α 1 q + 2α 2 0, and n 2 q 2 α 1 (n 1 2 q α 2 (n 2 2 n 2 (q 2 α 1 q α 2 + 2n(α 1 q + 2α 2 α 1 q α 1 q 4α 2 0. Put x n An 2 q n into (15; we have Aq [ n 2 n 2 q 2 α 1 (n 1 2 q α 2 (n 2 2] cq n. The coefficient A is determined as A cq2. α 1 q + 4α 2 Example 4.3. Solve the equation x n 10x n 1 25x n 2 + 5 n+1, n 2 x 0 5 x 1 15. Put x n An 2 5 n into the recurrence relation. We have An 2 5 n 10A(n 1 2 5 n 1 25A(n 2 2 5 n 2 + 5 n+1. Dividing both sides we further have An 2 2A(n 1 2 A(n 2 2 + 5. Thus A 5/2. The general solution is given by x n 5 2 n2 5 n + c 1 5 n + c 2 n5 n. Applying the initial conditions x 0 5 and x 1 15, we have c 1 5 and c 2 9/2. Hence ( 5 x n 2 n2 9 2 n + 5 5 n. 21

Theorem 4.3. Given a nonhomogeneous linear recurrence relation of the second order x n α 1 x n 1 + α 2 x n 2 + β n, n 2, (17 where β n is a polynomial function of n with degree k. (a If α 1 + α 2 1, then (17 has a particular solution of the form x n A 0 + A 1 n + + A k n k, where A 0, A 1,..., A k are constants to be determined. If k 2, then a particular solution has the form (b If α 1 + α 2 relation x n A 0 + A 1 n + A 2 n 2. 1, then (17 can be reduced to a first order recurrence where y n x n x n 1 for n 1. y n (α 1 1y n 1 + β n, n 2, Proof. (a Let β n k j0 b jn j. Put x n k j0 A jn j into the recurrence relation (17; we obtain A j n j α 1 A j (n 1 j + α 2 j0 j0 α 1 j0 A j +α 2 j0 α 1 n i +α 2 A j n i A j (n 2 j + j0 j ( j ( 1 j i n i i j ( j ( 2 j i n i + i ( j ( 1 j i A j i ( j ( 2 j i A j + i ji ji b j n j j0 b j n j. j0 b j n j j0 22

Collecting the coefficients of n i, we have ( j A i α 1 ( 1 j i A j α 2 i ji ( j ( 2 j i A j i Since α 1 + α 2 1, the coefficients A 0, A 1,..., A k are determined as A k A i b k, 1 α 1 α 2 1 b i + 1 α 1 α 2 ji ( j ( ( 1 j i α 1 + 2 j i α 2 i ji+1 where 0 i k 1. (b The recurrence relation (17 becomes x n α 1 x n 1 + (1 α 1 x n 2 + β n, n 2. b i A j n i 0. Set y n x n x n 1 for n 1; the recurrence (17 reduces to a first order recurrence relation. Example 4.4. Solve the following recurrence relation x n 6x n 1 9x n 2 + 8n 2 24n x 0 5 x 1 5. Solution. Put x n A 0 + A 1 n + A 2 n 2 into the recurrence relation; we obtain A 0 +A 1 n+a 2 n 2 6[A 0 +A 1 (n 1+A 2 (n 1 2 ] 9[A 0 +A 1 (n 2+A 2 (n 2 2 ]+8n 2 Collecting the coefficients of n 2, n, and the constant, we have (4A 2 8n 2 + (4A 1 24A 2 + 24n + (4A 0 12A 1 + 30A 2 0. We conclude that A 2 2, A 1 6, and A 0 3. So x n 2n 2 + 6n + 3 is a particular solution. Then the general solution of the recurrence is x n 2n 2 + 6n + 3 + 3 n c 1 + 3 n nc 2. Applying the initial condition x 0 x 1 5, we have c 1 2, c 2 4. The sequence is finally obtained as x n 2n 2 + 6n + 3 + 2 3 n 4n 3 n. 23,

5 Generating functions The (ordinary generating function of an infinite sequence is the infinite series A finite sequence a 0, a 1, a 2,..., a n,... A(x a 0 + a 1 x + a 2 x 2 + + a n x n +. a 0, a 1, a 2,..., a n can be regarded as the infinite sequence and its generating function is a polynomial. a 0, a 1, a 2,..., a n, 0, 0,... A(x a 0 + a 1 x + a 2 x 2 + + a n x n Example 5.1. The generating function of the constant infinite sequence is the function 1, 1,..., 1,... A(x 1 + x + x 2 + + x n + 1 1 x. Example 5.2. For any positive integer n, the generating function for the binomial coefficients ( n ( n ( n ( n,,,...,, 0,... 0 1 2 n is the function n ( n x k k (1 + x n. k0 24

Example 5.3. For any real number α, the generating function for the infinite sequence of binomial coefficients ( α ( α ( α ( α,,,...,,... 0 1 2 n is the function ( α x n n (1 + x α. Example 5.4. Let k be a positive integer and let a 0, a 1, a 2,..., a n,... be the infinite sequence whose general term a n is the number of nonnegative integral solutions of the equation x 1 + x 2 + + x k n. Then the generating function of the sequence (a n is A(x 1 x n i 1 0 i 1 + +i k n x i 1 ( 1 n ( k n i k 0 x i k x n i 1 + +i k n x i 1+ +i k 1 (1 x k ( n + k 1 x n. n Example 5.5. Let a n be the number of integral solutions of the equation x 1 + x 2 + x 3 + x 4 n, where 0 x 1 3, 0 x 2 2, x 3 2, and 3 x 4 5. The generating function of the sequence (a n is A(x ( 1 + x + x 2 + x 3 ( 1 + x + x 2 ( x 2 + x 3 + ( x 3 + x 4 + x 5 ( x5 1 + x + x 2 + x 3 ( 1 + x + x 2 2. 1 x 25

Example 5.6. Determine the generating function for the number of n-combinations of apples, bananas, oranges, and pears where in each n-combination the number of apples is even, the number of bananas is odd, the number of oranges is between 0 and 4, and the number of pears is at least two. The required generating function is ( ( ( 4 ( A(x x 2i x 2i+1 x i x i i2 x 3 (1 x 5 (1 x 2 2 (1 x 2. Example 5.7. Determine the number a n of bags with n pieces of fruit (apples, bananas, oranges, and pears such that the number of apples is even, the number bananas is a multiple of 5, the number oranges is at most 4, and the number of pears is either one or zero. The generating function of the sequence (a n is ( ( ( 4 ( 1 A(x x 2i x 5i x i x i (1 + x + x2 + x 3 + x 4 (1 + x (1 x 2 (1 x 5 (1 + x(1 x5 /(1 x (1 + x(1 x(1 x 5 1 (1 x ( 2 ( 1 n x n 2 n ( n + 1 x n (n + 1x n. n Thus a n n + 1. Example 5.8. Find a formula for the number a n,k of integer solutions (i 1, i 2,..., i k of the equation x 1 + x 2 + + x k n such that i 1, i 2,..., i k are nonnegative odd numbers. 26

The generating function of the sequence (a n is ( ( A(x x 2i+1 x 2i+1 x k (1 x 2 k ( i + k 1 ( i + k 1 x k x 2i i i ( j+r 1 jr j r x 2j for k 2r ( j+r jr j r x 2j+1 for k 2r + 1. We then conclude that a 2s,2r ( s+r 1 s r otherwise. We may combine the three cases into a n,k ( n 2 + k 2 1 n 2 k 2 x 2i+k, a2s+1,2r+1 ( s+r s r, and an,k 0 if n k even, 0 if n k odd. Example 5.9. Let a n denote the number of nonnegative integral solutions of the equation 2x 1 + 3x 2 + 4x 3 + 5x 4 n. Then the generating function of the sequence (a n is A(x 1 x n ( i,j,k,l 0 2i+3j+4k+5l0 x 2i j0 x 3j ( ( x 4k x 5l k0 1 (1 x 2 (1 x 3 (1 x 4 (1 x 5. Theorem 5.1. Let s n be the number of nonnegative integral solutions of the equation a 1 x 1 + a 2 x 2 + + a k x k n. l0 27

Then the generating function of the sequence (s n is A(x 1 (1 x a 1 (1 x a 2 (1 x a k. 6 Recurrence and generating functions Since then 1 (1 x n 1 (1 ax n k0 k0 ( n ( x k k ( n ( ax k k ( n + k 1 x k, x < 1; k k0 ( n + k 1 k0 k a k x k, x < 1 a. Example 6.1. Determine the generating function of the sequence Thus Since 1 1 x k0 xk, then 1 (1 x 2 d dx 0, 1, 2 2,..., n 2,.... ( 1 1 x k0 d ( x k dx kx k 1. x (1 x 2 k0 kxk. Taking the derivative with respect to x we have 1 + x (1 x 3 k0 Therefore the desired generating function is A(x k 2 x k 1. x(1 + x (1 x 3. Example 6.2. Solve the recurrence relation a n 5a n 1 6a n 2, n 2 a 0 1 a 1 2 k0 28

Let A(x a nx n. Applying the recurrence relation, we have A(x a 0 + a 1 x + (5a n 1 6a n 2 x n n2 a 0 + a 1 x 5xa 0 + 5xA(x 6x 2 A(x. Applying the initial values and collecting the coefficient functions of A(x, we further have ( 1 5x + 6x 2 A(x 1 7x. Thus the function g(x is solved as A(x 1 7x 1 5x + 6x 2. Observing that 1 5x + 6x 2 (1 2x(1 3x and applying partial fraction, 1 7x 1 5x + 6x A 2 1 2x + B 1 3x. The constants A and B can be determined by Then { Thus A 5, B 4. Hence Since A(x We obtain the sequence A(1 3x + B(1 2x 1 7x. 1 1 2x A +B 1 3A 2B 7 1 7x 1 5x + 6x 5 2 1 2x 4 1 3x. 2 n x n and 1 1 3x a n 5 2 n 4 3 n, n 0. 3 n x n 29

Theorem 6.1. Let (a n ; n 0 be a sequence satisfying the homogeneous linear recurrence relation a n α 1 a n 1 + α 2 a n 2 + + α k a n k, α k 0, n k (18 of order k with constant coefficients. Then its generating function A(x a nx n is of the form A(x P (x Q(x, (19 where Q(x is a polynomial of degree k with a nonzero constant term and P (x is a polynomial of degree strictly less than k. Conversely, given such polynomials P (x and Q(x, there exists a unique sequence (a n satisfying the linear homogeneous recurrence relation (18, and its generating function is the rational function in (19. Proof. The generating function A(x of the sequence (a n can be written as ( k 1 k 1 A(x a i x i + a n x n a i x i + α i a n i x n k 1 a i x i + k 1 k 1 A(x nk a i x i + α k x k a i x i + A(x α i α i x i + nk a n i x n a n x n + α i x i k 1 a i x i k 1 k 1 nk k 1 a i x i + k 1 x l l1 α i α i x i a n x n k i 1 α i x i j0 a j x j l α i a l i. nk i k i 1 j0 a n x n+i a j x j 30

Then Thus A(x ( 1 α i x i P (x a 0 + Q(x 1 k 1 a 0 + k 1 l1 ( a i x i k 1 l1 a l α i x i. ( k 1 l1 a l x l l α i a l i i α i a l i x l. l α i a l i x l, Conversely, let (a n be the sequence whose generating function is A(x P (x/q(x. Write A(x Then A(x P (x Q(x a n x n, P (x b i x i, is equivalent to ( ( 1 α i x i a n x n Q(x 1 b i x i. α i x i. The polynomial Q(x can be viewed as an infinite series with α i 0 for i > k. Thus ( n a n x n α i a n i x n b i x i. Equating the coefficients of x n, we have the recurrence relation a n α i a n i, n k. 31

Proposition 6.2 (Partial Fractions. (a If P (x is a polynomial of degree less than k, then P (x (1 ax k A 1 1 ax + A 2 (1 ax 2 + + A k (1 ax k, where A 1, A 2,..., A k are constants to be determined. (b If P (x is a polynomial of degree less than p + q + r, then P (x (1 ax p (1 bx q (1 cx A 1(x r (1 ax + A 2(x p (1 bx + A 3(x q (1 cx r, where A 1 (x, A 2 (x, and A 3 (x are polynomials of degree q + r, p + r, and p + q, respectively. 7 A geometry example A polygon P in R 2 is called convex if the segment joining any two points in P is also contained in P. Let C n denote the number of ways to divide a labeled convex polygon with n + 2 sides into triangles. The first a few such numbers are C 1 1, C 2 2, C 3 5. We first establish a recurrence relation for C n+1 in terms of C 0, C 1,..., C n. Let P v1 v 2...v n+3 denote a convex (n + 3-polygon with vertices v 1, v 2,..., v n+3. In each triangular decomposition of P v1 v 2...v n+3 into triangles, the segment v 1 v n+3 is one side of a triangle in the decomposition; the third vertex of the triangle is one of the vertices v 2, v 3,..., v n+2. Let v k+2 be the third vertex of other than v 1 and v n+3 (0 k n; see Figure 1 below. Then we have a convex (k + 2- v k+2 v n+2 v n+3 v 3 v v 1 2 Figure 1: v k+2 is the third vertex of the triangle with the side v 1 v n+3 polygon P v1 v 2...v k+2 and another convex (n k +2-polygon P vk+2 v k+3...v n+3. Then 32

by induction there are C k ways to divide P v1 v 2...v k+2 into triangles, and C n k ways to divide P vk+2 v k+3...v n+3 into triangles. We thus have the recurrence relation C n+1 n C k C n k with C 0 1. k0 Consider the generating function F (x C nx n. Then ( ( F (xf (x C n x n C n x n We thus obtain the equation Solving for F (x, we obtain ( n C k C n k k0 C n+1 x n 1 x F (x x 1 x. xf (x 2 F (x + 1 0. x n C n x n n1 Note that F (x 1 ± 1 4x. 2x ( 1 1 4x 1 + ( 1 n 2 4 n x n n n1 1 + a n x n, n1 33

where Then We conclude that [ ( ( 1 1 1 / a n ( 1 n 2 2 1 n!] 2 n + 1 2 n 2 n ( 1 n ( 1( 3( 5 ( 2 n 1 + 1 2 n n! 1 3 5 (2 n 1 1 2 n n! (2(n 1! 2 n!(n 1!. 1 4x 1 2 1 2 n1 (2(n 1! n!(n 1! xn F (x 1 1 4x 2x (2n! n!(n + 1! xn 1 n + 1 (2n! n!(n + 1! xn+1. ( 2n n x n. Hence the sequence (C n is given by the binomial coefficients: C n 1 ( 2n, n 0. n + 1 n The sequence (C n is known as the Catalan sequence and the numbers C n as the Catalan numbers. Example 7.1. Let C n be the number of ways to evaluate a matrix product A 1 A 2 A n+1, n 0 34

by adding various parentheses. For instance, C 0 1, C 1 1, C 2 2, and C 3 5. In general the formula is given by C n 1 ( 2n. n + 1 n Note that each way of evaluating the matrix product A 1 A 2 A n+2 will be finished by multiplying of two matrices at the end. There are exactly n + 1 ways of multiplying the two matrices at the end: A 1 A 2 A n+2 (A 1 A k+1 (A k+2 A n+2, 0 k n. This yields the recurrence relation ( Thus C n 1 2n n+1 n, n 0. C n+1 n C k C n k. k0 8 Exponential generating functions The ordinary generating function method is a powerful algebraic tool for finding unknown sequences, especially when the sequences are certain binomial coefficients or the order is immaterial. However, when the sequences are not binomial type or the order is material in defining the sequences, we may need to consider a different type of generating functions. For example, the sequence a n n! is the counting of the number of permutations of n distinct objects; its ordinary generating function a n x n n!x n cannot be easily figure out. However, the generating function a n n! xn x n 1 1 x is obvious. 35

The exponential generating function of a sequence (a n ; n 0 is the infinite series a n E(x n! xn. Example 8.1. The exponential generating function of the sequence P (n, 0, P (n, 1,..., P (n, n, 0,... is given by n P (n, k E(x k! k0 n ( n x k k k0 (1 + x n. x k Example 8.2. The exponential generating function of the constant sequence (a n 1; n 0 is x n E(x n! ex. The exponential generating function of the geometric sequence (a n a n ; n 0 is a n x n E(x e ax. n! Theorem 8.1. Let M {n 1 α 1, n 2 α 2,..., n k α k } be a multiset over the set S {α 1, α 2,..., α k } with n 1 many α 1 s, n 2 many α 2 s,..., n k many α k s. Let a n be the number of n-permutations of the multiset M. Then the exponential generating function of the sequence (a n ; n 0 is given by ( n1 ( n2 ( nk E(x x i i! x i i! x i i!. (20 36

Proof. Note that a n 0 for n > n 1 + + n k. Thus E(x is a polynomial. The right side of (20 can be expanded to the form n 1,n 2,...,n k i 1,i 2,...,i k 0 x i 1+i 2 + +i k i 1!i 2! i k! n 1 +n 2 + +n k x n n! i 1 +i 2 + +i k n 0 i 1 n 1,...,0 i k n k n! i 1!i 2! i k!. Note that the number of permutation of M with exactly i 1 α 1 s, i 2 α 2 s,..., and i k α k s such that i 1 + i 2 + + i k n is the multinomial coefficient ( n i 1, i 2,..., i k n! i 1!i 2! i k!. It turns out that the sequence (a n is given by ( n a n, n 0. i 1, i 2,..., i k i 1 +i 2 + +i k n 0 i 1 n 1,...,0 i k n k Example 8.3. Determine the number of ways to color the squares of a 1-by-n chessboard using the colors, red, white, and blue, if an even number of squares are colored red. Let a n denote the number of ways of such colorings and set a 0 1. Each such coloring can be considered as a permutation of three objects r (for red, w (for white, and b (for blue with repetition allowed, and the element r appears even 37

number of times. The exponential generating function of the sequence (a n is ( ( x 2n 2 x n E(x (2n! n! Thus the sequence is given by ex + e x e 2x 1 ( e 3x + e x ( 2 2 1 3 n x n x n + 2 n! n! 1 (3 n + 1 xn 2 n!. a n 3n + 1, n 0. 2 Example 8.4. Determine the number a n of n digit (under base 10 numbers with each digit odd where the digit 1 and 3 occur an even number of times. Let a 0 1. The number a n equals the number of n-permutations of the multiset M { 1, 3, 5, 7, 9}, in which 1 and 3 occur an even number of times. The exponential generating function of the sequence a n is ( 2 ( x 2n 3 x n E(x (2n! n! ( e x + e x 2 e 3x 2 1 ( e 5x + 2e 3x + e x 4 ( 1 5 n x n 3 n x n x n + + 4 n! n! n! ( 5 n + 2 3 n + 1 x n 4 n!. Thus a n 5n + 2 3 n + 1, n 0. 4 38

Example 8.5. Determine the number of ways to color the squares of a 1-by-n board with the colors, red, blue, and white, where the number of red squares is even and there is at least one blue square. The exponential generating function for the sequence is Thus and E(x ( x 2i (2i! ( x i i! ( ex + e x e x (e x 1 2 1 ( e 3x e 2x + e x 1 2 1 2 + 3 n 2 n + 1 xn 2 n! a n 3n 2 n + 1, n 1 2 a 0 0. 9 Combinatorial interpretations Theorem 9.1. The combinatorial interpretations of ordinary generating functions: (a The number of ways of placing n indistinguishable balls into m distinguishable boxes is the coefficient of x n in ( ( m 1 + x + x 2 + m x k k0 x i i! 1 (1 x m. (b The number of ways of placing n indistinguishable balls into m distinguishable boxes with at most r k balls in the kth box is the coefficient of x n in the expression m ( 1 + x + x 2 + + x r k. k1 39

(c The number of ways of placing n indistinguishable balls into m distinguishable boxes with at least s k balls in the kth box is the coefficient of x n in the expression m x ( s k 1 + x + x 2 + xs 1+ +s m (1 x. m k1 (d The number of ways of placing n indistinguishable balls into m distinguishable boxes, such that the number of balls held in the kth box is allowed in a subset C k Z 0 (1 k m, is the coefficient of x n in the expression x k x k. k C1 k C2 k C m x k Proof. Let us consider the situation of placing infinitely many indistinguishable balls into m distinguishable boxes. We use the symbol x to represent a ball and x k to represent indistinguishable k balls. In the course of placing the balls into m boxes, each box contains either none of balls (x 0 1, or one ball (x, or two balls (x 2, or three balls (x 3, etc.; that is, each box contains 1 + x + x 2 + x 3 + balls, where the plus sign + means or. Box 1 Box 2 Box 3 Box m 1 1 1 1 1 x x x x x x 2 x 2 x 2 x 2 x 2 x 3. x 3. x 3. x 3. x 3. If we use multiplication to represent and, then all possible distributions of balls in the m boxes in the course of placing are contained in the expression (1 + x + x 2 + m. (21 40

Thus, when there are n distinguishable balls to be placed into the m distinguishable boxes, the number of distributions of the n balls in the m boxes will be the coefficient of x n in the expression (21. Indeed, to compute the coefficient of x n in (21, we select x n 1 from column 1, x n 2 from column 2,..., x n m from column m in the above table such that x n 1x n 2 x n m x n, and do this in all possible ways. The number of such ways is clearly the number of non-negative integer solutions of the equation y 1 + y 2 + + y m n, and is given by ( m+n 1 n. The situation for other cases are similar. Theorem 9.2. The combinatorial interpretation of exponential generating functions: (a The number of ways of selecting an ordered n objects with repetition allowed from an m-set is the coefficient of xn n! in the expression ( m e mx. (22 (1 + m x2 + x1! 2! + x3 3! + (b The number of ways of selecting an ordered n objects from an m-set such that the number of kth objects is allowed in a subset C k Z 0, is the coefficient of xn n! in the expression k C1 x k k! k C2 x k k! k0 x k k! xk k! k C m Example 9.1. Find the number of 4-permutations of the multiset M {a, a, b, b, b, c}.. (23 41

There are 5 sub-multisets of M having cardinality 4. {a, a, b, b} {a, a, b, c} {a, b, b, b} {a, b, b, c} {b, b, b, c} 4!/2!2!0! 4!/2!1!1! 4!/1!3!0! 4!/1!2!1! 4!/0!3!1! Then the answer is 4! 2!2!0! + 4! 2!1!1! + 4! 1!3!0! + 4! 1!2!1! + 4! 0!3!1! 38, which is the coefficient of x4 4! in the expansion of x2 E(x (1 + + (1 + x1! 2! In fact, the coefficient of x 4 /4! is a 4 i+j+k4 i 2,j 3,k 1 x2 + x1! 2! + x3 3! ( 1 + x. 1! 4! i!j!k! 4! 2!2!0! + 4! 2!1!1! + 4! 1!3!0! + 4! 1!2!1! + 4! 0!3!1!. 42