CS 207m: Discrete Structures (Minor)
Lecture 10 – Counting and Combinatorics Solving Recurrence relations via generating functions
Feb 14 2018
Last few classes
Basic counting techniques and applications
1. Sum and product, bijection, double counting principles 2. Binomial coefficients and binomial theorem, Pascal’s
triangle
3. Permutations and combinations with/without repetitions 4. Counting subsets, relations, Handshake lemma
5. Stirling’s approximation: Estimating n!
6. Recurrence relations and one method to solve them.
Today
Solving recurrence relations via generating functions.
Last few classes
Basic counting techniques and applications
1. Sum and product, bijection, double counting principles 2. Binomial coefficients and binomial theorem, Pascal’s
triangle
3. Permutations and combinations with/without repetitions 4. Counting subsets, relations, Handshake lemma
5. Stirling’s approximation: Estimating n!
6. Recurrence relations and one method to solve them.
Today
Solving recurrence relations via generating functions.
Solving recurrence relations
By solving, we mean give a closed-form expression fornth term.
Fibonacci recurrence: ∀n ≥2,Fn=Fn−1+Fn−2, F0 =F1 = 1.
Proof method 1 (for linear recurrences: tryFn =αn!) 1. αn=αn−1+αn−2 implies αn−2(α2−α−1) = 0. 2. So if α2−α−1 = 0, the recurrence holds for alln. 3. Solving, α= 1+
√5
2 , β= 1−
√5 2
4. Thus, general solution is Fn=a(1+
√5
2 )n+b(1−
√5 2 )n. 5. Use F0 and F1 – initial conditions: a=
√ 5+1 2√
5 ,b=
√5−1 2√
5
Thus,Fn=
√ 5+1 2√
5 (1+
√ 5 2 )n+
√5−1 2√
5 (1−
√ 5 2 )n.
But this method may not work if we have repeated roots (but this can be fixed) and non-linear recurrences.
Solving recurrence relations
By solving, we mean give a closed-form expression fornth term.
Fibonacci recurrence: ∀n ≥2,Fn=Fn−1+Fn−2, F0 =F1 = 1.
Proof method 1 (for linear recurrences: tryFn =αn!) 1. αn=αn−1+αn−2 implies αn−2(α2−α−1) = 0. 2. So if α2−α−1 = 0, the recurrence holds for alln. 3. Solving, α= 1+
√5
2 , β= 1−
√5 2
4. Thus, general solution is Fn=a(1+
√5
2 )n+b(1−
√5 2 )n. 5. Use F0 and F1 – initial conditions: a=
√ 5+1 2√
5 ,b=
√5−1 2√
5
Thus,Fn=
√ 5+1 2√
5 (1+
√ 5 2 )n+
√5−1 2√
5 (1−
√ 5 2 )n.
But this method may not work if we have repeated roots (but this can be fixed) and non-linear recurrences.
Solving recurrence relations
By solving, we mean give a closed-form expression fornth term.
Fibonacci recurrence: ∀n ≥2,Fn=Fn−1+Fn−2, F0 =F1 = 1.
Proof method 1 (for linear recurrences: tryFn =αn!) 1. αn=αn−1+αn−2 impliesαn−2(α2−α−1) = 0.
2. So if α2−α−1 = 0, the recurrence holds for alln.
3. Solving, α= 1+
√5
2 , β= 1−
√5 2
4. Thus, general solution is Fn=a(1+
√5
2 )n+b(1−
√5 2 )n. 5. Use F0 and F1 – initial conditions: a=
√ 5+1 2√
5 ,b=
√5−1 2√
5
Thus,Fn=
√ 5+1 2√
5 (1+
√ 5 2 )n+
√5−1 2√
5 (1−
√ 5 2 )n.
But this method may not work if we have repeated roots (but this can be fixed) and non-linear recurrences.
Solving recurrence relations
By solving, we mean give a closed-form expression fornth term.
Fibonacci recurrence: ∀n ≥2,Fn=Fn−1+Fn−2, F0 =F1 = 1.
Proof method 1 (for linear recurrences: tryFn =αn!) 1. αn=αn−1+αn−2 impliesαn−2(α2−α−1) = 0.
2. So if α2−α−1 = 0, the recurrence holds for alln.
3. Solving, α= 1+
√5
2 , β= 1−
√5 2
4. Thus, general solution is Fn=a(1+
√5
2 )n+b(1−
√5 2 )n. 5. Use F0 and F1 – initial conditions: a=
√ 5+1 2√
5 ,b=
√5−1 2√
5
√ √ √ √
But this method may not work if we have repeated roots (but this can be fixed) and non-linear recurrences.
Solving recurrence relations
By solving, we mean give a closed-form expression fornth term.
Fibonacci recurrence: ∀n ≥2,Fn=Fn−1+Fn−2, F0 =F1 = 1.
Proof method 1 (for linear recurrences: tryFn =αn!) 1. αn=αn−1+αn−2 impliesαn−2(α2−α−1) = 0.
2. So if α2−α−1 = 0, the recurrence holds for alln.
3. Solving, α= 1+
√5
2 , β= 1−
√5 2
4. Thus, general solution is Fn=a(1+
√5
2 )n+b(1−
√5 2 )n. 5. Use F0 and F1 – initial conditions: a=
√ 5+1 2√
5 ,b=
√5−1 2√
5
Thus,Fn=
√ 5+1 2√
5 (1+
√ 5 2 )n+
√5−1 2√
5 (1−
√ 5 2 )n.
But this method may not work if we have repeated roots (but this can be fixed) and non-linear recurrences.
Proof Method 2: Using generating functions
Fibonacci recurrence relation
Forn≥2,Fn=Fn−1+Fn−2,F0 =F1 = 1.
ComputeFn in terms ofn.
I Consider the power series... φ(t) =
∞
X
n=0
F(n)tn.
Proof Method 2: Using generating functions
Fibonacci recurrence relation
Forn≥2,Fn=Fn−1+Fn−2,F0 =F1 = 1.
ComputeFn in terms ofn.
I Consider the power series... φ(t) =
∞
X
n=0
F(n)tn.
tφ(t) =
∞
X
n=0
F(n)tn+1 =
∞
X
n=1
F(n−1)tn
Proof Method 2: Using generating functions
Fibonacci recurrence relation
Forn≥2,Fn=Fn−1+Fn−2,F0 =F1 = 1.
ComputeFn in terms ofn.
I Consider the power series... φ(t) =
∞
X
n=0
F(n)tn.
tφ(t) =
∞
X
n=0
F(n)tn+1 =
∞
X
n=1
F(n−1)tn
t2φ(t) =
∞
X
n=0
F(n)tn+2 =
∞
X
n=2
F(n−2)tn
Proof Method 2: Using generating functions
Fibonacci recurrence relation
Forn≥2,Fn=Fn−1+Fn−2,F0 =F1 = 1.
ComputeFn in terms ofn.
I Consider the power series... φ(t) =
∞
X
n=0
F(n)tn.
tφ(t) =
∞
X
n=0
F(n)tn+1 =
∞
X
n=1
F(n−1)tn
t2φ(t) =
∞
X
n=0
F(n)tn+2 =
∞
X
n=2
F(n−2)tn
(t+t2)φ(t) =
∞
X
n=0
F(n)tn−1 (t+t2)φ(t) =φ(t)−1
Proof Method 2: Using generating functions
I φ(t) = 1−t−t1 2
= (1−αt)(1−βt)1 = 1−αta +1−βtb
I Solving we getα= 1+
√ 5
2 , β= 1−
√ 5 2 , a=
√ 5+1 2√
5 , b=
√5−1 2√
5 I Now φ(t) =a(1 +αt+α2t2+. . .) +b(1 +βt+β2t2+. . .)
I Equating coefficients oftn we get Fn=aαn+bβn. thus, as before
F(n) =
√5 + 1 2√
5
1 +√ 5 2
!n
+
√5−1 2√
5
1−√ 5 2
!n
Proof Method 2: Using generating functions
I φ(t) = 1−t−t1 2= (1−αt)(1−βt)1
= 1−αta +1−βtb
I Solving we getα= 1+
√ 5
2 , β= 1−
√ 5 2 , a=
√ 5+1 2√
5 , b=
√5−1 2√
5 I Now φ(t) =a(1 +αt+α2t2+. . .) +b(1 +βt+β2t2+. . .)
I Equating coefficients oftn we get Fn=aαn+bβn. thus, as before
F(n) =
√5 + 1 2√
5
1 +√ 5 2
!n
+
√5−1 2√
5
1−√ 5 2
!n
Proof Method 2: Using generating functions
I φ(t) = 1−t−t1 2= (1−αt)(1−βt)1 = 1−αta +1−βtb
I Solving we getα= 1+
√5
2 , β= 1−
√5 2 , a=
√5+1 2√
5 , b=
√5−1 2√
5
I Now φ(t) =a(1 +αt+α2t2+. . .) +b(1 +βt+β2t2+. . .)
I Equating coefficients oftn we get Fn=aαn+bβn. thus, as before
F(n) =
√5 + 1 2√
5
1 +√ 5 2
!n
+
√5−1 2√
5
1−√ 5 2
!n
Proof Method 2: Using generating functions
I φ(t) = 1−t−t1 2= (1−αt)(1−βt)1 = 1−αta +1−βtb
I Solving we getα= 1+
√5
2 , β= 1−
√5 2 , a=
√5+1 2√
5 , b=
√5−1 2√
5 I Now φ(t) =a(1 +αt+α2t2+. . .) +b(1 +βt+β2t2+. . .)
I Equating coefficients oftn we get Fn=aαn+bβn. thus, as before
F(n) =
√5 + 1 2√
5
1 +√ 5 2
!n
+
√5−1 2√
5
1−√ 5 2
!n
Proof Method 2: Using generating functions
I φ(t) = 1−t−t1 2= (1−αt)(1−βt)1 = 1−αta +1−βtb
I Solving we getα= 1+
√5
2 , β= 1−
√5 2 , a=
√5+1 2√
5 , b=
√5−1 2√
5 I Now φ(t) =a(1 +αt+α2t2+. . .) +b(1 +βt+β2t2+. . .)
I Equating coefficients oftn we get Fn=aαn+bβn.
thus, as before F(n) =
√5 + 1 2√
5
1 +√ 5 2
!n
+
√5−1 2√
5
1−√ 5 2
!n
Proof Method 2: Using generating functions
I φ(t) = 1−t−t1 2= (1−αt)(1−βt)1 = 1−αta +1−βtb
I Solving we getα= 1+
√5
2 , β= 1−
√5 2 , a=
√5+1 2√
5 , b=
√5−1 2√
5 I Now φ(t) =a(1 +αt+α2t2+. . .) +b(1 +βt+β2t2+. . .)
I Equating coefficients oftn we get Fn=aαn+bβn. thus, as before
F(n) =
√5 + 1 2√
5
1 +√ 5 2
!n
+
√5−1 2√
5
1−√ 5 2
!n
Properties of generating functions
Definition
The(ordinary) generating function for a sequencea0, a1, . . .∈R is the infinite seriesφ(x) =P∞
k=0akxk.
I Let f(x) =P∞
k=0akxk,g(x) =P∞
k=0bkxk. Then 1. Iff(x) =g(x), thenak=bk for allk.
2. f(x) +g(x) =P∞
k=0(ak+bk)xk, 3. f(x)g(x) =P∞
k=0(Pk
j=0ajbk−j)xk, 4. dxd (P∞
k=0akxk) =P∞
k=1(kak)xk−1
I Let u∈R,k∈Z≥0, Thenextended binomial coefficient uk is defined as uk
= u(u−1)...(u−k+1)
k! ifk >0 and = 1 ifk= 0.
I What if u=−nforn∈N? The extended binomial theorem Letu∈R, (1 +x)u =P∞
k=0 u k
xk. If you don’t like this, takex∈R,|x|<1.
Properties of generating functions
Definition
The(ordinary) generating function for a sequencea0, a1, . . .∈R is the infinite seriesφ(x) =P∞
k=0akxk.
I Let f(x) =P∞
k=0akxk,g(x) =P∞
k=0bkxk. Then 1. Iff(x) =g(x), thenak=bk for allk.
2. f(x) +g(x) =P∞
k=0(ak+bk)xk, 3. f(x)g(x) =P∞
k=0(Pk
j=0ajbk−j)xk, 4. dxd (P∞
k=0akxk) =P∞
k=1(kak)xk−1
I Let u∈R,k∈Z≥0, Thenextended binomial coefficient uk is defined as uk
= u(u−1)...(u−k+1)
k! ifk >0 and = 1 ifk= 0.
I What if u=−nforn∈N?
The extended binomial theorem Letu∈R, (1 +x)u =P∞
k=0 u k
xk. If you don’t like this, takex∈R,|x|<1.
Properties of generating functions
Definition
The(ordinary) generating function for a sequencea0, a1, . . .∈R is the infinite seriesφ(x) =P∞
k=0akxk.
I Let f(x) =P∞
k=0akxk,g(x) =P∞
k=0bkxk. Then 1. Iff(x) =g(x), thenak=bk for allk.
2. f(x) +g(x) =P∞
k=0(ak+bk)xk, 3. f(x)g(x) =P∞
k=0(Pk
j=0ajbk−j)xk, 4. dxd (P∞
k=0akxk) =P∞
k=1(kak)xk−1
I Let u∈R,k∈Z≥0, Thenextended binomial coefficient uk is defined as uk
= u(u−1)...(u−k+1)
k! ifk >0 and = 1 ifk= 0.
I What if u=−nforn∈N?
If you don’t like this, takex∈R,|x|<1.
Properties of generating functions
Definition
The(ordinary) generating function for a sequencea0, a1, . . .∈R is the infinite seriesφ(x) =P∞
k=0akxk.
I Let f(x) =P∞
k=0akxk,g(x) =P∞
k=0bkxk. Then 1. Iff(x) =g(x), thenak=bk for allk.
2. f(x) +g(x) =P∞
k=0(ak+bk)xk, 3. f(x)g(x) =P∞
k=0(Pk
j=0ajbk−j)xk, 4. dxd (P∞
k=0akxk) =P∞
k=1(kak)xk−1
I Let u∈R,k∈Z≥0, Thenextended binomial coefficient uk is defined as uk
= u(u−1)...(u−k+1)
k! ifk >0 and = 1 ifk= 0.
I What if u=−nforn∈N? The extended binomial theorem Letu∈R, (1 +x)u =P∞
k=0 u k
xk. If you don’t like this, takex∈R,|x|<1.
Simple examples using generating functions
Standard identities:
I 1
1−ax =P∞ k=0akxk
I 1
1−xr =P∞ k=0xrk
I ex=P∞ k=0xk
k!
Class work:
1. Solve the recurrenceak= 4ak−1 witha0= 3. 2. Solve the recurrenceak= 8ak−1+ 10k−1 with
a0 = 1, a1 = 9.
Simple examples using generating functions
Standard identities:
I 1
1−ax =P∞ k=0akxk
I 1
1−xr =P∞ k=0xrk
I ex=P∞ k=0xk
k!
Class work:
1. Solve the recurrenceak= 4ak−1 witha0= 3.
2. Solve the recurrenceak= 8ak−1+ 10k−1 with a0 = 1, a1 = 9.
Simple examples using generating functions
Standard identities:
I 1
1−ax =P∞ k=0akxk
I 1
1−xr =P∞ k=0xrk
I ex=P∞ k=0xk
k!
Class work:
1. Solve the recurrenceak= 4ak−1 witha0= 3.
2. Solve the recurrenceak= 8ak−1+ 10k−1 with a0 = 1, a1 = 9.
Solving Catalan numbers using generating functions
Catalan Numbers C(n) =
n−1
X
i=1
C(i)C(n−i) for n >1,C(0) = 0, C(1) = 1.
Solving Catalan numbers using generating functions
Catalan Numbers C(n) =
n−1
X
i=1
C(i)C(n−i) for n >1,C(0) = 0, C(1) = 1.
I Let φ(x) =P∞
k=1C(k)xk.
Solving Catalan numbers using generating functions
Catalan Numbers C(n) =
n−1
X
i=1
C(i)C(n−i) for n >1,C(0) = 0, C(1) = 1.
I Let φ(x) =P∞
k=1C(k)xk.
I Now considerφ(x)2.
I φ(x)2 = (P∞
k=1C(k)xk)(P∞
k=1C(k)xk)
= (P∞ k=2
Pk−1
i=1 C(i)C(k−i)xk)
= (P∞
k=2C(k)xk) =φ(x)−x
Solving Catalan numbers using generating functions
Catalan Numbers C(n) =
n−1
X
i=1
C(i)C(n−i) for n >1,C(0) = 0, C(1) = 1.
I Let φ(x) =P∞
k=1C(k)xk.
I Now considerφ(x)2.
I φ(x)2 = (P∞
k=1C(k)xk)(P∞
k=1C(k)xk)
= (P∞ k=2
Pk−1
i=1 C(i)C(k−i)xk)
= (P∞
k=2C(k)xk) =φ(x)−x
I Solving for φ(x) we get, φ(x) = 12(1±(1−4x)1/2)
I But since φ(0) = 0, we have
1 1/2 1 1 1/2
Catalan numbers
Recall: Extended binomial theorem Letα∈R,(1 +x)α=P∞
n=0 α n
xn, where αn
= α(α−1)...(α−n+1)
n! .
Catalan numbers
Recall: Extended binomial theorem Letα∈R,(1 +x)α=P∞
n=0 α n
xn, where αn
= α(α−1)...(α−n+1)
n! .
I P∞
k=1C(k)xk=φ(x) = 12 + (−12(1−4x)1/2) =
1
2 + (−12P∞ k=0
1/2 k
(−4x)k).
Catalan numbers
Recall: Extended binomial theorem Letα∈R,(1 +x)α=P∞
n=0 α n
xn, where αn
= α(α−1)...(α−n+1)
n! .
I P∞
k=1C(k)xk=φ(x) = 12 + (−12(1−4x)1/2) =
1
2 + (−12P∞ k=0
1/2 k
(−4x)k).
I The coefficient of xk is C(k) =−12 1/2k (−4)k
=−12(12(12−1)(12 −2). . .(12 −k+ 1))(−4)k!k
=−12(12)(−32)(−52). . .(−2k−32 ))(−4)k!k
Catalan numbers
Recall: Extended binomial theorem Letα∈R,(1 +x)α=P∞
n=0 α n
xn, where αn
= α(α−1)...(α−n+1)
n! .
I P∞
k=1C(k)xk=φ(x) = 12 + (−12(1−4x)1/2) =
1
2 + (−12P∞ k=0
1/2 k
(−4x)k).
I The coefficient of xk is C(k) =−12 1/2k (−4)k
=−12(12(12−1)(12 −2). . .(12 −k+ 1))(−4)k!k
=−12(12)(−32)(−52). . .(−2k−32 ))(−4)k!k
I C(k) =(−1)2k+1k(−4)k! k ·1·3· · ·(2k−3)
Catalan numbers
Recall: Extended binomial theorem Letα∈R,(1 +x)α=P∞
n=0 α n
xn, where αn
= α(α−1)...(α−n+1)
n! .
I P∞
k=1C(k)xk=φ(x) = 12 + (−12(1−4x)1/2) =
1
2 + (−12P∞ k=0
1/2 k
(−4x)k).
I The coefficient of xk is C(k) =−12 1/2k (−4)k
=−12(12(12−1)(12 −2). . .(12 −k+ 1))(−4)k!k
=−12(12)(−32)(−52). . .(−2k−32 ))(−4)k!k
I C(k) =(−1)2k+1k(−4)k! k ·1·3· · ·(2k−3)
I C(k) =2k+11·4k·k!·1.2....(2k−3)(2k−2)
2k−1(k−1)! = k!(k−1)!(2k−2)!.
Catalan numbers
Recall: Extended binomial theorem Letα∈R,(1 +x)α=P∞
n=0 α n
xn, where αn
= α(α−1)...(α−n+1)
n! .
I P∞
k=1C(k)xk=φ(x) = 12 + (−12(1−4x)1/2) =
1
2 + (−12P∞ k=0
1/2 k
(−4x)k).
I The coefficient of xk is C(k) =−12 1/2k (−4)k
=−12(12(12−1)(12 −2). . .(12 −k+ 1))(−4)k!k
=−12(12)(−32)(−52). . .(−2k−32 ))(−4)k!k
I C(k) =(−1)2k+1k(−4)k! k ·1·3· · ·(2k−3)
I C(k) =2k+11·4k·k!·1.2....(2k−3)(2k−2)
2k−1(k−1)! = k!(k−1)!(2k−2)!.
Other applications of generating functions
I What is the number of ways ak of selecting kelements from an nelement set if repetitions are allowed?
I Letφ(x) =P∞ k=0akxk.
I Observe thatφ(x) = (1 +x+x2+. . .)n= (1−x)−n
I Expand this by the extended binomial theorem and compare coefficients ofxk.
I ak= −nk
(−1)k = (−1)k n+k−1k
(−1)k= n+k−1k .
I (H.W)What if there must be ≥1 element of each type?
I Proving binomial identities: Show thatPn k=0
n k
2
= 2nn .
I Compare coefficients ofxn in (1 +x)2n= ((1 +x)n)2.
Other applications of generating functions
I What is the number of ways ak of selecting kelements from an nelement set if repetitions are allowed?
I Letφ(x) =P∞ k=0akxk.
I Observe thatφ(x) = (1 +x+x2+. . .)n= (1−x)−n
I Expand this by the extended binomial theorem and compare coefficients ofxk.
I ak= −nk
(−1)k = (−1)k n+k−1k
(−1)k= n+k−1k .
I (H.W)What if there must be ≥1 element of each type?
I Proving binomial identities: Show thatPn k=0
n k
2
= 2nn .
I Compare coefficients ofxn in (1 +x)2n= ((1 +x)n)2.
Other applications of generating functions
I What is the number of ways ak of selecting kelements from an nelement set if repetitions are allowed?
I Letφ(x) =P∞ k=0akxk.
I Observe thatφ(x) = (1 +x+x2+. . .)n= (1−x)−n
I Expand this by the extended binomial theorem and compare coefficients ofxk.
I ak= −nk
(−1)k = (−1)k n+k−1k
(−1)k= n+k−1k .
I (H.W)What if there must be ≥1 element of each type?
I Proving binomial identities: Show thatPn k=0
n k
2
= 2nn .
I Compare coefficients ofxn in (1 +x)2n= ((1 +x)n)2.
Other applications of generating functions
I What is the number of ways ak of selecting kelements from an nelement set if repetitions are allowed?
I Letφ(x) =P∞ k=0akxk.
I Observe thatφ(x) = (1 +x+x2+. . .)n= (1−x)−n
I Expand this by the extended binomial theorem and compare coefficients ofxk.
I ak= −nk
(−1)k = (−1)k n+k−1k
(−1)k= n+k−1k .
I (H.W)What if there must be ≥1 element of each type?
I Proving binomial identities: Show thatPn k=0
n k
2
= 2nn .
I Compare coefficients ofxn in (1 +x)2n= ((1 +x)n)2.
Other applications of generating functions
I What is the number of ways ak of selecting kelements from an nelement set if repetitions are allowed?
I Letφ(x) =P∞ k=0akxk.
I Observe thatφ(x) = (1 +x+x2+. . .)n= (1−x)−n
I Expand this by the extended binomial theorem and compare coefficients ofxk.
I ak= −nk
(−1)k = (−1)k n+k−1k
(−1)k= n+k−1k .
I (H.W)What if there must be ≥1 element of each type?
I Proving binomial identities: Show thatPn k=0
n k
2
= 2nn .
I Compare coefficients ofxn in (1 +x)2n= ((1 +x)n)2.
Other applications of generating functions
I What is the number of ways ak of selecting kelements from an nelement set if repetitions are allowed?
I Letφ(x) =P∞ k=0akxk.
I Observe thatφ(x) = (1 +x+x2+. . .)n= (1−x)−n
I Expand this by the extended binomial theorem and compare coefficients ofxk.
I ak= −nk
(−1)k = (−1)k n+k−1k
(−1)k= n+k−1k .
I (H.W)What if there must be ≥1 element of each type?
I Proving binomial identities: Show thatPn k=0
n k
2
= 2nn .
I Compare coefficients ofxn in (1 +x)2n= ((1 +x)n)2.
Other applications of generating functions
I What is the number of ways ak of selecting kelements from an nelement set if repetitions are allowed?
I Letφ(x) =P∞ k=0akxk.
I Observe thatφ(x) = (1 +x+x2+. . .)n= (1−x)−n
I Expand this by the extended binomial theorem and compare coefficients ofxk.
I ak= −nk
(−1)k = (−1)k n+k−1k
(−1)k= n+k−1k .
I (H.W)What if there must be ≥1 element of each type?
I Proving binomial identities: Show thatPn k=0
n k
2
= 2nn .
I Compare coefficients ofxn in (1 +x)2n= ((1 +x)n)2.
Other applications of generating functions
I What is the number of ways ak of selecting kelements from an nelement set if repetitions are allowed?
I Letφ(x) =P∞ k=0akxk.
I Observe thatφ(x) = (1 +x+x2+. . .)n= (1−x)−n
I Expand this by the extended binomial theorem and compare coefficients ofxk.
I ak= −nk
(−1)k = (−1)k n+k−1k
(−1)k= n+k−1k .
I (H.W)What if there must be ≥1 element of each type?
I Proving binomial identities: Show thatPn k=0
n k
2
= 2nn .
I Compare coefficients ofxn in (1 +x)2n= ((1 +x)n)2.