14.08.2013 Views

Binomial Coefficients and Generating Functions - Cs.ioc.ee

Binomial Coefficients and Generating Functions - Cs.ioc.ee

Binomial Coefficients and Generating Functions - Cs.ioc.ee

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Binomial</strong> <strong>Coefficients</strong> <strong>and</strong> <strong>Generating</strong> <strong>Functions</strong><br />

ITT9130 Konkr<strong>ee</strong>tne Matemaatika<br />

Chapter Five<br />

Basic Identities<br />

Basic Practice<br />

Tricks of the Trade<br />

<strong>Generating</strong> <strong>Functions</strong><br />

Hypergeometric <strong>Functions</strong><br />

Hypergeometric Transformations<br />

Partial Hypergeometric Sums


Contents<br />

1 <strong>Binomial</strong> coefficients<br />

2 <strong>Generating</strong> <strong>Functions</strong><br />

Operations on <strong>Generating</strong> <strong>Functions</strong><br />

Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

Identities in Pascal’s Triangle


Next section<br />

1 <strong>Binomial</strong> coefficients<br />

2 <strong>Generating</strong> <strong>Functions</strong><br />

Operations on <strong>Generating</strong> <strong>Functions</strong><br />

Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

Identities in Pascal’s Triangle


<strong>Binomial</strong> theorem<br />

Theorem 1<br />

for any integer n 0.<br />

(a + b) n =<br />

n<br />

∑<br />

k=0<br />

<br />

n<br />

a<br />

k<br />

k b n−k ,<br />

Proof. Exp<strong>and</strong>ing (a + b) n = (a + b)(a + b)···(a + b) yields the sum of the<br />

2 n products of the form e1e2 ···en, where each ei is a or b. These<br />

terms are composed by selecting from each factor (a + b) either a or<br />

b. For example, if we select a k times, then we must choose b n − k<br />

times. So, we can rearrange the sum as<br />

(a + b) n n<br />

= ∑ Cka<br />

k=0<br />

k b n−k ,<br />

where the coefficient Ck is the number how many possibilities are to<br />

select k elements (k factors (a + b)) from a set of n elements (from<br />

the production of n factors (a + b)(a + b)···(a + b)).<br />

That is why the coefficient Ck is called "(from) n choose k" <strong>and</strong><br />

denoted by n k . Q.E.D.


<strong>Binomial</strong> coefficients <strong>and</strong> combinations<br />

Theorem 2<br />

The number of k-subsets of an n-set is<br />

<br />

n n!<br />

=<br />

k k!(n − k)!<br />

Proof. At first, determine the number of k-element sequences: there are n<br />

choices for the first element of the sequence; for each, there are n − 1<br />

choices for the second; <strong>and</strong> so on, until there are n − k + 1 choices<br />

for the k-th. This gives n(n − 1)...(n − k + 1) = n k choices in all. And<br />

since each k-element subset has exactly k! different orderings, this<br />

number of sequences counts each subset exactly k! times. To get<br />

our answer, divide by k!:<br />

n<br />

k<br />

<br />

= nk<br />

k! =<br />

n!<br />

k!(n − k)!<br />

Some other notations used for the "n choose k" in literature:<br />

C n k ,C(n,k), nCk, n Ck.<br />

Q.E.D.


<strong>Binomial</strong> coefficients <strong>and</strong> combinations<br />

Theorem 2<br />

The number of k-subsets of an n-set is<br />

<br />

n n!<br />

=<br />

k k!(n − k)!<br />

Proof. At first, determine the number of k-element sequences: there are n<br />

choices for the first element of the sequence; for each, there are n − 1<br />

choices for the second; <strong>and</strong> so on, until there are n − k + 1 choices<br />

for the k-th. This gives n(n − 1)...(n − k + 1) = n k choices in all. And<br />

since each k-element subset has exactly k! different orderings, this<br />

number of sequences counts each subset exactly k! times. To get<br />

our answer, divide by k!:<br />

n<br />

k<br />

<br />

= nk<br />

k! =<br />

n!<br />

k!(n − k)!<br />

Some other notations used for the "n choose k" in literature:<br />

C n k ,C(n,k), nCk, n Ck.<br />

Q.E.D.


Properties of <strong>Binomial</strong> <strong>Coefficients</strong><br />

n<br />

k = 2n (number of all subsets of n-set);<br />

<br />

= 0 (number of subsets with odd cardinality is<br />

equel to the number of sets with even cardinality).<br />

1 ∑ n k=0<br />

2 ∑ n k=0 (−1)k n<br />

k<br />

Tõestus. Take a = b = 1 in the binomial theorem:<br />

n <br />

n n<br />

=<br />

k ∑ k<br />

∑<br />

k=0<br />

n<br />

∑<br />

k=0<br />

k=0<br />

Take a = −1 ja b = 1:<br />

n<br />

(−1) k<br />

n n<br />

=<br />

k ∑<br />

k=0<br />

n<br />

k<br />

<br />

1 k 1 n−k = (1 + 1) n = 2 n<br />

<br />

(−1) k 1 n−k = (−1 + 1) n = 0<br />

Q.E.D.


Another Property<br />

3<br />

n n<br />

k = n−k ;<br />

Proof. Direct conclusion from the Theorem 2:<br />

n<br />

k<br />

<br />

=<br />

n!<br />

k!(n − k)! =<br />

n<br />

n − k<br />

<br />

Q.E.D.


Yet Another Proerty<br />

4 If n,k > 0, then n−1<br />

k−1<br />

Proof.<br />

Note that<br />

+ n−1<br />

k<br />

n<br />

= k .<br />

1 1 k + n − k<br />

+ =<br />

n − k k k(n − k) =<br />

n<br />

k(n − k) .<br />

Multiplying this by (n − 1)! <strong>and</strong> dividing by (k − 1)!(n − k − 1)!, we get<br />

(n − 1)!<br />

