Graph Theory and Combinatorics - staff.fmi.uvt.roisabela.dramnesc/GTC/Lecture1_GTC.pdf · Graph...

Preview:

Citation preview

Graph Theory and CombinatoricsLecture 1: Introduction.

Counting Principles. Permutations and Combinations.Binomial and Multinomial Numbers

Isabela Dramnesc UVT

Computer Science Department,West University of Timisoara,

Romania

October 1, 2018

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 1 / 31

Purpose of this lecture

Become familiar with the basic notions from combinatorics andgraph theory.

1 Counting principles, Arrangements, permutations,combinations.

2 Principle of inclusion and exclusion, enumeration techniques.3 Combinations4 The cyclic structure of permutations. Advanced counting

techniques.5 Polya’s theory of counting6 Graph theory: basic notions7 Data structures for the representation of graphs8 Transport networks, maximal flows, minimal cuts9 Trees: definitions; generating trees; minimum cost trees

10 Paths, circuits, chains, and cycles11 The traveling salesman problem. Planar graphs12 Chromatic theory of graphs13 Matchings

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 2 / 31

Organizatorial items

Lecturer and TA: Isabela Dramnesc

Course webpage: staff.fmi.uvt.ro/~isabela.dramnesc

ExercisesSeminar/Lab: working with Combinatorica in Mathematica

Handouts: will be posted on the webpage of the lecture

Grading:

50% : weekly seminar assignments and a partial exam (week 8)50% : 1 written exam at the end of the semester

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 3 / 31

Lecture outline

Basic counting principles

The product ruleThe sum ruleCombinatorial proofs; examples

Counting techniques for

combinations - unordered selections of distinct elements of afinite setpermutations - ordered selections of distinct elements of afinite set

Generalizations

permutations with repetitioncombinations with repetitionpermutations with indistinguishable elements

Binomial and multinomial numbers

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 4 / 31

Basic counting principles1. The product rule

Product rule. If a procedure can be broken down into a sequence of twotasks, such that

first task can be done in n1 wayssecond task can be done in n2 ways

then there are n1 · n2 ways to do the procedure.

Generalized product rule. If a procedure can be broken down into asequence of m tasks, such that

first task can be done in n1 wayssecond task can be done in n2 ways. . .m-th task can be done in nm ways

then there are n1 · n2 · . . . · nm ways to do the procedure.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 5 / 31

Basic counting principles1. The product rule

Product rule. If a procedure can be broken down into a sequence of twotasks, such that

first task can be done in n1 wayssecond task can be done in n2 ways

then there are n1 · n2 ways to do the procedure.

Generalized product rule. If a procedure can be broken down into asequence of m tasks, such that

first task can be done in n1 wayssecond task can be done in n2 ways. . .m-th task can be done in nm ways

then there are n1 · n2 · . . . · nm ways to do the procedure.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 5 / 31

Applications of the product rule

(1) A new company with just 2 employees, John and Wayne,rents a floor of a building with 12 offices. How many ways arethere to assign different offices to these two employees?

Answer

The task can be broken down into a sequence of 2 tasks:choosing an office for John, followed by choosing an office forWayne.There are 12 ways to choose an office for John, because thereare 12 offices available.There are 11 choices for the office of Wayne, because onlyJohn’s office is unavailable.

⇒ by the product rule, there are 12 · 11 = 132 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 6 / 31

Applications of the product rule

(1) A new company with just 2 employees, John and Wayne,rents a floor of a building with 12 offices. How many ways arethere to assign different offices to these two employees?

Answer

The task can be broken down into a sequence of 2 tasks:choosing an office for John, followed by choosing an office forWayne.There are 12 ways to choose an office for John, because thereare 12 offices available.There are 11 choices for the office of Wayne, because onlyJohn’s office is unavailable.

⇒ by the product rule, there are 12 · 11 = 132 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 6 / 31

Applications of the product rule

(1) A new company with just 2 employees, John and Wayne,rents a floor of a building with 12 offices. How many ways arethere to assign different offices to these two employees?

AnswerThe task can be broken down into a sequence of 2 tasks:choosing an office for John, followed by choosing an office forWayne.

There are 12 ways to choose an office for John, because thereare 12 offices available.There are 11 choices for the office of Wayne, because onlyJohn’s office is unavailable.

⇒ by the product rule, there are 12 · 11 = 132 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 6 / 31

Applications of the product rule

(1) A new company with just 2 employees, John and Wayne,rents a floor of a building with 12 offices. How many ways arethere to assign different offices to these two employees?

AnswerThe task can be broken down into a sequence of 2 tasks:choosing an office for John, followed by choosing an office forWayne.There are 12 ways to choose an office for John, because thereare 12 offices available.

There are 11 choices for the office of Wayne, because onlyJohn’s office is unavailable.

⇒ by the product rule, there are 12 · 11 = 132 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 6 / 31

Applications of the product rule

(1) A new company with just 2 employees, John and Wayne,rents a floor of a building with 12 offices. How many ways arethere to assign different offices to these two employees?

AnswerThe task can be broken down into a sequence of 2 tasks:choosing an office for John, followed by choosing an office forWayne.There are 12 ways to choose an office for John, because thereare 12 offices available.There are 11 choices for the office of Wayne, because onlyJohn’s office is unavailable.

⇒ by the product rule, there are 12 · 11 = 132 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 6 / 31

Applications of the product rule

(1) A new company with just 2 employees, John and Wayne,rents a floor of a building with 12 offices. How many ways arethere to assign different offices to these two employees?

AnswerThe task can be broken down into a sequence of 2 tasks:choosing an office for John, followed by choosing an office forWayne.There are 12 ways to choose an office for John, because thereare 12 offices available.There are 11 choices for the office of Wayne, because onlyJohn’s office is unavailable.

⇒ by the product rule, there are 12 · 11 = 132 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 6 / 31

Applications of the product rule

(2) The seats of a lab room are to be labelled with a letter and anumber not exceeding 25. What is the largest number ofchairs that can be labeled differently?

Answer

This task can be broken down into a sequence of 2 tasks:assign one of the 26 letter, followed by assigning one of the 25possible numbers to the seat.According to the product rule, there are 26 · 25 = 650 ways todo so.

(3) How many different bit strings of length 7 are there?

Answer

Each of the 7 bits can be chosen in 2 ways, because each bit iseither 0 or 1.

