chapter 7 – counting techniques csnb 143 discrete mathematical structures

23
Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Upload: esmond-parks

Post on 18-Jan-2018

249 views

Category:

Documents


0 download

DESCRIPTION

What, Which, Where, When 1. Permutation Redundant elements(Clear / Not Clear) Non-redundant elements(Clear / Not Clear) The use of n P r (Clear / Not Clear) 2. Combination Non-redundant elements(Clear / Not Clear) The use of n C r (Clear / Not Clear) 3. Pigeonhole Pigeonhole Principle(Clear / Not Clear) Identifying n and m(Clear / Not Clear)

TRANSCRIPT

Page 1: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Chapter 7 – Counting Techniques

CSNB 143 Discrete Mathematical

Structures

Page 2: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

OBJECTIVESStudent should be able to understand all

types of counting techniques.Students should be able to identify the

three techniques learned. Students should be able to use each of the

counting techniques based on different questions and situations.

Page 3: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

What, Which, Where, When1. Permutation Redundant elements (Clear / Not Clear) Non-redundant elements (Clear / Not Clear) The use of nPr (Clear / Not Clear)2. Combination Non-redundant elements (Clear / Not Clear) The use of nCr (Clear / Not Clear)3. Pigeonhole Pigeonhole Principle (Clear / Not Clear) Identifying n and m (Clear / Not Clear)

Page 4: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

PermutationAn order of objectswe count no. of

sequenceTheorem 1If there are two tasks T1 and T2 are to be

done in sequence. If T1 can be done in n1 ways, and for each of these ways T2 can be done in n2 ways, the sequence T1T2 can be done in n1n2 ways.

Page 5: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Example 1 T1 T2

2 ways 3 waysT1T2 T2T1 2 x3 = 6 ways 3x2 = 6 ways

Page 6: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Theorem 2If there are k tasks T1, T2, T3, …, Tk are to be

done in sequence. If T1 can be done in n1 ways, and for each of these ways T2 can be done in n2 ways, and for each of these n1n2 ways, T3 can be done in n3 ways, and so on, then the sequence T1T2T3…Tk can be done in n1n2n3…nk ways.

Page 7: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

E.x 1: A label identifier, for a computer system consists of one letter followed by 3 digits. If repetition allowed, how many distinct label identifier are possible?

26 x 10 x10 x 10 = 26000 possible identifiers.

Problem 1: How many different sequences, each of length r, can be formed using elements from set A if:

a) elements in the sequence may be repeated? b) all elements in the sequence must be

distinct?

Page 8: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Theorem 3For problem 1 (a):Let A be a set with n elements and 1 r n.

Then the number of sequences of length r that can be formed from elements of A, allowing repetitions, is

 n.n.n.n… = nr that is n is multiplied r times

Ex 2: If A = {, , , }, how many words that can be build with length 3, repetition allowed?

n = 4, r = 3, then nr = 43 = 64 words

Page 9: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Theorem 4A sequence of r elements from n elements of A is

always said as ‘permutation of r elements chosen from n elements of A’, and written as nPr or P(n, r)

For problem 1 (b):If 1 r n, then nPr is the number of

permutation of n objects taken r at a time, is n(n-1)(n-2)… (n-(r - 1))When r = n, that is from n objects, taken r at a

time from A, where r = n, it is a nPn or n factorial, written as n!.

Page 10: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Ex 3: Choose 3 alphabet from A = {a, b, c}3P3 = 3! = 3.2.1 = 6, that are abc, acb, bac, bca,

cab, cba.

So, if there are n elements, taken r at a time,  

nPr = n.(n-1).(n-2)….. (n-(r-1)).(n-r).(n-(r+1))…..2.1(n-r).(n-(r-1))….2.1= n.(n-1).(n-2)….. (n-(r-1))

Page 11: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

= n! (n - r)!

Ex 4: If A = {p, q, r, s}, find the number of permutation for 3 elements.4P3 = 4.3.2.1 1= 4.3.2= 24 (ex: pqr, pqs, prq, prs, psq, psr, …….)

Page 12: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Ex 5: Choose 3 alphabets from A..Z26P3 = 26.25.24.23 …. 3.2.1

23.22……3.2.1.= 26.25.24

Page 13: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Theorem 5The number of distinguishable permutations

that can be formed from a collection of n objects where the first object appears k1 times, the second object appears k2 times, and so on, is:n! k1!k2!…ki!

Ex 6: a) MISSISSIPPI b) CANADAa) 11! = 34650 1!4!4!2!

Page 14: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Exercise :A bank password consists of two letter of

the English alphabet followed by two digits. How many different passwords are there?

A coin tossed four times and the result of each toss is recorded. How many different sequences of head and tails are possible?

Page 15: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

CombinationOrder does not matter.we count no.

of subsetTheorem 1Let A be a set with |A| = n, and let 1 r

n. Then the number of combinations of the elements of A, taken r at a time, written as nCr, is given by

nCr = n!r! (n - r)!

Page 16: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Ex 7: If A = {p, q, r, s}, find the number of combination for 3 elements.

4C3 = 4.3.2.13.2.1.1

= 4(ex: pqr, pqs, prs, qrs)(pqr, prq, rpq, rqp, all are the same)

Page 17: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Exercise:Compute each of the following:7C7 b) 7C4 c) 16C5

 Suppose that a valid computer password

consists of seven characters, the first of which is a letter chosen from the set A, B, C, D, E, F, G and the remaining six characters are letter chosen from the English alphabet or a digit. How many different passwords are possible?

Page 18: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

PigeonholePigeonhole Principle is a principle that

ensures that the data is exist, but there is no information to identify which data or what data.

Theorem 1If there are n pigeon are assigned to m

pigeonhole, where m < n, then at least one pigeonhole contains two or more pigeons.

Page 19: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Ex 9: if 8 people were chosen, at least 2 people were being born in the same day (Monday to Sunday). Show that by using pigeonhole principle.

Sol: Because there are 8 people and only 7 days per week, so Pigeonhole Principle says that, at least two or more people were being born in the same day.

Note that Pigeonhole Principle provides an existence proof. There must be an object or objects with certain characteristic. In the above example, the characteristic is having born on the same day of the week. The pigeonhole principle guarantees that they are at least two people with

Page 20: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

this characteristic but gives no information on identifying this people. Only their existence are guaranteed.

In order to use pigeonhole principle we must identify pigeons (object) and pigeonholes (categories of the desired characteristic) and be able to count the number of pigeons and the number of pigeonholes.

Page 21: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Ex 10: Show that if any five numbers from 1 to 8 are chosen, two of them will add to 9.

Two numbers that add up to 9 are placed in sets as follows:

A1 = {1, 8}, A2 = {2, 7}, A3 = {3, 6},A4 = {4, 5}

Sol: Each of the 5 numbers chosen must belong to one of these sets. Since there are only four sets, the pigeonhole principle tells us that two of the chosen numbers belong to the same set. These numbers add up to 9.

Page 22: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

The Extended Pigeonhole PrincipleIf there are m pigeonholes and more than

2m pigeons, three or more pigeons will have to be assigned to at least one of the pigeonholes.

NotationIf n and m are positive integers, then n/m

stands for largest integer less than equal to the rational number n/m.

3/2 = 1, 9/4 = 2 6/3 = 2

Page 23: Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures

Theorem 2If n pigeons are assigned to m pigeonholes,

then one of the pigeonholes must contain at least

(n-1)/m + 1 pigeons.