(k − 1)!(n − k)(n − k − 1)! +<br />

(n − 1)!<br />

k(k − 1)!(n − k − 1)! =<br />

n(n − 1)!<br />

k(k − 1)!(n − k)(n − k − 1)!<br />

This can be rewritten after some simplifying transformations as:<br />

(n − 1)!<br />

(k − 1)!(n − k)! +<br />

(n − 1)!<br />

k!(n − k − 1)! =<br />

n!<br />

k!(n − k)!<br />

Q.E.D.


Pascal’s Triangle<br />

n<br />

0<br />

n<br />

0<br />

1<br />

n<br />

1<br />

n<br />

2<br />

n<br />

3<br />

n<br />

4<br />

n<br />

5<br />

n<br />

6<br />

1 1 1<br />

2 1 2 1<br />

3 1 3 3 1<br />

4 1 4 6 4 1<br />

5 1 5 10 10 5 1<br />

6 1 6 15 20 15 6 1<br />

Blaise Pascal<br />

(1623–1662)


Pascal’s Triangle<br />

1<br />

1 1<br />

1 2 1<br />

1 3 3 1<br />

1 4 6 4 1<br />

1 5 10 10 5 1<br />

1 6 15 20 15 6 1<br />

Pascal Triangle is symmetric with respect to the vertical line<br />

through its apex.<br />

Blaise Pascal<br />

(1623–1662)<br />

Every number is the sum of the two numbers immediately above it.


Pascal’s Triangle<br />

1<br />

1 1<br />

1 2 1<br />

1 3 3 1<br />

1 4 6 4 1<br />

1 5 10 10 5 1<br />

1 6 15 20 15 6 1<br />

Pascal Triangle is symmetric with respect to the vertical line<br />

through its apex.<br />

Blaise Pascal<br />

(1623–1662)<br />

Every number is the sum of the two numbers immediately above it.


Next section<br />

1 <strong>Binomial</strong> coefficients<br />

2 <strong>Generating</strong> <strong>Functions</strong><br />

Operations on <strong>Generating</strong> <strong>Functions</strong><br />

Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

Identities in Pascal’s Triangle


<strong>Generating</strong> <strong>Functions</strong><br />

Definition<br />

The generating function for the infinite sequence 〈g0,g1,g2,...〉 is<br />

the power series<br />

G(x) = g0 + g1x + g2x 2 + g3x 3 + ··· =<br />

Ssome simple examples<br />

∞<br />

∑<br />

n=0<br />

〈0,0,0,0,...〉 ←→ 0 + 0x + 0x 2 + 0x 3 + ··· = 0<br />

gnx n<br />

〈1,0,0,0,...〉 ←→ 1 + 0x + 0x 2 + 0x 3 + ··· = 1<br />

〈2,3,1,0,...〉 ←→ 2 + 3x + 1x 2 + 0x 3 + ··· = 2 + 3x + 1x 2


More examples (1)<br />

〈1,1,1,1,...〉 ←→ 1 + x + x 2 + x 3 + ··· = 1<br />

1−x<br />

Subtract the equations:<br />

S = 1 + x + x 2 + x 3 + ···<br />

xS = x + x 2 + x 3 + ···<br />

(1 − x)S = 1 ehk S = 1<br />

1 − x<br />

NB! This formula converges only for −1 < x < 1.<br />

Actually, we don’t worry about convergence issues.


More examples (1)<br />

〈1,1,1,1,...〉 ←→ 1 + x + x 2 + x 3 + ··· = 1<br />

1−x<br />

Subtract the equations:<br />

S = 1 + x + x 2 + x 3 + ···<br />

xS = x + x 2 + x 3 + ···<br />

(1 − x)S = 1 ehk S = 1<br />

1 − x<br />

NB! This formula converges only for −1 < x < 1.<br />

Actually, we don’t worry about convergence issues.


More examples (2)<br />

〈a,ab,ab 2 ,ab 3 ,...〉 ←→ a + abx + ab 2 x 2 + ab 3 x 3 + ··· = a<br />

1−bx<br />

Like in the previous example:<br />

Subtract <strong>and</strong> get:<br />

S = a + abx + ab 2 x 2 + ab 3 x 3 + ···<br />

bxS = abx + ab 2 x 2 + ab 3 x 3 + ···<br />

(1 − bx)S = a ehk S = a<br />

1 − bx


More examples (3)<br />

Taking in the last example a = 0,5 <strong>and</strong> b = 1 yields<br />

0,5 + 0,5x + 0,5x 2 + 0,5x 3 + ··· = 0,5<br />

1 − x<br />

Taking a = 0,5 <strong>and</strong> b = −1, gives<br />

0,5 − 0,5x + 0,5x 2 − 0,5x 3 + ··· = 0,5<br />

1 + x<br />

Adding equations (1) <strong>and</strong> (2), we get the generating function of the<br />

sequence 〈1,0,1,0,1,0,...〉:<br />

1 + x 2 + x 4 + x 6 + ··· = 0,5 0,5<br />

+<br />

1 − x 1 + x =<br />

1<br />

1<br />

=<br />

(1 − x)(1 + x) 1 − x 2<br />

(1)<br />

(2)


More examples (3)<br />

Taking in the last example a = 0,5 <strong>and</strong> b = 1 yields<br />

0,5 + 0,5x + 0,5x 2 + 0,5x 3 + ··· = 0,5<br />

1 − x<br />

Taking a = 0,5 <strong>and</strong> b = −1, gives<br />

0,5 − 0,5x + 0,5x 2 − 0,5x 3 + ··· = 0,5<br />

1 + x<br />

Adding equations (1) <strong>and</strong> (2), we get the generating function of the<br />

sequence 〈1,0,1,0,1,0,...〉:<br />

1 + x 2 + x 4 + x 6 + ··· = 0,5 0,5<br />

+<br />

1 − x 1 + x =<br />

1<br />

1<br />

=<br />

