150 likes | 343 Views
Discrete Structures – CNS2300. Text Discrete Mathematics and Its Applications (5 th edition) Kenneth H. Rosen Chapter 4 Counting. Section 4.1. The Basics of Counting. Pick a Block OR a Cylinder. The Sum Rule.
E N D
Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications (5th edition) Kenneth H. Rosen Chapter 4 Counting
Section 4.1 The Basics of Counting
The Sum Rule If a task can be done in n1 ways and a second task in n2 ways, and if these tasks cannot be done at the same time, then there are n1 + n2 ways to do either task.
Example: Suppose that there are three different types of pie and 4 types of ice cream. If you are allowed pie or ice cream (not both) for desert, how many choices do you have? pie OR ice cream 3 + 4 = 7
Heads 1 Flip a Coin 1 1 Heads 2 2 2 Heads 3 Heads 3 3 Heads 4 4 4 Heads 5 5 5 Heads 6 6 6 Tails 1 Tails 2 Tails 3 Tails Tails 4 Tails 5 Tails 6 Roll a Die Tree Diagrams
Roll a Die Roll a Die T1H1 Flip a Coin Flip a Coin T1H2 1 1 1 1 T1H3 Heads Heads 2 2 2 2 T1H4 3 3 3 3 4 4 4 4 T1H5 5 5 5 5 T1H6 T1T1 6 6 6 6 T1T2 T1T3 Tails Tails T1T4 T1T5 T1T6
The Product Rule Suppose that a procedure can be broken down into two tasks. If there are n1 ways to do the first task and n2 ways to do the second task after the first task has been done, then there are n1n2 ways to do the procedure
Los Angeles Boston Detroit There are four major auto routes from Boston to Detroit and six from Detroit to Los Angeles. How many major auto routes are there from Boston to Los Angeles via Detroit? task 1 = drive from Boston to Detroit n1= 4task 2 = drive from Detroit to Los Angeles n2 = 6task 2 follows task 1 |Boston to Los Angles via Detroit| = (4)(6) = 24
Example The Telephone Numbering Plan Let X = 0…9 N = 2…9 Y = 0,1 Using the plan currently in existence in North America, numbers must be of the form NXX-NXX-XXXX How many numbers are possible in North America?
More Complex Example Each user on a computer system has a password, which is six characters long, where each character is an uppercase letter or a digit. Each password must contain at least one digit. How many possible passwords are there?
The Pigeonhole Principle If you have more pigeons than pigeonholes, at least one pigeon is going to have to double up. ?
Example There are 38 different time periods during which classes at a university can be scheduled. If there are 677 different classes, how many different rooms will be needed?