Discrete Maths Objective to introduce some of the counting rules (product, sum, subtraction, division, pigeonhole) through examples 242-213, Semester 2,

Slides:



Advertisements
Similar presentations
Counting Chapter 6 With Question/Answer Animations.
Advertisements

Counting Chapter 6 With Question/Answer Animations.
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.
College of Information Technology & Design
Chapter 6 With Question/Answer Animations. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
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;
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.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications (5 th edition) Kenneth H. Rosen Chapter 4 Counting.
CS100 : Discrete Structures
Counting Chapter 6 With Question/Answer Animations.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
9/15/2015MATH 106, Section 31 Section 3 Recipes Questions about homework? Submit homework!
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
IT-101 Section 001 Lecture #3 Introduction to Information Technology.
Counting. Why counting  Determine the complexity of algorithms To sort n numbers, how many instructions are executed ?  Count the number of objects.
The Basics of Counting Section 6.1.
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.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
1 CSC 321: Data Structures Fall 2013 Counting and problem solving  mappings, bijection rule  sequences, product rule, sum rule  generalized product.
1 Fundamental Principles of Counting OBJECTIVES: At the end of this chapter, students should be able to: 1. describe the concepts of permutation (arrangement)
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.
Module #15: Combinatorics Rosen 5 th ed., §§ & §6.5 Now we are moving on to Ch. 4 It is the study of arrangement of objects e.g. enumeration, counting.
CSNB143 – Discrete Structure
CS 103 Discrete Structures Lecture 16
11.1 CompSci 102© Michael Frank Today’s topics CountingCounting –Sum rule –Product rule –Tree diagrams –Inclusion/exclusion Reading: Sections 4.1Reading:
1 Basics of Counting CS/APMA 202 Rosen section 4.1 Aaron Bloomfield.
Discrete Structures Counting (Ch. 6)
Unit VI Discrete Structures Permutations and Combinations SE (Comp.Engg.)
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..
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.
CS 104: Discrete Mathematics
Chapter 6 With Question/Answer Animations Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written.
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.
Lec 13 – March 10  The Basics of Counting  The Pigeonhole Principle  Permutations and Combinations  Binomial Coefficients and Identities  Generalized.
Counting Chapter 6.
CSC 321: Data Structures Fall 2015 Counting and problem solving
ICS 253: Discrete Structures I
Chapter 5, Section 5.1 The Basics of Counting
Copyright © Zeph Grunschlag,
The Pigeonhole Principle
COCS DISCRETE STRUCTURES
Copyright © Zeph Grunschlag,
Counting Chapter 6 With Question/Answer Animations
Recursively Defined Functions
One, two, three, we’re… Counting.
Xuan Guo Lab 9 Xuan Guo
CS100: Discrete structures
Discrete Structures for Computer Science
8.3 Counting Apply the fundamental counting principle
Module #15: Combinatorics
The Pigeonhole Principle
Module #15: Combinatorics
Representations of Integers
Discrete Mathematics and its Applications
321 Section Feb. 21 Natalie Linnell.
Part IV Network layer 10. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
With Question/Answer Animations
Presentation transcript:

Discrete Maths Objective to introduce some of the counting rules (product, sum, subtraction, division, pigeonhole) through examples , Semester 2, Counting 1

Overview 1. The Product Rule 2. The Sum Rule 3. Combining the Sum and Product Rules 4. The Subtraction Rule 5. The Division Rule 6. Tree Diagrams 7. The Pigeonhole Principle 8. More Information 2

1. The Product Rule 3 no. of ways of doing task 1 = n 1 no. of ways of doing task 1 = n 1 no. of ways of doing task 2 = n 2 no. of ways of doing task 2 = n 2 no. of ways of doing task 1 and then task 2 = n 1 * n 2 no. of ways of doing task 1 and then task 2 = n 1 * n 2

Example 1 How many different 7-bit strings are there? e.g. " ", " ",... Each bit can be 0 or 1, so no. of ways == 2 for 1 bit. For 7 bits, the no. of ways is 2*2*2*2*2*2*2 = 2 7 =

How many different car license plates can be made if each plate is three uppercase English letters followed by three digits? There are 26 * 26 * 26 * 10 * 10 * 10 = 17,576,000 5 Example 2

2. The Sum Rule 6 Tasks must not overlap no. of ways of doing task 1 = n 1 no. of ways of doing task 1 = n 1 no. of ways of doing task 2 = n 2 no. of ways of doing task 2 = n 2 no. of ways of doing task 1 or task 2 = n 1 + n 2 no. of ways of doing task 1 or task 2 = n 1 + n 2

Example We must choose either a man or a woman for a group. How many choices are there if there are 37 men and 83 women? There are = 120 possible ways. 7

