0% found this document useful (0 votes)
49 views

Generating Functions: 2018 Prof. Yuh-Dauh Lyuu, National Taiwan University

Generating functions allow sequences to be represented by functions. A generating function for a sequence {ai} is a formal power series f(x) = a0 + a1x + a2x2 + ... . While convergence is not guaranteed, generating functions can be manipulated using operations like differentiation and addition. Examples show how common sequences like binomial coefficients have natural generating functions. Convolution of two sequences is defined using the product of their generating functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Generating Functions: 2018 Prof. Yuh-Dauh Lyuu, National Taiwan University

Generating functions allow sequences to be represented by functions. A generating function for a sequence {ai} is a formal power series f(x) = a0 + a1x + a2x2 + ... . While convergence is not guaranteed, generating functions can be manipulated using operations like differentiation and addition. Examples show how common sequences like binomial coefficients have natural generating functions. Convolution of two sequences is defined using the product of their generating functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 74

Generating Functions

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 464
Young men should prove theorems,
old men should write books.
— Godfrey Harold Hardy (1877–1947),
A Mathematician’s Apology (1940)

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 465
Generating Functions
• Let a0 , a1 , a2 , . . . be a sequence of real numbers.
• The function


f (x) = a0 + a1 x + a2 x2 + · · · = ai xi
i=0

is called the generating function for the sequence


{ ai }i=0,1,... .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 466
Convergence Issues
• We treat
f (x) = a0 + a1 x + a2 x2 + · · ·
as a formal power series.
• Convergence is not an issue unless
– We substitute a numerical value for x or
– a0 + a1 x + a2 x2 + · · · represents some function rather
than being an asymptotic series of some function.
• These issues will arise but will not lead to problems.a
a N.G.
de Bruijn (1958), Asymptotic Methods in Analysis; George E.
Andrews (1971), Number Theory.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 467
Examples
(1 + x)n is the generating function for sequence
     
n n n
, ,..., , 0, 0, . . . .
0 1 n
• Because
n  
n n i
(1 + x) = x.
i=0
i

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 468
Examples (continued)
(1 − xn+1 )/(1 − x) is the generating function for the sequence
n+1
  
1, 1, . . . , 1, 0, 0, . . . .

• Because

(1 − xn+1 )/(1 − x) = 1 + x + x2 + · · · + xn .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 469
Examples (continued)
1/(1 − x) is the generating function for

1, 1, 1, . . . .

• Because

1/(1 − x) = 1 + x + x2 + x3 + · · · .

1/(1 − ax) is the generating function for

1, a, a2 , . . . .

• Because

1/(1 − ax) = 1 + ax + (ax)2 + (ax)3 + · · · .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 470
Examples (continued)
−(1/x) ln(1 − x) is the generating function fora
1 1 1
1, , , , . . . .
2 3 4
• Because
1 2 1 3 1 4
− ln(1 − x) = x + x + x + x + · · · .
2 3 4
a Corrected by Mr. Tony Yun-Chih Chen (B03902074) on May 7, 2015.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 471
Examples (continued)
Lemma 65 If f (x) is the generating function for

a0 , a1 , a2 , . . . ,

then f  (x) is the generating function fora

a1 , 2a2 , 3a3 , . . . .


∞ ∞
d
f  (x) = ai xi = iai xi−1 .
i=0
dx i=1

a Equivalently, f  (x) is the generating function for { (i +


1) ai+1 }i=0,1,... or xf  (x) is the generating function for { iai }i=0,1,... .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 472
Examples (continued)
1/(1 − x)2 is the generating function for

1, 2, 3, 4, . . . .

• 1/(1 − x) is the generating function for 1, 1, 1, . . .


(p. 470).
• As
1 d 1
2
= ,
(1 − x) dx 1 − x
1/(1 − x)2 is the generating function for

1 × 1, 2 × 1, 3 × 1, . . . = 1, 2, 3, . . . ,

