Discrete Structures Counting (Ch. 6)

Slides:



Advertisements
Similar presentations
1 Basics of Counting CS/APMA 202 Epp sections 6.2 & 6.3 Aaron Bloomfield.
Advertisements

22C:19 Discrete Math Counting Fall 2011 Sukumar Ghosh.
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.
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.
The Pigeonhole Principle College of Information Technology & Design
12 April 2009Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction.
Recursively Defined Functions
The Pigeonhole Principle
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
1 Combinatorics Rosen 6 th ed., § , § Combinatorics Count the number of ways to put things together into various combinations.Count the number.
Chapter 7 Logic, Sets, and Counting Section 3 Basic Counting Principles.
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;
CSE115/ENGR160 Discrete Mathematics 04/10/12
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
CS100 : Discrete Structures
4. Counting 4.1 The Basic of Counting Basic Counting Principles Example 1 suppose that either a member of the faculty or a student in the department is.
Counting Chapter 6 With Question/Answer Animations.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Discrete Maths Objective to introduce some of the counting rules (product, sum, subtraction, division, pigeonhole) through examples , Semester 2,
Week 11 What is Probability? Quantification of uncertainty. Mathematical model for things that occur randomly. Random – not haphazard, don’t know what.
Counting. Product Rule Example Sum Rule Pigeonhole principle If there are more pigeons than pigeonholes, then there must be at least one pigeonhole.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
September1999 CMSC 203 / 0201 Fall 2002 Week #8 – 14/16 October 2002 Prof. Marie desJardins.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
1 Lecture 4 (part 1) Combinatorics Reading: Epp Chp 6.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
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.
CSNB143 – Discrete Structure
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
CS 103 Discrete Structures Lecture 16
1 Basics of Counting CS/APMA 202 Rosen section 4.1 Aaron Bloomfield.
Menu Traditional Menu Other Menu Nasi LemakBeef Burger Roti Canai Potatoes Chip Capati French Bread Mee Goreng Drink : Coffee, Tea, Coke and Pepsi.
Introduction to Discrete Probability Epp, section 6.x CS 202.
Counting.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures.
1 The Pigeonhole Principle CS 202 Epp section 7.3.
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.
1 The Pigeonhole Principle CS 202 Epp section ??? Aaron Bloomfield.
3/7/20161 Now it’s time to look at… Discrete Probability.
CS 104: Discrete Mathematics
Pigeonhole Principle – Page 1CPTR311 – Discrete Structures CPTR311 Discrete Structures Pigeonhole Principle Reading: Kolman, Section 3.3.
Discrete Mathematics. Exercises Exercise 1:  There are 18 Computer Science (CS) majors and 325 Business Administration (BA) majors at a college.
Main Menu Main Menu (Click on the topics below) Pigeonhole Principle Example Generalized Pigeonhole Principle Example Proof of Pigeonhole Principle Click.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 5 Counting 歐亞書局.
Section The Product Rule  Example: How many different license plates can be made if each plate contains a sequence of three uppercase English letters.
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Discrete Mathematics Counting.
The Pigeonhole Principle
ICS 253: Discrete Structures I
Chapter 5, Section 5.1 The Basics of Counting
CSNB 143 Discrete Mathematical Structures
The Pigeonhole Principle
Discrete Structures for Computer Science
COCS DISCRETE STRUCTURES
CS 2210 Discrete Structures Counting
Recursively Defined Functions
Xuan Guo Lab 9 Xuan Guo
CS100: Discrete structures
Discrete Structures for Computer Science
Counting techniques Basic Counting Principles, Pigeonhole Principle, Permutations and Combinations.
Counting Discrete Mathematics.
Discrete Structures Counting.
Representations of Integers
Presentation transcript:

Discrete Structures Counting (Ch. 6) Dr. Muhammad Humayoun Assistant Professor COMSATS Institute of Computer Science, Lahore. mhumayoun@ciitlahore.edu.pk https://sites.google.com/a/ciitlahore.edu.pk/dstruct/ Modified slides of Dr. M. Atif

First Reaction Counting?? What?? Are we first graders??

The Product Rule Also called the multiplication rule If there are n1 ways to do task 1, and n2 ways to do task 2: Then there are n1n2 ways to do both tasks in sequence This applies when doing the “procedure” is made up of separate tasks. We must make one choice AND a second choice

Product Rule Example Sample question There are 18 math majors and 25 CS majors How many ways are there to pick one math major and one CS major? Total is 18 * 25 = 450 possible ways

Product Rule Examples Ex.2: p-386. The chairs of an auditorium are to be labeled with a letter and a positive integer not exceeding 100. What is the largest number of chairs that can be labeled different? Largest Number of chairs = 26 * 100 = 2600 Ex.3: There are 32 microcomputers in a computer center. Each microcomputer has 24 ports. How many different ports to a microcomputer in the center are there. Two tasks – first picking a microcomputer and then picking a post on this microcomputer. Total no. of ways = 32 * 24 = 768 ports

Product Rule Examples Ex.1: p-386. A new company with just two employees, rents a floor of a building with 12 offices. How many ways are there to assign different offices to these two employees? Possible ways of allotment of any office to first employee = 12 Possible ways of allotment of any of the remaining office to second employee = 11 All possible ways of allotment of offices to two employees = 12 * 11 = 132 See Example 4, 5