(1 − x)(1 + x) 1 − x 2<br />

(1)<br />

(2)


More examples (3)<br />

Taking in the last example a = 0,5 <strong>and</strong> b = 1 yields<br />

0,5 + 0,5x + 0,5x 2 + 0,5x 3 + ··· = 0,5<br />

1 − x<br />

Taking a = 0,5 <strong>and</strong> b = −1, gives<br />

0,5 − 0,5x + 0,5x 2 − 0,5x 3 + ··· = 0,5<br />

1 + x<br />

Adding equations (1) <strong>and</strong> (2), we get the generating function of the<br />

sequence 〈1,0,1,0,1,0,...〉:<br />

1 + x 2 + x 4 + x 6 + ··· = 0,5 0,5<br />

+<br />

1 − x 1 + x =<br />

1<br />

1<br />

=<br />

(1 − x)(1 + x) 1 − x 2<br />

(1)<br />

(2)


Next subsection<br />

1 <strong>Binomial</strong> coefficients<br />

2 <strong>Generating</strong> <strong>Functions</strong><br />

Operations on <strong>Generating</strong> <strong>Functions</strong><br />

Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

Identities in Pascal’s Triangle


Operations on <strong>Generating</strong> <strong>Functions</strong><br />

1. Scaling<br />

If<br />

then<br />

for any c ∈ R.<br />

Proof.<br />

〈f0,f1,f2,...〉 ←→ F (x),<br />

〈cf0,cf1,cf2,...〉 ←→ c · F (x),<br />

〈cf0,cf1,cf2,...〉 ←→ cf0 + cf1x + cf2x 2 + ··· =<br />

= c(f0 + f1x + f2x 2 + ···) =<br />

= cF (x)<br />

Q.E.D.


Operations on <strong>Generating</strong> <strong>Functions</strong> (2)<br />

2. Addition<br />

If 〈f0,f1,f2,...〉 ←→ F (x) <strong>and</strong> 〈g0,g1,g2,...〉 ←→ G(x), then<br />

Proof.<br />

〈f0 + g0,f1 + g1,f2 + g2,...〉 ←→ F (x) + G(x).<br />

〈f0 + g0, f1 + g1, f2 + g2, ...〉 ←→<br />

=<br />

∞<br />

∑<br />

n=0<br />

<br />

∞<br />

∑ fnx<br />

n=0<br />

n<br />

<br />

∞<br />

+ ∑ gnx<br />

n=0<br />

n<br />

<br />

= F (x) + G(x)<br />

(fn + gn)x n =<br />

=<br />

Q.E.D.


Operations on <strong>Generating</strong> <strong>Functions</strong> (3)<br />

3. Right-shift<br />

If 〈f0,f1,f2,...〉 ←→ F (x), then<br />

Proof.<br />

〈0,0,...,0 ,f0,f1,f2,...〉 ←→ x k · F (x).<br />

<br />

k zeros<br />

〈0,0,...,0,f0,f1,f2,...〉 ←→ f0x k + f1x k+1 + f2x k+2 + ... =<br />

= x k (f0 + f1x + f2x 2 + ···) =<br />

= x k · F (x)<br />

Q.E.D.


Operations on <strong>Generating</strong> <strong>Functions</strong> (4)<br />

4. Differentiation<br />

If 〈f0,f1,f2,...〉 ←→ F (x), then<br />

Proof.<br />

〈f1,2f2,3f3,...〉 ←→ F ′ (x).<br />

〈f1,2f2,3f3,...〉 ←→ f1 + 2f2x + 3f3x 2 + ... =<br />

= d<br />

dx (f0 + f1x + f2x 2 + f3x 3 + ···) =<br />

= d<br />

F (x)<br />

dx<br />

Q.E.D.


Operations on <strong>Generating</strong> <strong>Functions</strong> (4)<br />

4. Differentiation<br />

If 〈f0,f1,f2,...〉 ←→ F (x), then<br />

Example<br />

〈1,1,1,...〉 ←→ 1<br />

1−x<br />

〈1,2,3,...〉 ←→ d<br />

dx<br />

〈f1,2f2,3f3,...〉 ←→ F ′ (x).<br />

1 1<br />

1−x =<br />

(1−x) 2


Operations on <strong>Generating</strong> <strong>Functions</strong> (5)<br />

5. Integration<br />

If 〈f0,f1,f2,...〉 ←→ F (x), then<br />

Proof.<br />

〈0,f0, 1 1 1<br />

f1, f2,<br />

2 3 4 f3,...〉 ←→<br />

x<br />

0<br />

F (z)dz.<br />

〈0,f0, 1 1 1<br />

f1, f2,<br />

2 3 4 f3,...〉 ←→ f0x + 1<br />

2 f1x 2 + 1<br />

3 f2x 3 + 1<br />

4 f3x 4 + ... =<br />

=<br />

=<br />

x<br />

(f0 + f1z + f2z<br />

0<br />

2 + f3z 3 + ···)dz =<br />

x<br />

0<br />

F (z)dz<br />

Q.E.D.


Operations on <strong>Generating</strong> <strong>Functions</strong> (5)<br />

5. Integration<br />

If 〈f0,f1,f2,...〉 ←→ F (x), then<br />

Example<br />

〈0,f0, 1 1 1<br />

f1, f2,<br />

2 3 4 f3,...〉 ←→<br />

〈1,1,1,1...〉 ←→ 1<br />

1−x<br />

〈0,1, 1 1<br />

2 , 3 ,...〉 ←→ x<br />

0<br />

x<br />

0<br />

F (z)dz.<br />

1<br />

1<br />

1−z dz = −ln(1 − x) = ln (1−x)


Operations on <strong>Generating</strong> <strong>Functions</strong> (6)<br />

6. Convolution (product)<br />

If 〈f0,f1,f2,...〉 ←→ F (x) <strong>and</strong> 〈g0,g1,g2,...〉 ←→ G(x), then<br />

