College of Information Technology & Design

Slides:



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

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.
Counting. Counting = Determining the number of elements of a finite set.
College of Information Technology & Design
4/16/2015 MATH 224 – Discrete Mathematics Counting Basic counting techniques are important in many aspects of computer science. For example, consider the.
Recursively Defined Functions
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.
1 Combinatorics Rosen 6 th ed., § , § Combinatorics Count the number of ways to put things together into various combinations.Count the number.
The Basis of Counting. Imagine you go out for lunch, and as a 1st course you can have soup or pate (but not both) you can have chicken soup or carrot.
Discrete Structures Chapter 4 Counting and Probability Nurul Amelina Nasharuddin Multimedia Department.
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
CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting.
Combinations We should use permutation where order matters
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.
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.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Combinatorics.
Exam 1 Review 5.1, , 8.1, 8.2.
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
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,
MAT 2720 Discrete Mathematics Section 6.1 Basic Counting Principles
The Basics of Counting Section 6.1.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
9.3 Addition Rule. The basic rule underlying the calculation of the number of elements in a union or difference or intersection is the addition rule.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
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.
Sullivan Algebra and Trigonometry: Section 14.2 Objectives of this Section Solve Counting Problems Using the Multiplication Principle Solve Counting Problems.
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
ICS 253: Discrete Structures I Discrete Probability King Fahd University of Petroleum & Minerals Information & Computer Science Department.
CS 103 Discrete Structures Lecture 16
1 Basics of Counting CS/APMA 202 Rosen section 4.1 Aaron Bloomfield.
Discrete Structures Counting (Ch. 6)
Introduction to Discrete Probability Epp, section 6.x CS 202.
Counting.
Each small square has sides of length 1 unit. How many distinct paths of length six units are there from A to B? A B..
Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures.
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
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.
Section 10.1 and Hand Back Exam #3 The class average was much better on this exam (no adjustments necessary). Activity 0: –Discuss problems 2 and.
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Number Systems Decimal Can you write 12,045 in expanded form? Base? Allowable digits for each place?
MAT 2720 Discrete Mathematics
Discrete Mathematics Counting.
ICS 253: Discrete Structures I
Chapter 5, Section 5.1 The Basics of Counting
Discrete Structures for Computer Science
COCS DISCRETE STRUCTURES
Recursively Defined Functions
One, two, three, we’re… Counting.
Xuan Guo Lab 9 Xuan Guo
CS100: Discrete structures
Discrete Structures for Computer Science
CSE 321 Discrete Structures
Counting techniques Basic Counting Principles, Pigeonhole Principle, Permutations and Combinations.
Counting Discrete Mathematics.
The Basis of Counting.
Discrete Structures Counting.
Representations of Integers
Chapter 3. Sets & Combinatorics
Presentation transcript:

College of Information Technology & Design Discrete Mathematics Basics of Counting University of Jazeera College of Information Technology & Design Khulood Ghazal

The product 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 Total is 18 * 325 = 5850 There are 18 math majors and 325 CS majors How many ways are there to pick one math major and one CS major? Total is 18 * 325 = 5850

The sum 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 one choice OR a second choice

Sum rule example Total is 18 + 325 = 343 There are 18 math majors and 325 CS majors How many ways are there to pick one math major or one CS major? Total is 18 + 325 = 343

More complex counting problems We combining the product rule and the sum rule Thus we can solve more interesting and complex problems

Example(1): 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 differently?

What is the largest number of chairs that can be labeled differently? We can think of this problem as involving a sequence of two tasks: Assign a letter between A and Z Assign a number between 1 and 100 The Product Rule says that there are 26 * 100 = 2600 ways to do this. So we can label 2600 chairs.

Example(2): How many different license plates are available if each plate contains a sequence of three letters followed by three digits? 26 choices for each letter 10 choices for each digit Total of: 26 * 26 * 26 * 10 * 10 * 10

Example(3): How many different bit strings are there of length seven? You probably already know it is 27. Think of this as: 2 (2 (2 (2 (2 (2 * 2)))))

Example(4): How many different bit strings are there of length 1? Only 2: 0 or 1 How many different bit strings are there of length 2? There are 4: 00, 01, 10, 11 How many different bit strings are there of length 3? There are 8: 000, 001, 010, 011, 100, 101, 110, 111

Example(5): Each user on a computer system has a password Each password is six to eight characters long Each character is an uppercase letter or a digit Each password must contain at least one digit How many possible passwords are there?

There are 26 letters and 10 decimal digits = 36 characters that we can use to form passwords. For P6 (6-character) passwords, the Product Rule says there are 366 potential passwords. But passwords that are all letters are prohibited. There are 266 of these. So there are 366 – 266 for P6 passwords. Similarly, for P7 and P8 passwords. P7 = 367 – 267 P8 = 368 – 268 Total passwords = P6 + P7 + P8

Example(6): How many bit strings of length eight either start with a 1 or end with the two bits 00? 1st Task: Construct a string beginning with a 1. 2nd Task: Construct a string ending with 00. Both tasks: Construct a string that begins with a 1 and ends with 00.

1st: There are 28 ways to construct a binary string of 8 bits, but it starts with a 1, so there are 27 ways to construct an 8-bit binary string starting with 1. 2nd: Construct a string ending with 00. The product rule says there are 2 ways to choose the first 6 bits and 1 way to chose the last 2 bits, so there are 26 ways to construct this string. Both: Construct a string that begins with 1 and ends with 00. The product rule says there is 1 way to choose the first bit, 2 ways to chose the middle 5 bits, and 1 way to chose the last 2 bits, so there are 25 ways to construct this string. Total = (27 + 26) – 25 = 160

Example(7): 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 = 410 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 = 510