as desired.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 473
Examples (continued)

Lemma 66 If f (x) = i=0 ai xi is the generating function
for
a0 , a1 , a2 , . . . ,
∞ i
then xf (x) = i=1 a i−1 x is the generating function for

0, a0 , a1 , a2 , . . . .

• This operation is called the shift operator in signal


processing or the operator E in difference equations.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 474
Examples (continued)
(x + 1)/(1 − x)3 is the generating function for the square
numbers
12 , 22 , 32 , 42 , . . . .
• Because
x+1 d x
=
(1 − x)3 dx (1 − x)2

d  i
= ix from p. 473 and p. 474
dx i=1


= i2 xi−1 .
i=1

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 475
Examples (continued)
Lemma 67 If f (x) is the generating function for

a0 , a1 , a2 , . . .

and g(x) is the generating function for

b0 , b1 , b2 , . . . ,

then f (x) + g(x) is the generating function for

a0 + b 0 , a1 + b 1 , a2 + b 2 , . . . .

• This is because


f (x) + g(x) = (ai + bi ) xi .
i=0

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 476
Examples (concluded)
As an application,


1 x+1
x +
(1 − x)2 (1 − x)3
is the generating function for the sequence

{ n + n2 }n=0,1,2,...

(see p. 473 and p. 475).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 477
Binomial Coefficients Revisited (P. 31)
     
n n−1 n−1
= + .
r r r−1
n
n
• (1 + x) is the generating function for { r }r=0,1,...,n
(p. 468).
• (1 + x)n−1 is the generating function for
n−1
{ r }r=0,1,...,n−1 .
• x(1 + x)n−1 is the generating function for
n−1 n−1 n−1
0, 0 , 1 , . . . , n−1 .
• Finally, (1 + x)n = (1 + x)n−1 + x(1 + x)n−1 .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 478
From Generating Function to Sequence
∞ i
Lemma 68 Let f (x) = i=0 a i x be the generating function
for { ai }i=0,1,... . Then

1 d f (x) 
i
ai = i  , i = 0, 1, 2, . . . .
i! dx x=0
• By the Taylor expansion.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 479
Convolution and Generating Functions

• Let f (x) = ∞ i
i=0 ai x be the generating function for
a0 , a1 , a2 , . . . .

• Let g(x) = i=0 bi xi be the generating function for
b0 , b1 , b2 , . . . .
• Then f (x) g(x) is the generating function for
h0 , h1 , h2 , . . ., where
i

hi = ak bi−k (61)
k=0

called the convolution of ai ’s and bi ’s.a


a Augustin Louis Cauchy (1789–1857), who published more than 800
papers.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 480
Augustin Louis Cauchy (1789–1857)

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 481
An Example
• Let f (x) = a0 + a1 x + a2 x2 and g(x) = b0 + b1 x + b2 x2 .
• Then

f (x) g(x) = a0 b0 + (a1 b0 + a0 b1 ) x


+(a2 b0 + a1 b1 + a0 b2 ) x2
+(a2 b1 + a1 b2 ) x3
+a2 b2 x4 .

• The convolution of two finite sequences can be


computed using the fast Fourier transform (FFT).a
a Cooley & Tukey (1965).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 482
2n n n 2
Identity n
= k=0 k
for n ∈ Z+ (P. 61)
2n 
   
2n 2n
(1 + x)2n = xi = · · · + xn + · · · ,
i=0
i n
 n   2
2
 n
[ (1 + x)n ] = xi
i=0
i
2n
 i    
  n n
= xi
i=0 k=0
k i−k
n   
n n
= ···+ xn + · · ·
k n−k
k=0
n  2
n
= ···+ xn + · · · .
k
k=0

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 483
Vandermonde’s Convolution Revisited (P. 49)
   n   
