A presentation on Counting Principles.pptx

ophiuchussrijonprogo 17 views 34 slides Sep 20, 2024
Slide 1
Slide 1 of 34
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34

About This Presentation

A presentation about counting principles. It's also including pigeonhole theorem. Those who are doing Discrete mathematics course in specially CSE, this might be helpful.


Slide Content

Counting Submitted to: Dr. Md Azam Hossain (Adjunct Faculty) Computer Science & Engineering Department, EWU. Submitted By Dip Chowdhury ID:2023-2-60-152 Sec: 7 Course: Discrete Mathematics Course Code: CSE-106

The Basics of Counting The Pigeonhole Principle

The Basics of Counting Page 03

Page 04 Introduction to Basics of Counting There are two basic counting principles: The product rule The sum rule.

Page 05 The product rule

The Product Rule Page 06 Definition Suppose that a procedure can be broken down into a sequence of two tasks. If there are n 1 ways to do the first task and for each of these ways of doing the first task, there are n 2 ways to do the second task, then there are n 1 n 2 ways to do the procedure.

Let’s see some examples!

Page 08 A new company with just two employees, Sanchez and Patel, rents a floor of a building with 12 offices. How many ways are there to assign different offices to these two employees? The procedure of assigning offices to these two employees consists of assigning an office to Sanchez, which can be done in 12 ways, then assigning an office to Patel different from the office assigned to Sanchez, which can be done in 11 ways. By the product rule, there are 12 ⋅ 11 = 132 ways to assign offices to these two employees.

There are 32 computers in a data center in the cloud. Each of these computers has 24 ports. How many different computer ports are there in this data center? The procedure of choosing a port consists of two tasks, first picking a computer and then picking a port on this computer. Because there are 32 ways to choose the computer and 24 ways to choose the port no matter which computer has been selected, the product rule shows that there are 32 ⋅ 24 = 768 ports. Page 09

**In counting Functions: How many functions are there from a set with m elements to a set with n elements? A function corresponds to a choice of one of the n elements in the codomain for each of the m elements in the domain. Hence, by the product rule there are n ⋅ n ⋅⋯⋅ n = nm functions from a set with m elements to one with n elements. For example, there are 53 = 125 different functions from a set with three elements to a set with five elements. Page 10

**In counting One-to-One Functions: How many one-to-one functions are there from a set with m elements to one with n elements? First note that when m > n there are no one-to-one functions from a set with m elements to a set with n elements. Now let m ≤ n. Suppose the elements in the domain are a 1 , a 2 , … , a m . There are n ways to choose the value of the function at a1. Because the function is one-to-one, the value of the function at a 2 can be picked in n − 1 ways (because the value used for a 1 cannot be used again). In general, the value of the function at ak can be chosen in n − k + 1 ways. By the product rule, there are n(n − 1)(n − 2) ⋯ (n − m + 1) one-to-one functions from a set with m elements to one with n elements. For example, there are 5 ⋅ 4 ⋅ 3 = 60 one-to-one functions from a set with three elements to a set with five elements. Page 11

What is the value of k after the following code, where n1, n2, … , nm are positive integers, has been executed? k := 0 for i1 := 1 to n1 for i2 := 1 to n2 . . . for im := 1 to nm k := k + 1 The initial value of k is zero. Each time the nested loop is traversed, 1 is added to k. Let Ti be the task of traversing the ith loop. Then the number of times the loop is tra?versed is the number of ways to do the tasks T1, T2, … , Tm. The number of ways to carry out the task Tj , j = 1, 2, … , m, is nj , because the jth loop is traversed once for each integer ij with 1 ≤ ij ≤ nj . By the product rule, it follows that the nested loop is traversed n1n2 ⋯ nm times. Hence, the final value of k is n1n2 ⋯ nm. Page 12

**In counting Subsets of a Finite Set: Use the product rule to show that the number of different subsets of a finite set S is 2|S| . Let S be a finite set. List the elements of S in arbitrary order. Recall from Section 2.2 that there is a one-to-one correspondence between subsets of S and bit strings of length |S|. Namely, a subset of S is associated with the bit string with a 1 in the ith position if the ith element in the list is in the subset, and a 0 in this position otherwise. By the product rule, there are 2|S| bit strings of length |S|. Hence, |P(S)| = 2|S| . Page 13

