Basic Counting Rosen 4.1. Sum Rule If a first task can be done in n 1 ways and a second task can be done in n 2 ways, and if these tasks cannot be done.

Slides:



Advertisements
Similar presentations
5.1 Rules for Exponents Review of Bases and Exponents Zero Exponents
Advertisements

Welcome to Who Wants to be a Millionaire
Chapter 7 EM Math Probability.
Measurements in Chemistry
Jeopardy General Compare & Order AdditionSubtraction Vocabulary Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400 Q $500 Final Jeopardy.
Problem of the Day Janet used a pedometer to count her steps. The first day and third day she took exactly the same number of steps. The second day.
WARM UP What is the value of 4 5 x 4? Explain. WARM UP What is the value of 4 5 x 4 3 ? Explain.
Divisibility tests These are simple tricks to test what a number can be shared by. We are going to learn tricks for testing if a number can be shared by.
Around the World AdditionSubtraction MultiplicationDivision AdditionSubtraction MultiplicationDivision.
Who Wants To Be A Millionaire?
L.O.1 To be able to derive quickly division facts corresponding to tables up to 10x10.

Welcome to Who Wants to be a Millionaire
Welcome to Who Wants to be a Millionaire
© Vinny Cahill 1 Writing a Program in Java. © Vinny Cahill 2 The Hello World Program l Want to write a program to print a message on the screen.
Objective - To simplify expressions using the order of operations. Simplify each expression below. 1) 6 + 5(8 - 2) 2) 3) 4)
ORDER OF OPERATIONS LESSON 2 DAY 2. BEDMAS B – Brackets E – Exponents D – Division from left to right M – Multiply from left to right A – Add from left.
Objective The student will be able to:
Algebra I 1.2 Order of Operations.
Use the order of operations to evaluate expressions. Objective The student will be able to: Designed by Skip Tyler, Varina High School and redesigned by.
Counting Chapter 6 With Question/Answer Animations.
CSC 2510 Test 3 1. Give the names of the formula or rule that provides the answer for each of the following problems. Do not try to solve the problems!
1 Learning Objectives for Section 7.3 Basic Counting Principles After this lesson, you should be able to apply and use the addition principle. draw and.
The Basics of Counting: Selected Exercises. Copyright © Peter Cappello2 Sum Rule Example There are 3 sizes of pink shirts & 7 sizes of blue shirts. How.
1 Basics of Counting CS/APMA 202 Epp sections 6.2 & 6.3 Aaron Bloomfield.
Review for 2nd Nine Weeks Exam
DIVISIBILITY, FACTORS & MULTIPLES
MM4A6c: Apply the law of sines and the law of cosines.
Yong Choi School of Business CSU, Bakersfield
Counting. Counting in Algorithms How many comparisons are needed to sort n numbers? How many steps to compute the GCD of two numbers ? How many steps.
Copyright © by [ All rights reserved.
Least Common Multiple LCM 2 Methods
Lecture 4 4.1,4.2 Counting. 4.1 Counting Two Important Principles: Product Rule and Sum Rule. Product Rule: Assume we need to perform procedure 1 AND.
Created by Susan Neal $100 Fractions Addition Fractions Subtraction Fractions Multiplication Fractions Division General $200 $300 $400 $500 $100 $200.
Rickleton Primary School Calculation Policy
Equal or Not. Equal or Not
Holt CA Course Dividing Decimals Warm Up Warm Up California Standards California Standards Lesson Presentation Lesson PresentationPreview.
Basic Math Terms.
Inclusion-Exclusion Selected Exercises
Partial Products. Category 1 1 x 3-digit problems.
Counting Techniques: Permutations of Selected Elements Addition Rule, Difference Rule, Inclusion/Exclusion Rule.
Counting Chapter 6.
Lecture 4 4.1,4.2 Counting. 4.1 Counting Two Important Principles: Product Rule and Sum Rule. Product Rule: Assume we need to perform procedure 1 AND.
Section 4.1: The Basics of Counting As we have seen, one way to count the number of objects in a finite set S is to produce a one-to-one correspondence.
College of Information Technology & Design
Copyright © Zeph Grunschlag, Counting Techniques Zeph Grunschlag.
1 Section 4.1 Basics of Counting. 2 Basic Counting Principles: Sum Rule Suppose you have two tasks to perform: –The first task can be done in n 1 ways;
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications (5 th edition) Kenneth H. Rosen Chapter 4 Counting.
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
The Basics of Counting Section 6.1.
Section Section Summary The Product Rule The Sum Rule The Subtraction Rule The Division Rule Examples, Examples, and Examples Tree Diagrams.
Counting Techniques. L172 Agenda Section 4.1: Counting Basics Sum Rule Product Rule Inclusion-Exclusion.
Discrete Structures Counting (Ch. 6)
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Introduction Suppose that a password on a computer system consists of 6, 7, or 8 characters. Each of these characters must be a digit or a letter of the.
Section Basic Counting Principles: The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n 1.
CS 104: Discrete Mathematics
Copyright © Zeph Grunschlag,
The Pigeonhole Principle
COCS DISCRETE STRUCTURES
Copyright © Zeph Grunschlag,
Recursively Defined Functions
CS100: Discrete structures
Discrete Structures Counting.
Representations of Integers
Copyright © Zeph Grunschlag,
Copyright © Zeph Grunschlag,
Presentation transcript:

Basic Counting Rosen 4.1

Sum Rule If a first task can be done in n 1 ways and a second task can be done in n 2 ways, and if these tasks cannot be done at the same time (i.e., the tasks are either/or), then there are n 1 + n 2 ways to do either task. If A and B are disjoint sets then |A  B|  |A|  |B| In general if A 1, A 2...A n are disjoint sets, then |A 1  A 2 ...  A n | = |A 1 | + |A 2 | |A n |

Product Rule Suppose that a procedure can be broken down into two tasks. If there are n 1 ways to do the first task and n 2 ways to do the second task after the first task has been done, then there are n 1 n 2 ways to do the procedure. If A and B are disjoint sets then | A  B | = | A | | B| In general if A 1, A 2...A n are disjoint sets, then |A 1  A 2 ...  A n | = |A 1 | |A 2 |... |A n |

Examples There are 18 math majors and 325 computer science majors at a college –How many ways are there to pick two representatives, so that one is a math major and the other is a computer science major? 18*325 = 5850 –How many ways are there to pick one representative who is either a math major or a computer science major? = 343

Examples A multiple choice test contains 10 questions. There are four possible answers for each question. –How many ways can a student answer the questions on the test if every question is answered? 4*4*4*4*4*4*4*4*4*4 = 4 10 –How many ways can a student answer the questions on the test if the student can leave answers blank? 5*5*5*5*5*5*5*5*5*5 = 5 10

Password Example Each user on a computer system has a password which is 6 to 8 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? By the sum rule, if P is the total number of possible passwords and P 6, P 7, P 8 denote passwords of length 6,7, and 8, respectively, then P = P 6 +P 7 +P 8

Password Example P 6 = number of six character passwords containing at least one digit = (total number of six character passwords) minus (number of six character passwords containing no digits). = (26+10)(26+10)(26+10)(26+10)(26+10) – (26)(26)(26)(26)(26)(26) = 36 6 – 26 6 = 1,867,866,560

Password Example By the same reasoning P 7 = 36 7 – 26 7 = 70,332,353,920 P 8 = 36 8 – 26 8 = 2,612,282,842,880 P 6 +P 7 +P 8 = 2,684,483,063,360 Just for fun: If a two GHz PC can check 200 million passwords a second, what is the longest time it would take to find the password to this system? (2,684,483,063,360/200,000,000)/(60*60) hours Less than four hours

Principle of Inclusion-Exclusion When two tasks can be done at the same time we add the number of ways to do each of the two tasks, then subtract the number of ways to do both tasks. If A and B are not disjoint |A  B|  |A|  |B|  |A  B| –Don't count objects in the intersection of two sets more than once!

How many bit strings of length eight either start with 1 or end with the two bits 00? Add (number of bit strings that look like 1xxxxxxx) to the (number of bit strings that look like xxxxxx00) minus the (number of bit string that look like 1xxxxx00) 1*2*2 *2 *2 *2 *2 *2 + 2* 2* 2* 2* 2* 2*1*1 – 1*2*2*2*2*2*1*1 = = 2 5 (4+2-1) = 5*2 5 = 5*32 = 160

How many positive integers with exactly three decimal digits (between 100 and 999 inclusively): Are divisible by 7? Are odd? Have the same three decimal digits? Are not divisible by 4? Are divisible by 3 or 4? Are not divisible by either 3 or 4? Are divisible by 3 but not by 4? Are divisible by 3 and 4?

How many positive integers with exactly three decimal digits (between 100 and 999 inclusively): Are divisible by 7? Divisible by 7 means equal to 7n where n  Z 7*15 = 105 7*142 = – = 128 Or floor( ( )/7) = floor (900/7) = floor ( ) = 128

How many positive integers with exactly three decimal digits (between 100 and 999 inclusively): Are odd? 9*10*5 = 450 Have the same three decimal digits? 9*1 = 9 Are not divisible by 4? Divisible by 4? 100 = 4*25; 996 = 4*249 so 249 – 24 = 225 (or floor 900/4 = 225) 900 – 225 = 675

How many positive integers with exactly three decimal digits (between 100 and 999 inclusively): Are divisible by 3 or 4? 225 are divisible by 4 3*34 = 102, 999 = 3*333, so = 300 are divisible by 3. Some are divisible by 3 and = 9*12, 996 = 12*83, 83-8 = = 450

How many positive integers with exactly three decimal digits (between 100 and 999 inclusively): Are not divisible by either 3 or 4? 900 – 450 = 450 Are divisible by 3 but not by 4? 200 divisible by 3 75 divisible by 3 and – 75 =125

How many positive integers with exactly three decimal digits (between 100 and 999 inclusively): Are divisible by 3 and 4? 75 are divisible by 12