Power Point DM Unit-4 - Part-1
Power Point DM Unit-4 - Part-1
Unit-4
Advanced Counting Techniques
Generating Functions
Definition.
Let A= n n 0 = a0 , a1 , a2 , , an ,
{a }
be the sequence. Then its generating function is
defined to be
A x a n x n a0 a1 x a 2 x 2
n0
Example
n
The generating function of the sequence {3 } is n 0
A x 1 3 x 3 x 3 x 3 x
2 2 3 3 n n
Problem
Find the generating function of the sequence
(1,1,1,1,1,1)
Solution
Ax 1 1x 12 x 2 13 x 3 14 x 4 15 x 5
Ax 1 x x 2 x 3 x 4 x 5
Closed form expressions for generating functions
Problem
Find the closed form expression for the generating
function of the sequence
an 4 , n 0
Solution
The generating function of the sequence is
Ax 4 4 x 4 x 2 4 x 3 4 x n
Ax 4(1 x x x x )
2 3 n
= 41 x
1 4
1 x
Problem
Find the generating function of the following
sequence 0,1,2,3, -------
Solution
Generating function is
0 1 x 2 x 3 x
2 3
x(1 2 x 3 x )
2
x 1 x
2 x
1 x 2
Problem
Find the generating function of the following
sequence
12 , 2 2 , 32 , 4 2
Solution
we have
x
1x 2 x 3 x
2 3
1 x 2
Differentiating both sides with respect to ‘x’
1 2 (2 x) 3(3 x 2 )
d x
dx
1 x 2
1 x 1 x 21 x 1
2
1 x 4
1 x 1 x 2 x
1 x 4
1 x
1 x 3
1 2 (2 x) 3(3 x )
2
1 x
(1 x) 3
n Cr 1 n r 1Cr
r
Result
n r 1C
1 x n Cr x 1
n r
r
r xr
r 0 r 0
1 x n n r 1Cr x r
r 0
Calculating coefficient of generating function
Problem
27
Find the coefficient of x in
x 4
x x
5 6
5
Solution
We have x x x =
4 5 6
5
x 1 x x x =
4 5 2 3 5
n r 1Cr x r
1 x
n
r 0
we get x 20
r 0
5 r 1 Cr x r
x
20 4 r Cr x r
r 0
4 r Cr x 20 r
r 0
27
x so
we have to find coefficient of
Take 20+r =27, then r=7
the coefficient of x 27 is
4 7 C 7 11 C7
11!
330
7!4!
Problem
20
x
Find the coefficient of in
x x 2 x x x x x
2 3 4 2 3 4 5
Solution
We have
x x 2x x2 3 4
x 2
x x
3 4
5
x 1 x 2x x 2 3
x 1 x x
2 5 2
5
x11 1 x 2 x 2 x 3 1 x 1 5
x11 1 x 2 x 2 x 3 1 x 5
1 x 2 x 5 r 1C
x 11 2
x 3
r xr
r 0
20
x
coefficient of in
x x 2
2x x
3 4
x 2 3 4
5
x x is
4 9 C 9 4 8 C 8 2 4 7 C 7 4 6 C 6
where 0r n
under the constraint that
e1 can take the integer values
a11 , a12 , a13
f1 x x a11
x a12
x a13
f 2 x x a2 1 x a2 2 x a2 3
---------------------
fn x x a n1
x an 2
x an 3
and consider f x as
f x f1 x f 2 x f n x
r
and determine the coefficient of x in this
function.
This coefficient happens to be the number of
solutions that we desired to find.
that is
f ( x) x1 x 2 x3
x x x
1 2 3
x x x
1 2 3
f ( x) x x x
3
1 2 3
Problem
Using generating function find the number of
for i 1, 2, 3, 4
The generating function for the number of non
–negative integer solution is
f ( x) f 1 x f 2 x f 3 x f 4 x
f (x) 1 x x 2 x 3
1 x x x
2 3
1 x x x
2 3
1 x x x
2 3
1 x x x
2 3 4
1 x
1 4
1 x
4
by using the result
1 x n r 1C
n
r xr
r 0
we get
1 x 4 4 r 1 Cr x r
r 0
3 r Cr x r
r 0
x r x 25 r 25
Taking we get
x 25
The coefficient of is
3 25 C 25 28 C25
28!
3276
25!3!
Thus, the given equation has 3276 non negative
integer solutions
2)In the case of positive integer solutions,
for i 1, 2, 3, 4
The generating function for the number of
positive integeral solutions is
f ( x) f 1 x f 2 x f 3 x f 4 x
f (x) x x 2 x 3 x 4
x x x x
2 3 4
x x x x
2 3 4
x x x x
2 3 4
x x x x
2 3 4 4
x 1 x x x
4
4 2 3
x 4
1 x 1 4
x 4
1 x
4
by using the result
1 x n n r 1Cr x r
r 0
we get
4 r 1C
x 4 1 x
4
x 4
r x r
r 0
3 r C
4 r
r x
r 0
take 4+r=25
which gives r = 25-4 = 21
x 25
The coefficient of is
3 21 C 21 24 C21
24!
2024
21!3!