⇒ by the product rule, there are 27 = 128 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 7 / 31

Applications of the product rule

(2) The seats of a lab room are to be labelled with a letter and anumber not exceeding 25. What is the largest number ofchairs that can be labeled differently?

Answer

This task can be broken down into a sequence of 2 tasks:assign one of the 26 letter, followed by assigning one of the 25possible numbers to the seat.According to the product rule, there are 26 · 25 = 650 ways todo so.

(3) How many different bit strings of length 7 are there?

Answer

Each of the 7 bits can be chosen in 2 ways, because each bit iseither 0 or 1.

⇒ by the product rule, there are 27 = 128 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 7 / 31

Applications of the product rule

(2) The seats of a lab room are to be labelled with a letter and anumber not exceeding 25. What is the largest number ofchairs that can be labeled differently?

AnswerThis task can be broken down into a sequence of 2 tasks:assign one of the 26 letter, followed by assigning one of the 25possible numbers to the seat.

According to the product rule, there are 26 · 25 = 650 ways todo so.

(3) How many different bit strings of length 7 are there?

Answer

Each of the 7 bits can be chosen in 2 ways, because each bit iseither 0 or 1.

⇒ by the product rule, there are 27 = 128 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 7 / 31

Applications of the product rule

(2) The seats of a lab room are to be labelled with a letter and anumber not exceeding 25. What is the largest number ofchairs that can be labeled differently?

AnswerThis task can be broken down into a sequence of 2 tasks:assign one of the 26 letter, followed by assigning one of the 25possible numbers to the seat.According to the product rule, there are 26 · 25 = 650 ways todo so.

(3) How many different bit strings of length 7 are there?

Answer

Each of the 7 bits can be chosen in 2 ways, because each bit iseither 0 or 1.

⇒ by the product rule, there are 27 = 128 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 7 / 31

Applications of the product rule

(2) The seats of a lab room are to be labelled with a letter and anumber not exceeding 25. What is the largest number ofchairs that can be labeled differently?

AnswerThis task can be broken down into a sequence of 2 tasks:assign one of the 26 letter, followed by assigning one of the 25possible numbers to the seat.According to the product rule, there are 26 · 25 = 650 ways todo so.

(3) How many different bit strings of length 7 are there?

Answer

Each of the 7 bits can be chosen in 2 ways, because each bit iseither 0 or 1.

⇒ by the product rule, there are 27 = 128 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 7 / 31

Applications of the product rule

(2) The seats of a lab room are to be labelled with a letter and anumber not exceeding 25. What is the largest number ofchairs that can be labeled differently?

AnswerThis task can be broken down into a sequence of 2 tasks:assign one of the 26 letter, followed by assigning one of the 25possible numbers to the seat.According to the product rule, there are 26 · 25 = 650 ways todo so.

(3) How many different bit strings of length 7 are there?

Answer

Each of the 7 bits can be chosen in 2 ways, because each bit iseither 0 or 1.

⇒ by the product rule, there are 27 = 128 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 7 / 31

Applications of the product rule

(2) The seats of a lab room are to be labelled with a letter and anumber not exceeding 25. What is the largest number ofchairs that can be labeled differently?

AnswerThis task can be broken down into a sequence of 2 tasks:assign one of the 26 letter, followed by assigning one of the 25possible numbers to the seat.According to the product rule, there are 26 · 25 = 650 ways todo so.

(3) How many different bit strings of length 7 are there?

AnswerEach of the 7 bits can be chosen in 2 ways, because each bit iseither 0 or 1.

⇒ by the product rule, there are 27 = 128 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 7 / 31

Applications of the product rule

(2) The seats of a lab room are to be labelled with a letter and anumber not exceeding 25. What is the largest number ofchairs that can be labeled differently?

AnswerThis task can be broken down into a sequence of 2 tasks:assign one of the 26 letter, followed by assigning one of the 25possible numbers to the seat.According to the product rule, there are 26 · 25 = 650 ways todo so.

(3) How many different bit strings of length 7 are there?

AnswerEach of the 7 bits can be chosen in 2 ways, because each bit iseither 0 or 1.

⇒ by the product rule, there are 27 = 128 ways.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 7 / 31

Applications of the product ruleCounting functions

(4) How many functions are there from a set with m elements toa set with n elements?

AnswerThe procedure to define such a function can be broken downinto a sequence of m subtasks, where each subtask fixes theoutput value for an input argument.Each subtask can be done in n ways (there are n possibleoutput values)

⇒ by product rule, the number of functions is n · . . . · n︸ ︷︷ ︸m times

= nm

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 8 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}

Note that we must have m ≤ n.There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}

Note that we must have m ≤ n.There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}

Note that we must have m ≤ n.There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}Note that we must have m ≤ n.

There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}Note that we must have m ≤ n.There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.

There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}Note that we must have m ≤ n.There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}

...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}Note that we must have m ≤ n.There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}

...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}Note that we must have m ≤ n.There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting one-to-one functions

(5) How many one-to-one functions are there from a set with melements to one with n elements?

Remark. A one-to-one function is a function that mapsdifferent elements to different values.

Answer: assume f : {a1, . . . , am} → {b1, . . . , bn}Note that we must have m ≤ n.There are n ways to pick a value forf (a1) ∈ {b1, . . . , bm}.There are n − 1 ways to pick a value forf (a2) ∈ {b1, . . . , bm} − {f (a1)}...There are n −m + 1 ways to pick the function value forf (am) ∈ {b1, . . . , bm} − {f (a1), . . . , f (am−1)}.

⇒ By product rule, there are n · (n − 1) · . . . · (n −m + 1)one-to-one functions.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 9 / 31

Applications of the product ruleCounting the subsets of a finite set

(6) The number of subsets of a finite set S = {a1, a2, . . . , an} is 2n.

AnswerFor every subset B of A we define the bit string b1b2 . . . bn with

bi =