〈h0,h1,h2,...〉 ←→ F (x) · G(x),<br />

where hn = f0gn + f1gn−1 + f2gn−2 + ··· + fng0.


Operations on <strong>Generating</strong> <strong>Functions</strong> (6)<br />

6. Convolution (product)<br />

If 〈f0,f1,f2,...〉 ←→ F (x) <strong>and</strong> 〈g0,g1,g2,...〉 ←→ G(x), then<br />

〈h0,h1,h2,...〉 ←→ F (x) · G(x),<br />

where hn = f0gn + f1gn−1 + f2gn−2 + ··· + fng0.<br />

Proof.<br />

F (x) · G(x) = (f0 + f1x + f2x 2 + ...)(g0 + g1x + g2x 2 + ...)<br />

= f0g0 + (f0g1 + f1g0)x + (f0g2 + f1g1 + f2g0)x 2 + ...<br />

Q.E.D.


Operations on <strong>Generating</strong> <strong>Functions</strong> (6)<br />

6. Convolution (product)<br />

If 〈f0,f1,f2,...〉 ←→ F (x) <strong>and</strong> 〈g0,g1,g2,...〉 ←→ G(x), then<br />

〈h0,h1,h2,...〉 ←→ F (x) · G(x),<br />

where hn = f0gn + f1gn−1 + f2gn−2 + ··· + fng0.<br />

Proof.<br />

F (x) · G(x) = (f0 + f1x + f2x 2 + ...)(g0 + g1x + g2x 2 + ...)<br />

= f0g0 + (f0g1 + f1g0)x + (f0g2 + f1g1 + f2g0)x 2 + ...<br />

Notice that all terms involving the same power of xlie on a /sloped diagonal:<br />

g0x 0 g1x 1 g2x 2 g3x 3 a0x<br />

...<br />

0 f0g0x 0 f0g1x 1 f0g2x 2 f0g3x 3 f1x<br />

...<br />

1 f1g0x 1 f1g1x 2 f1g2x 3 f2x<br />

...<br />

2 f2g0x 2 f2x 3 f3x<br />

...<br />

3 f3g0x 3 ...<br />

. ...<br />

Q.E.D.


Operations on <strong>Generating</strong> <strong>Functions</strong> (6)<br />

6. Convolution (product)<br />

If 〈f0,f1,f2,...〉 ←→ F (x) <strong>and</strong> 〈g0,g1,g2,...〉 ←→ G(x), then<br />

〈h0,h1,h2,...〉 ←→ F (x) · G(x),<br />

where hn = f0gn + f1gn−1 + f2gn−2 + ··· + fng0.<br />

Example<br />

Hence<br />

〈1,1,1,1...〉 · 〈0,1, 1 1<br />

, ,...〉 =<br />

2 3<br />

= 〈1·0, 1·0 + 1·1, 1·0 + 1·1 + 1· 1<br />

2<br />

= 〈0, 1, 1 + 1 1 1<br />

, 1 + +<br />

2 2 3 ,···〉<br />

= 〈0, H1, H2, H3,···〉<br />

∑ Hkx<br />

k0<br />

k =<br />

1<br />

(1 − x) ln<br />

1<br />

(1 − x) .<br />

1 1<br />

, 1·0 + 1·1 + 1· + 1·<br />

2 3 ,···〉


Operations on <strong>Generating</strong> <strong>Functions</strong> (7)<br />

Example<br />

〈1,1,1,1,...〉 ←→ 1<br />

1 − x<br />

〈1,2,3,4,...〉 ←→ d 1<br />

dx 1 − x =<br />

1<br />

(1 − x) 2<br />

1 x<br />

〈0,1,2,3,...〉 ←→ x · =<br />

(1 − x) 2 (1 − x) 2<br />

〈1,4,9,16,...〉 ←→ d x 1 + x<br />

=<br />

dx (1 − x) 2 (1 − x) 3<br />

1 + x x(1 + x)<br />

〈0,1,4,9,...〉 ←→ x · =<br />

(1 − x) 3 (1 − x) 3


Counting with <strong>Generating</strong> <strong>Functions</strong><br />

Choosing k-subset from n-set<br />

<strong>Binomial</strong> theorem yields:<br />

<br />

n n n n<br />

<br />

, , ,..., ,0,0,0,... ←→<br />

0 1 2 n<br />

<br />

n n n<br />

←→ + x + x<br />

0 1 2<br />

2 <br />

n<br />

...,<br />

n<br />

x n = (1 + x) n<br />

Thus, the coefficient of x k in (1 + x) n is the number of ways to<br />

choose k distinct items from a set of size n.<br />

For example, the coefficient of x 2 is , the number of ways to choose<br />

2 items from a set with n elements.<br />

Similarly, the coefficient of x n+1 is the number of ways to choose<br />

n + 1 items from a n-set, which is zero.


Counting with <strong>Generating</strong> <strong>Functions</strong><br />

Choosing k-subset from n-set<br />

<strong>Binomial</strong> theorem yields:<br />

<br />

n n n n<br />

<br />

, , ,..., ,0,0,0,... ←→<br />

0 1 2 n<br />

<br />

n n n<br />

←→ + x + x<br />

0 1 2<br />

2 <br />

n<br />

...,<br />

n<br />

x n = (1 + x) n<br />

Thus, the coefficient of x k in (1 + x) n is the number of ways to<br />

choose k distinct items from a set of size n.<br />

For example, the coefficient of x 2 is , the number of ways to choose<br />

2 items from a set with n elements.<br />

Similarly, the coefficient of x n+1 is the number of ways to choose<br />

n + 1 items from a n-set, which is zero.


Next subsection<br />

1 <strong>Binomial</strong> coefficients<br />

2 <strong>Generating</strong> <strong>Functions</strong><br />

Operations on <strong>Generating</strong> <strong>Functions</strong><br />

Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

Identities in Pascal’s Triangle


Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

.<br />

