15
Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 9.3 Counting Elements of Disjoint Sets: The Addition Rule

Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

Embed Size (px)

DESCRIPTION

Counting Password with Three or Fewer Letters A computer access password consists of from one to three letters chosen from the 26 in the alphabet with repetitions allowed. How many different passwords are possible? 3 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

Citation preview

Page 1: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

1

Spring 2016COMP 2300 Discrete Structures for Computation

Donghyun (David) KimDepartment of Mathematics and PhysicsNorth Carolina Central University

Chapter 9.3Counting Elements of Disjoint Sets: The Ad-dition Rule

Page 2: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

2

The Addition Rule• Suppose a finite set A equals the union of k

distinct mutually disjoint subsets Then,

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

.,,, kAAA 21

).()()()( kANANANAN 21

1A2A

3A4A

Page 3: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

3

Counting Password with Three or Fewer Letters• A computer access password consists of from

one to three letters chosen from the 26 in the alphabet with repetitions allowed. How many different passwords are possible?

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

1A2A

3A

3 length of passwords of number3 A

2 length of passwords of number2 A1 length of passwords of number1 A

Page 4: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

4

Counting Password with Three or Fewer Letters – cont’• A computer access password consists of from

one to three letters chosen from the 26 in the alphabet with repetitions allowed. How many different passwords are possible?

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

32

3

2

2626 26 passwords of number total the26 3 length of passwords of number26 2 length of passwords of number

26 1 length of passwords of number

Page 5: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

5

Counting the Number of Integers Divisible by 5• How many three-digit integers are divisible by

5?

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

1A 2A

0 in end that integers digit three1 A

5 in end that integers digit three2 A

Page 6: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

6

Counting the Number of Integers Divisible by 5 – cont’• How many three-digit integers are divisible by

5?

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

9 choices(1 ~ 9)

10 choices(0 ~ 9)

2 choices(0 or 5)

180210910910921 )()( ANAN

Page 7: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

7

The Difference Rule• If A is a finite set and B is a subset of A, then

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

).()()( BNANBAN

elements) ( nA

elements) ( kB elements) ( knBA

Page 8: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

8

Counting PINs with Repeated Symbols• The PINs are made from exactly four symbols

chosen from the 26 letters of the alphabet and the ten digits, with repetitions allowed.• How many PINs contain repeated symbols?

• If all PINs are equally likely, what is the probabil-ity that a randomly chosen PIN contains a re-peated symbol?

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

Page 9: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

9

Counting PINs with Repeated Symbols – cont’• The PINs are made from exactly four symbols

chosen from the 26 letters of the alphabet and the ten digits, with repetitions allowed.• How many PINs contain repeated symbols?• Total possible cases:• # of cases without any repetition:• Solution:

• If all PINs are equally likely, what is the probabil-ity that a randomly chosen PIN contains a re-peated symbol?

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

36363636 33343536

3334353636363636

363636363334353636363636

Page 10: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

10

Formula for the Probability of the Complement of an Event• If S is a finite sample space and A is an event

in S, then

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

).()( APAP C 1

)(AP )(APC

Page 11: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

11

The Inclusion/Exclusion Rule• Theorem 9.3.3: The Inclusion/Exclusion Rule

for Two or Three Sets• If A, B, and C are any finite sets, then

and

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

)()()()( BANBNANBAN

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

)(

CBANCANCBNBANCNBNAN

CBAN

Page 12: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

12

Counting Elements of a General Union• How many integers from 1 through 1,000 are

multiple of 3 or multiples of 5?

• How many integers from 1 through 1,000 are neither multiples of 3 nor multiples of 5?• 1000 – 467 = 533

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

Page 13: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

13

Counting Elements of a General Union – cont’• How many integers from 1 through 1,000 are

multiple of 3 or multiples of 5?• # of multiple of 3: 3, 6, …, 999 = 3 (1, 2, … , 333)• # of multiple of 5: 5, 10, …, 1000 = 5 (1, 2, … ,

200)• # of multiple of 15: 15, 30, …, 990 = 15 (1, 2, …,

66)• Answer: 200 + 333 – 66 = 533 = 467

• How many integers from 1 through 1,000 are nei-ther multiples of 3 nor multiples of 5?• 1000 – 467 = 533

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

Page 14: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

14

Counting the Number of Ele-ments in an Intersection• Out of a total of 50 students in the class,• 30 took precalculus• 18 took calculus• 26 took java• 9 took both precalculus and calculus• 16 took both precalculus and java• 8 took both calculus and java• 47 took at least one of the three courses

• How many students did not take any of the three courses?

• How many students took all three courses?

• How many students took precalculus and calculus but not java?

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

Page 15: Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University

15

Counting the Number of Ele-ments in an Intersection• Out of a total of 50 students in the class,• 30 took precalculus• 18 took calculus• 26 took java• 9 took both precalculus and calculus• 16 took both precalculus and java• 8 took both calculus and java• 47 took at least one of the three courses

• How many students did not take any of the three courses?

• How many students took all three courses?

• How many students took precalculus and calculus but not java?

Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

34750

6816926183047 )()(

369