COMP 4605/5605 Computer Networks

advertisement

Spring 2016

COMP 2300

Discrete Structures for Computation

Chapter 9.3

Counting Elements of Disjoint Sets: The

Addition Rule

Donghyun (David) Kim

Department of Mathematics and Physics

North Carolina Central University

1

The Addition Rule

• Suppose a finite set A equals the union of k distinct

A

1

, A

2

,  , A k

N ( A )

N ( A

1

)

N ( A

2

)

  

N ( A k

).

A

1

A

3

A

2

A

4

Spring 2016 COMP 2300

Donghyun (David) Kim

2

Department of Mathematics and Physics

North Carolina Central University

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?

A

1

 number of passwords of length 1

A

2

 number of passwords of length 2

A

2

A

1 A

3

A

3

 number of passwords of length 3

Spring 2016 COMP 2300

Donghyun (David) Kim

3

Department of Mathematics and Physics

North Carolina Central University

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?

number of passwords of length 1  26 number number the of of total passwords passwords number of of length 2  26 2 of length 3  26 3 passwords  26  26 2  26 3

Spring 2016 COMP 2300

Donghyun (David) Kim

4

Department of Mathematics and Physics

North Carolina Central University

Counting the Number of Integers

Divisible by 5

• How many three-digit integers are divisible by 5?

A

1

 three digit integers that end in 0

A

1

A

2

A

2

 three digit integers that end in 5

Spring 2016 COMP 2300

Donghyun (David) Kim

5

Department of Mathematics and Physics

North Carolina Central University

Counting the Number of Integers

Divisible by 5 – cont’

• How many three-digit integers are divisible by 5?

9 choices

(1 ~ 9)

10 choices

(0 ~ 9)

2 choices

(0 or 5)

N ( A

1

)

N ( A

2

)

 9  10  9  10  9  10  2  180

Spring 2016 COMP 2300

Donghyun (David) Kim

6

Department of Mathematics and Physics

North Carolina Central University

The Difference Rule

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

N ( A

B )

N ( A )

N ( B ).

A ( n elements)

B ( k elements)

A

B

( n

 k elements)

Spring 2016 COMP 2300

Donghyun (David) Kim

7

Department of Mathematics and Physics

North Carolina Central University

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 probability that a randomly chosen PIN contains a repeated symbol?

Spring 2016 COMP 2300

Donghyun (David) Kim

8

Department of Mathematics and Physics

North Carolina Central University

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: 36 36

36

36

 36

36 

36 

36

36

 35

36  35 

 34

34 

33

33

• If all PINs are equally likely, what is the probability that a randomly chosen PIN contains a repeated symbol?

36  36  36

36

 36

 36

36

36

35

36

 34  33

9

Spring 2016 COMP 2300

Donghyun (David) Kim

Department of Mathematics and Physics

North Carolina Central University

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

P ( A

C

)

 1 

P ( A ).

P ( A )

Spring 2016 COMP 2300

Donghyun (David) Kim

P

C

( A )

10

Department of Mathematics and Physics

North Carolina Central University

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

N ( A

B )

N ( A )

N ( B )

N ( A

B ) and

N ( A

B

C )

N ( A )

N ( B )

N ( C )

N ( A

B )

N ( B

C )

N ( A

C )

N ( A

B

C )

Spring 2016 COMP 2300

Donghyun (David) Kim

11

Department of Mathematics and Physics

North Carolina Central University

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

12

Spring 2016 COMP 2300

Donghyun (David) Kim

Department of Mathematics and Physics

North Carolina Central University

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 neither multiples of 3 nor multiples of 5?

• 1000 – 467 = 533

13

Spring 2016 COMP 2300

Donghyun (David) Kim

Department of Mathematics and Physics

North Carolina Central University

Counting the Number of

Elements 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

Donghyun (David) Kim

14

Department of Mathematics and Physics

North Carolina Central University

Counting the Number of

Elements 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?

50  47  3

• How many students took all three courses?

47 

(

30

9  6  3

 18  26

)

(

9  16  8

)

 6

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

15

Spring 2016 COMP 2300

Donghyun (David) Kim

Department of Mathematics and Physics

North Carolina Central University

Download