r+s r s
= , n ∈ N. (62)
n k n−k
k=0
r
r k
• (1 + x) = k≥0 k x .
s
s k
• (1 + x) = k≥0 k x .
 
n r s
• (1 + x)r (1 + x)s = n≥0 k=0 k n−k xn .
r s r+s
r+s n
• But (1 + x) (1 + x) = (1 + x) = n≥0 n x .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 484
Reciprocal of a Generating Function

Theorem 69 Every generating function f (x) = i=0 ai xi
with a0 = 0 has a unique generating function g(x) such that
f (x) g(x) = 1.
• Let


Δ
g(x) = bi xi ,
i=0


Δ
h(x) = f (x) g(x) = hi xi .
i=0

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 485
The Proof (concluded)
• By Eq. (61) on p. 480,
i

hi = ak bi−k .
k=0

• By the requirements, h(x) = 1; hence h0 = 1 and


h1 = h2 = · · · = 0.
• First, h0 = 1 = a0 b0 implies that b0 = 1/a0 .
• Inductively, hj = 0 implies that
j
k=1 ak bj−k
bj = − .
a0

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 486
The Summation Operator

• Let f (x) = i=0 ai xi be the generating function for

a0 , a1 , a2 , . . . .

• Then f (x)/(1 − x) is the generating function of prefix


sumsa
a0 , a0 + a1 , a0 + a1 + a2 , . . . .
−1
∞ i
– Let g(x) = (1 − x) = i=0 x be the generating
function of 1, 1, 1, . . . (p. 470).
– Then f (x) g(x) is the generating function of the said
sum by Eq. (61) on p. 480 with b1 = b2 = · · · = 1.
a Ofman (1963); Stone (1971); Blelloch (1990).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 487
1 + 2 + · · · + n = n(n + 1)/2 Revisited (p. 37)
2

• We have g(x) = x/(1 − x) = i=1 ixi (p. 475).
• By the summation operator, f (x) = x/(1 − x)3 is the
generating function for { 0 + 1 + 2 + · · · + i }i=0,1,2,... .

• g (x) = 1/(1 − x) + (2x)/(1 − x) = i=1 ixi−1 + 2f (x)
 2 3

as 1/(1 − x) = i=1 ixi−1 (p. 473).
2


∞ 2 i−1
• Alternatively, g (x) = i=1 i x .
• Combine the above two equations to obtain
∞ ∞
 ∞
   i(i + 1) i
2 i−1 i−1
f (x) = i x − ix /2 = x.
i=1 i=1 i=0
2

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 488
Generalized Binomial Coefficients
• For n ∈ R, define
 
n Δ n(n − 1) · · · (n − i + 1)
= , (63)
i i!
where i ∈ Z+ .
• For n ∈ R+ ,
 
−n (−n)(−n − 1) · · · (−n − i + 1)
=
i i!
 
n+i−1
= (−1)i . (64)
i
n
• The convention is that 0 = 1.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 489
Generalized Binomial Coefficients (concluded)
• In particular, by Eq. (64) on p. 489,
   
−1 1 + i − 1
= (−1)i = (−1)i , (65)
i i
   
−2 i 2+i−1
= (−1) = (−1)i (i + 1). (66)
i i

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 490
n
The Generating Function for { i }i=0,1,2,...
For n ∈ R, the Maclaurin series expansion for (1 + x)n is
(n)(n − 1) 2
(1 + x)n = 1 + nx + x
2!
n(n − 1)(n − 2) 3
+ x + ···
3!
∞  
n i
= x, (67)
i=0
i

where the last equality is by Eq. (63) on p. 489.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 491
−n
The Generating Function for { i }i=0,1,2,...
For n ∈ R+ , the Maclaurin series expansion for (1 + x)−n is

−n (−n)(−n − 1) 2
(1 + x) = 1 + (−n) x + x
2!
(−n)(−n − 1)(−n − 2) 3
+ x + ···
3!
∞  
n+i−1 i
= (−1)i x (68)
i=0
i
∞  
−n i
= x, (69)
i=0
i

