0% found this document useful (0 votes)
20 views37 pages

Counting 1

There are two main counting rules discussed in the document: the sum rule and the product rule. The sum rule states that if one counts the number of ways to do task 1 and task 2 separately, and the tasks are mutually exclusive, then the total number of ways is the sum of the individual counts. The product rule states that if one counts the number of ways to do task 1 and task 2, then the total number is the product of the individual counts. Examples are provided to illustrate applying these rules to counting problems. The document also discusses permutations and the pigeonhole principle for solving counting problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views37 pages

Counting 1

There are two main counting rules discussed in the document: the sum rule and the product rule. The sum rule states that if one counts the number of ways to do task 1 and task 2 separately, and the tasks are mutually exclusive, then the total number of ways is the sum of the individual counts. The product rule states that if one counts the number of ways to do task 1 and task 2, then the total number is the product of the individual counts. Examples are provided to illustrate applying these rules to counting problems. The document also discusses permutations and the pigeonhole principle for solving counting problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Counting

Dr. Daksha M Diwan


Assistant Professor
Mathematics
Government Engineering College, Gandhinagar,
GUJARAT(INDIA)

1
Counting
• Count the number of ways to put things together
into various combinations.
e.g. If a password is 6-8 letters and/or digits, how many
passwords can there be?
• Two main rules:
– Sum rule
– Product rule

2
Sum Rule

3
Generalized Sum Rule

4
EX. A student can choose a computer project from
one of three lists. The three lists contain 23, 15, and
19 possible projects respectively. How many
possible projects are there to choose from?
Solution: 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.

5
Example: The mathematics department must
choose either a student or a faculty member as a
representative for a university committee. How
many choices are there for this representative if
there are 37 members of the mathematics faculty
and 83 mathematics majors and no one is both a
faculty member and a student.
Solution: By the sum rule it follows that there are
37 + 83 = 120 possible ways to pick a representative.

6
Set Theoretic Version
• If A is the set of ways to do task 1, and B the set of
ways to do task 2, and if A and B are disjoint, then:
“the ways to do either task 1 or 2 are
AB, and |AB|=|A|+|B|”
• Let A1, A2, …, Am be pairwise disjoint sets. Then
|A1  A2  …  Am | = |A1|  |A2|  …  |Am|

7
Product Rule

8
Set Theoretic Version
• If A is the set of ways to do task 1, and B the set of
ways to do task 2, and if A and B are disjoint, then:
• The ways to do both task 1 and 2 can be represented
as AB, and |AB|=|A|·|B|

9
Example: The chairs of an auditorium are to be
labeled with a letter and a positive integer not to
exceed 100. What is the largest number of chairs
that can be labeled differently?

Solution: From A to Z From 1 to 100

The procedure of labeling a chair consists of two tasks,


namely, assigning to the seat one of the 26 uppercase
English letters, and then assigning to it one of the 100
possible integers.
The product rule shows that there are 26 · 100 = 2600
different ways that a chair can be labeled.
Therefore, the largest number of chairs that can be
labeled differently is 2600. 10
Ex. How many bit strings of length seven are
there?
Solution: Since each of the seven bits is either a 0
or a 1.
000

0 or 1
The total number of bit strings are 2^7 = 128.

11
Example: How many different license plates can be
made if each plate contains a sequence of three
uppercase English letters followed by three digits?

Solution: There are 26 letters from A to Z and 10


digits from 0 to 9.

By the product rule, there are 26 · 26 · 26 · 10 · 10 · 10


= 17,576,000 different possible license plates.
12
Example (Using Both Rules):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?
Solution: Let P be the total number of passwords, and let P6, P7, and
P8 be the passwords of length 6, 7, and 8.
By the sum rule P = P6 + P7 +P8.
To find each of P6, P7, and P8 , we find the number of passwords of
the specified length composed of letters and digits and subtract the
number composed only of letters.
Choice for one character of password is either from 26 letters or from
10 digits means total 36 choices.

13
Example (Using Both Rules):
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?
Solution: Let P be the total number of passwords, and let P6,
P7, and P8 be the passwords of length 6, 7, and 8.
By the sum rule P = P6 + P7 +P8.
To find each of P6, P7, and P8 , we find the number of
passwords of the specified length composed of letters and
digits and subtract the number composed only of letters.
Choice for one character of password is either from 26 letters
or from 10 digits means total 36 choices. For 6 characters
each have 36 choices so total choices 366 . 14
Example (Using Both Rules)

15
Basic Counting Principles:
Subtraction Rule

16
Example: How many strings of length eight either
start with a 1 bit or end with the two bit string 00?
• Count bit strings that start with 1
– Rest of bits can be anything: 27 = 128
– This is |A1|
• Count bit strings that end with 00
– Rest of bits can be anything: 26 = 64
– This is |A2|
• Count bit strings that both start with 1 and end with 00
– Rest of the bits can be anything: 25 = 32
– This is |A1∩ A2|
• Use formula |A1U A2| = |A1| + |A2| - |A1∩ A2|
=128 + 64 – 32 = 160

17
Pigeonhole Principle

If a flock of 13 pigeons flies into a set of 12 pigeonholes to


roost, one of the pigeonholes must have more than 1 pigeon.
Theorem: If k is a positive integer and k + 1 objects are
placed into k boxes, then at least one box contains two or
more objects.
18
Pigeonhole Principle

Proof: We use a proof by contraposition. Suppose