The product rule is often phrased in terms of sets in this way: If A 1 , A 2 , … , A m are finite sets, then the number of elements in the Cartesian product of these sets is the product of the number of elements in each set. To relate this to the product rule, note that the task of choosing an element in the Cartesian product A 1 × A 2 × ⋯ × A m is done by choosing an element in A 1 , an element in A 2 , … , and an element in Am. By the product rule it follows that |A 1 × A 2 × ⋯ × A m | = |A 1 | ⋅ |A 2 | ⋅⋯⋅ |A m |. Page 14

Page 15 The Sum Rule

The Sum Rule Page 16 Definition If a task can be done either in one of n 1 ways or in one of n 2 ways, where none of the set of n 1 ways is the same as any of the set of n 2 ways, then there are n 1 + n 2 ways to do the task.

Let’s see some examples for this rule now! Page 17

A student can choose a computer project from one of three lists. The three lists contain 23, 15, and 19 possible projects, respectively. No project is on more than one list. How many possible projects are there to choose from? The student can choose a project by selecting a project from the first list, the second list, or the third list. Because no project is on more than one list, by the sum rule there are 23 + 15 + 19 = 57 ways to choose a project. Page 18

More Complex Counting Problems..... Page 19

Each user on a computer system has a password, which is six to eight 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? Let P be the total number of possible passwords, and let P 6 , P 7 , and P 8 denote the number of possible passwords of length 6, 7, and 8, respectively. By the sum rule, P = P 6 + P 7 + P 8 . We will now find P 6 , P 7 , and P 8 . Finding P 6 directly is difficult. To find P 6 it is easier to find the number of strings of uppercase letters and digits that are six characters long, including those with no digits, and subtract from this the number of strings with no digits. By the product rule, the number of strings of six characters is 366, and the number of strings with no digits is 266. Hence, P 6 = 366 − 266 = 2,176,782,336 − 308,915,776 = 1,867,866,560. Similarly, we have P 7 = 367 − 267 = 78,364,164,096 − 8,031,810,176 = 70,332,353,920 and P 8 = 368 − 268 = 2,821,109,907,456 − 208,827,064,576 = 2,612,282,842,880. Consequently, P = P 6 + P 7 + P 8 = 2,684,483,063,360. Page 20

Page 21 The Subtraction Rule (Inclusion–Exclusion for Two Sets)

Page 22 Defination If a task can be done in either n 1 ways or n 2 ways, then the number of ways to do the task is n 1 + n 2 minus the number of ways to do the task that are common to the two different ways. The Subtraction Rule (Inclusion–Exclusion for Two Sets)

Page 23 The Division Rule

Page 24 Defination There are n∕d ways to do a task if it can be done using a procedure that can be carried out in n ways, and for every way w, exactly d of the n ways correspond to way w. The Division Rule

Page 25 Tree Diagrams

Page 26 Defination Counting problems can be solved using tree diagrams. A tree consists of a root, a number of branches leaving the root, and possible additional branches leaving the endpoints of other branches. (We will study trees in detail in Chapter 11.) To use trees in counting, we use a branch to represent each possible choice. We represent the possible outcomes by the leaves, which are the endpoints of branches not having other branches starting at them. Tree Diagrams

How many bit strings of length four do not have two consecutive 1s? 1st bit 2nd bit 3rd bit 1010 1001 1000 0101 0100 0010 0001 0000 1 1 1 1 1 1 1 Page 27

The Pigeonhole Principle Page 28

Page 29 Introduction to The Pigeonhole Principle Suppose that a flock of 20 pigeons flies into a set of 19 pigeonholes to roost. Because there are 20 pigeons but only 19 pigeonholes, a least one of these 19 pigeonholes must have at least two Links pigeons in it. To see why this is true, note that if each pigeonhole had at most one pigeon in it, at most 19 pigeons, one per hole, could be accommodated. This illustrates a general principle called the pigeonhole principle, which states that if there are more pigeons than pigeonholes, then there must be at least one pigeonhole with at least two pigeons in it. This principle is extremely useful; it applies to much more than pigeons and pigeonholes.

The Pigeonhole Principle Page 30 Defination 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.

Page 31 The Generalized Pigeonhole Principle

Page 32 Defination If N objects are placed into k boxes, then there is at least one box containing at least ⌈N∕k⌉ objects. The Generalized Pigeonhole Principle

An Example.............. Among 100 people there are at least ⌈100∕12⌉ = 9 who were born in the same month. Page 33

Thanks For Watching