The generating function for the number of ways to choose n elements from this<br />

set A is the function A(x) that’s expansion into power series has coefficient<br />

ai = 1 of x i iff i can be selected into the subset, otherwise ai = 0<br />

Examples of GF selecting items from a set A :<br />

If any natural number can be selected:<br />

A(x) = 1 + x + x 2 + x 3 + ··· = 1<br />

1 − x


Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

.<br />

The generating function for the number of ways to choose n elements from this<br />

set A is the function A(x) that’s expansion into power series has coefficient<br />

ai = 1 of x i iff i can be selected into the subset, otherwise ai = 0<br />

Examples of GF selecting items from a set A :<br />

If any natural number can be selected:<br />

If any even number can be selected:<br />

A(x) = 1 + x + x 2 + x 3 + ··· = 1<br />

1 − x<br />

A(x) = 1 + x 2 + x 4 + x 6 + ··· = 1<br />

1 − x 2


Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

.<br />

The generating function for the number of ways to choose n elements from this<br />

set A is the function A(x) that’s expansion into power series has coefficient<br />

ai = 1 of x i iff i can be selected into the subset, otherwise ai = 0<br />

Examples of GF selecting items from a set A :<br />

If any natural number can be selected:<br />

If any even number can be selected:<br />

A(x) = 1 + x + x 2 + x 3 + ··· = 1<br />

1 − x<br />

A(x) = 1 + x 2 + x 4 + x 6 + ··· = 1<br />

1 − x 2<br />

If any positive even number can be selected:<br />

A(x) = x 2 + x 4 + x 6 + ··· = x<br />

1 − x 2


Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

.<br />

The generating function for the number of ways to choose n elements from this<br />

set A is the function A(x) that’s expansion into power series has coefficient<br />

ai = 1 of x i iff i can be selected into the subset, otherwise ai = 0<br />

Examples of GF selecting items from a set A :<br />

If any natural number can be selected:<br />

A(x) = 1 + x + x 2 + x 3 + ··· = 1<br />

1 − x<br />

If any number multiple of 5 can be selected:<br />

A(x) = 1 + x 5 + x 10 + x 15 + ··· = 1<br />

1 − x 5


Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

.<br />

The generating function for the number of ways to choose n elements from this<br />

set A is the function A(x) that’s expansion into power series has coefficient<br />

ai = 1 of x i iff i can be selected into the subset, otherwise ai = 0<br />

Examples of GF selecting items from a set A :<br />

If any natural number can be selected:<br />

If at most four can be selected:<br />

A(x) = 1 + x + x 2 + x 3 + ··· = 1<br />

1 − x<br />

A(x) = 1 + x + x 2 + x 3 + x 4 =<br />

If zero or one number can be selected:<br />

A(x) = 1 + x<br />

1 − x5<br />

1 − x


Counting elements of two sets<br />

Convolution Rule<br />

Let A(x) be the generating function for selecting items from set A , <strong>and</strong><br />

let B(x), be the generating function for selecting items from set B.<br />

If A <strong>and</strong> B are disjoint, then the generating function for selecting items from<br />

the union A ∪ B is the product A(x) · B(x).<br />

Proof. To count the number of ways to select n items from A ∪ B we have to select j<br />

items from A <strong>and</strong> n − j items from B, where j ∈ {0,1,2,...,n}.<br />

Summing over all the possible values of j gives a total of<br />

a0bn + a1bn−1 + a2bn−2 + ··· + anb0<br />

ways to select n items from A ∪ B. This is precisely the coefficient of x n in the series<br />

for A(x) · B(x) Q.E.D.


How many positive integer solutions does the equation<br />

x1 + x2 = n have?<br />

We accept any natural number can be solution for x1, i.e generating function for<br />

selection a value for this variable is A(x) = 1 + x + x2 + x3 + ··· = 1<br />

1−x ;<br />

same for variable x2;<br />

all pairs of numbers for (x1,x2) are selected by the function H(x) = A(x) · A(x);<br />

numer of solutions is the coefficient of xn .<br />

H(x) = (1 + x + x 2 + x 3 + ···)(1 + x + x 2 + x 3 + ···) =<br />

= 1 · (1 + x + x 2 + x 3 + ···) + x(1 + x + x 2 + x 3 + ···) +<br />

+x 2 (1 + x + x 2 + x 3 + ···) + x 3 (1 + x + x 2 + x 3 + ···) + ··· =<br />

= 1 + 2x + 3x 2 + 4x 3 + ··· + (n + 1)x n 1<br />

+ ··· =<br />

(1 − x) 2<br />

Ind<strong>ee</strong>d, this equation has n + 1 solutions:<br />

0 + n = n<br />

1 + (n − 1) = n<br />

2 + (n − 2) = n<br />

··· ···<br />

n + 0 = n


How many positive integer solutions does the equation<br />

x1 + x2 = n have?<br />

We accept any natural number can be solution for x1, i.e generating function for<br />

selection a value for this variable is A(x) = 1 + x + x2 + x3 + ··· = 1<br />

1−x ;<br />

same for variable x2;<br />

all pairs of numbers for (x1,x2) are selected by the function H(x) = A(x) · A(x);<br />

numer of solutions is the coefficient of xn .<br />

H(x) = (1 + x + x 2 + x 3 + ···)(1 + x + x 2 + x 3 + ···) =<br />

= 1 · (1 + x + x 2 + x 3 + ···) + x(1 + x + x 2 + x 3 + ···) +<br />

+x 2 (1 + x + x 2 + x 3 + ···) + x 3 (1 + x + x 2 + x 3 + ···) + ··· =<br />

= 1 + 2x + 3x 2 + 4x 3 + ··· + (n + 1)x n 1<br />

+ ··· =<br />

(1 − x) 2<br />

Ind<strong>ee</strong>d, this equation has n + 1 solutions:<br />

0 + n = n<br />

1 + (n − 1) = n<br />

2 + (n − 2) = n<br />