{1 if ai ∈ B0 otherwise

There is a one-to-one correspondence between the subsets of Aand the bit strings of length n.The procedure to define a bit string of length n is a sequenceof n tasks, where each task chooses the value of a different bitfrom the bit string.By the product rule, there are 2n such bit strings.

⇒ there are 2n subsets of S .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 10 / 31

Applications of the product ruleCounting the subsets of a finite set

(6) The number of subsets of a finite set S = {a1, a2, . . . , an} is 2n.

Answer

For every subset B of A we define the bit string b1b2 . . . bn with

bi =

{1 if ai ∈ B0 otherwise

There is a one-to-one correspondence between the subsets of Aand the bit strings of length n.The procedure to define a bit string of length n is a sequenceof n tasks, where each task chooses the value of a different bitfrom the bit string.By the product rule, there are 2n such bit strings.

⇒ there are 2n subsets of S .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 10 / 31

Applications of the product ruleCounting the subsets of a finite set

(6) The number of subsets of a finite set S = {a1, a2, . . . , an} is 2n.

AnswerFor every subset B of A we define the bit string b1b2 . . . bn with

bi =

{1 if ai ∈ B0 otherwise

There is a one-to-one correspondence between the subsets of Aand the bit strings of length n.The procedure to define a bit string of length n is a sequenceof n tasks, where each task chooses the value of a different bitfrom the bit string.By the product rule, there are 2n such bit strings.

⇒ there are 2n subsets of S .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 10 / 31

Applications of the product ruleCounting the subsets of a finite set

(6) The number of subsets of a finite set S = {a1, a2, . . . , an} is 2n.

AnswerFor every subset B of A we define the bit string b1b2 . . . bn with

bi =

{1 if ai ∈ B0 otherwise

There is a one-to-one correspondence between the subsets of Aand the bit strings of length n.

The procedure to define a bit string of length n is a sequenceof n tasks, where each task chooses the value of a different bitfrom the bit string.By the product rule, there are 2n such bit strings.

⇒ there are 2n subsets of S .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 10 / 31

Applications of the product ruleCounting the subsets of a finite set

(6) The number of subsets of a finite set S = {a1, a2, . . . , an} is 2n.

AnswerFor every subset B of A we define the bit string b1b2 . . . bn with

bi =

{1 if ai ∈ B0 otherwise

There is a one-to-one correspondence between the subsets of Aand the bit strings of length n.The procedure to define a bit string of length n is a sequenceof n tasks, where each task chooses the value of a different bitfrom the bit string.

By the product rule, there are 2n such bit strings.

⇒ there are 2n subsets of S .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 10 / 31

Applications of the product ruleCounting the subsets of a finite set

(6) The number of subsets of a finite set S = {a1, a2, . . . , an} is 2n.

AnswerFor every subset B of A we define the bit string b1b2 . . . bn with

bi =

{1 if ai ∈ B0 otherwise

There is a one-to-one correspondence between the subsets of Aand the bit strings of length n.The procedure to define a bit string of length n is a sequenceof n tasks, where each task chooses the value of a different bitfrom the bit string.By the product rule, there are 2n such bit strings.

⇒ there are 2n subsets of S .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 10 / 31

Applications of the product ruleCounting the subsets of a finite set

(6) The number of subsets of a finite set S = {a1, a2, . . . , an} is 2n.

AnswerFor every subset B of A we define the bit string b1b2 . . . bn with

bi =

{1 if ai ∈ B0 otherwise

There is a one-to-one correspondence between the subsets of Aand the bit strings of length n.The procedure to define a bit string of length n is a sequenceof n tasks, where each task chooses the value of a different bitfrom the bit string.By the product rule, there are 2n such bit strings.

⇒ there are 2n subsets of S .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 10 / 31

Basic counting principles2. The sum rule

Sum rule. If a procedure can be done either in one of n1 ways or inone of n2 ways, and none of the set of n1 ways is the sameas any of the n2 ways, then there are n1 + n2 ways to dothe procedure.

Generalized sum rule. Suppose that a procedure can be done in one ofn1 ways, in one of n2 ways, . . . , or in one of nm ways,where none of the set of ni ways of doing the task is thesame as any of the set of nj ways, for all pairs i and j with1 ≤ i < j ≤ m. Then the number of ways to do the task isn1 + n2 + . . . + nm.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 11 / 31

Basic counting principles2. The sum rule

Sum rule. If a procedure can be done either in one of n1 ways or inone of n2 ways, and none of the set of n1 ways is the sameas any of the n2 ways, then there are n1 + n2 ways to dothe procedure.

Generalized sum rule. Suppose that a procedure can be done in one ofn1 ways, in one of n2 ways, . . . , or in one of nm ways,where none of the set of ni ways of doing the task is thesame as any of the set of nj ways, for all pairs i and j with1 ≤ i < j ≤ m. Then the number of ways to do the task isn1 + n2 + . . . + nm.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 11 / 31

Basic counting principles2. The sum rule

Sum rule. If a procedure can be done either in one of n1 ways or inone of n2 ways, and none of the set of n1 ways is the sameas any of the n2 ways, then there are n1 + n2 ways to dothe procedure.

Generalized sum rule. Suppose that a procedure can be done in one ofn1 ways, in one of n2 ways, . . . , or in one of nm ways,where none of the set of ni ways of doing the task is thesame as any of the set of nj ways, for all pairs i and j with1 ≤ i < j ≤ m. Then the number of ways to do the task isn1 + n2 + . . . + nm.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 11 / 31

Applications of the sum rule

(1) Suppose a student can choose a computer project from one of3 lists. The three lists contain 9, 8, and 12 possible projectsrespectively. No project is on more than one list. How manypossible project are there to choose from?

Answer

The project can be chosen by selecting from the first list, thesecond list, or the third list.Because no project is in more than one list, we can apply thesum rule ⇒ there are 9 + 8 + 12 = 29 ways to choose a project.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 12 / 31

Applications of the sum rule

(1) Suppose a student can choose a computer project from one of3 lists. The three lists contain 9, 8, and 12 possible projectsrespectively. No project is on more than one list. How manypossible project are there to choose from?

Answer

The project can be chosen by selecting from the first list, thesecond list, or the third list.Because no project is in more than one list, we can apply thesum rule ⇒ there are 9 + 8 + 12 = 29 ways to choose a project.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 12 / 31

Applications of the sum rule

(1) Suppose a student can choose a computer project from one of3 lists. The three lists contain 9, 8, and 12 possible projectsrespectively. No project is on more than one list. How manypossible project are there to choose from?

AnswerThe project can be chosen by selecting from the first list, thesecond list, or the third list.

Because no project is in more than one list, we can apply thesum rule ⇒ there are 9 + 8 + 12 = 29 ways to choose a project.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 12 / 31

Applications of the sum rule

(1) Suppose a student can choose a computer project from one of3 lists. The three lists contain 9, 8, and 12 possible projectsrespectively. No project is on more than one list. How manypossible project are there to choose from?

AnswerThe project can be chosen by selecting from the first list, thesecond list, or the third list.Because no project is in more than one list, we can apply thesum rule ⇒ there are 9 + 8 + 12 = 29 ways to choose a project.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 12 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.

By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.

To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting problems

Many complicated counting problems can not be solved using just thesum rule or just the product rule. But they can be solved using bothrules in combination.

Examples

(1) Assume a password is 6 to 8 characters long, where each characteris either an uppercase letter or a digit. Each password must containat least one digit. How many possible passwords are there?

Answer

Let P be the total number of passwords, and P6, P7 and P8 bethe number of passwords of length 6, 7, and 8, respectively.By sum rule, we have P = P6 + P7 + P8.To compute Pm for m ∈ {6, 7, 8}, we can proceed as follows:

Let Wm be the number of strings of uppercase letters anddigits of length m. By product rule, Wm = (26 + 10)m = 36m

Let Nm be the number of strings of uppercase letters of lengthm. By product rule, Nm = 26m.

Note that Pm = Wm − Nm (explain why).

⇒ P = W6−N6+W7−N7+W8−N8 = 366−266+367−267+368−268.Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 13 / 31

More complex counting examples

(2) In how many ways can we choose 2 books of differentlanguages among 5 books in Romanian, 9 in English, and 10in German?

Answer

R&E = 5× 9 = 45 by product ruleR&G = 5× 10 = 50 by product ruleE&G = 9× 10 = 90 by product rule

⇒ 45 + 50 + 90 = 185 ways (by sum rule).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 14 / 31

More complex counting examples

(2) In how many ways can we choose 2 books of differentlanguages among 5 books in Romanian, 9 in English, and 10in German?

Answer

R&E = 5× 9 = 45 by product ruleR&G = 5× 10 = 50 by product ruleE&G = 9× 10 = 90 by product rule

⇒ 45 + 50 + 90 = 185 ways (by sum rule).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 14 / 31

Combinatorial proofs

A combinatorial proof is a proof that uses counting arguments,such as the sum rule and product rule to prove something.

The proofs illustrated in the previous examples arecombinatorial proofs.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 15 / 31

Permutations and combinationsDefinitions

Assumption: A is a finite set with n elements.

An r -permutation is an ordered sequence 〈a1, a2, . . . , ar 〉 of relements of A.

A permutation of A is an ordered sequence 〈a1, a2, . . . , an〉 of allelements of A.

An r -combination of A is an unordered selection {a1, a2, . . . , ar} ofr elements of A.

Example

〈3, 1, 2〉 and 〈1, 3, 2〉 are permutations of {1, 2, 3}.〈3, 1〉 and 〈1, 2〉 are 2-permutations of {1, 2, 3}.

P(n, r) := the number of r -permutations of a set with nelements.

C (n, r) := the number of r -combinations of a set with nelements. Alternative notation:

(nr

).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 16 / 31

Permutations and combinationsDefinitions

Assumption: A is a finite set with n elements.

An r -permutation is an ordered sequence 〈a1, a2, . . . , ar 〉 of relements of A.

A permutation of A is an ordered sequence 〈a1, a2, . . . , an〉 of allelements of A.

An r -combination of A is an unordered selection {a1, a2, . . . , ar} ofr elements of A.

Example

〈3, 1, 2〉 and 〈1, 3, 2〉 are permutations of {1, 2, 3}.〈3, 1〉 and 〈1, 2〉 are 2-permutations of {1, 2, 3}.

P(n, r) := the number of r -permutations of a set with nelements.

C (n, r) := the number of r -combinations of a set with nelements. Alternative notation:

(nr

).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 16 / 31

Permutations and combinationsDefinitions

Assumption: A is a finite set with n elements.

An r -permutation is an ordered sequence 〈a1, a2, . . . , ar 〉 of relements of A.

A permutation of A is an ordered sequence 〈a1, a2, . . . , an〉 of allelements of A.

An r -combination of A is an unordered selection {a1, a2, . . . , ar} ofr elements of A.

Example

〈3, 1, 2〉 and 〈1, 3, 2〉 are permutations of {1, 2, 3}.〈3, 1〉 and 〈1, 2〉 are 2-permutations of {1, 2, 3}.

P(n, r) := the number of r -permutations of a set with nelements.

C (n, r) := the number of r -combinations of a set with nelements. Alternative notation:

(nr

).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 16 / 31

PermutationsWhat is the value of P(n, r)?

Theorem

P(n, r) = n · (n − 1) · . . . · (n − r + 1).

Proof

A = {a1, . . . , an}r -permutation = p1, p2, ..., pr

choice tasksp1 ∈ A p2 ∈ A− {p1} . . . pr ∈ A− {p1, . . . , pr−1}

# of choices n n − 1 . . . n − r + 1

⇒ P(n, r) = n · (n − 1) · . . . · (n − r + 1) =n!

(n − r)!

Remark. n! denotes the product 1 · 2 · . . . · (n − 1) · n.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 17 / 31

PermutationsWhat is the value of P(n, r)?

Theorem

P(n, r) = n · (n − 1) · . . . · (n − r + 1).

ProofA = {a1, . . . , an}r -permutation = p1, p2, ..., pr

choice tasksp1 ∈ A p2 ∈ A− {p1} . . . pr ∈ A− {p1, . . . , pr−1}

# of choices n n − 1 . . . n − r + 1

⇒ P(n, r) = n · (n − 1) · . . . · (n − r + 1) =n!

(n − r)!

Remark. n! denotes the product 1 · 2 · . . . · (n − 1) · n.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 17 / 31

PermutationsWhat is the value of P(n, r)?

Theorem

P(n, r) = n · (n − 1) · . . . · (n − r + 1).

ProofA = {a1, . . . , an}r -permutation = p1, p2, ..., pr

choice tasksp1 ∈ A p2 ∈ A− {p1} . . . pr ∈ A− {p1, . . . , pr−1}

# of choices n n − 1 . . . n − r + 1

⇒ P(n, r) = n · (n − 1) · . . . · (n − r + 1) =n!

(n − r)!

Remark. n! denotes the product 1 · 2 · . . . · (n − 1) · n.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 17 / 31

PermutationsWhat is the value of P(n, r)?

Theorem

P(n, r) = n · (n − 1) · . . . · (n − r + 1).

ProofA = {a1, . . . , an}r -permutation = p1, p2, ..., pr

choice tasksp1 ∈ A p2 ∈ A− {p1} . . . pr ∈ A− {p1, . . . , pr−1}

# of choices n n − 1 . . . n − r + 1

⇒ P(n, r) = n · (n − 1) · . . . · (n − r + 1) =n!

(n − r)!

Remark. n! denotes the product 1 · 2 · . . . · (n − 1) · n.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 17 / 31

Permutations and CombinationsProperties

Theorem

P(n, r) = C (n, r)× P(r , r).

Combinatorial proof

An r -permutation of a set with n elements can be performedby a sequence of 2 tasks:

1 choose r elements from the set with n elements2 arrange them.

There are C (n, r) ways to choose r elements out of n ⇒ task(1) can be done in C (n, r) ways.

There are P(r , r) ways to arrange r elements ⇒ task (2) canbe done in P(r , r) ways.

⇒ by product rule, we obtain P(n, r) = C (n, r)× P(r , r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 18 / 31

Permutations and CombinationsProperties

Theorem

P(n, r) = C (n, r)× P(r , r).

Combinatorial proof

An r -permutation of a set with n elements can be performedby a sequence of 2 tasks:

1 choose r elements from the set with n elements2 arrange them.

There are C (n, r) ways to choose r elements out of n ⇒ task(1) can be done in C (n, r) ways.

There are P(r , r) ways to arrange r elements ⇒ task (2) canbe done in P(r , r) ways.

⇒ by product rule, we obtain P(n, r) = C (n, r)× P(r , r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 18 / 31

Permutations and CombinationsProperties

Theorem

P(n, r) = C (n, r)× P(r , r).

Combinatorial proof

An r -permutation of a set with n elements can be performedby a sequence of 2 tasks:

1 choose r elements from the set with n elements2 arrange them.

There are C (n, r) ways to choose r elements out of n ⇒ task(1) can be done in C (n, r) ways.

There are P(r , r) ways to arrange r elements ⇒ task (2) canbe done in P(r , r) ways.

⇒ by product rule, we obtain P(n, r) = C (n, r)× P(r , r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 18 / 31

Permutations and CombinationsProperties

Theorem

P(n, r) = C (n, r)× P(r , r).

Combinatorial proof

An r -permutation of a set with n elements can be performedby a sequence of 2 tasks:

1 choose r elements from the set with n elements2 arrange them.

There are C (n, r) ways to choose r elements out of n ⇒ task(1) can be done in C (n, r) ways.

There are P(r , r) ways to arrange r elements ⇒ task (2) canbe done in P(r , r) ways.

⇒ by product rule, we obtain P(n, r) = C (n, r)× P(r , r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 18 / 31

Permutations and CombinationsProperties

Theorem

P(n, r) = C (n, r)× P(r , r).

Combinatorial proof

An r -permutation of a set with n elements can be performedby a sequence of 2 tasks:

1 choose r elements from the set with n elements2 arrange them.

There are C (n, r) ways to choose r elements out of n ⇒ task(1) can be done in C (n, r) ways.

There are P(r , r) ways to arrange r elements ⇒ task (2) canbe done in P(r , r) ways.

⇒ by product rule, we obtain P(n, r) = C (n, r)× P(r , r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 18 / 31

CombinationsCounting combinations

C (n, r) =?

We already know how to compute P(n, r), it is n!(n−r)!

We proved that P(n, r) = C (n, r)× P(r , r)

⇒ C (n, r) =P(n, r)

P(r , r)=

n!

(n − r)!· 0!

r !=

n!

r !(n − r)!

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 19 / 31

CombinationsCounting combinations

C (n, r) =?

We already know how to compute P(n, r), it is n!(n−r)!

We proved that P(n, r) = C (n, r)× P(r , r)

⇒ C (n, r) =P(n, r)

P(r , r)=

n!

(n − r)!· 0!

r !=

n!

r !(n − r)!

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 19 / 31

CombinationsCounting combinations

C (n, r) =?

We already know how to compute P(n, r), it is n!(n−r)!

We proved that P(n, r) = C (n, r)× P(r , r)

⇒ C (n, r) =P(n, r)

P(r , r)=

n!

(n − r)!· 0!

r !=

n!

r !(n − r)!

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 19 / 31

CombinationsCounting combinations

C (n, r) =?

We already know how to compute P(n, r), it is n!(n−r)!

We proved that P(n, r) = C (n, r)× P(r , r)

⇒ C (n, r) =P(n, r)

P(r , r)=

n!

(n − r)!· 0!

r !=

n!

r !(n − r)!

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 19 / 31

Properties of combinations

Theorem

C (n, r) = C (n − 1, r − 1) + C (n − 1, r) for all n > r > 0.

Combinatorial proof

Let S = {a1, a2, . . . , an}. There are C (n, r) ways to choose relements from S . We distinguish 2 distinct possibilities:

1 The choice of r elements from S contains a1. Let N1 be thenumber of such choices.

2 The choice of r elements from S does not contain a1. Let N2

be the number of such choices.

By sum rule, C (n, r) = N1 + N2. But:

N1 = C (n − 1, r − 1) because we have to choose r − 1elements from {a2, . . . , an}N2 = C (n − 1, r) because we have to choose r elements from{a2, . . . , an}

⇒ C (n, r) = C (n − 1, r − 1) + C (n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 20 / 31

Properties of combinations

Theorem

C (n, r) = C (n − 1, r − 1) + C (n − 1, r) for all n > r > 0.

Combinatorial proof

Let S = {a1, a2, . . . , an}. There are C (n, r) ways to choose relements from S . We distinguish 2 distinct possibilities:

1 The choice of r elements from S contains a1. Let N1 be thenumber of such choices.

2 The choice of r elements from S does not contain a1. Let N2

be the number of such choices.

By sum rule, C (n, r) = N1 + N2. But:

N1 = C (n − 1, r − 1) because we have to choose r − 1elements from {a2, . . . , an}N2 = C (n − 1, r) because we have to choose r elements from{a2, . . . , an}

⇒ C (n, r) = C (n − 1, r − 1) + C (n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 20 / 31

Properties of combinations

Theorem

C (n, r) = C (n − 1, r − 1) + C (n − 1, r) for all n > r > 0.

Combinatorial proof

Let S = {a1, a2, . . . , an}. There are C (n, r) ways to choose relements from S . We distinguish 2 distinct possibilities:

1 The choice of r elements from S contains a1. Let N1 be thenumber of such choices.

2 The choice of r elements from S does not contain a1. Let N2

be the number of such choices.

By sum rule, C (n, r) = N1 + N2. But:

N1 = C (n − 1, r − 1) because we have to choose r − 1elements from {a2, . . . , an}N2 = C (n − 1, r) because we have to choose r elements from{a2, . . . , an}

⇒ C (n, r) = C (n − 1, r − 1) + C (n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 20 / 31

Properties of combinations

Theorem

C (n, r) = C (n − 1, r − 1) + C (n − 1, r) for all n > r > 0.

Combinatorial proof

Let S = {a1, a2, . . . , an}. There are C (n, r) ways to choose relements from S . We distinguish 2 distinct possibilities:

1 The choice of r elements from S contains a1. Let N1 be thenumber of such choices.

2 The choice of r elements from S does not contain a1. Let N2

be the number of such choices.

By sum rule, C (n, r) = N1 + N2. But:

N1 = C (n − 1, r − 1) because we have to choose r − 1elements from {a2, . . . , an}N2 = C (n − 1, r) because we have to choose r elements from{a2, . . . , an}

⇒ C (n, r) = C (n − 1, r − 1) + C (n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 20 / 31

Properties of combinations

Theorem

C (n, r) = C (n − 1, r − 1) + C (n − 1, r) for all n > r > 0.

Combinatorial proof

Let S = {a1, a2, . . . , an}. There are C (n, r) ways to choose relements from S . We distinguish 2 distinct possibilities:

1 The choice of r elements from S contains a1. Let N1 be thenumber of such choices.

2 The choice of r elements from S does not contain a1. Let N2

be the number of such choices.

By sum rule, C (n, r) = N1 + N2. But:

N1 = C (n − 1, r − 1) because we have to choose r − 1elements from {a2, . . . , an}N2 = C (n − 1, r) because we have to choose r elements from{a2, . . . , an}

⇒ C (n, r) = C (n − 1, r − 1) + C (n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 20 / 31

Properties of combinations

Theorem

C (n, r) = C (n − 1, r − 1) + C (n − 1, r) for all n > r > 0.

Combinatorial proof

Let S = {a1, a2, . . . , an}. There are C (n, r) ways to choose relements from S . We distinguish 2 distinct possibilities:

1 The choice of r elements from S contains a1. Let N1 be thenumber of such choices.

2 The choice of r elements from S does not contain a1. Let N2

be the number of such choices.

By sum rule, C (n, r) = N1 + N2. But:

N1 = C (n − 1, r − 1) because we have to choose r − 1elements from {a2, . . . , an}N2 = C (n − 1, r) because we have to choose r elements from{a2, . . . , an}

⇒ C (n, r) = C (n − 1, r − 1) + C (n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 20 / 31

Properties of combinations

Theorem

C (n, r) = C (n − 1, r − 1) + C (n − 1, r) for all n > r > 0.

Combinatorial proof

Let S = {a1, a2, . . . , an}. There are C (n, r) ways to choose relements from S . We distinguish 2 distinct possibilities:

1 The choice of r elements from S contains a1. Let N1 be thenumber of such choices.

2 The choice of r elements from S does not contain a1. Let N2

be the number of such choices.

By sum rule, C (n, r) = N1 + N2. But:

N1 = C (n − 1, r − 1) because we have to choose r − 1elements from {a2, . . . , an}N2 = C (n − 1, r) because we have to choose r elements from{a2, . . . , an}

⇒ C (n, r) = C (n − 1, r − 1) + C (n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 20 / 31

Quizzes

1 Give an algebraic proof, using the formulas for C (n, r), of thefact that C (n, r) = C (n − 1, r − 1) + C (n − 1, r).

2 Give a combinatorial proof of the fact thatC (n, r) = C (n, n − r).

3 How many ways are there to select a first-prize winner, asecond-prize winner, and a third-prize winner from 100different people who have entered a contest?

4 In how many ways can n people stand to form a ring?

5 How many permutations of the letters ABCDEFGH containthe string ABC?

6 How many bit strings of length n contain exactly r 1s?

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 21 / 31

Generalized permutations and combinationsPermutations with repetition

In many counting problems, we want to use elementsrepeatedly.Permutations and combinations assume that every itemappears only once.An r -permutation with repetition of a set of n elements is anarrangement of r elements from that set, where elements mayoccur more than once.

Example

How many strings of length n can be formed with the lowercaseand uppercase letters of the English alphabet?Answer: |AlphabetEnglish| = 52 ⇒ 52n strings (by product rule)

Theorem

The number of r -permutations of a set of n elements withrepetition is nr .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 22 / 31

Generalized permutations and combinationsPermutations with repetition

In many counting problems, we want to use elementsrepeatedly.

Permutations and combinations assume that every itemappears only once.An r -permutation with repetition of a set of n elements is anarrangement of r elements from that set, where elements mayoccur more than once.

Example

How many strings of length n can be formed with the lowercaseand uppercase letters of the English alphabet?Answer: |AlphabetEnglish| = 52 ⇒ 52n strings (by product rule)

Theorem

The number of r -permutations of a set of n elements withrepetition is nr .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 22 / 31

Generalized permutations and combinationsPermutations with repetition

In many counting problems, we want to use elementsrepeatedly.Permutations and combinations assume that every itemappears only once.

An r -permutation with repetition of a set of n elements is anarrangement of r elements from that set, where elements mayoccur more than once.

Example

How many strings of length n can be formed with the lowercaseand uppercase letters of the English alphabet?Answer: |AlphabetEnglish| = 52 ⇒ 52n strings (by product rule)

Theorem

The number of r -permutations of a set of n elements withrepetition is nr .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 22 / 31

Generalized permutations and combinationsPermutations with repetition

In many counting problems, we want to use elementsrepeatedly.Permutations and combinations assume that every itemappears only once.An r -permutation with repetition of a set of n elements is anarrangement of r elements from that set, where elements mayoccur more than once.

Example

How many strings of length n can be formed with the lowercaseand uppercase letters of the English alphabet?Answer: |AlphabetEnglish| = 52 ⇒ 52n strings (by product rule)

Theorem

The number of r -permutations of a set of n elements withrepetition is nr .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 22 / 31

Generalized permutations and combinationsPermutations with repetition

In many counting problems, we want to use elementsrepeatedly.Permutations and combinations assume that every itemappears only once.An r -permutation with repetition of a set of n elements is anarrangement of r elements from that set, where elements mayoccur more than once.

Example

How many strings of length n can be formed with the lowercaseand uppercase letters of the English alphabet?Answer: |AlphabetEnglish| = 52 ⇒ 52n strings (by product rule)

Theorem

The number of r -permutations of a set of n elements withrepetition is nr .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 22 / 31

Combinations with repetition

An r -combination with repetition of a set of n elements is achoice of r elements from a bag of elements of n kinds, wherewe can choose the same kind of element any number of times.

Q: How many r -combinations with repetition of a set of nelements are there?

Example

How many ways are there to select 5 bills from a cash boxcontaining bills of $1, $2, $5, $10, $20, $50. Assume that: theorder in which the bills are chosen does not matter; the bills areindistinguishable; there are at least 5 bills of each type.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 23 / 31

Combinations with repetitionExample – continued

Five not necessarily distinct bills = a 5-combination with repetition fromthe set {$1, $2, $5, $10, $20, $50} of bill kinds = a placement of five * inthe slots of the cash box depicted below:

The number of * in a slot represents the number of bills taken fromthat place.

⇒ The number of 5-combinations with repetition of a set with 6

elements = the number of ways to place 5 stars in 6 slots.

$1 $2 $5 $10 $20 $50cash box with 6 types of bills

||∗∗|||∗∗∗∗∗ ∗∗∗

∗|| ∗ |∗|∗∗|∗ ∗ ∗ ∗∗

· · ·

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 24 / 31

Combinations with repetition

Note that

Every placement of 5 stars in 6 possible slots is uniquelydescribed by a string of 5 stars and 5 red bars.

In general, the number of r -combinations with repetition of aset with n elements = the number of strings with r stars andn − 1 red bars.

Q: In how many ways can we arrange n − 1 bars and r stars ?

A: The sequence has length n + r − 1⇒ there are n + r − 1 positions in the sequence⇒ we must choose r positions out of n + r − 1 to be filled with

stars; the others will be filled with red bars.

There are C (n + r − 1, r) such choices.

Theorem

The number of r -combinations with repetition of n elements isC (r + n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 25 / 31

Combinations with repetition

Note that

Every placement of 5 stars in 6 possible slots is uniquelydescribed by a string of 5 stars and 5 red bars.

In general, the number of r -combinations with repetition of aset with n elements = the number of strings with r stars andn − 1 red bars.

Q: In how many ways can we arrange n − 1 bars and r stars ?A: The sequence has length n + r − 1

⇒ there are n + r − 1 positions in the sequence⇒ we must choose r positions out of n + r − 1 to be filled with

stars; the others will be filled with red bars.

There are C (n + r − 1, r) such choices.

Theorem

The number of r -combinations with repetition of n elements isC (r + n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 25 / 31

Combinations with repetition

Note that

Every placement of 5 stars in 6 possible slots is uniquelydescribed by a string of 5 stars and 5 red bars.

In general, the number of r -combinations with repetition of aset with n elements = the number of strings with r stars andn − 1 red bars.

Q: In how many ways can we arrange n − 1 bars and r stars ?A: The sequence has length n + r − 1

⇒ there are n + r − 1 positions in the sequence⇒ we must choose r positions out of n + r − 1 to be filled with

stars; the others will be filled with red bars.

There are C (n + r − 1, r) such choices.

Theorem

The number of r -combinations with repetition of n elements isC (r + n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 25 / 31

Combinations with repetition

Note that

Every placement of 5 stars in 6 possible slots is uniquelydescribed by a string of 5 stars and 5 red bars.

In general, the number of r -combinations with repetition of aset with n elements = the number of strings with r stars andn − 1 red bars.

Q: In how many ways can we arrange n − 1 bars and r stars ?A: The sequence has length n + r − 1

⇒ there are n + r − 1 positions in the sequence⇒ we must choose r positions out of n + r − 1 to be filled with

stars; the others will be filled with red bars.

There are C (n + r − 1, r) such choices.

Theorem

The number of r -combinations with repetition of n elements isC (r + n − 1, r).

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 25 / 31

Permutations and combinationsSummary

Type Repetition Formulaallowed?

r -permutations No P(n, r) =n!

(n − r)!

r -combinations No C (n, r) =n!

r !(n − r)!r -permutations Yes nr

with repetition

r -combinations Yes C (n + r − 1, r) =(n + r − 1)!

r !(n − 1)!with repetition

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 26 / 31

Permutation with indistinguishable objects

Problem

How many strings can be made by reordering the string SUCCESS?

SUCCESS contains 3 Ss, 2 Cs, 1U, 1 E.

placements of 3 Ss among 7 places: C (7, 3) ⇒ 4 places left.

placements of 2 Cs among 4 places: C (4, 2) ⇒ 2 places left.

placements of 1 U among 2 places: C (2, 1) ⇒ 1 place left.

placements of 1 E among 1 place: C (1, 1).

⇒ by product rule, the number is

C (7, 3)× C (4, 2)× C (2, 1)× C (1, 1) =7!

3!2!1!1!

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 27 / 31

Permutation with indistinguishable objects

Problem

How many strings can be made by reordering the string SUCCESS?

SUCCESS contains 3 Ss, 2 Cs, 1U, 1 E.

placements of 3 Ss among 7 places: C (7, 3) ⇒ 4 places left.

placements of 2 Cs among 4 places: C (4, 2) ⇒ 2 places left.

placements of 1 U among 2 places: C (2, 1) ⇒ 1 place left.

placements of 1 E among 1 place: C (1, 1).

⇒ by product rule, the number is

C (7, 3)× C (4, 2)× C (2, 1)× C (1, 1) =7!

3!2!1!1!

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 27 / 31

Permutations with indistinguishable objects

Theorem

The number of different permutations of n objects, where there are

B n1 indistinguishable elements of type 1

B n2 indistinguishable elements of type 2

. . .

B nk indistinguishable elements of type nk

isn!

n1!n2! · · · nk !.

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 28 / 31

Binomial and multinomial numbers

The binomial numbers are the coefficients cn,k in the formula

(x + y)n =n∑

k=0

cn,k · xn−kyk

The multinomial numbers are the coefficients cn,k1,...,kr in theformula

(x1 + . . . + xr )n =n∑

k1+...+kr=n

cn,k1,...,kr · xk11 xk2

2 . . . xkrr

Example

(x + y)3 = 1 · x3 + 3 · x2y + 3 · x y2 + 1 · y3

(x1 + x2 + x3)2 = 1 · x21 + 1 · x2

2 + 1 · x23 +

2 · x1x2 + 2 · x1x3 + 2 · x2x3

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 29 / 31

Binomial numbers and multinomial numbersHow to compute them?

(x1 + . . . + xr )n =

n∑k1+...+kr=n

n!

k1! . . . kr !· xk1

1 xk22 . . . xkrr

Combinatorial proof

(x1 + . . . + xr )n =

n parenthesized expressions︷ ︸︸ ︷(x1 + . . . + xr ) · . . . · (x1 + . . . + xr )

In how many ways can we produce the monomial xk11 · . . . · xkrr ?

B Choose k1 parentheses from where x1 originates ⇒(nk1

)choices.

B Choose k2 parentheses from where x2 originates ⇒(n−k1

k2

)choices.

. . .

B Choose kr parentheses from where xr originates ⇒(n−∑r−1

i=1 kikr

)choices.

⇒ by the product rule, the number of occurrences of xk11 · . . . · xkrr in the

right hand side is(nk1

)(n−k1

k2

)· . . . ·

(n−∑r−1i=1 kikr

)=

n!

k1! . . . kr !

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 30 / 31

Binomial numbers and multinomial numbersHow to compute them?

(x1 + . . . + xr )n =

n∑k1+...+kr=n

n!

k1! . . . kr !· xk1

1 xk22 . . . xkrr

Combinatorial proof

(x1 + . . . + xr )n =

n parenthesized expressions︷ ︸︸ ︷(x1 + . . . + xr ) · . . . · (x1 + . . . + xr )

In how many ways can we produce the monomial xk11 · . . . · xkrr ?

B Choose k1 parentheses from where x1 originates ⇒(nk1

)choices.

B Choose k2 parentheses from where x2 originates ⇒(n−k1

k2

)choices.

. . .

B Choose kr parentheses from where xr originates ⇒(n−∑r−1

i=1 kikr

)choices.

⇒ by the product rule, the number of occurrences of xk11 · . . . · xkrr in the

right hand side is(nk1

)(n−k1

k2

)· . . . ·

(n−∑r−1i=1 kikr

)=

n!

k1! . . . kr !

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 30 / 31

Binomial numbers and multinomial numbersHow to compute them?

(x1 + . . . + xr )n =

n∑k1+...+kr=n

n!

k1! . . . kr !· xk1

1 xk22 . . . xkrr

Combinatorial proof

(x1 + . . . + xr )n =

n parenthesized expressions︷ ︸︸ ︷(x1 + . . . + xr ) · . . . · (x1 + . . . + xr )

In how many ways can we produce the monomial xk11 · . . . · xkrr ?

B Choose k1 parentheses from where x1 originates ⇒(nk1

)choices.

B Choose k2 parentheses from where x2 originates ⇒(n−k1

k2

)choices.

. . .

B Choose kr parentheses from where xr originates ⇒(n−∑r−1

i=1 kikr

)choices.

⇒ by the product rule, the number of occurrences of xk11 · . . . · xkrr in the

right hand side is(nk1

)(n−k1

k2

)· . . . ·

(n−∑r−1i=1 kikr

)=

n!

k1! . . . kr !

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 30 / 31

Binomial numbers and multinomial numbersHow to compute them?

(x1 + . . . + xr )n =

n∑k1+...+kr=n

n!

k1! . . . kr !· xk1

1 xk22 . . . xkrr

Combinatorial proof

(x1 + . . . + xr )n =

n parenthesized expressions︷ ︸︸ ︷(x1 + . . . + xr ) · . . . · (x1 + . . . + xr )

In how many ways can we produce the monomial xk11 · . . . · xkrr ?

B Choose k1 parentheses from where x1 originates ⇒(nk1

)choices.

B Choose k2 parentheses from where x2 originates ⇒(n−k1

k2

)choices.

. . .

B Choose kr parentheses from where xr originates ⇒(n−∑r−1

i=1 kikr

)choices.

⇒ by the product rule, the number of occurrences of xk11 · . . . · xkrr in the

right hand side is(nk1

)(n−k1

k2

)· . . . ·

(n−∑r−1i=1 kikr

)=

n!

k1! . . . kr !

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 30 / 31

Binomial numbers and multinomial numbersHow to compute them?

(x1 + . . . + xr )n =

n∑k1+...+kr=n

n!

k1! . . . kr !· xk1

1 xk22 . . . xkrr

Combinatorial proof

(x1 + . . . + xr )n =

n parenthesized expressions︷ ︸︸ ︷(x1 + . . . + xr ) · . . . · (x1 + . . . + xr )

In how many ways can we produce the monomial xk11 · . . . · xkrr ?

B Choose k1 parentheses from where x1 originates ⇒(nk1

)choices.

B Choose k2 parentheses from where x2 originates ⇒(n−k1

k2

)choices.

. . .

B Choose kr parentheses from where xr originates ⇒(n−∑r−1

i=1 kikr

)choices.

⇒ by the product rule, the number of occurrences of xk11 · . . . · xkrr in the

right hand side is(nk1

)(n−k1

k2

)· . . . ·

(n−∑r−1i=1 kikr

)=

n!

k1! . . . kr !Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 30 / 31

Binomial numbers and multinomial numbersConclusions

For the formula n!k1!...kr ! with k1 + . . . + kr = n we often use

the notation( nk1,...,kr

).

The binomial formula is

(x + y)n =n∑

k=0

(n

k

)xn−kyk

The multinomial formulas

(x1 + . . . + xr )n =∑

k1+...+kr=n

(n

k1, . . . , kr

)xk1

1 · . . . · xkrr

Remark.(nk

)=( nk,n−k

)and

(x1 + x2)n =n∑

k=0

(n

k

)xk1 x

n−k2 =

∑k1+k2=n

(n

k1, k2

)xk1

1 xk22 .

Isabela Dramnesc UVT Graph Theory and Combinatorics – Lecture 1 31 / 31

Recommended