Product Rule Examples More sample questions… How many strings of 4 decimal digits… Do not contain the same digit twice? We want to chose a digit, then another that is not the same, then another… First digit: 10 possibilities Second digit: 9 possibilities (all but first digit) Third digit: 8 possibilities Fourth digit: 7 possibilities Total = 10*9*8*7 = 5040 End with an even digit? First three digits have 10 possibilities Last digit has 5 possibilities Total = 10*10*10*5 = 5000

More examples How many different bit strings of length 7 are there? 27 = 128 different bit strings of length seven. How many different license plates are available if each plate contains a sequence of three upper case letters followed by three digits. Choices for 3 upper case letter: 26 * 26 * 26 Choices for 3 digits: 10 * 10 * 10 Total choices: 263 · 103

More Examples What is the value of k after the following code, where n1, n2, . . . , nm are +ve integers: n1* n2* ...* nm

The Sum Rule Also called the addition rule If there are n1 ways to do task 1, and n2 ways to do task 2 If these tasks can be done at the same time, then… Then there are n1+n2 ways to do one of the two tasks We must make first choice OR a second choice

Sum Rule Examples More sample questions How many strings of 4 decimal (non-zero)digits… Have exactly three digits that are 9s? The string can have: The non-9 as the first digit OR the non-9 as the second digit OR the non-9 as the third digit OR the non-9 as the fourth digit Thus, we use the sum rule For each of those cases, there are 9 possibilities for the non-9 digit (any number other than 9) Thus, the answer is 9+9+9+9 = 36

Sum Rule Examples Sample question Total is 18 + 25 = 43 There are 18 math majors and 25 CS majors How many ways are there to pick one math major or one CS major? Total is 18 + 25 = 43

n1 + n2 + … + nm

Sum Rule Examples Ex.11: Suppose that either a member of the mathematics faculty or a student who is mathematics major is chosen as a representative to a university committee. How many different choices are there for this representative if there are 37 members of the math faculty and 83 math students. All possible ways to pick a representative = 37 + 83 = 120 See Ex. 12 . Exercise Q. 1,3

Misc Examples There are 18 mathematics majors and 325 computer science majors at a college In how many ways can two representatives be picked so that one is a mathematics major and the other is a computer science major? 18 . 325 In how many ways can one representative be picked who is either a mathematics major or a computer science major? 18 + 325

A multiple-choice test contains 10 questions A multiple-choice test contains 10 questions. There are four possible answers for each question. In how many ways can a student answer the questions on the test if the student answers every question? 4 * 4 * …. * 4 (10 times)= 410 In how many ways can a student answer the questions on the test if the student can leave answers blank? 510

A particular brand of shirt comes in 12 colors, has a male version and a female version, and comes in three sizes for each gender. How many different types of this shirt are made? 12 * ( 3 + 3)

How many strings of three decimal digits do not contain the same digit three times? 10*10*10 – 10 = 990 begin with an odd digit? 5* 10*10 = 500 have exactly two digits that are 4s? 10 + 10 + 10 = 30

A committee is formed consisting of one representative from each of the 50 states in the United States, where the representative from a state is either the governor or one of the two senators from that state. How many ways are there to form this committee? (1+1+1)50

How many license plates can be made using either three digits followed by three uppercase English letters or three uppercase English letters followed by three digits? 10^3 * 26^3 + 26^3 * 10^3

How many license plates can be made using either two uppercase English letters followed by four digits or two digits followed by four uppercase English letters? 26^2*10^4 + 10^2*26^4

6.2 The Pigeonhole Principle Suppose that there are 9 pigeonholes for a flock of 10 pigeons. Because there are 10 pigeons but only 9 pigeonholes, a least one of these 9 pigeonholes must have at least two pigeons in it. This illustrates the pigeonhole principle. If there are more pigeons than pigeonholes, then there must be at least one pigeonhole with at least two pigeons in it.

The Pigeonhole Principle If k is a positive integer and k + 1 or more objects are placed into k boxes, then there is at least one box containing two or more of the objects.

Can be used to demonstrate possibly unexpected results Among a group of 367 people (randomly chosen), there must be at least two with the same birthday, because there are only 365 possible birthdays. In any group of 27 English words (randomly chosen), there must be at least two that begin with the same letter, because there are 26 letters in the English alphabet. Among a set of 15 or more students, at least 3 are born on the same day of the week.

More examples Question: How many students must be in a class to guarantee that at least two students receive the same score on the final exam, if the exam is graded on a scale from 0 to 100 points? Ans: There are 101 possible scores on the final. The pigeonhole principle shows that among any 102 students there must be at least 2 students with the same score.

The Generalized Pigeonhole Principle Even more can be said when the number of objects exceeds a multiple of the number of boxes. Among any set of 21 decimal digits there must be 3 that are the same. Why? when 21 objects are distributed into 10 boxes, one box must have more than 2 objects.

The Last slide. VIS How many numbers must be selected from the set {1, 2, 3, 4 , 5, 6} to guarantee that at least one pair of these numbers add up to 7? Sol: Total numbers = 6 Possible ways to add up to 7= (1,6), (2, 5), (3, 4) We have to select at least 4 numbers, so that at least one pair from above 3 pairs is selected.