Chapter 6
Chapter 6
Chapter 6
With Question/Answer
Animations
Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Chapter Summary
The Basics of Counting
The Pigeonhole Principle
The Basics of Counting
Section 6.1
Section Summary
The Product Rule
The Sum Rule
The Subtraction Rule
Examples, Examples, and Examples
Tree Diagrams
Basic Counting Principles: The Product
Rule
The Product Rule: A procedure can be
broken down into a sequence of two tasks.
There are n1 ways to do the first task and n2
ways to do the second task. Then there are
n1∙n2 ways to do the procedure.
there are 26 ∙ 26 ∙ 26 ∙ 10 ∙ 10 ∙ 10 =
Solution: By the product rule,
We want to chose a digit, then another that is not the same, then
another…
First digit: 10 possibilities
Second digit: 9 possibilities (all but first digit)
Third digit: 8 possibilities
Fourth digit: 7 possibilities
7
Total = 10*10*10*5 = 5000
Counting Functions
Counting Functions: How many functions
are there from a set with m elements to a set
with n elements?
Solution: Since a function represents a
choice of one of the n elements of the
codomain for each of the m elements in the
. . . . . .
n − m + 1 ways to choose a
Telephone Numbering Plan
telephone number consists of 10 digits, consisting of a three-digit area code,
Example: The North American numbering plan (NANP) specifies that a
a three-digit office code, and a four-digit station code. There are some
restrictions on the digits.
Let X denote a digit from 0 through 9.
Let N denote a digit from 2 through 9.
Let Y denote a digit that is 0 or 1.
In the old plan (in use in the 1960s) the format was NYX-NNX-XXXX.
In the new plan, the format is NXX-NXX-XXXX.
How many different telephone numbers are possible under the old plan and
the new plan?
representative.
The Sum Rule in terms of sets.
The sum rule can be phrased in terms of sets.
|A ∪ B|= |A| + |B| as long as A and B are
disjoint sets.
Or more generally,
13
Combining the Sum and Product Rule
Example: Suppose statement labels in a
programming language can be either a single
letter or a letter followed by a digit. Find the
number of possible labels.
26 + 26 ∙ 10 = 286
Solution: Use the product rule.
Counting Passwords
Combining the sum and product rule allows us to solve more complex problems.
Example: 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. We
find that:
16
Wedding pictures example
Consider a wedding picture of 6 people
There are 10 people, including the bride and groom
17
Wedding pictures example
Consider a wedding picture of 6 people
There are 10 people, including the bride and groom
c) How many possibilities are there if only one of the bride and groom
are in the picture
Sum rule: place only the bride
Product rule: place the bride AND then place the rest of the party
First place the bride
She can be in one of 6 positions
Next, place the other five people via the product rule
There are 8 people to choose for the second person, 7 for the third, etc.
We can’t choose the groom!
Total = 8*7*6*5*4 = 6720
Product rule yields 6 * 6720 = 40,320 possibilities
OR place only the groom
Same possibilities as for bride: 40,320
Sum rule yields 40,320 + 40,320 = 80,640 possibilities
18
Basic Counting Principles: Subtraction Rule
Subtraction Rule: If a task can be done
either in one of n1 ways or in one of n2 ways,
00?
Solution: Use the subtraction rule.
= 32
Hence, the number is 128 + 64 − 32 = 160.
Tree Diagrams
Tree Diagrams: We can solve many counting problems
through the use of tree diagrams, where a branch represents
a possible choice and the leaves represent possible outcomes.
Example: Suppose that “I Love Discrete Math” 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 the campus book store needs to stock to have one
of each size and color available?
Solution: Draw the tree diagram.
22
The Pigeonhole Principle
Section 6.2
Section Summary
The Pigeonhole Principle
The Generalized Pigeonhole Principle
The Pigeonhole Principle
If a flock of 20 pigeons roosts in a set of 19 pigeonholes, one
of the pigeonholes must have more than 1 pigeon.
objects.