Professional Documents
Culture Documents
r 0
For example
1 Is generating function
for sequence
1 x 1,1,1,…………………..
1
1 x
is generating function
for sequence
1,-1,1,-1,… (-1)r+1,………
m m!
C (m, r ) ,
r r! (m-r)!
0! 1
(1+x) -m
= 1-mx+(-m(-m-1)/2)x2 +….
+[(-m)(-m-1) (-m-r+1)]/r!)xr
+……………….
m 1 r
( x)
r
r 0 r
n
n 1 r r
(1 x)
r 0 r
x
7 article 3.1 : If we are given
integers from 1 to 34 find the
number of ways of selecting 3
nonconsecutive integers through
generating function.
Solution :manual not simple
Can generating function help
Let numbers be q1 , q2 , q3
number of integers
between q1 & q2
X1 +X2 + X3 + X4 + X5 =20
Where
0 X2 3, 0 X3 3, 0 X4 3
If A(x)=
(1+x+……+x20)2 (1+x+x2+x3 )3 ?
Shifting property of
generating functions
If A(x) generates the sequence
(q0, q1,…, qn,………………)
Then xA(x) generates the sequence
(0,q0, q1,…, qn,………………)
Then x2 A(x) generates the sequence
(0,0,q0, q1,…, qn,………………)
Then x3 A(x) generates the sequence
(0,0,0, q0, q1,…, qn,………………)
think : Write the generating
function for sequence defined as
{qr }= { r} sequence
0,1,2,3,4,………..
1
1 7 x 10 x 2
Through partial fractions
1 1
1 7 x 10 x 2
(1 2 x)(1 5 x)
A C
1 2x 1 5x
2 1 5 1
(1 2 x) (1 5 x)
3 3
2 5
2x 5x
r r
3 r 0 3 r 0
2 5
2x 5x
r r
3 r 0 3 r 0
Ans :
qr = (5/3) 5 - (2/3) 2
r r
Q. 4 (vii) Write the generating
function for sequence defined
as qr = r2
A( x) r x r x [r(r 1)-r]x
2 r 2 r r
r 0 r 1 r 1
A( x) [(r 1)(r 2)-(r 1)]x r 1
r 0
A( x) [(r 1)(r 2)-(r 1)]x r 1
r 0
x [(r 1)(r 2)x ]-x (r 1)x
r r
r 0 r 0
r 2 r
r 1 r
x [2 x ]-x x
r 0 r r 0 r
A( x) x [(r 1)(r 2)-(r 1)]x r
r 0
r 2 r
r 1 r
A( x) x [2 x ]-x x
r 0 r r 0 r
2x 2
3
x (1 x )
(1-x)
2x-x(1-x) x(1 x)
3
3
(1-x) (1-x)
How to find generating
function of r ?
3
(iii) (r+1) r(r-1)=r3 -r
Solution:A(x) (r 1)r(r-1)x r
0
(r 1)r(r-1)x r
2
(r 3)(r 2)(r 1)x r 2
0
2
6x
4
(1-x)
(iii) (r+1) r(r-1)=r3 -r
x
0 r x (1-x)2
r
12
Q.7 Find the coefficient of x in
1-x x x
4 7 11
5
(1-x)
5 5 1 r r
(1 x)
r 0 r
x
1-x x x
4 7 11
5
(1-x)
5 1 r r
(1-x x x )
4 7 11
x
r 0 r
4 r r 4 r r 4
x x
r 0 r r 0 r
4 r r 7 4 r r 11
x x
r 0 r r 0 r
4 r r 4 r r 4
x x
r 0 r r 0 r
4 r r 7 4 r r 11
x x
r 0 r r 0 r
Coefficient of x12 is
16 12 9 5
12 8 5 1
13
Q.8 (ii) Find the coefficient of x in
1 x x 2
x
3 10
1 x
4 10
(1` x)10
10 10 4 r 10 1 s s
( x ) x
r 0 r s 0 s
10 10
9 s s
(1) x
r 4r
x
r 0 r s 0 s
x x ........ x
20 21 45
(1 x ) (1 x ) (1 x )
16 15 26
x 31
(1 x) (1 x) (1 x)
3 1 r r
x (1 x )(1 x )(1 x )
31 16 15 26
x
r 0 r
(1 x ) (1 x ) (1 x )
16 15 26
x 31
(1 x) (1 x) (1 x)
3 1 r r
x (1 x )(1 x )(1 x )
31 16 15 26
x
r 0 r
3 1 r r
( x x )(1 x )(1 x )
31 47 15 26
x
r 0 r
3 1 r r
( x x -x x )(1 x )
31 46 47 62 26
x
r 0 r
3 1 r r
( x x -x powers of x 50)
31 46 47
x
r 0 r
3 1 r r
( x x -x x )(1 x )
31 46 47 62 26
x
r 0 r
3 1 r r
( x x -x powers of x 50)
31 46 47
x
r 0 r
21 5 6
19 3 4
4 Find a recurrence relation to
find number of way put flags on a “n”
meter length pole taking help of
four type of flags red blue black &
orange, red flags of 2 meter and
rest other three color flags of
1 meter.
?: Let qn represent the number of ways to
arrange flags on pole of length n
Solution. We partition the set of all such
ways into two types –
I: those that end with red color,
II :those that end with other 3 colors
for of type I : rest of flags are to be put for
length n − 2 ,i.e qn−2 ways as red flag is
of 2 feet.
r 1
Solved in book ?
The second-degree linear
homogeneous recurrence
relation with constant
coefficients , general form is ,
r0qn+r1qn-1+r2qn-2=0, n2.
r2 0 r0 0
where q0 & q1 are known
First order Linear inhomogeneous
recurrence relation and generating
function
tested : Solve the recurrence
relation
qr-2qr-1+qr-2 , = 2r+r, r≥2 ,
q0=0=q1
With the help of generating
functions.
qr-2qr-1+qr-2 = 2r+r, r2
2
q r x -2 q r-1 x q r-2 x
r
2
r
2
r
2 x rx ,
r r r
2 2
(A(x)-q 0 -q1x )-2x
1
qr x x
r 2
0
qr x r
2 x -1-2x rx -x
r r r
0 0
A(x)-2x(A(x)-q0 ) x A(x) 2
1 2
(1 2 x) (1 3x) x(1 x)
A(x)(1-2x x ) 2
1 2
(1 2 x) (1 3x) x(1 x)
A(x)
1 2 2 4
(1 2 x) (1 x) (1 3x)(1 x) x(1 x)
Now find partial fractions of
(1-2x)-1(1-x)-2
1 L C M
(1 2 x)(1 x) 2
(1 2 x) (1 x) (1 x) 2
we find
1 4 2 1
(1 2 x)(1 x) 2
(1 2 x) (1 x) (1 x) 2
1 2 4
A( x) (1 3x)(1 x) x(1 x)
(1 2 x)(1 x) 2
4 2 1 1 3x x
(1 2 x) (1 x) (1 x) (1 x) (1 x)
2 2 4
4 2 2 3x x
(1 2 x) (1 x) (1 x) (1 x) (1 x)4
2 2
A( x) (4)2 x - 2x 2 (r 1)x 3 (r)x
r r r r r
0 0 0 0
4-1 r r 1
x
0 r
A( x) (4)2 x - 2x 2 (r 1)x 3 (r)x
r r r r r
0 0 0 0
4-1 r r 1
x
0 r
4-1 r r 1
2 r r
0 r x x
r 1 r-1
(r 2)(r 1)r r
x
r 1 6
(r 2)(r 1)r r
x
r 0 6
A( x) (4)2 x - 2x 2 (r 1)x 3 (r)x
r r r r r
0 0 0 0
(r 2)(r 1)r r
x
r 0 6
r (r 1)(r 2)
q r 4(2) 2 2(r 1) 3r
r
6
r (r 1)(r 2)
4(2) 4 5r
r
6
Thm : Generating function A(x) for solution
of degree three linear homogenous recurrence
relation with constant coefficients
q n r1q n-1 r2 q n-2 r3q n-3 0 , n 3
q 0 (q1 r1q 0 ) x (q 2 r1q1 r2 q 0 ) x 2
is A(x)
1 r1x r2 x r3 x
2 3
Q.10 Solve the divide & conquer 10
8 Solve relation qn=qn/2+2n-1, n2,
q1=1,For n=2r
Q 2 -Q1 2 -1,
3
...(2) Qr=4(2r-1)-r+1
Q 3 -Q2 2 -1,
4
...(3)
r 1
Q r -Q r-1 2 -1, ...(r) Add all we get
r 1
Q r -Q0 2 2 ...........2 -r
2 3
r 1
Q r -1 2 2 ...........2 -r
2 3
Qr=4(1+2+…….2r-1)-r+1
Q r 4(2) 3 ( r )
r
q 2r 4(2) 3 ( r )
r
q n 4n 3 log 2 n for n 2 r
Method of Characteristic
polynomial roots to solve linear
homogenous recurrence relation
The second-degree linear
homogeneous recurrence relation
with constant coefficients
qn+r1qn-1+r2qn-2=0, n2. r20
If we take qn=cn ,c0 , 0
then we get c n-2 ( 2+r1+r2 )=0
C()2+r1+r2=0
C() is called characteristic
polynomial of recurrence relation
C()2+r1+r2=0
C() is called characteristic polynomial
of recurrence relation
qn+r1qn-1+r2qn-2=0, n2.
The roots 1, 2 of this equation are called
characteristic roots.
Three possibilities for the roots:
(1) distinct real roots,
(2) repeated real roots,
(3) complex roots
qn+r1qn-1+r2qn-2=0, n2. -------(a)
Characteristic polynomial
2+r1+r2=0 -----------(i)
(I ) 1 & 2 are real and distinct roots
Then qn= 1(1 )n+ 2(2 )n
is general solution of (a) , where
1 & 2 are arbitrary constants.
(II) If 1 = 2 = is double root of
(i)
Then qn= 1( )n+ 2 n( )n
is general solution of (a)
Third degree linear
homogenous recurrence
relation
qn+ r1 qn-1+ r2 qn-2+ r3 qn-3 =0,n3, r30
---------(*)
Characteristic equation is
3+r12+r2 + r3 = 0 --------(i)
Different possibilities
(I ) 1 , 2 and 3 are real and
distinct roots of (i)
Then qn=L(1 )n+C(2 )n +M(3 )n
is general solution of (*)
(II) 1 is a double root & 2 is
a simple root of (i) Then
qn=L(1 )n+ C n(1 )n +M(2 )n
Is general solution of (*)
(III) 1 = 2 = 3 = is root of
multiplicity 3 of characteristic
polynomial (i), then
qn=L( ) +C
n n( )n +M n ()
2 n
and q0=2.
The solution for qr-3qr-1=0
C()= -3
=3 is root, qr(h)=A(3r)
Now f(r)=5 (7r)
=7 , C(7)0
(Hence qr(p)= D 7r
qr(p) -3 qr-1(p)=5(7r)
D 7r -3 D 7r-1 =5(7r) D= 35/4
The particular solution is
qr(p)=(5/4)7r+1.
The general solution to the problem is
qr= A(3r)+ (5/4)7r+1
Finally, we have q0=2 A=-(27/4)
qr= -(1/4)(3r+3)+ (5/4)7r+1
Simple: Find the form of particular
solution qn(p) (do not solve for constants)
qn = A+Cn+2n2
4 : Solve the recurrence relation
qr-5qr-1+6qr-2 , = 4r-2 r≥2 ,
q0=1,5=q1
(i)first taking help of generating
functions
(ii) taking help of undetermined
Coefficients
qr-5qr-1+6qr-2 = 4r-2
2
q r x -5 q r-1 x 6 q r-2 x 4 x
r
2
r
2
r
2
r-2 r
2
q r x -5x q r x 6 x
r
1
r 2
0
qr x x
r 2
0
4xr r
2
x
(A(x)-q 0 -q1x)-5x(A(x)-q 0 ) 6 x A( x) 2
1 4x
2
x
A( x)(1 5 x 6 x )
2
1 q 0 1& q1 5
1 4x
1 x2 4x L M C
A( x)
(1 4 x)(1 2 x)(1 3x) 1 4 x 1 2 x 1 3x
1 x 4 x L(1 2 x)(1 3x) M (1 4 x)(1 3x) C (1 2 x)(1 4 x)
2
1 3 2
A( x)
2(1 4 x) 2(1 2 x) (1 3x)
1 r r 3
A( x) 4 x - 2 x 2 (3 )x
r r r r
2 0 2 0 0
1 r r 1
q r (4) 3(2 ) 2(3 )
r
2
tested : qn -3qn-1+2qn-2 =n2n
n2
solve for q0 =q1 =1
Solution : homogenous equation
qn-3qn-1+2qn-2 = 0
C()= 2 -3+2=(-2) (-1)
qn(p)=(0 + 1n)n2n
qn(p) -3 qn-1(p)+ 2qn-2(p) = n2n
(0 + 1n)n2n-3{0+ 1(n-1)}(n-1) 2n-1
+2 {0 + 1(n-2)}(n-2) 2n-2=n2n
4 1 =4 1 =1
& 20 +2 1 =0 0 = -1
qn(p)=(-1+n)n2n
qn = C(2n)+ D +(-1+n)n2n
q0 = C+ D=1
q1 = 2C+ D =1 i.e C=0 &
D=1
qn = 1 +(-1+n)n2n
tested: Find particular solution to the recurrence
relation qn-3qn-1+2qn-2 = 5n+3, n2 ,
using method of undetermined coefficients
-2 1 =5 1 =-5/2
& 51 - 0 =3 0 = -31/2
qn(p)={-(31/2)–(5/2)n)}n
recurrence relation that can be
transformed to linear recurrence
relation with constant coefficients
rn nq n
(iii)q 2qn-1 0, q0 8
3
n
Solution : q 2q n-1 0, q 0 8
3
n
q 2q n-1 0 q
3
n
3
n 2q n-1
3log 2 q n 1 log 2 q n-1
log 2 q n rn
3rn rn1 1, log 2 q 0 r0 log 2 8 3
(ix)nq n (n 1)q n-1 2n, q 0 1
rn rn-1 2n, r0 0
(h)
r
n A(1) , r
n (p)
n w0 w1n
hence w0 w1n w0 w1 (n 1) 2n
w1 1& 2w0 w1 0 w0 1/ 2
rn 1 1
rn , r0 3
3 3
F 1
F
3 3
2 1 1
F F
3 3 2
1 n 1
rn w( )
3 2
1 5
3 w w
2 2
n
51 1
log 2 qn Check q1 =(2)4/3
23 2
(iv)q n nq n-1 n !, q 0 2
qn q n-1
Solution : 1, q 0 2
n ! (n 1)!
r n r n 1 1, r0 2
(vi ) q n 5nq n-1 6n(n 1)q n-2 0, q 0 6 &q1 17
Solution:
q n 5nq n-1 6n(n 1)q n-2 0, q 0 6 &q1 17
q n 5nq n-1 6n(n 1)q n-2 0,
qn n 6n(n 1)
(n!) 0, 5 q n-1 q n-2 0
(n !) n ! n!
qn
rn
(n !)
(viii)nq n (n 2)q n-1 2n, q 0 5
1
ln(q n ) ln(q n-1 )-2ln(q n-2 ) q 0 1, q1 1
2