where the last equality is by Eq. (64) on p. 489.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 492
n+i−1
The Generating Function for { i }i=0,1,2,...
For n ∈ Z+ ,

  
n+i−1
(1 − x)−n = (−1)i (−x)i
i=0
i
∞  
n+i−1 i
= x (70)
i=0
i

from the Maclaurin series expansion for [ 1 + (−x) ]−n and


Eq. (68) on p. 492.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 493
The Generating Function for {(−1)i (i + 1)}i=0,1,2,...
• (1 + x)−2 = 1/(1 + x)2 is the generating function for
−2
{ i }i=0,1,2,... by Eq. (69) on p. 492.
• But by Eq. (66) on p. 490,
 
−2
= (−1)i (i + 1).
i

• So the answer is (1 + x)−2 .


• Below is an alternative proof.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 494
The Proof (continued)
• The convolutiona of {(−1)i }i=0,1,2,... and
{(−1)i }i=0,1,2,... is
i
 i

(−1)k (−1)i−k = (−1)i = (−1)i (i + 1).
k=0 k=0

• So {(−1)i (i + 1)}i=0,1,2,... is the convolution of


{(−1)i }i=0,1,2,... and {(−1)i }i=0,1,2,... .
a Recall Eq. (61) on p. 480.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 495
The Proof (concluded)
• By Eq. (65) on p. 490, The generating function for
 i

(−1) i=0,1,2,... is
1
.
1+x
• So 1/(1 + x)2 is the generating function for our sequence.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 496
Integer Solutions of a Linear Equation Revisited (P. 85)
n+r−1
There are r integer solutions to

x1 + x2 + · · · + xn = r, xi ≥ 0.

• Note that

f (x) = (x0 + x1 + x2 + · · · + xr )n

= xx1 +x2 +···+xn .
0≤x1 ,x2 ,...,xn ≤r

• The desired number is the coefficient of xr because it


counts the number of ways x1 + x2 + · · · + xn = r.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 497
The Proof (continued)
• For example, for n = 4 and r = 3,

(x0 + x1 + · · · )(x0 + x1 + x2 + · · · )( x0 + · · · )( x0 + · · · )
= · · · + x3 + · · · .

• Clearly, each solution to the linear equation contributes


one to the coefficient of x3 .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 498
The Proof (continued)
• Now,
 n
1 − xr+1
f (x) =
1−x
= (1 − xr+1 )n (1 − x)−n
 r 
 n + i − 1
= (1 − xr+1 )n xi by Eq. (70) on p. 493
i=0
i
r 
 n + i − 1
= xi + xr+1 (· · · ).
i=0
i

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 499
The Proof (concluded)
• The coefficient of xr is
 
n+r−1
,
r
as desired.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 500
An Example
14
• There are 10 = 1001 nonnegative integer solutions to

x1 + x2 + x3 + x4 + x5 = 10.

• Now,

(1 − x11 )5 (1 − x)−5
= 1 + 5x + 15x2 + 35x3 + 70x4 + 126x5 + 210x6
+330x7 + 495x8 + 715x9 + 1001x10 + · · · .

• The coefficient of x10 is indeed 1001.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 501
A Simplified Proof
• For each variable xi , the exponents of the series
1 + x + x2 + · · · represents the possible values for that
variable: 0, 1, 2, . . . .
• The desired number is the coefficient of xr in

(1 + x + x2 + · · · )n .

• Now,
∞ 
 
n+i−1
(1 + x + x2 + · · · )n = (1 − x)−n = xi
i=0
i

by Eq. (70) on p. 493.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 502
Integer Solutions of a Linear Equation with Upper Bounds
Revisited (P. 445)
• The number of integer solutions of

x1 + x2 + · · · + xn = r,

