P1:
Solve the recurrence relation = for = , , , … and with initial
condition = by using generating function.
Solution:
∞
Let be the generating function for the sequence ,
∞
. ., = ∑a
k =0
k xk .
Multiplying the recurrence relation by
−3 =0
∞ ∞
k +1
⟹ ∑a
k =1
k x −3 ∑a k =1
k −1 x k = 0.
⟹ − −3 =0⟹ 1−3 =
∞ ∞
. ., 1−3 =2⟹ =
!"
=2 ∑3
k =0
k
x k
∵
$"
= ∑a
k =0
k
xk
Thus, = 2. 3
P2:
Using generating functions, solve the recurrence relation
= − , = and = .
Solution: The given recurrence relation is
=6 −9 , = 2, =3
Let ( ) be the generating function the sequence ∞
"
. ., ( )=!
⟹ =6 −9
" " "
⟹! =6 ! −9 !
⟹ ( )− + =6 ( ( )− )−9 ( )
⟹ ( ) − 3 − 2 = 6 ( ( ) − 2) − 9 ( )
⟹ ( )(1 − 6 − 9 ) = 3 + 2 − 12 = 2 − 9
2−9
∴ ( )=
1−6 −9
Now,
2−9 2−9 ' (
= = +
1−6 −9 (1 − 3 ) 1−3 (1 − 3 )
Therefore, 2 − 9 = '(1 − 3 ) + (
⟹ ' + ( = 2, −3' = −9 ⟹ ' = 3, ( = −1
Thus,
3 1
( )= −
1−3 (1 − 3 )
. .,
∞ ∞ ∞
! = 3!3 − !() + 1)3
Equating the coefficients of on both sides
=3 *
− () + 1)3 = 3 (2 − ))
∴ = 3 (2 − )), ) = 0,1,2, …
P3:
Solve the recurrence relation = + , = using generating
function.
Solution: We have the recurrence relation
=2 + 1, =1
The initial condition = 1, yields = 0. ( = 1 ⟹ =2 +1⟹ = 0)
Let ( ) be the generating function for the sequence ∞
. .,
( )=
=2 +1⟹ =2 +
⟹ =2 +
⟹ ( )− =2 + −1
⟹ ( )=2 + −1=2 ( )+ −1
1
⟹ (1 − 2 ) ( ) = −1=
1− 1−
⟹ ( )=( ⟹ ( )= − ( by the method of partial fractions)
! )( ) !
= 2 − = (2 − 1)
Thus,
= 2 − 1, = 0,1,2, …
P4:
Solve the recurrence relation
− + = , = , , ,…, = , =
using generating function.
Solution: We have the recurrence relation
−5 +6 = 2, = 0,1,2, … , = 3, =7
Let ( ) be the generating function for the sequence ! "$# , %. '.,
$
( )=(
#
Multiply the recurrence relation by we get
−5 +6 =2
$ $ $ $
⟹( −5( +6( = 2(
# # # #
$ $ $ $
⟹( −5 ( +6 ( =2 (
# # # #
1
⟹ ( )− − −5 ( ( )− )+6 ( )=2
1−
2
⟹ ( )(1 − 5 + 6 ) − 7 − 3 + 15 =
1−
2
⟹ ( )(1 − 5 + 6 )= +3−8
1−
2 3−8
⟹ ( )= +
(1 − )(1 − 5 + 6 ) 1−5 +6
2 + (3 − 8 )(1 − )
=
(1 − )(1 − 5 + 6 )
$
10 − 11 + 3 (5 − 3)(2 − 1)
⟹( = =
(1 − )(1 − 2 )(1 − 3 ) (1 − )(1 − 2 )(1 − 3 )
#
3−5 2 1
= = + ( ,- %.!)
(1 − )(1 − 3 ) 1 − 3 1−
$ $
= 2(3 +(
# #
Equating the coefficients of on both sides we get
= 2. 3 + 1, = 0,1,2, …
4.6
Generating Functions:
, . ., , , , … , , … of real
Generating function for a sequence: The generating function (or ordinary
generating function) for the sequence
number is the infinite series
= + + +⋯+ … … 1
. ., =
Example 1: The generating functions for the sequences with
i. = 3, ii. = ! + 1 and iii. = 2 are
Solution:
∞ ∞ ∞
i. ∑ 3 x n
, ii. ∑ ( n + 1) x n
and iii. ∑ 2n x n
n =0 n =0 n =0
respectively.
Generating functions for a finite sequence:
Define the generating function of a finite sequence , , , … , of real
numbers by extending it by setting # = 0 for % = ! + 1, ! + 2, … .
The generating function of this infinite sequence is a polynomial of
degree !, since no terms of the form # & with % > ! ocuurs, . .,
#
( & = + &+ & + ⋯+ &
, , , , , .
Example 2: Write down the generating function for the finite sequence
Solution: The generating function for 1,1,1,1,1,1 is
( & = 1 + & + & + &) + &* + &+
= 1 + & + & + & ) + & * + & + , when & ≠ 1. Therefore,
, -.
,.
Note that
( & = is the generating function for the sequence 1,1,1,1,1,1.
, .
-
,.
Note: The RHS of the equation 1 is a formal power series in &. The letter & does
not represent any thing. The various powers & of & are simply used to keep track
of the corresponding terms of the sequence. The convergence/divergence of
the series is of no interest to us (at present).
Example 3: Let 0 be a positive integer and let = Ck , 1 = , , , … , 0.
m
1
What is the generating function for the sequence , ,… 0 ?
Solution: The generating function for the finite sequence , , ,…, is
( & = + &+ & +⋯+ 2&
2
= mC + mC & + mC & +, . . + mC m & 2
0 1 2
= 1+& 2
Example 4:
i. 3 & = 1 + 2& + 3& + ⋯ + ! + 1 & + ⋯ is the generating function for
the sequence ! of positive integers.
ii. The function 4 & = is the generating function for the sequence 1,1,1, …
.,
= 1 + & + & + ⋯ for |&| < 1.
.,
since
iii. The function ℎ & =
.8,
is the generating function for the sequence
1, , , )
, … ,since =1+ &+ & + & + ⋯ when | &| < 1 or
) )
.8,
|&| < , ≠ 0.
|8|
Equality of generating functions:
Two generating functions 3 & = and 4 & =
∞ ∞
n
∑ an x ∑ bn x n are equal if
= 9 ∀! = 0,1,2, …
n =0 n =0
Addition and Multiplication of generating functions:
Let 3 & = ∑ an x and 4 & =
∞ ∞
n
∑ bn x n be two generating functions. Then
n =0 n =0
; +< = +=
; < = > ? = .? @
?
Example 5: Let ; = , , , … in the expansion
.
. Find the coefficients
of ; =
∞
∑ an x n .
n =0
Solution: We have 4 & = =1+&+& +⋯=
∞
.,
∑ an x n
n =0
Now:
1 1 1
3 & = = . =B & CB &2C
1−& 1−& 1−&
2
= > D 9 .D @ & = > 1.1@ &
D D
= > 1@ & = !+1 & ∵ 1=!+1
D D
Therefore, the coefficients of 3 & are = ! + 1, ! = 0,1,2, …
Extended binomial coefficients:
Let F be a real number and % be a nonnegative integer. Then the extended
H
binomial coefficients G I is defined by
1
H H− H− … H−1+
H ;1>0
G I=J 1! M
1
;1≤
Example 6:
−2
(i). G I= = = −4
. . . . . . .) .*
3 )! )!
Q Q Q Q Q Q S T
G IG . IG . IG .)I G IG. IG. IG. I
(ii). O P = = =−
R R R R R R R R +
4 *! *! U
parameter is a negative integer. If the top parameter F is a negative integer then
The following is a useful formula for extended binomial coefficients when the top
the extended binomial coefficient can be expressed in terms of an ordinary
binomial coefficient.
Theorem 1: If is a positive integer then
−
G I= − V n + r −1
V
Cr
Proof:
−! −! −! − 1 −! − 2 … −! − W + 1
G I=
W W!
! !+1 !+2 … !+W−1
= −1 X
W!
!+W−1 !+W−2 … !+1 !
= −1 X
W!
!+W−1
= −1 X
G I
W
= −1 X n + r −1
Cr
The extended binomial Theorem
Let be a real number with | | < 1 and let H be a real number. Then
H
+ = G I
∞
H 1
1
1
Remark: If F is a positive integer, the extended Binomial Theorem reduces to
F
Binomial Theorem, (since G I = 0 if % > F).
%
Example 7: Find the generating functions for + . and − .
where
is a positive integer, using the extended Binomial theorem.
Solution: By the extended Binomial Theorem, we have
−!
1+& .
= G I &#
%
#
= −1 # ( n + k −1)C & #
#
k
Thus, the generating function for 1 + & .
is
−1 # ( n + k −1)C & #
#
k
Replacing & by – &, we get the generating function for 1 − & . It is given by
−1 # ( n + k −1)C −& #
= ( n + k −1)C & #
# #
k k
Summary of some generating functions for certain sequences
1 :Generating for the sequence 1 1
1 & & &)
%! = 1+&+ + +⋯ = ,
%! 2! 3!
#
−1 #Z # & &)
−1 #Z & = & − + − ⋯ = [! 1 + &
%! 2! 3!
% #
1
1 &# = 1 + & + & + ⋯ =
1−&
#
1
# # #
& =1+ &+ & +⋯=
1− &
#
1 if W|%; 0 otherwise 1
& X# = 1 + & X + & X
+⋯=
1 − &X
#
1
%+1 (% + 1)& # = 1 + 2& + 3& + ⋯ =
(1 − &)
#
1
( n + k −1)C & # = 1 + nC & + ( n +1)C & + ⋯ =
( n + k −1)C k 1 2 (1 − & )
k #
( n + k −1)C 1
(−1) & # = 1 − nC & + ( n +1)C & −⋯=
(1 + &)
(−1)# ( n + k −1)C #
k 1 2
k
1
( n + k −1)C &# ( n + k −1)C & = 1 + nC ( &) + ( n +1)C
# # ( &) + ⋯ =
k k 1 2 (1 − &)
#
1 , if % ≤ !; 1−& Z
0 , otherwise &# = 1 + & + & + ⋯ + & =
1−&
#
C k & = 1 + nC 1 & + nC 2 & + ⋯ = (1 + &)
#
n
Ck n
#
#
& = 1 + nC & + nC ( &) + ⋯ = (1 + & )
# #
n
Ck n
Ck 1 2
#
Counting problems and Generating Functions
Generating functions can be used to solve a wide variety of counting problems.
Example 8: Find the number of solutions of
+ + ] = ^
where , and ] are nonnegative integers with ≤ ≤ _, ] ≤ ≤ ` and
a ≤ ] ≤ ^.
Solution: The number of solutions with the given constraints is the coefficient of
& b in the expansion of
(& + & ) + & * + & + )(& ) + & * + & + + & c )(& * + & + + & c + & b )
This is so, since we obtain a term equal to & b
in the product by taking a term in
the first sum & dQ , a term in the second sum & dR and a term in the third sum & dS ,
where the exponents , and ) satisfy the equation (1) and the given
constraints.
The coefficient of & b in this product is 1 + 1 + 1 = 3
(The products & * & c & b , & + & + & b , & + & c & c )
Proving Identities using Generating Functions
Example 9: Use generating function to show that
1
( )
n
Ck = 2n
Cn
where is a positive integer?
Solution: Note that by the Binomial Theorem 2n
Cn is the coefficient of & in
(1 + &) , now
(1 + &) = (1 + &) (1 + &)
= ( nC + nC & + nC & + ⋯ nC n & )
0 1 2
Equating the coefficient & on both sides ,we get
2n
Cn = nC . nC n + nC . nC + nC . nC + ⋯ + nC n . nC
0 1 n−1 2 n−2 0
= nC . nC + nC . nC + nC . nC + ⋯ + nC n . nC n
0 0 1 1 2 2
( ∵ nC r = nC )
r−1
=
1
( )
n
Ck
Hence the result.
Solving recurrence relations using generating functions
Example 10: Solve the Fibonacci recurrence relation
e =e . +e . , e =e =
by using generating function.
Solution: We have the recurrence relation
f =f . +f . ,f = f = 1
Put ! = 2 then f = f + f ⟹ f = 0
Let ((&) be the generating function for the sequence f , i.e,
( (& ) = f&
f =f . +f . ⟹f& =f . & +f . &
f& =& f . & .
+& f . & .
⟹ ( (& ) − f & − f = &(( (& ) − f ) + & ( (&)
⟹ ( (& ) − & = &( (& ) + & ( (&)
⟹ ( (& )(1 − & − & ) = &
&
⟹ ( (& ) =
1−&−&
Now, 1 − & − & = (1 − h &)(1 − i&), where h + i = 1, hi = −1.
Z√+ .√+
. ., h = ,i =
& & k l
= = +
1−&−& (1 − h & )(1 − i&) 1 − h & 1 − i&
⟹ & = k(1 − i& ) + l(1 − h& ) = (k + l) − (ik + hl)&
⟹ k + l = 0, ik + hl = −1
Solving we get, k = = −l(do it!)
√+
Thus,
1 1 1
((&) = n − o
√5 1 − h& 1 − i&
. .,
1 1
f& = p h & − i & q= B (h − i )& C
√5 √5
Equating the coefficients of & on both sides we get
1
f = (h − i )
√5
Z√+ .√+
. ., f = nG I −G I o
√+
This is called Binnet Formula for e .
Example 11: Solve the recurrence relation
=r . + .
, =s
by using generating function.
Solution: Let ( (& ) = ∑a n x n be the generating function for the sequence
n=0
∞
. Putting ! = 1, in the given recurrence relation we get
=8 +1⟹9=8 +1⟹ =1
Multiply the given recurrence relation by & , we get
& =8 . & + 10 .
&
Sum both sides starting from ! = 1
& =8 . & + 10 .
&
⟹ ( (& ) − = 8& . & .
+& 10 .
& .
⟹ ( (& ) − 1 = 8& & +& 10 &
= 8&( (& ) + & 10 &
&
= 8&( (& ) +
1 − 10&
& 1 − 9&
⟹ (1 − 8&)( (& ) = 1 + =
1 − 10& 1 − 10&
1 − 9& 1 1 1
⟹ ( (& ) = = v + w
(1 − 8&)(1 − 10&) 2 1 − 8& 1 − 10&
1
= B 8 & + 10 & C
2
1
= (8 + 10 ) &
2
Therefore, = (8 + 10 )
Example 12: Solve the recurrence relation
−] . = , ∈ y, =
by using generating function.
Solution: We have the generating function
−3 . = !, ! ∈ y, =1
Let ((&) be the generating function for the sequence . .,
( (& ) = &
Now,
−3 . =!⟹ & −3 . & = !&
⟹ & −3 . & = !&
⟹ ( (& ) − − 3& . & .
= !&
⟹ ( (& ) − 1 − 3&((&) = !&
⟹ ( (& )(1 − 3&) − 1 = & + 2& + 3& ) + ⋯ = &(1 + 2& + 3& + ⋯ )
1
= &.
(1 − &)
,
⟹ ( (& ) = + … (1)
( .),)( .,)R .),
& k l z
= + +
(1 − & ) (1 − 3&) 1 − & (1 − &) 1 − 3&
⟹ & = k(1 − & )(1 − 3& ) + l(1 − 3&) + z(1 − &)
Put & = 1, 1 = l(−2) ⟹ l = −
* )
Put & = , = z. ⟹ z =
) ) { *
Put & = 0, 0 = k + l + z ⟹ k = −(l + z ) = −
*
& 1 1 1 1 3 1
∴ =− − +
(1 − &) (1 − 3&) 4 1 − & 2 (1 − &) 4 1 − 3&
From (1)
1 1 1 1 7 1
( (& ) = − +
4 1 − & 2 (1 − &) 4 1 − 3&
1 1 2+!−1 7
& =− & − G I& + 3 &
4 2 ! 4
Equating the coefficients of & on both sides we get
1 1 7 1 (! + 1) 7
= − − ( n + 1)C n + 3 = − − + 3
4 2 4 4 2 4
3 ! 7
=− − + 3
4 2 4
Generating functions can be used to solve a system of recurrence relation.
Example 13: Solve the following system of recurrence relations using the
method of generating functions
Z = −2 − 49 , … (1)
9 Z =4 + 69 , … (2)
! = 0,1,2, … ; = 1, 9 = 0.
Solution: Let f(&) and ((&) be the generating functions for the sequence
and 9 respectively. Form the equations (1) and (2), when
! = 0,1,2, …
Z & Z
= −2 & Z
− 49 & Z
9 Z & Z
=4 & Z
+ 69 & Z
⟹ Z & Z
= −2& & − 4& 9 &
9 Z & Z
= 4& & + 6& 9 &
⟹ f (& ) − = −2&f (& ) − 4&((&)
( (& ) − 9 = 4&f (& ) + 6&((&)
⟹ (1 + 2&)f (& ) + 4&((& ) = 1 …(3)
4& f (& ) − (1 − 6&)((& ) = 0 … (4)
Solving for f (& ), we get
.c,
f (& ) = (
. ,)R
(do it!)
.c, • €
Now,
( . ,)R
= . ,
+( . , )R
. ., 1 − 6& = k(1 − 2&) + l ⟹ k + l = 1, l = −2 ⟹ k = 3, l = −2
Hence f (& ) =
3
1−2&
− 2
(1−2&)2
=3 2 & −2 (! + 1)2 &
= (3.2 − 2(! + 1)2 )&
∞ ∞
= 2! (1 − 2!)&! = !&
!
!=0 !=0
*, *,
From (4), we have ( (& ) = f (& ) = (
.c, 1−2&)2
*, 2 2
=− +
(1−2&)2 (1−2&)2
( do it! )
1−2&
Now,
= −2 2 & +2 (! + 1)2 &
= 2 (−2 + 2! + 2)&
= 2 (2!)& = !. 2 Z
& = 9 &
Thus , = 2 (1 − 2!), 9 = ! 2 Z
.