cse115/engr160 discrete mathematics 04/17/12 ming-hsuan yang uc merced 1

34
CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Post on 19-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

CSE115/ENGR160 Discrete Mathematics04/17/12

Ming-Hsuan Yang

UC Merced

1

Page 2: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

6.3 Permutations & Combinations

• Counting: – Find out the number of ways to select a particular

number of elements from a set– Sometimes the order of these elements matter

• Example:– How many ways we can select 3 students from a

group of 5 students?– How many different ways they stand in line for

picture?

2

Page 3: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Permutation

• How many ways can we select 3 students from a group of 5 to stand in lines for a picture?

• First note that the order in which we select students matters

• There are 5 ways to select the 1st student• Once the 1st student is selected, there are 4 ways to

select the 2nd student in line. By product rule, there are 5x4x3=60 ways to select 3 student from a group of 5 students to stand line for picture

3

Page 4: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Permutation

• How many ways can we arrange all 5 in a line for a picture?

• By product rule, we have 5x4x3x2x1=120 ways to arrange all 5 students in a line for a picture

4

Page 5: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Permutation

• A permutation of a set of distinct objects is an ordered arrangement of these objects

• An ordered arrangement of r elements of a set is called an r-permutation

• The number of r-permutation of a set with n element is denoted by P(n,r). We can find P(n,r) using the product rule

• Example: Let S={1, 2, 3}. The ordered arrangement 3, 1, 2 is a permutation of S. The ordered arrangement 3, 2, is a 2-permutation of S

5

Page 6: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Permutation

• Let S={a, b, c}. The 2-permutation of S are the ordered arrangements, a, b; a, c; b, a; b, c; c, a; and c, b

• Consequently, there are 6 2-permutation of this set with 3 elements

• Note that there are 3 ways to choose the 1st element and then 2 ways to choose the 2nd element

• By product rule, there are P(3,2)=3 x 2 = 66

Page 7: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

r-permutation

• Theorem 1: If n is a positive and r is an integer with 1≤r≤n, then there are P(n,r)=n(n-1)(n-2)…(n-r+1) r-permutations of a set with n elements

• Proof: Use the product rule, the first element can be chosen in n ways. There are n-1 ways to chose the 2nd element. Likewise, there are n-2 ways to choose 3rd element, and so on until there are exactly n-(r-1)=n-r+1 ways to choose the r-th element. Thus, there are n∙(n-1)∙(n-2)… ∙(n-r+1) r-permutations of the set7

Page 8: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

r-permutation

• Note that p(n,0)=1 whenever n is a nonnegative integer as there is exactly one way to order zero element

• Corollary 1: If n and r are integers with 0≤r≤n, then P(n,r)=n!/(n-r)!• Proof: When n and r are integers with

1≤r≤n, by Theorem 1 we have P(n,r)=n(n-1)…(n-r+1)=n!/(n-r)!• As n!/(n-0)!=1 when n is a nonnegative integer, we have P(n,r)=n!/(n-r)! also holds when r=0

8

Page 9: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

r-permutation

• By Theorem 1, we know that if n is a positive integer, then P(n,n)=n!

• Example: How many ways are there to select a 1st prize winner, a 2nd prize winner, and a 3rd prize winner from 100 different contestants?

• P(100,3)=100x99x98=970,200

9

Page 10: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• How many permutations of the letters ABCDEFGH contain string ABC?

• As ABC must occur as a block, we can find the answer by finding the permutations of 6 letters, the block ABC and the individual letters, D,E,F,G, and H. As these 6 objects must occur in any order, there are 6!=720 permutations of the letters ABCDEFGH in which ABC occurs in a block

10

Page 11: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Combinations

• How many different committees of 3 students can be formed from a group of 4 students?

• We need to find the number of subsets with 3 elements from the set containing 4 students

• We see that there are 4 such subsets, one for each of the 4 students as choosing 4 students is the same as choosing one of the 4 students to leave out of the group

• This means there are 4 ways to choose 3 students for the committee, where th order in which these students are chosen does not matter

11

Page 12: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

r-combination

• An r-combination of elements of a set is an unordered selection of r elements from the set

• An r-combination is simply a subset of the set with r elements