··· ···<br />

n + 0 = n


How many positive integer solutions does the equation<br />

x1 + x2 = n have?<br />

We accept any natural number can be solution for x1, i.e generating function for<br />

selection a value for this variable is A(x) = 1 + x + x2 + x3 + ··· = 1<br />

1−x ;<br />

same for variable x2;<br />

all pairs of numbers for (x1,x2) are selected by the function H(x) = A(x) · A(x);<br />

numer of solutions is the coefficient of xn .<br />

H(x) = (1 + x + x 2 + x 3 + ···)(1 + x + x 2 + x 3 + ···) =<br />

= 1 · (1 + x + x 2 + x 3 + ···) + x(1 + x + x 2 + x 3 + ···) +<br />

+x 2 (1 + x + x 2 + x 3 + ···) + x 3 (1 + x + x 2 + x 3 + ···) + ··· =<br />

= 1 + 2x + 3x 2 + 4x 3 + ··· + (n + 1)x n 1<br />

+ ··· =<br />

(1 − x) 2<br />

Ind<strong>ee</strong>d, this equation has n + 1 solutions:<br />

0 + n = n<br />

1 + (n − 1) = n<br />

2 + (n − 2) = n<br />

··· ···<br />

n + 0 = n


Number of solutions of the equation x1 + x2 + ··· + xk = n<br />

Theorem<br />

The number of ways to distribute n identical objects<br />

into k bins is n+k−1<br />

n .<br />

Proof.<br />

The number of ways to distribute n objects equals to the number of solutions of<br />

x1 + x2 + ··· + xk = n that is coefficient of x n of the generating function<br />

G(x) = 1/(1 − x) k = (1 − x) −k .<br />

For recollection: Maclaurin series (a Taylor series<br />

expansion of a function about 0):<br />

.<br />

f (x) = f (0) + f ′ (0)x + f ′′ (0)<br />

2! x2 + f ′′′ (0)<br />

x<br />

3!<br />

3 + ··· + f (n) (0)<br />

x<br />

n!<br />

n + ···


Number of solutions of the equation x1 + x2 + ··· + xk = n<br />

Theorem<br />

The number of ways to distribute n identical objects<br />

into k bins is n+k−1<br />

n .<br />

Proof.<br />

The number of ways to distribute n objects equals to the number of solutions of<br />

x1 + x2 + ··· + xk = n that is coefficient of x n of the generating function<br />

G(x) = 1/(1 − x) k = (1 − x) −k .<br />

For recollection: Maclaurin series (a Taylor series<br />

expansion of a function about 0):<br />

.<br />

f (x) = f (0) + f ′ (0)x + f ′′ (0)<br />

2! x2 + f ′′′ (0)<br />

x<br />

3!<br />

3 + ··· + f (n) (0)<br />

x<br />

n!<br />

n + ···


Equation x1 + x2 + ··· + xk = n (2)<br />

Continuation of the proof ...<br />

let’s differentiate G(x) = (1 − x) −k :<br />

G ′ (x) = k(1 − x) −(k+1)<br />

G ′′ (x) = k(k + 1)(1 − x) −(k+2)<br />

G ′′′ (x) = k(k + 1)(k + 2)(1 − x) −(k+3)<br />

G (n) (x) = k(k + 1)···(k + n − 1)(1 − x) −(k+n)<br />

Coefficient of x n can be evaluated as:<br />

G (n) (0)<br />

n!<br />

= k(k + 1)···(k + n − 1)<br />

= (k + n − 1)!<br />

=<br />

=<br />

n!<br />

(k − 1)!n! =<br />

<br />

n + k − 1<br />

n<br />

Q.E.D.


Distribute n objects into k bins so that there is at least one<br />

object in each bin<br />

Theorem<br />

The number of positive solutions of the equation<br />

x1 + x2 + ··· + xk = n is n−1<br />

k−1 .<br />

Idea of the proof. Possible number of objects in a single bin (xi > 0)<br />

could be generated by the function<br />

C(x) = x + x 2 + x 3 + ··· = x(1 + x + x 2 + ···) = x<br />

1 − x<br />

Similarly to the previous theorem, the number distributions is the<br />

coefficient of x n of the generating function<br />

H(X ) = C k (x) =<br />

k x<br />

(1 − x) k<br />

Q.E.D.


Example: 100 Euro<br />

How many ways 100 Euro can be changed using smaller banknotes?<br />

<strong>Generating</strong> functions for selecting banknotes of 5, 10, 20 or 50 Euros:<br />

<strong>Generating</strong> function for the task<br />

A(x) = x 0 + x 5 + x 10 + x 15 + ··· = 1<br />

1 − x5 B(x) = x 0 + x 10 + x 20 + x 30 1<br />

+ ··· =<br />

1 − x10 C(x) = x 0 + x 20 + x 40 + x 60 1<br />

+ ··· =<br />

1 − x20 D(x) = x 0 + x 50 + x 100 + x 150 1<br />

+ ··· =<br />

1 − x50 P(x) = A(x)B(x)C(x)D(x) =<br />

1<br />

(1 − x 5 )(1 − x 10 )(1 − x 20 )(1 − x 50 )


Example: 100 Euro<br />

How many ways 100 Euro can be changed using smaller banknotes?<br />

<strong>Generating</strong> functions for selecting banknotes of 5, 10, 20 or 50 Euros:<br />

<strong>Generating</strong> function for the task<br />

A(x) = x 0 + x 5 + x 10 + x 15 + ··· = 1<br />

1 − x5 B(x) = x 0 + x 10 + x 20 + x 30 1<br />

+ ··· =<br />

1 − x10 C(x) = x 0 + x 20 + x 40 + x 60 1<br />

+ ··· =<br />

1 − x20 D(x) = x 0 + x 50 + x 100 + x 150 1<br />

+ ··· =<br />

1 − x50 P(x) = A(x)B(x)C(x)D(x) =<br />