where 0 ≤ x1 , x2 , . . . , xn < b, was solved on p. 445.


• The solution appears as the coefficient of xr in

(1 + x + x2 + · · · + xb−1 )n .

• For example, for n = 3, r = 3, and b = 3,

(x0 + x1 + x2 )(x0 + x1 + x2 )( x0 + x1 + x2 )
= · · · + x3 + · · · .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 503
An Example
• What is the number of positive integers x, where
x ≤ 999, whose sum of the digits equals 20?
• As

(1 + x + x2 + · · · + x9 )3
= (· · · ) + 36x20 + (· · · ),

the answer is 36.


• The same problem was solved more tediously on p. 450
by the principle of inclusion and exclusion.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 504
Compositions of Positive Integers Revisited (P. 102)
• A composition for m is a sum of positive integers whose
order is relevant and which sum to m.
• Next we use the generating function to reprove the fact
that the number of compositions for m is 2m−1 .
• First, x/(1 − x) = x + x2 + x3 + · · · .
• A summand in a composition can be 1 or 2 or 3 or . . ..
• So the coefficient of xm in [ x/(1 − x) ]i is the number of
compositions with i summands for m.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 505
Compositions of Positive Integers Revisited
(continued)
• The generating function for the number of compositions
is therefore
∞  i
x
.
i=1
1−x
• Now,
∞  i ∞  i
x x  x
=
i=1
1−x 1 − x i=0 1−x
x 1
= x
1 − x 1 − 1−x
x
= .
1 − 2x

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 506
Compositions of Positive Integers Revisited
(concluded)
• Observe that
x  2

= x 1 + (2x) + (2x) + · · ·
1 − 2x
= x + 2x2 + 22 x3 + · · ·
∞
= 2i−1 xi .
i=1

• So the number of compositions for m is indeed 2m−1 ,


confirming Theorem 19 (p. 103).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 507
Partition of Integers
• We ask for the number of partitions of m ∈ Z+ into
positive integers where the order of summands is
irrelevant.
– Let p(m) denote the number of partitions of m.
– The number of partitions of m = 3 is p(3) = 3 as

3, 2 + 1, 1 + 1 + 1.

• Contrast it with composition on p. 102 and p. 505.


• Observation: The number m can be a sum of a few 1s, a
few 2s, a few 3s, . . ., and a few m’s.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 508
Partition of Integers (concluded)
• The desired number p(m) is the coefficient of xm in

(1 + x + x2 + · · · )(1 + x2 + x4 + · · · )
(1 + x3 + x6 + · · · ) · · · (1 + xm + x2m + · · · )
1 1 1 1
= · · · . (71)
1−x 1−x 1−x2 3 1−x m

• The generating function for { p(n) }n=0,1,2,... is thereforea


1 1 1
2 3
··· . (72)
1−x 1−x 1−x
a Euler.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 509
An Example
• Note that
1
(1 − x)(1 − x2 )(1 − x3 )(1 − x4 )(1 − x5 )
= 1 + x + 2x2 + 3x3 + 5x4 + 7x5 + · · · .

• So there are 7 ways to partition 5.a


• Indeed, the partitions are: 5, 4 + 1, 3 + 2, 3 + 1 + 1,
2 + 2 + 1, 2 + 1 + 1 + 1, 1 + 1 + 1 + 1 + 1.
• No known closed-form formulas.b
a In fact, the above also gives p(1), p(2), p(3), and p(4) as bonus!
b Björner & Stanley (1999).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 510
Comments on Calculation
• In Eq. (71) on p. 509, we were asked to calculate the
coefficient of xn of
1 1 1 1
··· .
1 − x 1 − x2 1 − x3 1 − xn
• But it is a product of infinite power series!
• The trick is to calculate only
[ 1 + x + x2 + · · · + xn ]
[ 1 + x2 + x4 + · · · + x2n/2 ]
[ 1 + x3 + x6 + · · · + x3n/3 ]
· · · [ 1 + xn ].