Examples of "Overlap" Task 1Task 2Overlap or not? Choose a manChoose a womanNo overlap Choose a mouseChoose a lionNo overlap Choose a womanChoose an ajarnOverlap Choose a studentChoose an ajarnOverlap! (some Ajarn are also Masters/PhD students) 8 Cannot use the Sum Rule

3. Combining Sum and Product Rules Example: Variable names in a programming language can be a single letter or a letter followed by a single digit. All letters are lowercase. e.g. "x", "y", "a2", "w3", "b9",... Find the number of possible names. Solution: 26 + ( 26 * 10) = and then or and then / followed by or

Example: Counting Internet Addresses IPv 4 uses 32 bits. How many Internet addresses are there? 10 continued

is not available as the netid of a Class A network. Hostids consisting of all 0 s and all 1 s are not available in any network. 11 A: 7 bits A: 24 bits C: 21 bits C: 8 bits B: 14 bits B: 16 bits

Let x A, x B, and x C denote the number of addresses for the classes. To find, x A : 2 7 − 1 = 127 netids; 2 24 − 2 = 16,777,214 hostids. x A = 127 * 16,777,214 = 2,130,706,178 To find, x B : 2 14 = 16,384 netids; 2 16 − 2 = 16,534 hostids x B = 16,384 * 16, 534 = 1,073,709,056 To find, x C : 2 21 = 2,097,152 netids; 2 8 − 2 = 254 hostids x C = 2,097,152 * 254 = 532,676, continued not not or and then

Total number of available IPv 4 addresses is = x A or x B or x C = 2,130,706, ,073,709, ,676,608 = 3,737,091,842 about 3.7 billion 13 Not Enough!! The IPv6 protocol solves the problem of too few addresses. Not Enough!! The IPv6 protocol solves the problem of too few addresses. continued

IPv6 uses 128 bits, so can theoretically hold IP addresses: = 340,282,366,920,938,463,463,374,607,431,768,211,456 = about 340 x = 340 undecillion addresses this is about 7.9×10 28 times as many as IPv4 But restrictions on the address space reduces it to nearer == about 4.2×10 37 == 42 undecillion See just-how-many-ipv6-addresses-are-there-really/ 14

4. The Subtraction Rule 15 no. of ways of doing task 1 = n 1 no. of ways of doing task 1 = n 1 no. of ways of doing task 2 = n 2 no. of ways of doing task 2 = n 2 no. of ways of doing task 1 or task 2 = n 1 + n 2 – (no. of tasks common to both) no. of ways of doing task 1 or task 2 = n 1 + n 2 – (no. of tasks common to both) Tasks do overlap

Subtraction Rule as Sets A = set of ways of doing task 1 B = set of ways of doing task 2 No. of ways of doing task 1 or task 2: 16 AB ways of doing task 1 ways of doing task 2

Example: Counting 8-Bit Strings How many 8-bit strings either start with a " 1" or end with " 00" ? e.g. " ", " ",... But there is overlap: strings that start with "1" and end with "00": e.g. " ", " ",... 17

Task 1: no. of 8-bit strings that start with a " 1 ": 2 7 = 128 Task 2: no. of 8-bit strings that end with " 00" : 2 6 = 64 Overlap: no. of 8-bit strings that start with " 1 " and end with " 00" : 2 5 = 32 Total no. of ways: − 32 =

5. Division Rule A big job can be carried out in n ways. It can be divided into separate tasks, each of which can be done in d ways. How many tasks are there? 19 Job no. of ways = n..... d ways... Task 1Task 2 Task ?? No. of tasks = n/d

6. Tree Diagrams We can solve counting problems with tree diagrams a branch represents a possible choice the leaves represent possible results 20

21 I Discrete Maths Example “I Love Discrete Maths” T-shirts come in five different sizes: S, M, L, XL, and XXL. Each size comes in four colors (white, red, green, and black), except XL, which comes only in red, green, and black, and XXL, which comes only in green and black. What is the minimum number of shirts that a shop needs to have one of each size and color?

Tree Diagram 22 4 colors size choices Total no of shirts: = 17

7. The Pigeonhole Principle Pigeonhole Principle: If k + 1 objects are placed in k boxes, then at least one box contains 2 or more objects. e.g. If 10 pigeons are in 9 pigeonholes, one of the pigeonholes must have more than 1 pigeon. 23

Example: Among 367 people, there must be at least two with the same birthday, because there are at most 366 possible birthdays. 24 don't forget leap years!

8. More Information Discrete Mathematics and its Applications Kenneth H. Rosen McGraw Hill, 2007, 7th edition chapter 6, sections 6.1 –