23
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Embed Size (px)

Citation preview

Page 1: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

R. Johnsonbaugh

Discrete Mathematics 5th edition, 2001

Chapter 4Counting methods

and the pigeonhole principle

Page 2: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

4.1 Basic principlesMultiplication principle

If an activity can be performed in k successive steps, Step 1 can be done in n1 ways

Step 2 can be done in n2 ways … Step k can be done in nk ways

Then: the number of different ways that the

activity can be performed is the product

n1n2…nk

Page 3: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Addition principleLet X1, X2,…, Xk be a collection of k pairwise

disjoint sets, each of which has nj elements, 1 < j < k, then the union of those sets

k

X = Xj

j =1

has n1 + n2 + … + nk elements

Page 4: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

4.2 Permutations and combinations

A permutation of n distinct elements x1, x2,…, xn is an ordering of the n elements. There are n! permutations of n elements.

Example: there are 3! = 6 permutations of three elements a, b, c:

abc bac cab

acb bca cba

Page 5: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

r-permutationsAn r-permutation of n distinct elements is an

ordering of an r-element subset of the n elements x1, x2,…, xn

Theorem 4.2.10:

For r < n the number of r-permutations of a set with n distinct objects is

P(n,r) = n(n-1)(n-2)…(n-r+1)

Page 6: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Combinations

Let X = {x1, x2,…, xn} be a set containing n

distinct elements An r-combination of X is an unordered

selection of r elements of X, for r < n The number of r-combinations of X is the

binomial coefficient

C(n,r) = n! / r!(n-r)! = P(n,r)/ r!

Page 7: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Catalan numbers

Eugene-Charles Catalan (1814-1894)

Catalan numbers are defined by the formula

Cn = C(2n,n) / (n+1)

for n = 0, 1, 2,…

The first few terms are:

n 0 1 2 3 4 5 6 7 8 9 10

Cn 1 1 2 5 14 42 132 429 1430 4862 16796

Page 8: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

4.3 Algorithms for generating permutations and combinations

Lexicographic order: Given two strings = s1s2…sp and = t1t2…tq

Define < if p < q and si = ti for all i = 1, 2,…, p

Or for some i, si ti and for the smallest i, si < ti

Example: if = 1324, = 1332, = 132,

then < and < .

Page 9: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

4.4 Introduction to discrete probability

An experiment is a process that yields an outcome

An event is an outcome or a set of outcomes from an experiment

The sample space is the event of all possible outcomes

Page 10: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Probability

Probability of an event is the number of outcomes in the event divided by the number of outcomes in the sample space.

If S is a finite sample space and E is an event (E is a subset of S) then the probability of E is

P(E) = |E| / |S|

Page 11: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

4.5 Discrete probability theory

When all outcomes are equally likely and there are n possible outcomes, each one has a probability 1/n.

BUT this is not always the case. When all probabilities are not equal, then some probability (possibly different numbers) must be assigned to each outcome.

Page 12: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Probability function A probability function P is a function from

the set of all outcomes (sample space S) to the interval [0, 1], in symbols

P : S [0, 1]

The probability of an event E S is the sum of the probabilities of every outcome in E

P(E) = P(x)

x E

Page 13: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Probability of an event Given E S, we have

0 < P(E) < P(S) = 1

If S = {x1, x2,…, xn} is a sample space, then

n

P(S) = P(xi) = 1

i =1

If Ec is the complement of E in S, then

P(E) + P(Ec) = 1

Page 14: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Events in a sample space

Given any two events E1 and E2 in a sample space S. Then

P(E1 E2) = P(E1) + P(E2) – P(E1E2)

We also have P() = 0

Events E1 and E2 are mutually exclusive if and

only if E1E2 = . In this case

P(E1E2) = P(E1) + P(E2)

Page 15: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Conditional probability

Conditional probability is the probability of an event E, given that another event F has occurred, is called. In symbols P(E|F).

If P(F) > 0 then

P(E|F) = P(EF) / P(F) Two events E and F are independent if

P(EF) = P(E)P(F)

Page 16: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Pattern recognition Pattern recognition places items into classes,

based on various features of the items. Given a set of features F we can calculate the

probability of a class C, given F: P(C|F) Place the item into the most probable class, i.e.

the one C for which P(C|F) is the highest. Example: Wine can be classified as Table wine (T), Premium (R)

or Swill (S). Let F {acidity, body, color, price} Suppose a wine has feature F, and P(T|F) = 0.5, P(R|F) = 0.2

and P(S|F) = 0.3. Since P(T|F) is the highest number, this wine will be classified as table wine.

Page 17: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Bayes’ Theorem Given pairwise disjoint classes C1, C2,…,

Cn and a feature set F, then

P(Cj|F) = A / B, where

A = P(F|Cj)P(Cj)

n

and B = P(F|Ci)P(Ci)

i = 1

Page 18: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Generalized permutations and combinations

Theorem 4.6.2: Suppose that a sequence of n items has nj identical objects of type j,

for 1< j < k. Then the number of orderings of S is

____n!____

n1!n2!...nk!

Page 19: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

4.7 Binomial coefficients and combinatorial identities

Theorem 4.7.1: Binomial theorem. For any real numbers a, b, and a nonnegative integer n: (a+b)n = C(n,0)anb0 + C(n,1)an-1b1 + … + C(n,n-1)a1bn-1 + C(n,n)a0bn

Theorem 4.7.6: For 1 < k < n, C(n+1,k) = C(n,k) + C(n,k-1)

Page 20: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Pascal’s Triangle 1 1 1

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

1 6 15 20 15 6 1

1 7 21 35 35 21 7 1

1 8 28 56 70 56 28 8 1

1 9 36 84 126 126 84 36 9 1

Page 21: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

4.8 The pigeonhole principle First form: If k < n and n pigeons fly into k

pigeonholes, some pigeonhole contains at least two pigeons.

Page 22: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Second form of the pigeonhole principle

If X and Y are finite sets with |X| > |Y| and f : X Y is a function, then f(x1) = f(x2) for some x1, x2 X, x1 x2.

Page 23: R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle

Third form of the pigeonhole principle

If X and Y are finite sets with |X| = n, |Y| = m and k = n/m, then there are at least k values a1, a2,…, ak X such that f(a1) = f(a2) = … f(ak).

Example: n = 5, m = 3k = n/m = 5/3 = 2.