02.01.2015 Views

Introduction to Combinatorics: Basic Counting Techniques - pjwstk

Introduction to Combinatorics: Basic Counting Techniques - pjwstk

Introduction to Combinatorics: Basic Counting Techniques - pjwstk

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong> <strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong> <strong>Counting</strong> <strong>Techniques</strong><br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Marcin Sydow<br />

Project co-nanced by European Union within the framework of European Social Fund


Literature<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Combina<strong>to</strong>rics:<br />

D.Knuth et al. Concrete Mathematics (also available in<br />

Polish, PWN 1998)<br />

M.Libura et al. Wykªady z Matematyki Dyskretnej, cz.1<br />

Kombina<strong>to</strong>ryka, skrypt WSISIZ, Warszawa 2001<br />

M.Lipski Kombina<strong>to</strong>ryka dla programistów, WNT 2004<br />

Van Lint et al. A Course in Combina<strong>to</strong>rics, Cambridge<br />

2001<br />

Graphs:<br />

R.Wilson <strong>Introduction</strong> <strong>to</strong> Graph Theory (also available in<br />

Polish, PWN 2000)<br />

R.Diestel Graph Theory, Springer 2000


Contents<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

<strong>Basic</strong> <strong>Counting</strong><br />

Reminder of basic facts<br />

Binomial Coecient<br />

Multinomial Coecient<br />

Multisets<br />

Set Partitions<br />

Number Partitions<br />

Permutations and Cycles<br />

General <strong>Techniques</strong><br />

Pigeonhole Principle<br />

Inclusion-Exclusion Principle<br />

Generating Functions


General <strong>Basic</strong> Ideas for <strong>Counting</strong><br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

create easy-<strong>to</strong>-count representations of counted objects<br />

product rule: multiply when choices are independent<br />

sum rule: sum up exclusive alternatives<br />

combina<strong>to</strong>rial interpretation proving technique<br />

These ideas can be used not only <strong>to</strong> count objects but also <strong>to</strong><br />

easily prove non-trivial discrete-maths identities (examples<br />

soon)


<strong>Counting</strong> <strong>Basic</strong> Objects<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

Denotations: # means: the number of<br />

[n] means: the set {1,...,n}, for n ∈ N<br />

n, m ∈ N<br />