• Cut also any terms beyond xn in the process.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 511
Application: Number of Groupings
• How many ways are there for m identical objects to
form groups?a
• Well, it is the same as the number of partitions of m
into positive integers, i.e., p(m) (p. 508).
– Each partition of m, say

m = m1 + m2 + · · · ,

incurs a grouping of sizes m1 , m2 , . . ., and vice versa.


a The
number of ways for m distinct objects to form groups is the Bell
number (p. 299).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 512
Weighted Integer Solutions of a Linear Equation
• What is the number of integer solutions to

x1 + 2x2 + 3x3 + · · · + nxn = n,

where xi ≥ 0?
• For example, the number of solutions for n = 5 is 7:

(x1 , x2 , x3 , x4 , x5 ) ∈ {(5, 0, 0, 0, 0), (3, 1, 0, 0, 0),


(2, 0, 1, 0, 0), (1, 2, 0, 0, 0), (1, 0, 0, 1, 0),
(0, 1, 1, 0, 0), (0, 0, 0, 0, 1)}.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 513
Weighted Integer Solutions of a Linear Equation
(concluded)
• This problem is the partition-of-integers problem in
disguise.
– Every solution (x1 , x2 , . . . , xn ) implies a partition of
n in which there are xi i’s, and vice versa.
• The desired number is again p(n), the coefficient of xn in
1 1 1 1
···
1 − x 1 − x2 1 − x3 1 − xn
from Eq. (71) on p. 509.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 514
No Summands Appear More Than Twice
• What is the number of partitions of m ∈ Z+ into positive
integers where no summands appear more than twice?
• The desired number is the coefficient of xm in

(1 + x + x2 )(1 + x2 + x4 )(1 + x3 + x6 )(1 + x4 + x8 ) · · ·


∞ 3i
1 − x3 1 − x6 1 − x9 1 − x12 i=1 (1 − x )
= · · · = ∞
1 − x 1 − x2 1 − x3 1 − x4 i
i=1 (1 − x )
1 1 1 1 1
= ··· .
1 − x 1 − x2 1 − x4 1 − x5 1 − x7
• Same as partitions into positive summands not divisible
by 3.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 515
Partition of Integers into Distinct Summandsa
• We ask for the number of partitions of m ∈ Z+ into
distinct positive integers.
– Let p# (m) denote the number of such partitions of
m.
– The number of such partitions of m = 3 is p# (3) = 2:
3, 2 + 1.
• The desired number p# (m) is the coefficient of xm in

(1 + x)(1 + x2 )(1 + x3 ) · · · (1 + xm ). (73)


a Euler.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 516
Partition of Integers into Distinct Summands
(concluded)
• There are no known closed-form formulas for p# (m).
• Can we compute p# (m) in o(m3 ) steps?a
• What is a good upper bound on p# (m)?b
• How fast can we compute all the actual solutions?
a Inthe word model.
b Thanks to a lively discussion on November 29, 2004.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 517
An Example
• Note that
 2  3  4  5  6
(1 + x) 1 + x 1+x 1+x 1+x 1+x
= 1 + x + x2 + 2x3 + 2x4 + 3x5 + 4x6 + · · · .

• So there are 4 ways to partition 6.


• Indeed, the partitions are: 6, 5 + 1, 4 + 2, 3 + 2 + 1.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 518
Partition of Integers into Odd Summandsa
• What is the number of partitions of m ∈ Z+ into odd
positive integers?
– The number of such partitions of m = 3 is 2: 3,
1 + 1 + 1.
• The desired number is the coefficient of xm in
 2  3 6  5 10 
1 + x + x + ··· 1 + x + x + ··· 1+x +x + ··· ··· .

a Euler (1748).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 519
The Proof (concluded)
• But,

(1 + x + x2 + · · · )(1 + x3 + x6 + · · · )(1 + x5 + x10 + · · · ) · · ·


