97
Discrete Mathematics and Its Applications Lecture 3: Counting: Pigeonhole Principle and Binomial Coefficients MING GAO DaSE@ ECNU (for course related communications) [email protected] Apr. 17, 2020

Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Discrete Mathematics and Its ApplicationsLecture 3: Counting: Pigeonhole Principle and Binomial Coefficients

MING GAO

DaSE@ ECNU(for course related communications)

[email protected]

Apr. 17, 2020

Page 2: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Outline

1 Pigeonhole Principle

2 Binomial Coefficient

3 Pascal’s Triangle

4 Take-aways

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 2 / 33

Page 3: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The sock problem

I have n pairs of socks. Each pair is different from the other pair.How many socks do I have to pick out to be sure that I have at leastone matching pair.

The answer of the previous question seems obvious. But it appears to bevery useful in numerous cases. It is called the pigeonhole principle.

The pigeonhole principle

If we put n+ 1 objects into n boxes, at least one box gets more thanone objects (also called Dirichlet drawer principle).

Example

Suppose that a flock of 20 pigeons flies into a set of 19 pigeonholes toroost. Because there are 20 pigeons but only 19 pigeonholes, a least oneof these 19 pigeonholes must have at least two pigeons in it.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 3 / 33

Page 4: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The sock problem

I have n pairs of socks. Each pair is different from the other pair.How many socks do I have to pick out to be sure that I have at leastone matching pair.

The answer of the previous question seems obvious. But it appears to bevery useful in numerous cases. It is called the pigeonhole principle.

The pigeonhole principle

If we put n+ 1 objects into n boxes, at least one box gets more thanone objects (also called Dirichlet drawer principle).

Example

Suppose that a flock of 20 pigeons flies into a set of 19 pigeonholes toroost. Because there are 20 pigeons but only 19 pigeonholes, a least oneof these 19 pigeonholes must have at least two pigeons in it.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 3 / 33

Page 5: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The sock problem

I have n pairs of socks. Each pair is different from the other pair.How many socks do I have to pick out to be sure that I have at leastone matching pair.

The answer of the previous question seems obvious. But it appears to bevery useful in numerous cases. It is called the pigeonhole principle.

The pigeonhole principle

If we put n+ 1 objects into n boxes, at least one box gets more thanone objects (also called Dirichlet drawer principle).

Example

Suppose that a flock of 20 pigeons flies into a set of 19 pigeonholes toroost. Because there are 20 pigeons but only 19 pigeonholes, a least oneof these 19 pigeonholes must have at least two pigeons in it.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 3 / 33

Page 6: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The sock problem

I have n pairs of socks. Each pair is different from the other pair.How many socks do I have to pick out to be sure that I have at leastone matching pair.

The answer of the previous question seems obvious. But it appears to bevery useful in numerous cases. It is called the pigeonhole principle.

The pigeonhole principle

If we put n+ 1 objects into n boxes, at least one box gets more thanone objects (also called Dirichlet drawer principle).

Example

Suppose that a flock of 20 pigeons flies into a set of 19 pigeonholes toroost. Because there are 20 pigeons but only 19 pigeonholes, a least oneof these 19 pigeonholes must have at least two pigeons in it.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 3 / 33

Page 7: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Students with the same birthday

It is quite often that you find people with the same birthday.

Since there is at most 366 days in a year, the pigeonholeprinciple states that if you have 367 people is a room, there isat least one pair with the same birthday.

But that’s the worst case scenario, as it is more common tofind people with the same birthday. (In the next class, we willtry to see if there is a pair of students in the class with thesame birthday.)

So, let’s think about the probability that there are twostudents with the same birthday in a room with 40 students.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 4 / 33

Page 8: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Students with the same birthday

It is quite often that you find people with the same birthday.

Since there is at most 366 days in a year, the pigeonholeprinciple states that if you have 367 people is a room, there isat least one pair with the same birthday.

But that’s the worst case scenario, as it is more common tofind people with the same birthday. (In the next class, we willtry to see if there is a pair of students in the class with thesame birthday.)

So, let’s think about the probability that there are twostudents with the same birthday in a room with 40 students.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 4 / 33

Page 9: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Students with the same birthday

It is quite often that you find people with the same birthday.

Since there is at most 366 days in a year, the pigeonholeprinciple states that if you have 367 people is a room, there isat least one pair with the same birthday.

But that’s the worst case scenario, as it is more common tofind people with the same birthday. (In the next class, we willtry to see if there is a pair of students in the class with thesame birthday.)

So, let’s think about the probability that there are twostudents with the same birthday in a room with 40 students.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 4 / 33