• Denote by C(n,r). Note that C(n,r) is also denoted by and is called a binomial coefficient

12

r

n

Page 13: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• Let S be the set {1, 2, 3, 4}. Then {1, 3, 4} is a 3-combination from S

• We see that C(4,2)=6, as the 2-combination of {a, b, c, d} are 6 subsets {a, b}, {a, c}, {a, d}, {b, c}, {b, d}, and {c, d}

13

Page 14: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

r-combination

• We can determine the number of r-combinations of a set with n elements using the formula for the number of r-permutations of a set

• Note that the r-permutations of a set can be obtained by first forming r-combinations and then ordering the elements in these combinations

14

Page 15: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

r-combination

• The number of r-combinations of a set with n elements, where n is a nonnegative integer and r is an integer with 0≤r≤n equals

• Proof: The r-permutations of the set can be obtained by forming the C(n,r) r-combinations and then ordering the elements in each r-permutation which can be done in P(r,r) ways 15

)!(!

!),(

rnr

nrnC

)!(!

!

)!/(!

)!/(!

),(

),(),(

),(),(),(

rnr

n

rrr

rnn

rrP

rnPrnC

rrPrnCrnP

Page 16: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

r-combination

• When computing r-combination

thus canceling out all the terms in the larger factorial

16

!

)1()1(

!

),(

)!(!

!),(

r

rnnn

r

rnP

rnr

nrnC

Page 17: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• How many poker hands of 5 cards can be dealt from a standard deck of 52 cards? Also, how many ways are there to select 47 cards from a standard deck of 52 cards?

• Choose 5 out of 52 cards: C(52,5)=52!/(5!47!)= (52x51x50x49x48)/(5x4x3x2x1)=26x17x10x49x12=2,598,960

• C(52,47)=52!/(47!5!)=2,5,98,960

17

Page 18: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Corollary 2

• Let n and r be nonnegative integers with r≤n. Then C(n,r)=C(n,n-r)• Proof:

18

!)!(

!

))!(()!(

!),(

)!(!

!),(

rrn

n

rnnrn

nrnnC

rnr

nrnC

Page 19: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Combinatorial proof

• A combinatorial proof of an identity is a proof that uses counting arguments to prove that both sides of the identity count the same objects but in different ways

• Proof of Corollary 2: Suppose that S is a set with n elements. Every subset A of S with r elements corresponds to a subset of S with n-r elements, i.e., . Thus, C(n,r)=C(n,n-r)

19

A

Page 20: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• How many ways are there to select 5 players from a 10-member tennis team?

• Choose 5 out of 10 elements, i.e., C(10, 5)=10!/(5!5!)=252

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

• This is equivalent to choose r elements from n elements, i.e., C(n,r)

20

Page 21: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

6.4 Binomial coefficients

• The number of r-combinations form a set with n elements is often denoted by

• Also called as a binomial coefficient as these numbers occur as coefficients in the expansion of powers of binomial expressions such as (a+b)n

• A binomial expression is simply the sum of two terms, such as x+y

21

r

n

Page 22: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• The expansion of (x+y)3 can be found using combinational reasoning instead of multiplying the there terms out

• When (x+y)3=(x+y)(x+y)(x+y) is expanded, all products of a term in the 1st sum, a term in the 2nd sum, and a term in the 3rd sum are added, e.g., x3, x2y, xy2, and y3

• To obtain a term of the form x3, an x must be chosen in each of the sums, and this can be done in only one way. Thus, the x3 term in the product has a coefficient of 1

22

Page 23: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• To obtain a term of the form x2y, an x must be chosen in 2 of the 3 sums (and consequently a y in the other sum). Hence, the number of such terms is the number of 2-combinations of 3 objects, namely,

• Similarly, the number of terms of the form xy2 is the number of ways to pick 1 of the 3 sums to obtain an x (and consequently take a y from each of the other two sums), which can be done in ways

23

2

3

1

3

Page 24: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• Consequently,

• The binomial theorem: Let x and y be variables, and let n be a nonnegative integer

24

3223

3

33

))(())()(()(

yxyyxx

yyyyyxyxyyxxxyyxyxxxyxxx

yxyyyxxyxxyxyxyxyx

nnnnn

n

j

jjnn

yn

nxy

n

nyx

nyx

nx

n

yxj

nyx

1221

0

1210

)(

Page 25: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Binomial theorem

• Proof: A combinatorial proof of the theorem is given. The terms in the product when it is expanded are of the form xn-jyj

for j=0,1,2…, n• To count the number of terms of the form xn-jyj , note that to

obtain such a term it is necessary to choose n-j x’s from the n sums (so that the other j terms in the product are y’s). Therefore, the coefficients of xn-jyj is which is equal to

25

nnnnn

n

j

jjnn

yn

nxy

n

nyx

nyx

nx

n

yxj

nyx

1221

0

1210

)(

jn

n

j

n

Page 26: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• What is the coefficient of x12y13 in the expansion of (x+y)25?

26

432234

4

0

44

4

4

3

4

2

4

1

4

0

4

4)(

yxyyxyxx

yxj

yxj

jj

300,200,5!12!13

!25

13

25

Page 27: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Example

• What is the coefficient of x12y13 in the expansion of (2x-3y)25?

• Consequently, the coefficient of x12y13 is

27

25

0

2525 )3()2(25

)32(j

jj yxj

yx

13121312 32!12!13

!25)3(2

13

25

Page 28: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Corollary

• Corollary 1: Let n be a nonnegative integer. Then

• Proof: Using Binomial theorem with x=1 and y=1

28

nn

k k

n2

0

n

k

knkn

k

nn

k

n

k

n

00

11)11(2

Page 29: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Corollary

• There is also a combinatorial proof of Corollary 1• Proof: A set with n elements has a total of 2n

different subsets. Each subset has 0 elements, 1 element, 2 elements, or n elements in it. Thus, there are subsets with 0 elements, subsets with 1 element, … and subsets with n elements. Thus counts the total number of subsets of a set with n elements,

• This shows that

29

0

n

1

n

n

n

n

k k

n

0

nn

k k

n2

0

Page 30: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Corollary 2

30

531420

)1(1)1()1)1((00:Proof

0)1(

Then integer. positive a be Let

00

0

nnnnnn

k

n

k

n

k

n

n

kn

k

knkn

k

nn

n

k

k

Page 31: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Corollary 3

31

kn

k

knkn

k

n

n

k

nk

k

n

k

n

k

n

n

212)12(:Proof

32

Then interger. negative-non a be Let

00

0

Page 32: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Pascal identity and triangle• Pascal’s identity: Let n and k be positive integers with n ≥ k. Then

• Combinatorial proof: Let T be a set containing n+1 elements. Let a be an element in T, and let S=T-{a} (S has n elements)

• Note that there are subsets of T containing k elements. However, a subset of T with k elements either contains a (i.e., a subset of k-1 elements of S) or not.

• There are subsets of k-1 elements of S, and so there are subsets of k-1 elements containing a• There are subsets of k elements of T that do not contain a• Thus

32

k

n

k

n

k

n

1

1

k

n 1

1k

n

1k

n

k

n

k

n

k

n

k

n

1

1

Page 33: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Pascal identity and triangle

• Can also prove the Pascal identity with algebraic manipulation of

33

k

n

)!1(!

)!1(

)!1(!

!)1(

)!1(!

!)1(

)!1(!

!)1(

)!1(!

!

1

)!1(!

!)1(

)1()!(!

!)1(

)!(!

!

)!1(!

!

)!1()!1(

!

)!1()!1(

!

1

)!1(!

)!1(1

knk

n

knk

nn

knk

nknk

knk

nkn

knk

kn

k

n

k

n

knk

nkn

knknk

nkn

knk

n

k

n

knk

kn

knkk

kn

knk

n

k

n

knk

n

k

n

Page 34: CSE115/ENGR160 Discrete Mathematics 04/17/12 Ming-Hsuan Yang UC Merced 1

Pascal’s triangle

• Pascal’s identity is the basis for a geometric arrangement of the binomial coefficients in a triangle

34

k

n

k

n

k

n

1

1

k

n

k

n

k

n

n

1

1

tscoefficien binomial row,th -each