1 1 1 1 − x2 1 − x4 1 − x6 1 − x8
= ··· = ···
1 − x 1 − x3 1 − x5 1 − x 1 − x2 1 − x3 1 − x4
= (1 + x)(1 + x2 )(1 + x3 )(1 + x4 ) · · · (1 + xm ) · · · .

• Hence the count is the same as that of partitions into


distinct positive summands p# (m) by Eq. (73) on p. 516.
• This is called Euler’s theorem or Euler’s identity.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 520
Partition of Integers into Even Summands
• How about the number of partitions of m ∈ Z+ into
even positive integers?
• The desired number is the coefficient of xm in
  
1 + x2 + x4 + · · ·
1 + x4 + x8 + · · ·
   
6 12 2m/2 4m/2
1 + x + x + ··· ··· 1 + x +x + ··· .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 521
Partition of Integers into Even Numbers of Each Summand
• We ask for the number of partitions of m ∈ Z+ into
positive integer summands.
• Furthermore, each summand appears an even number of
times.
• The desired number remains the coefficient of xm in
 2 4  4 8 
1 + x + x + ···1 + x + x + ···
   
6 12 2m/2 4m/2
1 + x + x + ··· ··· 1 + x +x + ··· .

– 1 appears an even number of times, 2 appears an


even number of times, etc.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 522
Partition of Integers into Distinct Summands with
Upper Bounds
• We ask for the number of partitions of m ∈ Z+ into
distinct positive integers at most n.
• The desired number is the coefficient of xm in
2

(1 + x) 1 + x 1 + x · · · (1 + xn )
3

(compare it with Eq. (73) on p. 516.)


• No known closed-form formulas.
• Applications in computational finance.a
a Lyuu (2002).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 523
An Example
• Note that
 2  3  4  5  6
(1 + x) 1 + x 1+x 1+x 1+x 1+x
= 1 + x + x2 + 2x3 + 2x4 + 3x5 + 4x6 + 4x7 + · · · + x21 .

• So there are 4 ways to partition m = 7 into distinct


positive integers at most n = 6.
– Indeed, the partitions are: 6 + 1, 5 + 2, 4 + 3,
4 + 2 + 1.
• In fact, we solved 21 problems: The coefficient of xi ,
where 1 ≤ i ≤ 21, represents the number of ways to
partition i into distinct positive integers at most 6.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 524
Partition of Integers into Positive Summands
≡ 0 mod k
• The desired number is the coefficient of xm in
2
2 4

1+ x+ x + ··· 1+ x + x + ··· ···
 
1 + xk−1 + x2(k−1) + · · ·
 
1 + xk+1 + x2(k+1) + · · · · · · .

• In other words, terms 1 + xik + x2ik + · · · , where i ∈ Z+ ,


are excluded.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 525
The Proof (continued)
• Now, the desired number is the coefficient of xm in
1 1 1 1
· · · ···
1 − x 1 − x2 1 − xk−1 1 − xk+1
∞ ik
i=1 (1 − x )
= ∞ i
i=1 (1 − x )


1 − xik
=
i=1
1 − xi
∞ 


i 2i (k−1)i
= 1 + x + x + ··· + x
i=1
  
2 k−1 2 4 2(k−1)
= 1 + x + x + ··· + x 1 + x + x + ··· + x ··· .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 526
The Proof (concluded)
• The count is the same as that of partitions into positive
integers where every summand appears ≤ k − 1 times.
• This generalizes results on p. 515 and p. 519.a
• With k = 2, we have an alternative proof of Euler’s
theorem (p. 520).b
a An alternative proof uses the principle of inclusion and exclusion.
b Observation by Mr. Ansel Lin (B93902003) on November 29, 2004.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 527
Partition of Integers vs. Integer Solution of Linear Equations
• These two issues are often related in subtle ways.
• To wit, what is the number of partitions of m ∈ N+ into
n nonnegative integers where the order of summands is
relevant?a
• Each nonnegative integer solution of