Page 10: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two. E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6. (Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 11: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two.

E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6. (Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 12: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two. E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6.

(Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 13: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two. E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6. (Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 14: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two. E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6. (Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 15: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two. E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6. (Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 16: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two. E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6. (Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 17: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two. E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6. (Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 18: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A simple case

Let’s start with 2 people in the room.

Notes: While we have not defined properly what probabilities mean,

we can count the number of all possibilities and the number of cases

that we are interested in, and then calculate probability as the ratio

between the two. E.g., if there are 50 possible outcomes and 30 of

them are the ones we are interested in, the probability is 0.6. (Note

that we assume that every outcome is equally likely.)

How many possible birthdays can two people have?

Since each person has 366 choices, and the first person and thesecond person can choose independently, the number is366 · 366.

How many possible ways can they share the same birthday?

Since the first person has 366 choices, and the second personhas to choose the same day, there are only 366 ways.

Thus, the probability is 3663662 = 0.0027, very unlikely.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 5 / 33

Page 19: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 20: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 21: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 22: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices.

The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 23: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices.

The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 24: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices.

Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 25: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.

Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 26: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 27: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 28: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

3 people

Let’s consider 3 people. How many possible birthdays can 3people have?

Since each person has 366 choices, and each person can chooseindependently, the number is 366 · 366 · 366 = 3663.

How many possible ways can at least two of them share thesame birthday?

So let’s think about the case when everyone do not share anybirthdays.The first person has 366 choices. The second one has366− 1 = 365 choices. The third one has 366− 2 = 364choices. Thus, the number of ways they do not share anybirthdays is 366 · 365 · 364.Notice that this is the number of ordered subsets.

Thus, the probability that they do not share birthdays is366·365·364

3663 = 0.9918. Thus the probability that two of themshare a birthday is 1− 0.9918 = 0.0082.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 6 / 33

Page 29: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have?

36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it? Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 30: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have? 36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it? Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 31: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have? 36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it? Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 32: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have? 36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.

Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it? Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 33: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have? 36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it? Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 34: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have? 36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it? Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 35: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have? 36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it?

Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 36: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have? 36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it? Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 37: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

40 people

Let’s extend our previous argument to the case with 40 people.

How many possible birthdays can 40 people have? 36640.

How many possible ways that they do not sure any birthdays?

This is the number of ordered subsets with 40 elements of a366-set.Thus, there are 366 · 365 · 364 · · · 327 ways.

Thus, the probability that they do not share birthdays is

366 · 365 · 364 · · · 327

36640.

Umm... how small is it? Again you can use a computer tocompute the exact value of this quantity. For example, youmay want to use Wolfram Alpha.

Anyway, we will try to estimate it using basic mathematicaltools.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 7 / 33

Page 38: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

General case: n days k people

Let’s continue on the general case. When we have k peopleand a year contains n days, the probability that no two peopleshare the same birthday is

n · (n − 1) · (n − 2) · · · (n − k + 1)

nk.

If this number is very close to 0, then it is very unlikely that notwo people share the same birthday, i.e., it is very likely thatthere exists two people with the same birthday.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 8 / 33

Page 39: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

General case: n days k people

Let’s continue on the general case. When we have k peopleand a year contains n days, the probability that no two peopleshare the same birthday is

n · (n − 1) · (n − 2) · · · (n − k + 1)

nk.

If this number is very close to 0, then it is very unlikely that notwo people share the same birthday, i.e., it is very likely thatthere exists two people with the same birthday.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 8 / 33

Page 40: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A few tweaks

Dealing with small numbers is sometimes troublesome. (Thereason will be more apparent later when we start introducingthe tools.) So let’s consider the reciprocal instead:

nk

n · (n − 1) · (n − 2) · · · (n − k + 1).

The top term looks easy to deal with; the bottom one doesnot. Let’s break up the product:(n

n

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

).

If you look closely at this product, you can see that each termis at least one. In the beginning, the terms are very close toone and they get larger at the end.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 9 / 33

Page 41: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A few tweaks

Dealing with small numbers is sometimes troublesome. (Thereason will be more apparent later when we start introducingthe tools.) So let’s consider the reciprocal instead:

nk

n · (n − 1) · (n − 2) · · · (n − k + 1).

The top term looks easy to deal with; the bottom one doesnot. Let’s break up the product:(n

n

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

).

If you look closely at this product, you can see that each termis at least one. In the beginning, the terms are very close toone and they get larger at the end.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 9 / 33

Page 42: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

A few tweaks

Dealing with small numbers is sometimes troublesome. (Thereason will be more apparent later when we start introducingthe tools.) So let’s consider the reciprocal instead:

nk

n · (n − 1) · (n − 2) · · · (n − k + 1).

The top term looks easy to deal with; the bottom one doesnot. Let’s break up the product:(n

n

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

).

If you look closely at this product, you can see that each termis at least one. In the beginning, the terms are very close toone and they get larger at the end.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 9 / 33

Page 43: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The logarithms

There is a nice tool that you can turn multiplications toadditions: logarithms. So let’s try to take the logarithms;

weget

ln

((nn

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

))

= ln(nn

)+ ln

(n

n − 1

)+ ln

(n

n − 2

)+ · · ·+ ln

(n

n − k + 1

).

The terms do not look that much better. But there’s a nicefact about the natural logarithms.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 10 / 33

Page 44: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The logarithms

There is a nice tool that you can turn multiplications toadditions: logarithms. So let’s try to take the logarithms; weget

ln

((nn

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

))

= ln(nn

)+ ln

(n

n − 1

)+ ln

(n

n − 2

)+ · · ·+ ln

(n

n − k + 1

).

The terms do not look that much better. But there’s a nicefact about the natural logarithms.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 10 / 33

Page 45: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The logarithms

There is a nice tool that you can turn multiplications toadditions: logarithms. So let’s try to take the logarithms; weget

ln

((nn

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

))

= ln(nn

)+ ln

(n

n − 1

)+ ln

(n

n − 2

)+ · · ·+ ln

(n

n − k + 1

).

The terms do not look that much better. But there’s a nicefact about the natural logarithms.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 10 / 33

Page 46: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

ln x : the upper bound

Fact:ln x ≤ x − 1

This fact can be proved with elementary calculus. But it is fairly clear ifyou plot the functions ln x and x − 1.

So let’s do that at Wolfram Alpha.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 11 / 33

Page 47: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

ln x : the upper bound

Fact:ln x ≤ x − 1

This fact can be proved with elementary calculus. But it is fairly clear ifyou plot the functions ln x and x − 1.So let’s do that at Wolfram Alpha.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 11 / 33

Page 48: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

ln x : the lower bound

We know thatln x ≤ x − 1

If we use the fact that ln 1x = − ln x , we can obtain the lower bound.

ln x = − ln1

x≥ −

(1

x− 1

)=

x − 1

x.

Let’s conclude by stating the lemma:

Lemma

x − 1

x≤ ln x ≤ x − 1.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 12 / 33

Page 49: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

ln x : the lower bound

We know thatln x ≤ x − 1

If we use the fact that ln 1x = − ln x , we can obtain the lower bound.

ln x = − ln1

x≥ −

(1

x− 1

)=

x − 1

x.

Let’s conclude by stating the lemma:

Lemma

x − 1

x≤ ln x ≤ x − 1.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 12 / 33

Page 50: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The lower bound

Let’s look at each term in the sum: ln(

nn−j

). Using the lower bound in

Lemma 1, we get that

ln

(n

n − j

)≥

nn−j − 1

nn−j

=

n−n+jn−jn

n−j

=j

n.

Thus,

ln

((nn

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

))

= ln(nn

)+ ln

(n

n − 1

)+ ln

(n

n − 2

)+ · · ·+ ln

(n

n − k + 1

)≥ 0

n+

1

n+

2

n+ · · ·+ k − 1

n

=1

n(1 + 2 + · · ·+ (k − 1)) =

k(k − 1)

2n.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 13 / 33

Page 51: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The lower bound

Let’s look at each term in the sum: ln(

nn−j

). Using the lower bound in

Lemma 1, we get that

ln

(n

n − j

)≥

nn−j − 1

nn−j

=

n−n+jn−jn

n−j

=j

n.

Thus,

ln

((nn

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

))

= ln(nn

)+ ln

(n

n − 1

)+ ln

(n

n − 2

)+ · · ·+ ln

(n

n − k + 1

)≥ 0

n+

1

n+

2

n+ · · ·+ k − 1

n

=1

n(1 + 2 + · · ·+ (k − 1)) =

k(k − 1)

2n.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 13 / 33

Page 52: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The upper bound

Again, let’s look at each term in the sum: ln(

nn−j

). Using the upper

bound in Lemma 1, we get that

ln

(n

n − j

)≤ n

n − j− 1 =

j

n − j.

Thus,

ln

((nn

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

))

≤ 0

n − 0+

1

n − 1+

2

n − 2+ · · ·+ k − 1

n − k + 1

≤ 0

n − k + 1+

1

n − k + 1+

2

n − k + 1+ · · ·+ k − 1

n − k + 1

=1

n − k + 1(1 + 2 + · · ·+ (k − 1)) =

k(k − 1)

2(n − k + 1).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 14 / 33

Page 53: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The upper bound

Again, let’s look at each term in the sum: ln(

nn−j

). Using the upper

bound in Lemma 1, we get that

ln

(n

n − j

)≤ n

n − j− 1 =

j

n − j.

Thus,

ln

((nn

)·(

n

n − 1

)·(

n

n − 2

)· · ·(

n

n − k + 1

))

≤ 0

n − 0+

1

n − 1+

2

n − 2+ · · ·+ k − 1

n − k + 1

≤ 0

n − k + 1+

1

n − k + 1+

2

n − k + 1+ · · ·+ k − 1

n − k + 1

=1

n − k + 1(1 + 2 + · · ·+ (k − 1)) =

k(k − 1)

2(n − k + 1).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 14 / 33

Page 54: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Both

Using the derived upper and lower bounds, we get

ek(k−1)

2n ≤ nk

n(n − 1)(n − 2) · · · (n − k + 1)≤ e

k(k−1)2(n−k+1)

Let’s plug in n = 366 and k = 40:

8.42 ≤ 36640

366 · 365 · · · 327≤ 10.86.

So the probability that we get no two people with the same birthday isbetween 1/8.42 ≈ 0.118 and 1/10.86 ≈ 0.092. So we have high chance offinding two students with the same birthday. This is pretty close as theactual value is 0.1094.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 15 / 33

Page 55: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Both

Using the derived upper and lower bounds, we get

ek(k−1)

2n ≤ nk

n(n − 1)(n − 2) · · · (n − k + 1)≤ e

k(k−1)2(n−k+1)

Let’s plug in n = 366 and k = 40:

8.42 ≤ 36640

366 · 365 · · · 327≤ 10.86.

So the probability that we get no two people with the same birthday isbetween 1/8.42 ≈ 0.118 and 1/10.86 ≈ 0.092. So we have high chance offinding two students with the same birthday. This is pretty close as theactual value is 0.1094.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 15 / 33

Page 56: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Both

Using the derived upper and lower bounds, we get

ek(k−1)

2n ≤ nk

n(n − 1)(n − 2) · · · (n − k + 1)≤ e

k(k−1)2(n−k+1)

Let’s plug in n = 366 and k = 40:

8.42 ≤ 36640

366 · 365 · · · 327≤ 10.86.

So the probability that we get no two people with the same birthday isbetween 1/8.42 ≈ 0.118 and 1/10.86 ≈ 0.092. So we have high chance offinding two students with the same birthday.

This is pretty close as theactual value is 0.1094.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 15 / 33

Page 57: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Both

Using the derived upper and lower bounds, we get

ek(k−1)

2n ≤ nk

n(n − 1)(n − 2) · · · (n − k + 1)≤ e

k(k−1)2(n−k+1)

Let’s plug in n = 366 and k = 40:

8.42 ≤ 36640

366 · 365 · · · 327≤ 10.86.

So the probability that we get no two people with the same birthday isbetween 1/8.42 ≈ 0.118 and 1/10.86 ≈ 0.092. So we have high chance offinding two students with the same birthday. This is pretty close as theactual value is 0.1094.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 15 / 33

Page 58: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The generalized pigeonhole principle

Corollary: A function f from a set with k + 1 or more elements toa set with k elements is not one-to-one.

The generalized pigeonhole principle

Theorem: If N objects are placed into k boxes, then there is at leastone box containing at least dNk e objects.

Proof.

Suppose that none of the boxes contains more than dNk e − 1objects. Then, the total number of objects is at most

k(dNke − 1) < k((

N

k+ 1)− 1) = N,

where the inequality dNk e <Nk + 1 has been used.

This is a contradiction because there are a total of N objects.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 16 / 33

Page 59: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The generalized pigeonhole principle

Corollary: A function f from a set with k + 1 or more elements toa set with k elements is not one-to-one.

The generalized pigeonhole principle

Theorem: If N objects are placed into k boxes, then there is at leastone box containing at least dNk e objects.

Proof.

Suppose that none of the boxes contains more than dNk e − 1objects.

Then, the total number of objects is at most

k(dNke − 1) < k((

N

k+ 1)− 1) = N,

where the inequality dNk e <Nk + 1 has been used.

This is a contradiction because there are a total of N objects.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 16 / 33

Page 60: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The generalized pigeonhole principle

Corollary: A function f from a set with k + 1 or more elements toa set with k elements is not one-to-one.

The generalized pigeonhole principle

Theorem: If N objects are placed into k boxes, then there is at leastone box containing at least dNk e objects.

Proof.

Suppose that none of the boxes contains more than dNk e − 1objects. Then, the total number of objects is at most

k(dNke − 1) < k((

N

k+ 1)− 1) = N,

where the inequality dNk e <Nk + 1 has been used.

This is a contradiction because there are a total of N objects.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 16 / 33

Page 61: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

The generalized pigeonhole principle

Corollary: A function f from a set with k + 1 or more elements toa set with k elements is not one-to-one.

The generalized pigeonhole principle

Theorem: If N objects are placed into k boxes, then there is at leastone box containing at least dNk e objects.

Proof.

Suppose that none of the boxes contains more than dNk e − 1objects. Then, the total number of objects is at most

k(dNke − 1) < k((

N

k+ 1)− 1) = N,

where the inequality dNk e <Nk + 1 has been used.

This is a contradiction because there are a total of N objects.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 16 / 33

Page 62: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Some elegant applications of the Pigeonhole principle I

Question: During a month with 30 days, a baseball team plays atleast one game a day, but no more than 45 games. Show that theremust be a period of some number of consecutive days during whichthe team must play exactly 14 games.

Solution

Let aj be the number of games played on or before the j−th day ofthe month. Then 1 ≤ a1 ≤ a2 ≤ · · · ≤ a30 ≤ 45.

Moreover, 15 ≤ ai + 14 ≤ 59 is also an increasing sequence ofdistinct positive integers. The 60 positive integers have1 ≤ a1, a2, · · · , a30, a1 + 14, a2 + 14, · · · , a30 + 14 ≤ 59.Hence, by the pigeonhole principle two of these integers are equal.Because aj are all distinct and aj + 14 are all distinct, there must beindices i and j with ai = aj + 14. This means that exactly 14 gameswere played from day j + 1 to day i .

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 17 / 33

Page 63: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Some elegant applications of the Pigeonhole principle I

Question: During a month with 30 days, a baseball team plays atleast one game a day, but no more than 45 games. Show that theremust be a period of some number of consecutive days during whichthe team must play exactly 14 games.

Solution

Let aj be the number of games played on or before the j−th day ofthe month. Then 1 ≤ a1 ≤ a2 ≤ · · · ≤ a30 ≤ 45.Moreover, 15 ≤ ai + 14 ≤ 59 is also an increasing sequence ofdistinct positive integers. The 60 positive integers have1 ≤ a1, a2, · · · , a30, a1 + 14, a2 + 14, · · · , a30 + 14 ≤ 59.

Hence, by the pigeonhole principle two of these integers are equal.Because aj are all distinct and aj + 14 are all distinct, there must beindices i and j with ai = aj + 14. This means that exactly 14 gameswere played from day j + 1 to day i .

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 17 / 33

Page 64: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Some elegant applications of the Pigeonhole principle I

Question: During a month with 30 days, a baseball team plays atleast one game a day, but no more than 45 games. Show that theremust be a period of some number of consecutive days during whichthe team must play exactly 14 games.

Solution

Let aj be the number of games played on or before the j−th day ofthe month. Then 1 ≤ a1 ≤ a2 ≤ · · · ≤ a30 ≤ 45.Moreover, 15 ≤ ai + 14 ≤ 59 is also an increasing sequence ofdistinct positive integers. The 60 positive integers have1 ≤ a1, a2, · · · , a30, a1 + 14, a2 + 14, · · · , a30 + 14 ≤ 59.Hence, by the pigeonhole principle two of these integers are equal.Because aj are all distinct and aj + 14 are all distinct, there must beindices i and j with ai = aj + 14. This means that exactly 14 gameswere played from day j + 1 to day i .

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 17 / 33

Page 65: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Some elegant applications of the Pigeonhole principle II

Question: Show that among any n+1 positive integers not exceeding2n there must be an integer that divides one of the other integers.

Solution

Write each of the n + 1 integers a1, a2, · · · , an+1 as a power of 2times an odd integer. In other words, let aj = 2kjqj forj = 1, 2, · · · , n + 1, where kj is a nonnegative integer and qj is odd.Integers q1, q2, · · · , qn+1 are all odd positive integers less than 2n.Because there are only n odd positive integers less than 2n, itfollows from the pigeonhole principle that two of integersq1, q2, · · · , qn+1 must be equal. Therefore, there are distinctintegers i and j such that qi = qj . Let q be the common value ofqi and qj . Then, ai = 2kiq and aj = 2kjq. It follows that if ki < kj, then ai divides aj ; while if ki > kj , then aj divides ai .

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 18 / 33

Page 66: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Ramsey theory

Theorem: Every sequence of n2 + 1 distinct real numbers contains asubsequence of length n + 1 that is increasing or decreasing strictly.Proof: Let ai be a sequence of n2 + 1 distinct real numbers. As-sociate (ik , dk) to term ak , where ik and dk are the lengths of thelongest increasing and longest decreasing subsequences starting atak , respectively.

Suppose that there are no increasing or decreas-ing subsequences of length n + 1. Then ik ≤ n and dk ≤ n, fork = 1, 2, · · · , n2 + 1. Hence, by the product rule there are n2 pos-sible ordered pairs for (ik , dk). By the pigeonhole principle, two ofthese n2 + 1 ordered pairs are equal, i.e., there exist terms as andat (s < t) s.t. is = it and ds = dt . Because the terms are distinct,either as < at or as > at . If as < at , then, because is = it , anincreasing subsequence of length it + 1 can be built starting at as , bytaking as followed by an increasing subsequence of length it begin-ning at at . This is a contradiction. Similarly, if as > at , the samereasoning shows that ds > dt , which is a contradiction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 19 / 33

Page 67: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Ramsey theory

Theorem: Every sequence of n2 + 1 distinct real numbers contains asubsequence of length n + 1 that is increasing or decreasing strictly.Proof: Let ai be a sequence of n2 + 1 distinct real numbers. As-sociate (ik , dk) to term ak , where ik and dk are the lengths of thelongest increasing and longest decreasing subsequences starting atak , respectively. Suppose that there are no increasing or decreas-ing subsequences of length n + 1. Then ik ≤ n and dk ≤ n, fork = 1, 2, · · · , n2 + 1.

Hence, by the product rule there are n2 pos-sible ordered pairs for (ik , dk). By the pigeonhole principle, two ofthese n2 + 1 ordered pairs are equal, i.e., there exist terms as andat (s < t) s.t. is = it and ds = dt . Because the terms are distinct,either as < at or as > at . If as < at , then, because is = it , anincreasing subsequence of length it + 1 can be built starting at as , bytaking as followed by an increasing subsequence of length it begin-ning at at . This is a contradiction. Similarly, if as > at , the samereasoning shows that ds > dt , which is a contradiction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 19 / 33

Page 68: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Ramsey theory

Theorem: Every sequence of n2 + 1 distinct real numbers contains asubsequence of length n + 1 that is increasing or decreasing strictly.Proof: Let ai be a sequence of n2 + 1 distinct real numbers. As-sociate (ik , dk) to term ak , where ik and dk are the lengths of thelongest increasing and longest decreasing subsequences starting atak , respectively. Suppose that there are no increasing or decreas-ing subsequences of length n + 1. Then ik ≤ n and dk ≤ n, fork = 1, 2, · · · , n2 + 1. Hence, by the product rule there are n2 pos-sible ordered pairs for (ik , dk). By the pigeonhole principle, two ofthese n2 + 1 ordered pairs are equal, i.e., there exist terms as andat (s < t) s.t. is = it and ds = dt .

Because the terms are distinct,either as < at or as > at . If as < at , then, because is = it , anincreasing subsequence of length it + 1 can be built starting at as , bytaking as followed by an increasing subsequence of length it begin-ning at at . This is a contradiction. Similarly, if as > at , the samereasoning shows that ds > dt , which is a contradiction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 19 / 33

Page 69: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Ramsey theory

Theorem: Every sequence of n2 + 1 distinct real numbers contains asubsequence of length n + 1 that is increasing or decreasing strictly.Proof: Let ai be a sequence of n2 + 1 distinct real numbers. As-sociate (ik , dk) to term ak , where ik and dk are the lengths of thelongest increasing and longest decreasing subsequences starting atak , respectively. Suppose that there are no increasing or decreas-ing subsequences of length n + 1. Then ik ≤ n and dk ≤ n, fork = 1, 2, · · · , n2 + 1. Hence, by the product rule there are n2 pos-sible ordered pairs for (ik , dk). By the pigeonhole principle, two ofthese n2 + 1 ordered pairs are equal, i.e., there exist terms as andat (s < t) s.t. is = it and ds = dt . Because the terms are distinct,either as < at or as > at . If as < at , then, because is = it , anincreasing subsequence of length it + 1 can be built starting at as , bytaking as followed by an increasing subsequence of length it begin-ning at at . This is a contradiction.

Similarly, if as > at , the samereasoning shows that ds > dt , which is a contradiction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 19 / 33

Page 70: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pigeonhole Principle

Ramsey theory

Theorem: Every sequence of n2 + 1 distinct real numbers contains asubsequence of length n + 1 that is increasing or decreasing strictly.Proof: Let ai be a sequence of n2 + 1 distinct real numbers. As-sociate (ik , dk) to term ak , where ik and dk are the lengths of thelongest increasing and longest decreasing subsequences starting atak , respectively. Suppose that there are no increasing or decreas-ing subsequences of length n + 1. Then ik ≤ n and dk ≤ n, fork = 1, 2, · · · , n2 + 1. Hence, by the product rule there are n2 pos-sible ordered pairs for (ik , dk). By the pigeonhole principle, two ofthese n2 + 1 ordered pairs are equal, i.e., there exist terms as andat (s < t) s.t. is = it and ds = dt . Because the terms are distinct,either as < at or as > at . If as < at , then, because is = it , anincreasing subsequence of length it + 1 can be built starting at as , bytaking as followed by an increasing subsequence of length it begin-ning at at . This is a contradiction. Similarly, if as > at , the samereasoning shows that ds > dt , which is a contradiction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 19 / 33

Page 71: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

The binomial coefficients

There is a reason why the term(nk

)is called the binomial coefficients. In

this lecture, we will discuss

the Pascal’s triangle,

the binomial theorem, and

advanced counting with binomial coefficients.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 20 / 33

Page 72: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Polynomial expansions

Let’s start by looking at polynomial of the form (x + y)n. Let’s start withsmall values of n:

(x + y)1 = x + y

(x + y)2 = x2 + 2 · xy + y2

(x + y)3 = x3 + 3 · x2y + 3 · xy2 + y3

(x + y)4 = x4 + 4 · x3y + 6 · x2y2 + 4 · xy3 + y4.

Let’s focus on the coefficient of each term. You may notice that terms xn

and yn always have 1 as their coefficients. Why is that?Let’s look further at the coefficients of terms xn−1y . Do you see anypattern in their coefficients? Can you explain why?

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 21 / 33

Page 73: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Polynomial expansions

Let’s start by looking at polynomial of the form (x + y)n. Let’s start withsmall values of n:

(x + y)1 = x + y

(x + y)2 = x2 + 2 · xy + y2

(x + y)3 = x3 + 3 · x2y + 3 · xy2 + y3

(x + y)4 = x4 + 4 · x3y + 6 · x2y2 + 4 · xy3 + y4.

Let’s focus on the coefficient of each term. You may notice that terms xn

and yn always have 1 as their coefficients. Why is that?Let’s look further at the coefficients of terms xn−1y . Do you see anypattern in their coefficients? Can you explain why?

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 21 / 33

Page 74: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Another way to look at it

Let’s take a look at (x + y)4 again. It is

(x + y)(x + y)(x + y)(x + y).

How do we get x4 in the expansion?

For every factory, you have topick x .

How do we get x3y in the expansion? Out of the 4 factors, you haveto pick y in one of the factor (or you have to pick x in 3 of thefactors). Thus there are

(43

)=(4

1

)ways to do so.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 22 / 33

Page 75: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Another way to look at it

Let’s take a look at (x + y)4 again. It is

(x + y)(x + y)(x + y)(x + y).

How do we get x4 in the expansion? For every factory, you have topick x .

How do we get x3y in the expansion?

Out of the 4 factors, you haveto pick y in one of the factor (or you have to pick x in 3 of thefactors). Thus there are

(43

)=(4

1

)ways to do so.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 22 / 33

Page 76: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Another way to look at it

Let’s take a look at (x + y)4 again. It is

(x + y)(x + y)(x + y)(x + y).

How do we get x4 in the expansion? For every factory, you have topick x .

How do we get x3y in the expansion? Out of the 4 factors, you haveto pick y in one of the factor (or you have to pick x in 3 of thefactors).

Thus there are(4

3

)=(4

1

)ways to do so.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 22 / 33

Page 77: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Another way to look at it

Let’s take a look at (x + y)4 again. It is

(x + y)(x + y)(x + y)(x + y).

How do we get x4 in the expansion? For every factory, you have topick x .

How do we get x3y in the expansion? Out of the 4 factors, you haveto pick y in one of the factor (or you have to pick x in 3 of thefactors). Thus there are

(43

)=(4

1

)ways to do so.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 22 / 33

Page 78: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

The binomial theorem

Theorem

If you expand (x + y)n, the coefficient of the term xkyn−k is(nk

).

That is,

(x + y)n =n∑

k=0

(n

k

)xkyn−k =

(n

n

)xn +

(n

n − 1

)xn−1y1 +

(n

n − 2

)xn−2y2 + · · ·+

(n

1

)xyn−1 +

(n

0

)yn.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 23 / 33

Page 79: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Additional applications of the binomial theorem

The binomial theorem can be used to prove various identities regarding thebinomial coefficients.

Corollary 1

Let n be a nonnegative integer, then(n

0

)+

(n

1

)+ · · ·+

(n

n − 1

)+

(n

n

)= 2n[Hint: (1 + 1)n = 2n].

Quick check. Can you prove that(n

0

)−(n

1

)+

(n

2

)−(n

3

)+ · · · = 0.

Note that this statements says that the number of odd subsets equalsthe number of even subsets.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 24 / 33

Page 80: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Additional applications of the binomial theorem

The binomial theorem can be used to prove various identities regarding thebinomial coefficients.

Corollary 1

Let n be a nonnegative integer, then(n

0

)+

(n

1

)+ · · ·+

(n

n − 1

)+

(n

n

)= 2n[Hint: (1 + 1)n = 2n].

Quick check. Can you prove that(n

0

)−(n

1

)+

(n

2

)−(n

3

)+ · · · = 0.

Note that this statements says that the number of odd subsets equalsthe number of even subsets.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 24 / 33

Page 81: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Corollary

Corollary 2

Let n be a nonnegative integer. Then(n

0

)−(n

1

)+

(n

2

)−(n

3

)+ · · · = 0.[Hint: (1− 1)n = 0]

Corollary 3

Let n be a nonnegative integer. Then

n∑k=0

2k(n

k

)= 3n[Hint: (1 + 2)n = 3n].

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 25 / 33

Page 82: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Binomial Coefficient

Corollary

Corollary 2

Let n be a nonnegative integer. Then(n

0

)−(n

1

)+

(n

2

)−(n

3

)+ · · · = 0.[Hint: (1− 1)n = 0]

Corollary 3

Let n be a nonnegative integer. Then

n∑k=0

2k(n

k

)= 3n[Hint: (1 + 2)n = 3n].

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 25 / 33

Page 83: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Triangle binomial coefficient

(00

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)(40

) (41

) (42

) (43

) (44

)(50

) (51

) (52

) (53

) (54

) (55

)

11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 26 / 33

Page 84: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

The Triangle

If we move the numbers in the table slightly to the right, the tablebecomes the Pascal’s triangle.

11 1

1 2 11 3 3 1

1 4 6 4 11 5 10 10 5 1

1 6 15 20 15 6 1...

......

The table and the binomial coefficients have many other interestingproperties.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 27 / 33

Page 85: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

The Triangle

If we move the numbers in the table slightly to the right, the tablebecomes the Pascal’s triangle.

11 1

1 2 11 3 3 1

1 4 6 4 11 5 10 10 5 1

1 6 15 20 15 6 1...

......

The table and the binomial coefficients have many other interestingproperties.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 27 / 33

Page 86: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Pascal’s triangle

(00

)(10

) (11

)(20

) (21

) (22

)(30

) (31

) (32

) (33

)(40

) (41

) (42

) (43

) (44

)(50

) (51

) (52

) (53

) (54

) (55

)(60

) (61

) (62

) (63

) (64

) (65

) (66

)Yanghui’s triangle Pascal’s triangle

Pascal’s triangle wasknown in the early11th century throughthe work of Chinesemathematicians Jia X-ian (1010-1070) andYang Hui (1238-1298).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 28 / 33

Page 87: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Next observation I

Pascal’s identity

Theorem: Let n and k be positive integers with n ≥ k . Then(n + 1

k

)=

(n

k − 1

)+

(n

k

).

Vandenmonde’s identity

Theorem: Let m, n and r be nonnegative integers with r not exceed-ing either m or n. Then(

m + n

r

)=

r∑k=0

(m

r − k

)(n

k

).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 29 / 33

Page 88: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Next observation I

Pascal’s identity

Theorem: Let n and k be positive integers with n ≥ k . Then(n + 1

k

)=

(n

k − 1

)+

(n

k

).

Vandenmonde’s identity

Theorem: Let m, n and r be nonnegative integers with r not exceed-ing either m or n. Then(

m + n

r

)=

r∑k=0

(m

r − k

)(n

k

).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 29 / 33

Page 89: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Next observation II

11 1

1 2 11 3 3 1

1 4 6 4 11 5 10 10 5 1

1 6 15 20 15 6 11 7 21 35 35 21 7 1

Let’s try to compute the sum of squares of numbers in each row.

12 = 1

12 + 12 = 2

12 + 22 + 12 = 6

12 + 32 + 32 + 12 = 20

12 + 42 + 62 + 42 + 12 = 70

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 30 / 33

Page 90: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Next observation II

11 1

1 2 11 3 3 1

1 4 6 4 11 5 10 10 5 1

1 6 15 20 15 6 11 7 21 35 35 21 7 1

Let’s try to compute the sum of squares of numbers in each row.

12 = 1

12 + 12 = 2

12 + 22 + 12 = 6

12 + 32 + 32 + 12 = 20

12 + 42 + 62 + 42 + 12 = 70

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 30 / 33

Page 91: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Next observation II

11 1

1 2 11 3 3 1

1 4 6 4 11 5 10 10 5 1

1 6 15 20 15 6 11 7 21 35 35 21 7 1

Let’s try to compute the sum of squares of numbers in each row.

12 = 1

12 + 12 = 2

12 + 22 + 12 = 6

12 + 32 + 32 + 12 = 20

12 + 42 + 62 + 42 + 12 = 70

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 30 / 33

Page 92: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Next observation II

11 1

1 2 11 3 3 1

1 4 6 4 11 5 10 10 5 1

1 6 15 20 15 6 11 7 21 35 35 21 7 1

Let’s try to compute the sum of squares of numbers in each row.

12 = 1

12 + 12 = 2

12 + 22 + 12 = 6

12 + 32 + 32 + 12 = 20

12 + 42 + 62 + 42 + 12 = 70

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 30 / 33

Page 93: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Next observation II

11 1

1 2 11 3 3 1

1 4 6 4 11 5 10 10 5 1

1 6 15 20 15 6 11 7 21 35 35 21 7 1

Let’s try to compute the sum of squares of numbers in each row.

12 = 1

12 + 12 = 2

12 + 22 + 12 = 6

12 + 32 + 32 + 12 = 20

12 + 42 + 62 + 42 + 12 = 70

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 30 / 33

Page 94: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Theorem: Let n be a nonnegative integer. Then(2n

n

)=

n∑k=0

(n

k

)2

.

Proof.n∑

k=0

(n

k

)2

=n∑

k=0

(n

k

)(n

n − k

)=

(2n

n

).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 31 / 33

Page 95: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Corollary 4: Let n and r be a nonnegative integers with r ≤ n. Then(n + 1

r + 1

)=

n∑k=r

(k

r

).

Proof.

Let(n+1r+1

)counts the bit strings of length n + 1 containing r + 1

ones.Ways Location of last 1 Counting

Way 1: r + 1(rr

)Way 2: r + 2

(r+1r

)Way 3: r + 3

(r+2r

)· · · · · ·Way n − r + 1: n + 1

(nr

)

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 32 / 33

Page 96: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Pascal’s Triangle

Corollary 4: Let n and r be a nonnegative integers with r ≤ n. Then(n + 1

r + 1

)=

n∑k=r

(k

r

).

Proof.

Let(n+1r+1

)counts the bit strings of length n + 1 containing r + 1

ones.Ways Location of last 1 CountingWay 1: r + 1

(rr

)Way 2: r + 2

(r+1r

)Way 3: r + 3

(r+2r

)· · · · · ·Way n − r + 1: n + 1

(nr

)

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 32 / 33

Page 97: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/... · 3 Pascal’s Triangle 4 Take-aways MING GAO (DaSE@ECNU) Discrete Mathematics and Its

Take-aways

Take-aways

Conclusions

Pigeonhole Principle

Binomial Coefficient

Pascal’s Triangle

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Apr. 17, 2020 33 / 33