none of the k boxes has more than one object. Then
the total number of objects would be at most k. This
contradicts the statement that we have k + 1 objects.

19
Pigeonhole Principle

Corollary 1: A function f from a set with k + 1elements to a


set with k elements is not one-to-one.
Proof: Use the pigeonhole principle.
Create a box for each element y in the codomain of f .
Put in the box for y all of the elements x from the
domain such that f(x) = y.
Because there are k + 1(pigeons) elements and only k
(holes)boxes, at least one box has two or more elements.
Hence, f can’t be one-to-one.

20
Pigeonhole Principle
Example: Among any group of 367 people, there
must be at least two with the same birthday,
because there are only 366 possible birthdays.

21
Example: How many people do you need in a
school to guarantees that there are two people who
have the same initials.(First and last name only)

Solution: There are 26 letters for each of the first and


last names number at possible sets of initials are
262 =676.
So by pigeonhole principle, provided there are more
than 676 people there must be at least two people
with the same initials.
Generalized Pigeonhole Principle

23
G.P.P. Example
Example: Among 100 people there are at least
⌈100/12⌉ = 9 who were born in the same month.
(K=12 box and N=100 objects)
Example: There are 280 students in the class. Without
knowing anybody’s birthday, what is the largest value
of n for which we can prove that at least n students
must have been born in the same month?
Solution: N=280 objects, K=12 boxes
280/12 = 23.3 = 24
At least24 students who were born in the same month.24
Example: Show that if 30 dictionaries in a library
contain a total of 61,327 pages then one of the
dictionaries must have at least 2045 pages.

Let the pages be the pigeons and the dictionaries the


pigeonholes.
Then by extended pigeonhole principle, one
61326
dictionary must contain at least + 1 = 2045
30
pags.
Example: a) How many cards must be selected
from a standard deck of 52 cards to guarantee that
at least three cards of the same suit are chosen?
b) How many must be selected to guarantee that at
least three hearts are selected?

Solution: a)
We assume four boxes; one for each suit.
Using the generalized pigeonhole principle, at least one box
contains at least ⌈N/4⌉ cards.
At least three cards of one suit are selected if ⌈N/4⌉≥3. The
smallest integer N such that ⌈N/4⌉ ≥3.
Therefor N= 2 · 4 + 1 = 9.
26
Example: a) How many cards must be selected from a
standard deck of 52 cards to guarantee that at least
three cards of the same suit are chosen?
b) How many must be selected to guarantee that at
least three hearts are selected?

Solution: b) A deck contains 13 hearts and 39 cards which are


not hearts. So, if we select 41 cards, we may have 39 cards
which are not hearts along with 2 hearts. However, when we
select 42 cards, we must have at least three hearts. (Note that
the generalized pigeonhole principle is not used here.)
Answer is 42.

27
Permutations

28
A Formula for the Number of Permutations

Also,
𝑛!
𝑛𝑝𝑟 =
𝑛−𝑟 !

29
Solving Counting Problems by Counting
Permutations

30
Example: Eight boys and three girls are to sit in a
row for a photograph. Find the the total number of
ways that no two girls are sit together.
The seating arrangement are as follows:
_B_ B_ B_ B_ B_ B_ B_ B_ .
8 boys can sit in any of 8 places.
Number of ways they can sit= 8𝑝8
3 girls can sit any of 9 places marked_ .
Number of ways they can sit= 9𝑝3 Hence, the total
number of ways that no two girls are sit together
8𝑝8 . 9𝑝3 = 8. 7. 6. 5 . 4 . 3 2 . 1 . 9 . 8 . 7
Combinations

n n!
C (n, r )    
 r  r !(n  r )!
32
Formula for the Number of Combinations

• 𝑛𝑝𝑟 = 𝑛𝑐𝑟 𝑟𝑝𝑟


𝑛 𝑝𝑟 𝑛!
• 𝑛𝑐𝑟 = =
𝑟𝑝𝑟 𝑟! 𝑛−𝑟 !

• 𝑛𝑐𝑟 = 𝑛𝑐𝑛−𝑟
• 𝑛𝑐1 = 𝑛
• 𝑛𝑐𝑛 = 𝑛𝑐0 = 1

33
Combination Example
Example: How many number of ways that 7-card can
be drawn from a standard 52-card deck?
Solution:
52𝑐7
52𝑝7
=
7𝑐7
52·51·50·49·48·47·46
=
7.6.5.4.3.2.1
= 52 · 17 · 10 · 7 · 47 · 46
= 133,784,560
34
Example: Two people are selected at random from
a group of seven men and five women. Find the
number of ways of selections that both are men or
both are women.
Solution:
Out of 7 men, 2 can be selected in 7𝑐2 and out of 5
women, 2 can be selected in 5𝑐2 ways.
Favorable number of cases = 7𝑐2 + 5𝑐2
7 .6 5 .4
= +
2 .1 2 .1
= 21 + 10 = 31
Example: Suppose that there are 9 faculty members in
the mathematics department and 11 in the computer
science department. How many ways are there to
select a committee to develop a discrete mathematics
course at a school if the committee is to consist of
three faculty members from the mathematics
department and four from the computer science
department?
Solution:
To form committee we have to choose 3
mathematics faculty from total 9 mathematics
faculty members and 4 computer science faculty
from total 11 computer science faculty members.
Total number of ways to form committee is
= 9𝑐3 . 11𝑐4
9 .8.7 11.10.9 .8.
= .
3.2.1 4.3.2.1
= 27,720

You might also like