1<br />

(1 − x 5 )(1 − x 10 )(1 − x 20 )(1 − x 50 )


Example: 100 Euro<br />

How many ways 100 Euro can be changed using smaller banknotes?<br />

<strong>Generating</strong> functions for selecting banknotes of 5, 10, 20 or 50 Euros:<br />

<strong>Generating</strong> function for the task<br />

A(x) = x 0 + x 5 + x 10 + x 15 + ··· = 1<br />

1 − x5 B(x) = x 0 + x 10 + x 20 + x 30 1<br />

+ ··· =<br />

1 − x10 C(x) = x 0 + x 20 + x 40 + x 60 1<br />

+ ··· =<br />

1 − x20 D(x) = x 0 + x 50 + x 100 + x 150 1<br />

+ ··· =<br />

1 − x50 P(x) = A(x)B(x)C(x)D(x) =<br />

1<br />

(1 − x 5 )(1 − x 10 )(1 − x 20 )(1 − x 50 )


Example: 100 Euro (2)<br />

1. Observation:<br />

(1 − x 5 )(1 + x 5 + ··· + x 45 + 2x 50 + 2x 55 + ··· + 2x 95 + 3x 100 + 3x 105 + ··· + 3x 145 + 4x 150 + ···) =<br />

Thus:<br />

1 + x 5 + ··· + x 45 + 2x 50 + 2x 55 + ··· + 2x 95 + 3x 100 + 3x 105 + ··· + 3x 145 + 4x 150 ··· −<br />

− x 5 − ··· − x 45 − x 50 − 2x 55 − ··· − 2x 95 − 2x 100 − 3x 105 − ··· − 3x 145 − 3x 150 − 4x 155 − ··· =<br />

= 1 + x 50 + x 100 + x 150 + x 200 1<br />

+ ··· =<br />

1 − x50 F (x) = A(x)D(x) =<br />

1<br />

(1 − x5 )(1 − x50 ) = <br />

k<br />

∑ + 1 x<br />

k0 10<br />

5k = ∑ fkx<br />

k0<br />

5k


Example: 100 Euro (2)<br />

1. Observation:<br />

(1 − x 5 )(1 + x 5 + ··· + x 45 + 2x 50 + 2x 55 + ··· + 2x 95 + 3x 100 + 3x 105 + ··· + 3x 145 + 4x 150 + ···) =<br />

Thus:<br />

1 + x 5 + ··· + x 45 + 2x 50 + 2x 55 + ··· + 2x 95 + 3x 100 + 3x 105 + ··· + 3x 145 + 4x 150 ··· −<br />

− x 5 − ··· − x 45 − x 50 − 2x 55 − ··· − 2x 95 − 2x 100 − 3x 105 − ··· − 3x 145 − 3x 150 − 4x 155 − ··· =<br />

= 1 + x 50 + x 100 + x 150 + x 200 1<br />

+ ··· =<br />

1 − x50 2. Similarly:<br />

F (x) = A(x)D(x) =<br />

G(x) = B(x)C(x) =<br />

1<br />

(1 − x5 )(1 − x50 ) = <br />

k<br />

∑ + 1 x<br />

k0 10<br />

5k = ∑ fkx<br />

k0<br />

5k<br />

1<br />

(1 − x10 )(1 − x20 ) = <br />

k<br />

∑ + 1 x<br />

k0 2<br />

10k = ∑ gkx<br />

k0<br />

10k


Example: 100 Euro (3)<br />

Convolution:<br />

The coefficient of x 100 equals to<br />

P(x) = F (x)G(x) = ∑ cnx<br />

k0<br />

5n<br />

c20 = f0g10 + f2g9 + f4g8 + ··· + f20g0<br />

10<br />

∑<br />

= f2kg10−k<br />

k=0<br />

10 <br />

2k 10 − k<br />

= ∑ + 1<br />

+ 1<br />

k=0 10<br />

2<br />

10 <br />

k + 5 12 − k<br />

= ∑<br />

k=0 5 2<br />

= 1(6 + 5 + 5 + 4 + 4) + 2(3 + 3 + 2 + 2 + 1) + 3 · 1 =<br />

= 24 + 22 + 3 = 49


Next subsection<br />

1 <strong>Binomial</strong> coefficients<br />

2 <strong>Generating</strong> <strong>Functions</strong><br />

Operations on <strong>Generating</strong> <strong>Functions</strong><br />

Building <strong>Generating</strong> <strong>Functions</strong> that Count<br />

Identities in Pascal’s Triangle


V<strong>and</strong>ermonde’s identity<br />

<strong>Binomial</strong> theorem provides the generating function:<br />

Convolution yields<br />

(1 + x) m <br />

m<br />

= ∑ x<br />

k0 k<br />

k<br />

∑<br />

k0<br />

m + n<br />

k<br />

<br />

x k = (1 + x) m+n<br />

<strong>and</strong> (1 + x) n <br />

n<br />

= ∑ x<br />

k0 k<br />

k<br />

= (1 + x) m · (1 + x) n<br />

<br />

∑<br />

<br />

m<br />

= x<br />

k0 k<br />

k<br />

<br />

n<br />

∑ x<br />

k0 k<br />

k<br />

<br />

<br />

k <br />

m n<br />

= ∑ ∑<br />

k0 j=0 j k − j<br />

<br />

x k


V<strong>and</strong>ermonde’s identity (2)<br />

Equating coefficients of z k on both sides of this equation gives:<br />

Convolution yields<br />

1<br />

1<br />

1 9<br />

1<br />

8<br />

1<br />

7<br />

1<br />

6<br />

28<br />

1<br />

5<br />

21<br />

36 84<br />

1<br />

4<br />

15<br />

56<br />

1<br />

3<br />

10<br />

35<br />

1<br />

2<br />

6<br />

20<br />

70<br />

V<strong>and</strong>ermonde’s convolution:<br />

k <br />

m n m + n<br />

