Generating Functions
Arash Rafiey
September 7, 2015
Arash Rafiey Generating Functions
Generating Functions
For any sequence a0 , a1 , a2 , .., of real numbers, the corresponding
generating function of the sequence is
X
G (x) = a0 + a1 x + a2 x 2 + = an x n .
n=0
Arash Rafiey Generating Functions
Generating Functions
For any sequence a0 , a1 , a2 , .., of real numbers, the corresponding
generating function of the sequence is
X
G (x) = a0 + a1 x + a2 x 2 + = an x n .
n=0
Example :
Determine the generating functions of the following
1 an = 1 (n = 0, 1, . . . ,)
Arash Rafiey Generating Functions
Generating Functions
For any sequence a0 , a1 , a2 , .., of real numbers, the corresponding
generating function of the sequence is
X
G (x) = a0 + a1 x + a2 x 2 + = an x n .
n=0
Example :
Determine the generating functions of the following
an = 1 (n = 0, 1, . . . ,) G (x) = 1 + x + x 2 + = xn
P
1
n=0
Arash Rafiey Generating Functions
Generating Functions
For any sequence a0 , a1 , a2 , .., of real numbers, the corresponding
generating function of the sequence is
X
G (x) = a0 + a1 x + a2 x 2 + = an x n .
n=0
Example :
Determine the generating functions of the following
an = 1 (n = 0, 1, . . . ,) G (x) = 1 + x + x 2 + = xn
P
1
n=0
2 an = n! (n = 0, 1, 2, . . . , ..)
Arash Rafiey Generating Functions
Generating Functions
For any sequence a0 , a1 , a2 , .., of real numbers, the corresponding
generating function of the sequence is
X
G (x) = a0 + a1 x + a2 x 2 + = an x n .
n=0
Example :
Determine the generating functions of the following
an = 1 (n = 0, 1, . . . ,) G (x) = 1 + x + x 2 + = xn
P
1
n=0
2 an = n! (n = 0, 1, 2, . . . , ..)
3 a0 = 1, a1 = 1, a2 = 1, a3 = 1.
Arash Rafiey Generating Functions
Generating Functions
For any sequence a0 , a1 , a2 , .., of real numbers, the corresponding
generating function of the sequence is
X
G (x) = a0 + a1 x + a2 x 2 + = an x n .
n=0
Example :
Determine the generating functions of the following
an = 1 (n = 0, 1, . . . ,) G (x) = 1 + x + x 2 + = xn
P
1
n=0
2 an = n! (n = 0, 1, 2, . . . , ..)
3 a0 = 1, a1 = 1, a2 = 1, a3 = 1.
G (x) = 1 + x + x 2 + x 3 .
Arash Rafiey Generating Functions
Example :
If there is an unlimitted number of red, green, blue, and black
jelly beans, in how many ways can Douglas select 24 of these
candies so that he has an even number of blue beans and at least
six black ones ?
Arash Rafiey Generating Functions
Example :
If there is an unlimitted number of red, green, blue, and black
jelly beans, in how many ways can Douglas select 24 of these
candies so that he has an even number of blue beans and at least
six black ones ?
For red ( green) : we can have (1 + x + x 2 + + x 24 ) (zero red,
1 red, 2 reds,...)
Arash Rafiey Generating Functions
Example :
If there is an unlimitted number of red, green, blue, and black
jelly beans, in how many ways can Douglas select 24 of these
candies so that he has an even number of blue beans and at least
six black ones ?
For red ( green) : we can have (1 + x + x 2 + + x 24 ) (zero red,
1 red, 2 reds,...)
For blue : (1 + x 2 + x 4 + x 6 + + x 24 ) (even numbers)
Arash Rafiey Generating Functions
Example :
If there is an unlimitted number of red, green, blue, and black
jelly beans, in how many ways can Douglas select 24 of these
candies so that he has an even number of blue beans and at least
six black ones ?
For red ( green) : we can have (1 + x + x 2 + + x 24 ) (zero red,
1 red, 2 reds,...)
For blue : (1 + x 2 + x 4 + x 6 + + x 24 ) (even numbers)
For black : (x 6 + x 7 + x 8 + + x 24 ) (at least 6)
Arash Rafiey Generating Functions
Example :
If there is an unlimitted number of red, green, blue, and black
jelly beans, in how many ways can Douglas select 24 of these
candies so that he has an even number of blue beans and at least
six black ones ?
For red ( green) : we can have (1 + x + x 2 + + x 24 ) (zero red,
1 red, 2 reds,...)
For blue : (1 + x 2 + x 4 + x 6 + + x 24 ) (even numbers)
For black : (x 6 + x 7 + x 8 + + x 24 ) (at least 6)
So the answer to the problem is the coefficient of x 24 in the
generating function
f (x) = (1+x +x 2 +x 3 + +x 24 )2 (1+x 2 +x 4 +x 6 + +x 24 )
(x 6 + x 7 + x 8 + + x 24 )
Arash Rafiey Generating Functions
For n Z + ,
(1 x n+1 ) = (1 x)(1 + x + x 2 + + x n ).
Arash Rafiey Generating Functions
For n Z + ,
(1 x n+1 ) = (1 x)(1 + x + x 2 + + x n ).
1 = (1 x)(1 + x + x 2 + + ...)
Arash Rafiey Generating Functions
For n Z + ,
(1 x n+1 ) = (1 x)(1 + x + x 2 + + x n ).
1 = (1 x)(1 + x + x 2 + + ...)
1
G (x) = 1 + x + x 2 + = xn =
P
1x
n=0
Arash Rafiey Generating Functions
For n Z + ,
(1 x n+1 ) = (1 x)(1 + x + x 2 + + x n ).
1 = (1 x)(1 + x + x 2 + + ...)
1
G (x) = 1 + x + x 2 + = xn =
P
1x
n=0
What is the generaliting function for sequence 1, 2, 3, . . . , n, . . . .
G (x) = 1 + 2x + 3x 2 + 4x 3 + + nx n1 + ...
Arash Rafiey Generating Functions
For n Z + ,
(1 x n+1 ) = (1 x)(1 + x + x 2 + + x n ).
1 = (1 x)(1 + x + x 2 + + ...)
1
G (x) = 1 + x + x 2 + = xn =
P
1x
n=0
What is the generaliting function for sequence 1, 2, 3, . . . , n, . . . .
G (x) = 1 + 2x + 3x 2 + 4x 3 + + nx n1 + ...
d 1
dx 1x = d
dx (1 x)1 = 1
(1x)2
Arash Rafiey Generating Functions
For n Z + ,
(1 x n+1 ) = (1 x)(1 + x + x 2 + + x n ).
1 = (1 x)(1 + x + x 2 + + ...)
1
G (x) = 1 + x + x 2 + = xn =
P
1x
n=0
What is the generaliting function for sequence 1, 2, 3, . . . , n, . . . .
G (x) = 1 + 2x + 3x 2 + 4x 3 + + nx n1 + ...
d 1
dx 1x = d
dx (1 x)1 = 1
(1x)2
d
dx (1 + x + x 2 + x 3 + . . . ) = 1 + 2x + 3x 2 + 4x 3 + . . .
Arash Rafiey Generating Functions
Suppose an = 1 if n is even and 0 otherwise. Then the generating
function corresponding to this sequence is :
Arash Rafiey Generating Functions
Suppose an = 1 if n is even and 0 otherwise. Then the generating
function corresponding to this sequence is :
1 X
2
= 1 + x2 + x4 + = x 2n
1x
n=0
Arash Rafiey Generating Functions
Suppose an = 1 if n is even and 0 otherwise. Then the generating
function corresponding to this sequence is :
1 X
2
= 1 + x2 + x4 + = x 2n
1x
n=0
1
A useful generating function corresponds to the sequence an = n!
which is the exponential function e x .
Arash Rafiey Generating Functions
Suppose an = 1 if n is even and 0 otherwise. Then the generating
function corresponding to this sequence is :
1 X
2
= 1 + x2 + x4 + = x 2n
1x
n=0
1
A useful generating function corresponds to the sequence an = n!
which is the exponential function e x .
x2 x3 xn
ex = 1 + x +
P
2! + 3! + = n! .
n=0
Arash Rafiey Generating Functions
Arithmetic of Generating Functions
Definition
an x n ,
P
Suppose we have two generating functions F (x) =
n=0
bn x n . Then
P
G (x) =
n=0
the sum of these generating functions is
(an + bn )x n
P
F (x) + G (x) =
n=0
the difference of these generating functions is
(an bn )x n
P
F (x) G (x) =
n=0
the products of these generating functions is
(a0 bn + a1 bn1 + a2 bn2 + + an b0 )x n =
P
G (x).F (x) =
n=0
P n
ak bnk )x n
P
(
n=0 k=0
Arash Rafiey Generating Functions
Example
ex x 1 x2 x3
1x = e . 1x = (1 + x + 2! + 3! + . . . ).(1 + x + x 2 + x 3 + . . . )
Arash Rafiey Generating Functions
Example
ex x 1 x2 x3
1x = e . 1x = (1 + x + 2! + 3! + . . . ).(1 + x + x 2 + x 3 + . . . )
=
1 1 1
1.1+(1.1+1.1)x +(1.1+1.1+ 2! .1)x 2 +(1.1+1.1+ 2! .1+ 3! .1)x 3 +. . .
Arash Rafiey Generating Functions
Example
ex x 1 x2 x3
1x = e . 1x = (1 + x + 2! + 3! + . . . ).(1 + x + x 2 + x 3 + . . . )
=
1 1 1
1.1+(1.1+1.1)x +(1.1+1.1+ 2! .1)x 2 +(1.1+1.1+ 2! .1+ 3! .1)x 3 +. . .
n
ex 1 1 1 1 1
an x n where an =
P P
1x = 0! + 1! + 2! + + n! = k!
n=0 n=0
Arash Rafiey Generating Functions
Exercise
(1) x 2 + x 3 + x 4 + ... = xn
P
n=2
4x 2 8x 3
(2) (1 x)(1 + 2x + 2! + 3! + ...)
Arash Rafiey Generating Functions
Definition
If a is a real number and k is a non-negative integer, we define the
generalized binomial coefficient kn as
a
a(a1)(a2)...(ak+1)
k = k! if k > 0 and 1 otherwise.
3/2
(3/2)(1/2)(1/2)(3/2) 3
4 = 4! = 128 .
If a is a negative integer : a = n then
a k
k = (1) C (n + k 1, k).
Arash Rafiey Generating Functions
Definition
If a is a real number and x is a real number with |x| < 1, then
(1 + x)a = 1 + 1a x + 2a x 2 + 3a x 3 + = a n
P
n x
n=0
Arash Rafiey Generating Functions
Definition
If a is a real number and x is a real number with |x| < 1, then
(1 + x)a = 1 + 1a x + 2a x 2 + 3a x 3 + = a n
P
n x
n=0
1
Expand (1x)2
.
Arash Rafiey Generating Functions
Definition
If a is a real number and x is a real number with |x| < 1, then
(1 + x)a = 1 + 1a x + 2a x 2 + 3a x 3 + = a n
P
n x
n=0
1
Expand (1x)2
.
a 7 2 and x 7 x
Arash Rafiey Generating Functions
Definition
If a is a real number and x is a real number with |x| < 1, then
(1 + x)a = 1 + 1a x + 2a x 2 + 3a x 3 + = a n
P
n x
n=0
1
Expand (1x)2
.
a 7 2 and x 7 x
1 2 2 2
(x)2 + (x)3 + . . .
(1x) 2 = 1 + 1 (x) + 2 3
2 n
P
= n (x)
n=0
Arash Rafiey Generating Functions
Definition
If a is a real number and x is a real number with |x| < 1, then
(1 + x)a = 1 + 1a x + 2a x 2 + 3a x 3 + = a n
P
n x
n=0
1
Expand (1x)2
.
a 7 2 and x 7 x
1 2 2 2
(x)2 + (x)3 + . . .
(1x) 2 = 1 + 1 (x) + 2 3
2 n
P
= n (x)
n=0
2
= (1)n (n + 1)
n
Arash Rafiey Generating Functions
Definition
If a is a real number and x is a real number with |x| < 1, then
(1 + x)a = 1 + 1a x + 2a x 2 + 3a x 3 + = a n
P
n x
n=0
1
Expand (1x)2
.
a 7 2 and x 7 x
1 2 2 2
(x)2 + (x)3 + . . .
(1x) 2 = 1 + 1 (x) + 2 3
2 n
P
= n (x)
n=0
2
= (1)n (n + 1)
n
1
= 1 + 2x + 3x 2 + 4x 3 + = (n + 1)x n .
P
(1x)2
n=0
Arash Rafiey Generating Functions
In how many ways we can select, with repetitions allowed, r
objects from n distinc objects?
Arash Rafiey Generating Functions
In how many ways we can select, with repetitions allowed, r
objects from n distinc objects?
We have f (x) = (1 + x + x 2 + x 3 + . . . )n and we look for
coffiecent of x r .
Arash Rafiey Generating Functions
In how many ways we can select, with repetitions allowed, r
objects from n distinc objects?
We have f (x) = (1 + x + x 2 + x 3 + . . . )n and we look for
coffiecent of x r .
1 n 1 n+i1 i
(1 + x + x 2 + x 3 + . . . )n = ( 1x
P
) = (1x) n = i x
n=0
Arash Rafiey Generating Functions
Exercise
A company hires 11 new epmployees, each assigned to one of four
subdivitions.
Each subdivition will get at least one new employee.
In how many ways can these assignments be made ?
Arash Rafiey Generating Functions
Exercise
A company hires 11 new epmployees, each assigned to one of four
subdivitions.
Each subdivition will get at least one new employee.
In how many ways can these assignments be made ?
A,B,C,D subdivitions, we can count the number of 11-letter
sequences in which there is at least one occurence of each of
letters A,B,C,D.
Arash Rafiey Generating Functions
Exercise
A company hires 11 new epmployees, each assigned to one of four
subdivitions.
Each subdivition will get at least one new employee.
In how many ways can these assignments be made ?
A,B,C,D subdivitions, we can count the number of 11-letter
sequences in which there is at least one occurence of each of
letters A,B,C,D.
x2 x3 x4
f (x) = (x + 2! + 3! + 4! + . . . )4
Arash Rafiey Generating Functions
Exercise
A company hires 11 new epmployees, each assigned to one of four
subdivitions.
Each subdivition will get at least one new employee.
In how many ways can these assignments be made ?
A,B,C,D subdivitions, we can count the number of 11-letter
sequences in which there is at least one occurence of each of
letters A,B,C,D.
x2 x3 x4
f (x) = (x + 2! + 3! + 4! + . . . )4
f (x) = (e x 1)4 = e 4x 4e 3x + 6e 2x 4e x + 1
Arash Rafiey Generating Functions
Exercise
A company hires 11 new epmployees, each assigned to one of four
subdivitions.
Each subdivition will get at least one new employee.
In how many ways can these assignments be made ?
A,B,C,D subdivitions, we can count the number of 11-letter
sequences in which there is at least one occurence of each of
letters A,B,C,D.
x2 x3 x4
f (x) = (x + 2! + 3! + 4! + . . . )4
f (x) = (e x 1)4 = e 4x 4e 3x + 6e 2x 4e x + 1
The answer is the coefficient of x 11 /11! in f (x).
Arash Rafiey Generating Functions
Exercise
A company hires 11 new epmployees, each assigned to one of four
subdivitions.
Each subdivition will get at least one new employee.
In how many ways can these assignments be made ?
A,B,C,D subdivitions, we can count the number of 11-letter
sequences in which there is at least one occurence of each of
letters A,B,C,D.
x2 x3 x4
f (x) = (x + 2! + 3! + 4! + . . . )4
f (x) = (e x 1)4 = e 4x 4e 3x + 6e 2x 4e x + 1
The answer is the coefficient of x 11 /11! in f (x).
4
4
411 4(311 ) + 6(211 ) 4(111 ) = (1)i (4 i)11 .
P
i
n=0
Arash Rafiey Generating Functions