x1 + x2 + · · · + xn = m

corresponds to a valid partition.


n+m−1 b
• The answer is thus m .
a Like composition.
b See p. 85 and p. 497.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 528
Partition of Integers as Linear Equations
• What is the number of integer solutions of

x1 + x2 + · · · + xn = n,

where 0 ≤ x1 ≤ x2 ≤ · · · ≤ xn ?
• A solution corresponds to a partition of n into positive
integers (the order of summands is irrelevanta ).
– (0, 0, 0, 1, 2, 3) ⇐⇒ 6 = 1 + 2 + 3.
a Because of the constraints 0 ≤ x1 ≤ x2 ≤ · · · ≤ xn .

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 529
Partition of Integers as Linear Equations (continued)
• From Eq (71) on p. 509, the number equals the
coefficient p(n) of xn in
1
2 n
.
(1 − x)(1 − x ) · · · (1 − x )

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 530
Partition of Integers as Linear Equations (continued)
• In general, what is the number of integer solutions of

x1 + x2 + · · · + xn = m, (74)

where 0 ≤ x1 ≤ x2 ≤ · · · ≤ xn ?
• Each solution corresponds to a partition of integer m
into n nonnegative integers (equivalently, at most n
positive integers)!a
a Professor Andrews, private communications, October 2001.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 531
Partition of Integers as Linear Equations (continued)
• For example, with m = 6 and n = 5,

(0, 0, 1, 2, 3) ⇐⇒ 6 = 1 + 2 + 3.

• Alternatively, each solution corresponds to a partition of


m into positive summands at most n.
– See the Ferrers graph on the next page.
• The desired number hence equals the coefficient of xm in
1
2 n
. (75)
(1 − x)(1 − x ) · · · (1 − x )

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 532
The Ferrers Graph

9=4+4+1
x1 x2 x3 x4 x5 x6
9=0+0+2+2+2+3

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 533
Partition of Integers as Linear Equations (continued)
• For instance,
1 2 3 4 5
= 1 + x + 2x + 3x + 4x + 5x
(1 − x)(1 − x2 )(1 − x3 )
+ 7x6 + 8x7 + 10x8 + 12x9 + 14x10 + 16x11 + 19x12 + · · · .

• There are 7 ways to partition m = 6 into n = 3


nonnegative integers:

0 + 0 + 6, 0 + 1 + 5,
0 + 2 + 4, 0 + 3 + 3,
1 + 1 + 4, 1 + 2 + 3, 2 + 2 + 2.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 534
Partition of Integers as Linear Equations (continued)
• What is the number of integer solutions to

x1 + 2x2 + 3x3 + · · · + nxn = m, (76)

where xi ≥ 0?a
• Well, it is the same partition-of-integers problem
considered at Eq. (74) on p. 531.
– As on p. 514, each solution corresponds to a partition
m into x1 1s, x2 2s, etc.
a See p. 513 when n = m.

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 535
Partition of Integers as Linear Equations (continued)
• The desired number is therefore the coefficient of xm in
1 1 1 1
··· (77)
1−x 1−x 1−x
2 3 1−x n

from Eq. (75) on p. 532.


• In summary, if pn (m) denotes the number of partitions
of m into positive summands at most n, then Eq. (77) is
the generating function for { pn (m) }m=0,1,... .
• If qn (m) denotes the number of partitions of m into at
most n positive summands, then

pn (m) = qn (m) (78)

(recall p. 532).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 536
Partition of Integers as Linear Equations (concluded)
• Furthermore, p(m) = pn (m) for all n > m.
– Recall that p(m) is the number of partitions of m
(p. 508).
– Recall that pn (m) equals the number of partitions of
m into positive summands at most n (p. 536).

c
2018 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 537

You might also like