(# functions from [m] in<strong>to</strong> [n]) |Fun([m], [n])| =<br />

General<br />

<strong>Techniques</strong>


<strong>Counting</strong> <strong>Basic</strong> Objects<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

Denotations: # means: the number of<br />

[n] means: the set {1,...,n}, for n ∈ N<br />

n, m ∈ N<br />

(# functions from [m] in<strong>to</strong> [n]) |Fun([m], [n])| = n m<br />

(# subsets of an n-element set) |P([n])| =<br />

General<br />

<strong>Techniques</strong>


<strong>Counting</strong> <strong>Basic</strong> Objects<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Denotations: # means: the number of<br />

[n] means: the set {1,...,n}, for n ∈ N<br />

n, m ∈ N<br />

(# functions from [m] in<strong>to</strong> [n]) |Fun([m], [n])| = n m<br />

(# subsets of an n-element set) |P([n])| = 2 n<br />

(# injections as above) |Inj([m], [n])| =


<strong>Counting</strong> <strong>Basic</strong> Objects<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Denotations: # means: the number of<br />

[n] means: the set {1,...,n}, for n ∈ N<br />

n, m ∈ N<br />

(# functions from [m] in<strong>to</strong> [n]) |Fun([m], [n])| = n m<br />

(# subsets of an n-element set) |P([n])| = 2 n<br />

(# injections as above) |Inj([m], [n])| = n m for n ≥ m (called<br />

falling fac<strong>to</strong>rial)<br />

# ordered placings of m dierent balls in<strong>to</strong> n dierent boxes :


<strong>Counting</strong> <strong>Basic</strong> Objects<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Denotations: # means: the number of<br />

[n] means: the set {1,...,n}, for n ∈ N<br />

n, m ∈ N<br />

(# functions from [m] in<strong>to</strong> [n]) |Fun([m], [n])| = n m<br />

(# subsets of an n-element set) |P([n])| = 2 n<br />

(# injections as above) |Inj([m], [n])| = n m for n ≥ m (called<br />

falling fac<strong>to</strong>rial)<br />

# ordered placings of m dierent balls in<strong>to</strong> n dierent boxes : n ©m<br />

(called increasing power)<br />

(# permutations of [n]) |S n | =


<strong>Counting</strong> <strong>Basic</strong> Objects<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Denotations: # means: the number of<br />

[n] means: the set {1,...,n}, for n ∈ N<br />

n, m ∈ N<br />

(# functions from [m] in<strong>to</strong> [n]) |Fun([m], [n])| = n m<br />

(# subsets of an n-element set) |P([n])| = 2 n<br />

(# injections as above) |Inj([m], [n])| = n m for n ≥ m (called<br />

falling fac<strong>to</strong>rial)<br />

# ordered placings of m dierent balls in<strong>to</strong> n dierent boxes : n ©m<br />

(called increasing power)<br />

(# permutations of [n]) |S n | = n!


Binomial Coecient<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

# k-subsets of [n]<br />

( n<br />

k<br />

)<br />

= nk<br />

k!<br />

N ∋ k ≤ n ∈ N<br />

(there is also possible a more general formulation for<br />

non-natural numbers)


Recursive formulation<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

( n<br />

k<br />

)<br />

=<br />

( n − 1<br />

k − 1<br />

) ( n − 1<br />

+<br />

k<br />

(also known as Pascal's triangle)<br />

)<br />

General<br />

<strong>Techniques</strong>


Recursive formulation<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

( n<br />

k<br />

)<br />

=<br />

( n − 1<br />

k − 1<br />

) ( n − 1<br />

+<br />

k<br />

(also known as Pascal's triangle)<br />

how <strong>to</strong> prove it without (almost) any algebra<br />

(use combina<strong>to</strong>rial interpretation idea)<br />

)


Recursive formulation<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

( n<br />

k<br />

)<br />

=<br />

( n − 1<br />

k − 1<br />

) ( n − 1<br />

+<br />

k<br />

(also known as Pascal's triangle)<br />

how <strong>to</strong> prove it without (almost) any algebra<br />

(use combina<strong>to</strong>rial interpretation idea)<br />

(consider whether one xed element of [n] belongs <strong>to</strong> the<br />

k-subset or not)<br />

)


<strong>Basic</strong> properties<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

Symmetry:<br />

( n<br />

k<br />

)<br />

=<br />

( n<br />

n − k<br />

)<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong>


<strong>Basic</strong> properties<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

( ) ( )<br />

n n<br />

Symmetry: =<br />

k n − k<br />

(each k-subset denes (n-k)-subset its complement)<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong>


<strong>Basic</strong> properties<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

( ) ( )<br />

n n<br />

Symmetry: =<br />

k n − k<br />

(each k-subset denes (n-k)-subset its complement)<br />

n∑<br />

( ) n<br />

= 2 n<br />

k<br />

k=0


<strong>Basic</strong> properties<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

( ) ( )<br />

n n<br />

Symmetry: =<br />

k n − k<br />

(each k-subset denes (n-k)-subset its complement)<br />

n∑<br />

( ) n<br />

= 2 n<br />

k<br />

k=0<br />

(summing subsets of [n] by their multiplicity)


<strong>Basic</strong> properties<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

( n<br />

k<br />

) ( k<br />

m<br />

) ( n<br />

=<br />

m<br />

) ( n − m<br />

n − k<br />

)<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong>


<strong>Basic</strong> properties<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

( ) ( ) ( ) ( )<br />

n k n n − m<br />

=<br />

k m m n − k<br />

(consider m-element subset of o k-element subset of [n])<br />

General<br />

<strong>Techniques</strong>


<strong>Basic</strong> properties<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

( ) ( ) ( ) ( )<br />

n k n n − m<br />

=<br />

k m m n − k<br />

(consider m-element subset of o k-element subset of [n])<br />

( m + n<br />

k<br />

)<br />

=<br />

k∑<br />

( m<br />

s<br />

s=0<br />

) ( n<br />

k − s<br />

)


Binomial Theorem<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(x + y) n =<br />

n∑<br />

( ) n<br />

x k y n−k<br />

k<br />

k=0<br />

(explanation: each term on the right may be represented as a<br />

k-subset of [n])<br />

Corollaries:<br />

# odd subsets of [n] equals # even subsets


Binomial Theorem<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(x + y) n =<br />

n∑<br />

( ) n<br />

x k y n−k<br />

k<br />

k=0<br />

(explanation: each term on the right may be represented as a<br />

k-subset of [n])<br />

Corollaries:<br />

# odd subsets of [n] equals # even subsets (substitute<br />

x=1 and y=-1)


Binomial Theorem<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(x + y) n =<br />

n∑<br />

( ) n<br />

x k y n−k<br />

k<br />

k=0<br />

(explanation: each term on the right may be represented as a<br />

k-subset of [n])<br />

Corollaries:<br />

# odd subsets of [n] equals # even subsets (substitute<br />

x=1 and y=-1)<br />

n∑<br />

( ) n<br />

k = n2 n−1<br />

k<br />

k=0<br />

(take derivative (as function of x) of both sides and then<br />

subsitute x=y=1)


Multinomial Coecient<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(a generalisation of the binomial coecient)<br />

# colourings of n balls with at most m dierent colours so that<br />

exactly k i ∈ N balls have the i-th colour<br />

(<br />

)<br />

n<br />

=<br />

k 1 k 2 . . . k m<br />

n!<br />

k 1 ! · . . . · k m !


Multinomial Coecient<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(a generalisation of the binomial coecient)<br />

# colourings of n balls with at most m dierent colours so that<br />

exactly k i ∈ N balls have the i-th colour<br />

(<br />

)<br />

n<br />

=<br />

k 1 k 2 . . . k m<br />

n!<br />

k 1 ! · . . . · k m !<br />

(x the sequence (k) i and x a permutation of [n] <strong>to</strong> be<br />

coloured)


Multinomial Theorem<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

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

∑<br />

k 1 , . . . , k m ∈ N<br />

k 1 + . . . + k m = n<br />

(<br />

)<br />

n<br />

x k 1 km<br />

1 ·. . .·xm<br />

k 1 k 2 . . . k m<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Corollary:<br />

∑<br />

k 1 , . . . , k m ∈ N<br />

k 1 + . . . + k m = n<br />

(<br />

n<br />

k 1 k 2 . . . k m<br />

)<br />

= m n


Multinomial Theorem<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

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

∑<br />

k 1 , . . . , k m ∈ N<br />

k 1 + . . . + k m = n<br />

(<br />

)<br />

n<br />

x k 1 km<br />

1 ·. . .·xm<br />

k 1 k 2 . . . k m<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Corollary:<br />

∑<br />

k 1 , . . . , k m ∈ N<br />

k 1 + . . . + k m = n<br />

(<br />

)<br />

n<br />

= m n<br />

k 1 k 2 . . . k m<br />

(substitute all 1's on the left-hand side)


Recursive Formula<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(<br />

) (<br />

n<br />

=<br />

k 1 k 2 . . . k m<br />

) (<br />

n − 1<br />

+<br />

k 1 − 1 k 2 . . . k m<br />

(<br />

+ . . . +<br />

n − 1<br />

k 1 k 2 . . . k m − 1<br />

)<br />

n − 1<br />

+<br />

k 1 k 2 − 1 . . . k m<br />

)


Recursive Formula<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(<br />

) (<br />

n<br />

=<br />

k 1 k 2 . . . k m<br />

) (<br />

n − 1<br />

+<br />

k 1 − 1 k 2 . . . k m<br />

(<br />

+ . . . +<br />

n − 1<br />

k 1 k 2 . . . k m − 1<br />

)<br />

n − 1<br />

+<br />

k 1 k 2 − 1 . . . k m<br />

(explanation: x one element of [n] and analogously <strong>to</strong> the<br />

binomial theorem)<br />

)


Multisets<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

Element of type x i has k i (identical) copies.<br />

Q =< k 1 ∗ x 1 , . . . , k n ∗ x n ><br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Subset S of Q:<br />

S =< m 1 ∗ x 1 , . . . , m n ∗ x n ><br />

(0 ≤ m i ≤ k i , for i ∈ [n])<br />

Fact:<br />

# subsets of Q = <br />

|Q| = k 1 + . . . + k n


Multisets<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

Element of type x i has k i (identical) copies.<br />

Q =< k 1 ∗ x 1 , . . . , k n ∗ x n ><br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Subset S of Q:<br />

S =< m 1 ∗ x 1 , . . . , m n ∗ x n ><br />

(0 ≤ m i ≤ k i , for i ∈ [n])<br />

|Q| = k 1 + . . . + k n<br />

Fact:<br />

# subsets of Q = (1 + k 1 ) · (1 + k 2 ) · . . . · (1 + k n )


Partitions of number n in<strong>to</strong> sum of k terms<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

P(n, k)<br />

# k-partitions of n, n ∈ N<br />

Partition of n: n = a 1 + . . . + a k , a 1 ≥ . . . ≥ a k > 0<br />

Recursive formula:<br />

P(n, k) = P(n − 1, k − 1) + P(n − k, k)


Partitions of number n in<strong>to</strong> sum of k terms<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

P(n, k)<br />

# k-partitions of n, n ∈ N<br />

Partition of n: n = a 1 + . . . + a k , a 1 ≥ . . . ≥ a k > 0<br />

Recursive formula:<br />

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

(either a k = 1 or all blocks can be decreased by 1 element)


Partitions of number n in<strong>to</strong> sum of k terms<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

P(n, k)<br />

# k-partitions of n, n ∈ N<br />

Partition of n: n = a 1 + . . . + a k , a 1 ≥ . . . ≥ a k > 0<br />

Recursive formula:<br />

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

(either a k = 1 or all blocks can be decreased by 1 element)<br />

Fact:<br />

P(n, k) =<br />

k∑<br />

P(n − k, i)<br />

i=0


Partitions of number n in<strong>to</strong> sum of k terms<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

# k-partitions of n, n ∈ N<br />

P(n, k)<br />

Partition of n: n = a 1 + . . . + a k , a 1 ≥ . . . ≥ a k > 0<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Recursive formula:<br />

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

(either a k = 1 or all blocks can be decreased by 1 element)<br />

Fact:<br />

k∑<br />

P(n, k) = P(n − k, i)<br />

i=0<br />

(decrease by 1 each of i terms greater than 1)


Set Partitions<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Partition of nite set X in<strong>to</strong> k blocks: Π k = A 1 , . . . , A k so that:<br />

∀ 1≤i≤k A i ≠ ∅<br />

A 1 ∪ . . . ∪ A k = X<br />

∀ 1≤i


Stirling Number of the 2nd kind<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

{ n<br />

k<br />

}<br />

= |Π k ([n])|<br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(# partitions of [n] in<strong>to</strong> k blocks)<br />

Recursive formula:<br />

{ } { }<br />

n n<br />

= 1 = 0 for n > 0<br />

n 0<br />

{ n<br />

k<br />

}<br />

=<br />

{ n − 1<br />

k − 1<br />

} { n − 1<br />

+ k<br />

k<br />

}


Stirling Number of the 2nd kind<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

{ n<br />

k<br />

}<br />

= |Π k ([n])|<br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(# partitions of [n] in<strong>to</strong> k blocks)<br />

Recursive formula:<br />

{ } { }<br />

n n<br />

= 1 = 0 for n > 0<br />

n 0<br />

{ n<br />

k<br />

}<br />

=<br />

{ n − 1<br />

k − 1<br />

} { n − 1<br />

+ k<br />

k<br />

(a xed element constitutes a single<strong>to</strong>n-block or belongs <strong>to</strong> one<br />

of bigger k blocks)<br />

}


Equivalence Relations and Surjections<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

Bell Number<br />

B n =<br />

n∑<br />

{ n<br />

k<br />

k=0<br />

(# equivalence relations on [n])<br />

}<br />

General<br />

<strong>Techniques</strong><br />

# surjections from [m] on<strong>to</strong> [n], m ≥ n =


Equivalence Relations and Surjections<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

Bell Number<br />

B n =<br />

n∑<br />

{ n<br />

k<br />

k=0<br />

(# equivalence relations on [n])<br />

}<br />

General<br />

<strong>Techniques</strong><br />

# surjections from [m]<br />

{<br />

on<strong>to</strong><br />

}<br />

[n], m ≥ n = <br />

m<br />

|Sur([m], [n])| = m! ·<br />

n


Relation between x n , x n , x n (with Stirling 2-nd order numbers)<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

n∑<br />

{ n<br />

x n =<br />

k<br />

k=0<br />

}<br />

· x n =<br />

n∑<br />

{ n<br />

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

k<br />

k=0<br />

}<br />

· x n


Permutations<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Inj([n], [n])<br />

Permutations on [n] constitute a group denoted by S n<br />

composition of 2 permutations gives a permutation on [n]<br />

identity permutation is a neutral element (e)<br />

inverse of permutation f is a permutation f −1 on [n]


Examples<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Inverse:<br />

( ) 12345<br />

f =<br />

53214<br />

( ) 12345<br />

g =<br />

25314<br />

f −1 =<br />

( 12345<br />

43251<br />

The group is not commutative: fg is dierent than gf:<br />

( ) 12345<br />

fg =<br />

34251<br />

gf =<br />

( 12345<br />

43521<br />

)<br />

)


Decomposition in<strong>to</strong> Cycles<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

A cycle is a special kind of permutation.<br />

Each permutation can be decomposed in<strong>to</strong> disjoint cycles:<br />

Example:<br />

decomposition is unique<br />

the cycles are commutative<br />

f =<br />

( 12345<br />

53214<br />

)<br />

f = f ′ f ′′ = [1, 5, 4][2, 3] = [2, 3][1, 5, 4] = f ′′ f ′ = f


Stirling Number of the 1st kind<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

# permutations consisting of exactly k cycles:<br />

[ n<br />

k<br />

]<br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

n∑<br />

[ ] n<br />

= n!<br />

k<br />

k=0<br />

Recursive Formula:<br />

[ ] [ n n − 1<br />

=<br />

k k − 1<br />

] [ n − 1<br />

+ (n − 1)<br />

k<br />

]


Stirling Number of the 1st kind<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

# permutations consisting of exactly k cycles:<br />

[ n<br />

k<br />

]<br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

n∑<br />

[ ] n<br />

= n!<br />

k<br />

k=0<br />

Recursive Formula:<br />

[ ] [ n n − 1<br />

=<br />

k k − 1<br />

] [ n − 1<br />

+ (n − 1)<br />

k<br />

(x a single element: it either itself constitutes a 1-cycle or can<br />

be at one of the n-1 positions in the k cycles)<br />

]


Expressing decreasing and increasing powers in terms<br />

of normal powers with the help of Stirling Numbers of the 1-st kind<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

x n =<br />

n∑<br />

[ n<br />

k<br />

k=0<br />

x n =<br />

k=0<br />

]<br />

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

n∑<br />

[ ] n<br />

k<br />

x k


(Reminder of the opposite)<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

n∑<br />

{ n<br />

x n =<br />

k<br />

k=0<br />

}<br />

· x n =<br />

n∑<br />

{ n<br />

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

k<br />

k=0<br />

}<br />

· x n


Other (amazing) connections between Stirling<br />

Numbers of both kinds<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

n∑<br />

[ ] { }<br />

n k<br />

(−1) n−k = [m == n]<br />

k m<br />

k=0<br />

n∑<br />

{ } [ ] n k<br />

(−1) n−k = [m == n]<br />

k m<br />

k=0


Type of permutation<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Permutation f ∈ S n has type (λ 1 , . . . , λ n ) i its decomposition<br />

in<strong>to</strong> disjoint cycles contains exactly λ i cycles of length i.<br />

Example:<br />

f =<br />

f = [1, 7, 6, 3], [2, 5], [4], [8, 9]<br />

( 123456789<br />

751423698<br />

)<br />

Thus, the type of f is (1, 2, 0, 1, 0, 0, 0, 0, 0).<br />

We equivalently denote it as: 1 1 2 2 4 1


Inversion in a permutation<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Inversion in a permutation f = (a 1 , . . . , a n ) ∈ S n is a pair<br />

(a i , a j ) so that i < j ≤ n and a i > a j<br />

The number of inversions in permutation f is denoted as I (f )<br />

What is the minimum/maximum value of I (f )<br />

How does it relate <strong>to</strong> sorting<br />

How <strong>to</strong> eciently compute I (f )


Transpositions<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

A permutation that is a cycle of length 2 is called transposition<br />

Fact: Each permutation f is a composition of exactly I (f )<br />

transpositions of neighbouring elements


Sign of Permutation<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

assume, f ∈ S n :<br />

(denition)<br />

sgn(f ) = (−1) I (f )<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

sgn(fg) = sgn(f ) · sgn(g)<br />

sgn(f −1 ) = sgn(f )<br />

We say that a permutation is even when sgn(f ) = 1 and odd<br />

otherwise<br />

Fact: sgn(f ) = (−1) k−1 for any f being a k-cycle


Computing the sign of a permutation<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

For any permutation f ∈ S n of the type (1 λ 1<br />

. . . n λn ) its sign<br />

can be computed as follows:<br />

∑ ⌊n/2⌋<br />

sgn(f ) = (−1) j=1 λ 2j<br />

(only even cycles contribute <strong>to</strong> the sign of the permutation)


General <strong>Techniques</strong><br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Pigeonhole Principle<br />

Inclusion-Exclusion Principle<br />

Generating Functions


Pigeonhole Principle (Pol. Zasada szuadkowa)<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Let X,Y be nite sets, f ∈ Fun(X , Y ) and |X | > r · |Y | for some<br />

r ∈ R + . Then, for at least one y ∈ Y , |f −1 ({y})| > r.<br />

(or equivalently: if you put m balls in<strong>to</strong> n boxes then at least<br />

one box contains not less than m/n balls)


Examples<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

Any 10-subset of [50] contains two dierent 5-subsets that have<br />

the same sum of elements.<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong>


Examples<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Any 10-subset of [50] contains two dierent 5-subsets that have<br />

the same sum of elements.<br />

(Hair strands theorem, etc.):<br />

At the moment, there exist two people on the earth that have<br />

exactly the same number of hair strands


Inclusion-Exclusion Principle<br />

(Pol. Zasada Wª¡cze«-Wyª¡cze«)<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

For any non-empty family A = {A 1 , . . . , A n } of subsets of a<br />

nite set X, the following holds:<br />

|<br />

n⋃<br />

A i | =<br />

i=1<br />

n∑<br />

(−1) i−1<br />

i=1<br />

(proof by induction on n)<br />

∑<br />

1≤p 1


Example: number of Derangements<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

A derangement (Pol. nieporz¡dek) is a permutation f ∈ S n so<br />

that f (i) ≠ i, for i ∈ [n].<br />

D n is the set of all derangements on [n]. |D n | is denoted as !n.<br />

Theorem: !n = |D n | = n! ∑ n<br />

i=0<br />

(−1) i<br />

i!


Proof of the formula for !n<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Let A i = {f ∈ S n : f (i) = i}, for i ∈ [n]. Thus<br />

!n = |S n | − |A 1 ∪ A 2 ∪ . . . ∪ A n | =<br />

= n! −<br />

n∑<br />

(−1) i−1<br />

i=1<br />

∑<br />

1≤p 1


Ratio of Derangements in Permutations<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

Since !n = |D n | = n! ∑ n (−1) i<br />

i=0 i!<br />

The ratio of derangements: |D n |/|S n | while n → ∞ tends <strong>to</strong> 1 e<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

e −1 =<br />

∞∑<br />

(−1) i 1 i! ≈ 0.368 . . . ,<br />

i=0<br />

(e ≈ 2.7182 . . . is the base of the natural logarithm)


Generating Functions<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

A generating function of an innite sequence a 0 , a 1 , . . . is a<br />

power series:<br />

A(z) =<br />

where z is a complex variable<br />

∞∑<br />

a i z i<br />

i=0<br />

Generating functions is a powerful <strong>to</strong>ol for representing,<br />

manipulating and nding closed-form formulas for sequences<br />

(especially recurrent sequences)


How <strong>to</strong> extract a sequence from its generating<br />

function<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Let's view A(z) as a function of z, that is convergent in some<br />

neighbourhood of z. Then we have:<br />

a k = A(k) (0)<br />

k!<br />

(k-th fac<strong>to</strong>r in the Maclaurin series of A(z))


Examples<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

a i = [i = n] ∑ ∞<br />

[i = n]z i<br />

i=0<br />

= z n<br />

a i = c i ∑ ∞<br />

i=0 ci z i = (1 − cz) −1 (geometric series)<br />

a i = [m|i] ∑ ∞<br />

z m·i<br />

i=0<br />

= 1<br />

a i = (i!) −1 ∑ ∞<br />

i=0<br />

z i<br />

i!<br />

= e z<br />

1−z m<br />

(a) = (0, 1, 1/2, 1/3/, 1/4, . . .) ∑ ∞<br />

i=1<br />

z i<br />

i<br />

= −ln(1 − z)


<strong>Basic</strong> Operations<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Let A(z) and B(z) are the generating functions (GF) of<br />

sequences (a i ) and (b i ), respectively, α ∈ R. Then:<br />

GF of (a i + b i ) is A(z) + B(z) = ∑ ∞<br />

i=0 (a i + b i )z i<br />

GF of (α · a i ) is α · A(z) = ∑ ∞<br />

i=0 α · a i · z i<br />

GF of (a i−m ) is z m · A(z)


Further Examples<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

(0, 1, 0, 1 . . .) z(1 − z 2 ) −1<br />

(1, 1/2, 1/3, . . .) −z −1 ln(1 − z)<br />

a i = 1 (1 − z) −1<br />

a i = (−1) i (1 + z) −1<br />

i · a i z · A ′ (z)<br />

a i = i z d dz (1 − z)−1 = z(1 − z) −2


Convolution of sequences<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

A convolution of two sequences (a i ) and (b i ) is a sequence c i :<br />

c i =<br />

i∑<br />

a k · b i−k<br />

k=0<br />

and is denoted as: (c i ) = (a i ) ∗ (b i )<br />

Convolution is commutative.<br />

Fact:<br />

∞∑<br />

c i z i = A(z) · B(z)<br />

i=0<br />

(GF of (a i ) ∗ (b i ) is A(z) · B(z))


Example<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

Harmonic number:<br />

Closed-form formula<br />

H n =<br />

n∑<br />

i=1<br />

GF for (H n ) is a convolution of (0, 1, 1/2, 1/3, . . .) and<br />

(1, 1, 1, . . .). Thus, this GF is −(1 − z) −1 ln(1 − z).<br />

1<br />

i


Example: Closed-form formula Fibonacci Numbers<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

thus (its GF is):<br />

F i = F i−1 + F i−2 + [i = 1]<br />

F (z) = zF (z) + z 2 F (z) + z<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

z<br />

F (z) =<br />

1 − z − z 2<br />

(1 − z − z 2 ) = (1 − az)(1 − bz), where a = (1 − √ 5)/2 and<br />

b = (1 + √ 5)/2. Thus,<br />

z<br />

F (z) =<br />

(1−az)(1−bz) = 1<br />

(a−b) ( 1<br />

(1−az) − 1<br />

(1−bz) ) = ∑ ∞ a i −b i<br />

i=0 a−b · z i .<br />

Finally:<br />

F i = √ 1 [( 1 + √ 5<br />

) i − ( 1 − √ 5<br />

) i ]<br />

5 2<br />

2


N-th order linear recurrent equations<br />

<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

General<br />

<strong>Techniques</strong><br />

a i = q(i) + q 1 · a i−1 + q 2 · a i−2 + . . . + q k · a i−k<br />

where q(i) = a i , for i ∈ [k − 1] (initial conditions)<br />

A(z) = A 0 (z) + q 1 · zA(z) + q 2 · z 2 A(z) + . . . + q k · z k A(z)<br />

A(z) =<br />

a 0 + a 1 z + . . . + a k−1 z k−1<br />

1 − q 1 z − q 2 z 2 − . . . − q k z k


<strong>Introduction</strong><br />

<strong>to</strong> Combina<strong>to</strong>rics:<br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

<strong>Techniques</strong><br />

Marcin<br />

Sydow<br />

<strong>Introduction</strong><br />

<strong>Basic</strong><br />

<strong>Counting</strong><br />

Thank you for attention<br />

General<br />

<strong>Techniques</strong>

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

Saved successfully!

Ooh no, something went wrong!