∑<br />

=<br />

j=0 j k − j k<br />

1<br />

3<br />

10<br />

35<br />

126 126<br />

1<br />

4<br />

15<br />

56<br />

1<br />

5<br />

21<br />

1<br />

6<br />

28<br />

1<br />

7<br />

84 36<br />

1<br />

8<br />

1<br />

1<br />

9 1<br />

<br />

9 3 6 3 6 3 6<br />

= + +<br />

2 0 2 1 1 2 0


V<strong>and</strong>ermonde’s identity (2)<br />

Equating coefficients of z k on both sides of this equation gives:<br />

Convolution yields<br />

1<br />

1<br />

1 9<br />

1<br />

8<br />

1<br />

7<br />

1<br />

6<br />

28<br />

1<br />

5<br />

21<br />

36 84<br />

1<br />

4<br />

15<br />

56<br />

1<br />

3<br />

10<br />

35<br />

1<br />

2<br />

6<br />

20<br />

70<br />

V<strong>and</strong>ermonde’s convolution:<br />

k <br />

m n m + n<br />

∑<br />

=<br />

j=0 j k − j k<br />

1<br />

3<br />

10<br />

35<br />

126 126<br />

1<br />

4<br />

15<br />

56<br />

1<br />

5<br />

21<br />

1<br />

6<br />

28<br />

1<br />

7<br />

84 36<br />

1<br />

8<br />

1<br />

1<br />

9 1<br />

<br />

9 3 6 3 6 3 6<br />

= + +<br />

2 0 2 1 1 2 0


V<strong>and</strong>ermonde’s identity (3)<br />

Special case m = n = k yields:<br />

<br />

2n<br />

=<br />

n<br />

n<br />

∑<br />

j=0<br />

Example: 42 42 42 42 42 8 0 + 1 + 2 + 3 + 4 = 4<br />

1<br />

1<br />

1 8<br />

1<br />

7<br />

1<br />

6<br />

1<br />

5<br />

21<br />

1<br />

4<br />

15<br />

28 56<br />

1<br />

3<br />

10<br />

35<br />

1<br />

2<br />

6<br />

20<br />

1<br />

3<br />

10<br />

35<br />

1<br />

4<br />

15<br />

70 56<br />

1<br />

5<br />

21<br />

1<br />

6<br />

2 n n n<br />

=<br />

j n − j ∑<br />

j0 j<br />

1<br />

7<br />

1<br />

28 8<br />

1<br />

1<br />

1<br />

1<br />

1 16<br />

1<br />

9<br />

1<br />

4<br />

1<br />

9<br />

1<br />

36 16<br />

1 + 16 + 36 + 16 + 1 = 70<br />

1<br />

1


V<strong>and</strong>ermonde’s identity (3)<br />

Special case m = n = k yields:<br />

<br />

2n<br />

=<br />

n<br />

n<br />

∑<br />

j=0<br />

Example: 42 42 42 42 42 8 0 + 1 + 2 + 3 + 4 = 4<br />

1<br />

1<br />

1 8<br />

1<br />

7<br />

1<br />

6<br />

1<br />

5<br />

21<br />

1<br />

4<br />

15<br />

28 56<br />

1<br />

3<br />

10<br />

35<br />

1<br />

2<br />

6<br />

20<br />

1<br />

3<br />

10<br />

35<br />

1<br />

4<br />

15<br />

70 56<br />

1<br />

5<br />

21<br />

1<br />

6<br />

2 n n n<br />

=<br />

j n − j ∑<br />

j0 j<br />

1<br />

7<br />

1<br />

28 8<br />

1<br />

1<br />

1<br />

1<br />

1 16<br />

1<br />

9<br />

1<br />

4<br />

1<br />

9<br />

1<br />

36 16<br />

1 + 16 + 36 + 16 + 1 = 70<br />

1<br />

1


Sequence m<br />

0<br />

Let’s take sequences<br />

<strong>and</strong><br />

,0,− m<br />

1<br />

,0, m<br />

2<br />

,0,− m<br />

3<br />

,0, m<br />

4<br />

<br />

m m m m<br />

〈 , , ,..., ,...〉 ←→ F (X ) = (1 + x)<br />

0 1 2 n<br />

m<br />

,0,..., <br />

<br />

m m m m<br />

〈 ,− , ,− ,...,(−1)<br />

0 1 2 3<br />

n<br />

<br />

m<br />

,...〉 ←→ G(X ) = (1 − x)<br />

n<br />

m<br />

Then the convolution corresponds to the function (1 − x) m (1 + x) m = (1 − x 2 ) m that<br />

gives the identity of binomial coefficients:<br />

n <br />

m m<br />

∑<br />

(−1)<br />

j=0 j n − j<br />

j = (−1) n/2<br />

<br />

m<br />

[n is even].<br />

n/2


Some other useful sequences<br />

For any n 0:<br />

1<br />

(1 − x) n+1 = ∑<br />

k0<br />

−n − 1<br />

k<br />

<br />

(−x) k = ∑<br />

k0<br />

<br />

= (−1) k n−k−1 k<br />

Here the identity negative coefficients n k<br />

For any n 0, using right-shift :<br />

xn (1 − x) n+1 = <br />

k<br />

∑ x<br />

k0 n<br />

k<br />

Exponential series<br />

Logarithmic series<br />

n + k<br />

e x = 1 + x + 1<br />

2! x2 + 1<br />

3! x3 1<br />

+ ··· = ∑<br />

k0 k! xk<br />

ln(1 + x) = x − 1<br />

2 x2 + 1<br />

3 x3 − ··· = ∑<br />

k1<br />

n<br />

<br />

x k<br />

is used.<br />

(−1) k+1<br />

x<br />

k<br />

k<br />

1 1<br />

= x +<br />

ln(1 + x) 2 x2 + 1<br />

3 x3 1<br />

+ ··· = ∑<br />

k1 k xk

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!