principle of inclusion and exclusion - warwick...

25
Principle of inclusion and exclusion If A and B are disjoint sets, then |AB|=|A|+|B| Rule of Sum If A and B are not disjoint, then |AB|=|A|+|B|-|AB| A B

Upload: hamien

Post on 21-Mar-2018

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

If A and B are disjoint sets, then

|AB|=|A|+|B| Rule of Sum

If A and B are not disjoint, then

|AB|=|A|+|B|-|AB|

A B

Page 2: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

For three sets we have,

|ABC|=|A|+|B|+|C|-|AB|-|AC|-|BC|+|ABC|

A B

C

2

2 2 3

|A|+|B|+|C| 1 1

1

Page 3: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

For three sets we have,

|ABC|=|A|+|B|+|C|-|AB|-|AC|-|BC|+|ABC|

A B

C

1

2 2 2

|A|+|B|+|C|

-|AB| 1 1

1

Page 4: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

For three sets we have,

|ABC|=|A|+|B|+|C|-|AB|-|AC|-|BC|+|ABC|

A B

C

1

1 2 1

|A|+|B|+|C|

-|AB|

-|AC|

1 1

1

Page 5: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

For three sets we have,

|ABC|=|A|+|B|+|C|-|AB|-|AC|-|BC|+|ABC|

A B

C

1

1 1 0

|A|+|B|+|C|

-|AB|

-|AC|

-|BC|

1 1

1

Page 6: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

For three sets we have,

|ABC|=|A|+|B|+|C|-|AB|-|AC|-|BC|+|ABC|

A B

C

1

1 1 1

|A|+|B|+|C|

-|AB|

-|AC|

-|BC|

+|ABC|

1 1

1

Page 7: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

For A1,A2,…,An and a natural kn, denote

||2

21

1 k

k

ii

iii

ik AAAS

|||| 11 nAAS ||2 ji

ji

AAS

n

n

n SSSSSAAA 1

432121 )1(||

Theorem

Page 8: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

n

n

n SSSSSAAA 1

432121 )1(||

Theorem

Proof.

xA1 … An

Assume x is contained in m sets,

then x contributes m to S1

x contributes to S2,

2

m

k

mx contributes to Sk

m

k

k

m

k

k

m

k

m

k

m

0

1

1

1

1100

)1(

)1(

0)1(0

m

k

k

k

m0)1(

0

1

m

k

k

k

m

Page 9: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Principle of inclusion and exclusion

n

n

n SSSSSAAA 1

432121 )1(||

Theorem

If A1,A2,…,AnA, then denoting |A|=S0, we have

n

n

n SSSSSAAAA )1(|||| 321021

Page 10: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Illustration of the Principle of inclusion and exclusion

How many ways are there to place k identical balls into n different boxes so that no box contains more than p balls?

kxxx n 21 (1)

How many non-negative integer solutions of (1) are there in which no xi exceeds p?

Before answering this question, recall

How many ways are there to place k identical balls into n different boxes?

How many ways are there to place k identical balls into n different boxes so that each box contains at least p+1 balls?

1

11

n

kn

k

kn

kn(p+1)

1

1)1(

n

pnkn

Page 11: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Illustration of the Principle of inclusion and exclusion

How many ways are there to place k identical balls into n different boxes so that no box contains more than p balls?

kxxx n 21 (1)

How many non-negative integer solutions of (1) are there in which no xi exceeds p?

Let B be the set of non-negative integer solutions of (1) s.t. xip i

and A be the set of all non-negative integer solutions of (1)

k

knA

1|| |B|=?

Ai the set of non-negative integer solutions of (1) in which xi>p

|B|=|A|-|A1A2 …An|

Page 12: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

||2

21

1 l

l

ii

iii

il AAAS

n

n

n SSSSSAAA 1

432121 )1(||

Illustration of the Principle of inclusion and exclusion

liii AAA 21

pxpxlii ,...,

1

1

1)1(||

21 n

plknAAA

liii

1

1)1(

n

plkn

l

nSl

n

l

l

n

plkn

l

nB

0 1

1)1()1(||

= the set of solutions in which

Ai the set of non-negative integer solutions of (1) in which xi>p

|B|=|A|-|A1A2 …An|

Page 13: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Exercise

Call a 7-digit telephone number d1,d2,d3 d4,d5,d6,d7 memorable if the prefix sequence d1,d2,d3 is exactly the same as either the sequence d4,d5,d6 or d5,d6,d7 (possibly both). Assuming that each di can be any of the ten decimal digits 0,1,2,…,9, find the number of different memorable numbers.

Let A be the set of memorable numbers with d1,d2,d3= d4,d5,d6 and B the set of memorable numbers with d1,d2,d3= d5,d6,d7

Then the number of different memorable numbers is |AB|=|A|+|B|-|AB|=104+104-10

Page 14: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Exercise

In a group of 15 people, 6 people speak English, 4 people speak French, 5 people speak German, 3 speak English and French, 2 speak English and German, 2 speak French and German, 1 speaks all three languages. Determine how many people in the group speak none of the three languages.

|U|=15, |E|=6, |F|=4, |G|=5, |EF|=3, |EG|=2, |FG|=2, |EFG|=1

|None|=|U|-|EFG| |EFG|=|E|+|F|+|G|-|EF|-|EG|-|FG|+|EFG|

|None|=6

Page 15: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Relations

Definition. A binary relation on a set A is a subset of A2

Examples: If A={1,2,3}, then {(1,2),(2,3)} is a relation on A

If A is the set of students taking Combinatorics, then R1={(a,b) | a likes b} is binary relation and R2={(a,b) | a and b have the same birthday} is a binary relation

How many binary relations on a set A are there?

Answer: 2||2 A

Page 16: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Representation of relations

1. By listing the elements: {(1,2),(2,3)} is a relation on A ={1,2,3}

2. By a binary matrix: 1

2

3

1 2 3

0 1 0

1 0 0

0 0 0

2. By a graph: 1

2 3

Page 17: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Properties of relations

Definition. A relation R is symmetric if (a,b) R implies (b,a) R

In terms of graphs: a b

Is R1={(a,b) | a likes b} symmetric?

Is R2={(a,b) | a and b have the same birthday} symmetric?

Is {(1,2),(2,3)} symmetric?

Page 18: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Properties of relations

Definition. A relation R on A is reflexive if (a,a) R for each a A

In terms of graphs:

Is R1={(a,b) | a likes b} reflexive?

Is R2={(a,b) | a and b have the same birthday} reflexive?

Is {(1,2),(2,3)} reflexive?

a loop

1

1

1

In terms of matrices:

Page 19: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Properties of relations

Definition. A relation R on A is transitive if (a,b) R and (b,c) R implies (a,c) R

In terms of graphs:

Is R1={(a,b) | a likes b} transitive?

Is R2={(a,b) | a and b have the same birthday} transitive?

Is {(1,2),(2,3)} transitive?

a

b

c

Page 20: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Properties of relations

Definition. A relation R is an equivalence relation if R is symmetric, reflexive and transitive

R2={(a,b) | a and b have the same birthday} is an equivalence relation

Page 21: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Partitions

Definition. Partition of a set A is an equivalence relation on A

Definition. A collection of subsets A1,…,Ak of a set A is called a partition of A if the subsets are pairwise disjoint and the union of the subsets coincides with A

R={(a,b) | there is Ai such that aAi and bAi}

Each subset Ai is called an equivalence class of the relation

Page 22: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Partitions

How many partitions of an n-set are there?

Bn Bell number

How many ways to partition an n-set into k subsets are there?

}{k

n Stirling number of the second kind

How many ordered partitions of an n-set into k subsets are there?

A partition (A1,…,Ak) is ordered if the order of the subsets matters

Example. there are 2 ordered partitions of the set {1,2} into two subsets: ({1},{2}) and ({2},{1})

Page 23: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Partitions

Theorem. The number of ordered partitions of an n-set into k subsets of cardinalities n1,…,nk is

!!!

!

21 knnn

n

)!(!

!

11 nnn

n

Proof.

)!(!

)!(

212

1

nnnn

nn

)!(!

)!(

1

11

kk

k

nnnn

nnn

!!!

!

21 knnn

n

Multinomial coefficient

knnn

n

,,, 21

Page 24: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Partitions

Exercise. Let A={a1,…,ak} be an alphabet and n a natural number, and n=n1+…+nk a partition of n.

How many words of length n in alphabet A in which letter ai appears exactly ni times are there?

!!!

!

21 knnn

n

1 2 3 4 5 ...... n-1 n

…… a1 a1 a1

Page 25: Principle of inclusion and exclusion - Warwick Insitehomepages.warwick.ac.uk/~masgax/week4.pdfIllustration of the Principle of inclusion and exclusion How many ways are there to place

Multinomial Theorem

k

k

n

k

nn

nnn k

n

k xxxnnn

nxxx

21

1

21

... 21

21,,,

)...(

For any integer n0 and k1,

Proof.

Represent

and expand the brackets

n

kk

n

k xxxxxxxxx )...()...()...( 212121

332313322212312111

321321

2

321 ))(()(

xxxxxxxxxxxxxxxxxx

xxxxxxxxx

For instance, for n=2 and k=3 we have

The set of all words of length n in the alphabet {x1,…,xk}

kn

k

nnxxx 21

21The coefficient of is the number of words containing letter xi

exactly ni times, which is the multinomial coefficient