100% found this document useful (1 vote)
285 views118 pages

Counting

The document discusses basic counting principles including the product rule, sum rule, subtraction rule, and division rule. It provides examples of applying each principle to problems involving counting the number of ways to arrange objects, assign seats, generate passwords and bit strings. The last section notes that it is impossible to fill a square with 1s and -1s such that all rows, columns and diagonals have different sums.
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
100% found this document useful (1 vote)
285 views118 pages

Counting

The document discusses basic counting principles including the product rule, sum rule, subtraction rule, and division rule. It provides examples of applying each principle to problems involving counting the number of ways to arrange objects, assign seats, generate passwords and bit strings. The last section notes that it is impossible to fill a square with 1s and -1s such that all rows, columns and diagonals have different sums.
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/ 118

COUNTING

CMSC 57
DISCRETE MATHEMATICAL STRUCTURES IN
COMPUTER SCIENCE II

FIRST SEMESTER 2016 2017


EARL FRANCIS M. VALDEHUESA

BASIC COUNTING PRINCIPLES


PRODUCT RULE
Suppose that a procedure can be broken down into a sequence of
two tasks. If there are n1 ways to do the first task and for each of
these ways of doing the first task, there are n2 ways to do the
second task, then there are n1n2 ways to do the procedure.

EXAMPLE
Two CMSC 57 students want to sit on the first two rows of CL2. In
how many ways are can we assign the two students these different
seats in the first two rows?

BASIC COUNTING PRINCIPLES


PRODUCT RULE
Suppose that a procedure can be broken down into a sequence of
two tasks. If there are n1 ways to do the first task and for each of
these ways of doing the first task, there are n2 ways to do the
second task, then there are n1n2 ways to do the procedure.

EXAMPLE
Two CMSC 57 students want to sit on the first two rows of CL2. In
how many ways are can we assign the two students these different
seats in the first two rows?
ANSWER: 2 * (number of seats)

BASIC COUNTING PRINCIPLES


PRODUCT RULE
EXAMPLE 1
The chairs of CL2 are to be labeled with an uppercase English
letter followed by a positive integer not exceeding 100. What is the
maximum number of chairs that can be labeled differently?

BASIC COUNTING PRINCIPLES


PRODUCT RULE
EXAMPLE 1
The chairs of CL2 are to be labeled with an uppercase English
letter followed by a positive integer not exceeding 100. What is the
maximum number of chairs that can be labeled differently?
ANSWER: 26 * 100 = 2,600 different ways

BASIC COUNTING PRINCIPLES


PRODUCT RULE
EXAMPLE 1
The chairs of CL2 are to be labeled with an uppercase English
letter followed by a positive integer not exceeding 100. What is the
maximum number of chairs that can be labeled differently?
ANSWER: 26 * 100 = 2,600 different ways

EXAMPLE 2
How many different bit strings of length seven are there?

BASIC COUNTING PRINCIPLES


PRODUCT RULE
EXAMPLE 1
The chairs of CL2 are to be labeled with an uppercase English
letter followed by a positive integer not exceeding 100. What is the
maximum number of chairs that can be labeled differently?
ANSWER: 26 * 100 = 2,600 different ways

EXAMPLE 2
How many different bit strings of length seven are there?
ANSWER: 27= 128 different bit strings of length seven

BASIC COUNTING PRINCIPLES


PRODUCT RULE
EXAMPLE 3
How many different license plates can be made if each plate
contains a sequence of three uppercase English letters followed
by three digits (and no sequences of letters are prohibited, even if
they are obscene)?

BASIC COUNTING PRINCIPLES


PRODUCT RULE
EXAMPLE 3
How many different license plates can be made if each plate
contains a sequence of three uppercase English letters followed
by three digits (and no sequences of letters are prohibited, even if
they are obscene)?
ANSWER: 263 * 103 = 17,576,000 possible license plates

BASIC COUNTING PRINCIPLES


PRODUCT RULE
EXAMPLE 4
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

BASIC COUNTING PRINCIPLES


PRODUCT RULE
EXAMPLE 4
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
ANSWER: n1n2...nm

BASIC COUNTING PRINCIPLES


SUM RULE
If a task can be done either in one of n1 ways or in one of n2 ways,
where none of the set of n1 ways is the same as any of the set of
n2 ways, then there are n1 + n2 ways to do the task.

EXAMPLE
Suppose that either a student of CMSC 57 section 1 or section 2
sis chosen as the batch representative for Komsai.Org. How many
different choices are there for this representative if there are 15
students in section 1 and 26 students in section 2?

BASIC COUNTING PRINCIPLES


SUM RULE
If a task can be done either in one of n1 ways or in one of n2 ways,
where none of the set of n1 ways is the same as any of the set of
n2 ways, then there are n1 + n2 ways to do the task.

EXAMPLE
Suppose that either a student of CMSC 57 section 1 or section 2
sis chosen as the batch representative for Komsai.Org. How many
different choices are there for this representative if there are 15
students in section 1 and 26 students in section 2?
ANSWER: 15 + 26 = 41 possible ways to pick the batch rep.

BASIC COUNTING PRINCIPLES


SUM RULE
EXAMPLE 1
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?

BASIC COUNTING PRINCIPLES


SUM RULE
EXAMPLE 1
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?
ANSWER: 23 + 15 + 19 = 57 projects to choose from

BASIC COUNTING PRINCIPLES


SUM RULE
EXAMPLE 1
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?
ANSWER: 23 + 15 + 19 = 57 projects to choose from

EXAMPLE 2
How many different bit strings of length six to eight and 1 is the
leftmost bit that are there?

BASIC COUNTING PRINCIPLES


SUM RULE
EXAMPLE 1
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?
ANSWER: 23 + 15 + 19 = 57 projects to choose from

EXAMPLE 2
How many different bit strings of length six to eight and 1 is the
leftmost bit that are there?
ANSWER: 25 + 27 + 28

BASIC COUNTING PRINCIPLES


SUM RULE
EXAMPLE 3
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
k := k + 1
for i2 := 1 to n2
k := k + 1
...
for im := 1 to nm
k := k + 1

BASIC COUNTING PRINCIPLES


SUM RULE
EXAMPLE 3
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
k := k + 1
for i2 := 1 to n2
k := k + 1
...
for im := 1 to nm
k := k + 1
ANSWER: n1 + n2 + ... + nm

BASIC COUNTING PRINCIPLES


SUM RULE
EXAMPLE 4
Each user on a computer system has a password, which is eight to
ten characters long, where each character is a letter or a digit.
Each password must contain at least one digit. How many
possible passwords are there?

BASIC COUNTING PRINCIPLES


SUM RULE
EXAMPLE 4
Each user on a computer system has a password, which is eight to
ten characters long, where each character is a letter or a digit.
Each password must contain at least one digit. How many
possible passwords are there?
ANSWER: Let P be the total number of possible passwords,
and P8, P9, and P10 denote the number of possible passwords
of length 8, 9, and 10 respectively.
By the sum rule, P = P8 + P9 + P10
P8 = 628 528, P9 = 629 529, P8 = 6210 5210

BASIC COUNTING PRINCIPLES


SUBTRACTION RULE
If a task can be done in either n1 ways or n2 ways, then the
number of ways to do the task is n1 + n2 minus the number of
ways to do the tasks that are common to the two different ways.

INCLUSION-EXCLUSION RULE
The subtraction rule is also known as the Principle of InclusionExclusion, especially when it is used to count the number of
elements in the union of two sets.
| A1 A2 | = | A1 | + | A2 | | A1 A2 |

BASIC COUNTING PRINCIPLES


SUBTRACTION RULE
EXAMPLE 1
How many bit strings of length eight either start with a 1 bit or end
with the two bits 00?

BASIC COUNTING PRINCIPLES


SUBTRACTION RULE
EXAMPLE 1
How many bit strings of length eight either start with a 1 bit or end
with the two bits 00?
ANSWER: 128 + 64 32 = 160 ways

BASIC COUNTING PRINCIPLES


SUBTRACTION RULE
EXAMPLE 1
How many bit strings of length eight either start with a 1 bit or end
with the two bits 00?
ANSWER: 128 + 64 32 = 160 ways

EXAMPLE 2
I have a total of 350 students. Suppose that 220 of these students
took CMSC 57, 147 took CMSC 22, and 51 took both CMSC 57
and CMSC 22. How many of my students are neither in CMSC 57
nor in CMSC 22?

BASIC COUNTING PRINCIPLES


SUBTRACTION RULE
EXAMPLE 1
How many bit strings of length eight either start with a 1 bit or end
with the two bits 00?
ANSWER: 128 + 64 32 = 160 ways

EXAMPLE 2
I have a total of 350 students. Suppose that 220 of these students
took CMSC 57, 147 took CMSC 22, and 51 took both CMSC 57
and CMSC 22. How many of my students are neither in CMSC 57
nor in CMSC 22?
ANSWER: 220 + 147 51 = 316, 350 316 = 34 students

BASIC COUNTING PRINCIPLES


DIVISION RULE
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.

EXAMPLE
How many different ways are there to sit six people around a
circular table, where two seatings are considered the same when
each person has the same left neighbor and the same right
neighbor?

BASIC COUNTING PRINCIPLES


DIVISION RULE
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.

EXAMPLE
How many different ways are there to sit six people around a
circular table, where two seatings are considered the same when
each person has the same left neighbor and the same right
neighbor?
ANSWER: 5!/2 = 60 ways

NOT SO MAGIC SQUARES


THE CHALLENGE
Fill in boxes with 1s and -1s so that columns,
rows, and diagonals all have different sums.

NOT SO MAGIC SQUARES


THE CHALLENGE
Fill in boxes with 1s and -1s so that columns,
rows, and diagonals all have different sums.

SURPRISE! IT CANT BE DONE!

NOT SO MAGIC SQUARES


THE CHALLENGE
Fill in boxes with 1s and -1s so that columns,
rows, and diagonals all have different sums.

SURPRISE! IT CANT BE DONE!


1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

-1

NOT SO MAGIC SQUARES


THE CHALLENGE
WHY CANT IT BE DONE?
Different sums needed = 2 columns + 2 rows + 2 diagonals = 6
Biggest possible sum: 1 + 1 = 2
Smallest possible sum: (-1) + (-1) = -2
Every possible sum is between (or equal to) 2 and 2.
BUT, only five numbers from -2 to 2.
# of sums needed > # of sums possible
Therefore, at least two of the sums must be the same!

THE PIGEONHOLE PRINCIPLE


If 6 pigeons have to fit into 5 pigeonholes,
then some pigeonhole gets more than one
pigeon.

THE PIGEONHOLE PRINCIPLE


If 6 pigeons have to fit into 5 pigeonholes,
then some pigeonhole gets more than one
pigeon.

PIGEONHOLE PRINCIPLE
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.

THE PIGEONHOLE PRINCIPLE


If 6 pigeons have to fit into 5 pigeonholes,
then some pigeonhole gets more than one
pigeon.

PIGEONHOLE PRINCIPLE
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.

PROOF
Suppose that none of the k boxes contains more than one object.
Then the total number of objects would be at most k. This is a
contradiction, because there are at least k + 1 objects.

THE PIGEONHOLE PRINCIPLE


STRATEGY FOR USING PIGEONHOLE PRINCIPLE

Identify the pigeons and pigeonhole

Is the number of pigeons > the number of pigeonholes?

If YES, then some pigeonhole has to get more than one pigeon.

THE PIGEONHOLE PRINCIPLE


STRATEGY FOR USING PIGEONHOLE PRINCIPLE

Identify the pigeons and pigeonhole

Is the number of pigeons > the number of pigeonholes?

If YES, then some pigeonhole has to get more than one pigeon.

EXAMPLE (NOT SO MAGIC SQUARES)


Pigeons = different sums needed (6)
Pigeonholes = possible sums (<5)
Therefore 2 (or more) sums must be the same.

THE PIGEONHOLE PRINCIPLE


STRATEGY FOR USING PIGEONHOLE PRINCIPLE

Identify the pigeons and pigeonhole

Is the number of pigeons > the number of pigeonholes?

If YES, then some pigeonhole has to get more than one pigeon.

EXAMPLE (NOT SO MAGIC SQUARES)


Pigeons = different sums needed (6)
Pigeonholes = possible sums (<5)
Therefore 2 (or more) sums must be the same.
A function f from a set with k + 1 or more elements to a

COROLLARY set with k elements is not one-to-one.

THE PIGEONHOLE PRINCIPLE


PIGEONHOLE PRINCIPLE
EXAMPLE 1
Among any group of 367 people, there must be at least two with
the same birthday, because there are only 366 possible birthdays.

THE PIGEONHOLE PRINCIPLE


PIGEONHOLE PRINCIPLE
EXAMPLE 1
Among any group of 367 people, there must be at least two with
the same birthday, because there are only 366 possible birthdays.

EXAMPLE 2
At least 2 students in UP Visayas have the same first/last initials.

THE PIGEONHOLE PRINCIPLE


PIGEONHOLE PRINCIPLE
EXAMPLE 1
Among any group of 367 people, there must be at least two with
the same birthday, because there are only 366 possible birthdays.

EXAMPLE 2
At least 2 students in UP Visayas have the same first/last initials.
pigeons
pigeonholes
#(pigeons)
#(pigeonholes)

=
=
=
=

UP Visayas students
possible first/last initials
3,200
676

THE PIGEONHOLE PRINCIPLE


PIGEONHOLE PRINCIPLE
EXAMPLE 3
At least two students in this CMSC 57 class will receive exactly the
same final grade mark. Why?

THE PIGEONHOLE PRINCIPLE


PIGEONHOLE PRINCIPLE
EXAMPLE 3
At least two students in this CMSC 57 class will receive exactly the
same final grade mark. Why?
REASON: There are 26 students enrolled under this course. Final
grade mark are 1.0 5.0, INC, and DRP, which is exactly 13 marks.

THE PIGEONHOLE PRINCIPLE


PIGEONHOLE PRINCIPLE
EXAMPLE 3
At least two students in this CMSC 57 class will receive exactly the
same final grade mark. Why?
REASON: There are 26 students enrolled under this course. Final
grade mark are 1.0 5.0, INC, and DRP, which is exactly 13 marks.

EXAMPLE 4
How many students must be in a class to guarantee that at least
two students receive the same score on a long exam?

THE PIGEONHOLE PRINCIPLE


PIGEONHOLE PRINCIPLE
EXAMPLE 3
At least two students in this CMSC 57 class will receive exactly the
same final grade mark. Why?
REASON: There are 26 students enrolled under this course. Final
grade mark are 1.0 5.0, INC, and DRP, which is exactly 13 marks.

EXAMPLE 4
How many students must be in a class to guarantee that at least
two students receive the same score on a long exam?
ANSWER: At least 102 students, since an exam is graded from 0
to 100 points, that makes it 101 boxes.

THE PIGEONHOLE PRINCIPLE

Examples

Triangular dartboard

A triangular dartboard

PIGEONHOLE PRINCIPLE
EXAMPLE 5
Dartboard = equilateral triangle with side
length of 2 feet.
CLAIM: If you throw 5 darts (no misses), at
least 2 will be within a foot of each other.
Dartboard = equilateral triangle with side length of 2

CLAIM: If you throw 5 darts (no misses), at least 2 w


of each other.

T. Goldberg (Cornell)

The pigeonhole principle

THE PIGEONHOLE PRINCIPLE

Examples

Triangular dartboard

A triangular dartboard

PIGEONHOLE PRINCIPLE
EXAMPLE 5
Dartboard = equilateral triangle with side
length of 2 feet.
CLAIM: If you throw 5 darts (no misses), at
least 2 will be within a foot of each other.

REASON:
Dartboard = equilateral triangle with side length of 2
Divide triangle into 4 sub-triangles.
Darts in the same sub-triangle
are w/in 1 foot of each other.
CLAIM: If you throw 5 darts (no misses), at least 2 w
pigeons
= darts
(5)other.
of each
pigeonholes = sub-triangles (4)
T. Goldberg (Cornell)

The pigeonhole principle

THE PIGEONHOLE PRINCIPLE


GENERALIZED PIGEONHOLE PRINCIPLE
If N objects are placed into k boxes, then there is at least one box
containing at least N / k objects.

THE PIGEONHOLE PRINCIPLE


GENERALIZED PIGEONHOLE PRINCIPLE
If N objects are placed into k boxes, then there is at least one box
containing at least N / k objects.

PROOF
Suppose that none of the boxes contains more than N / k - 1
objects. Then, the total number of objects is at most

where the inequality N / k < ( N / k ) + 1 has been used. This is


a contradiction because there are a total of N objects.

THE PIGEONHOLE PRINCIPLE


GENERALIZED PIGEONHOLE PRINCIPLE
EXAMPLE 1
Among 100 people, there are at least 100 / 12 = 9 who were
born in the same month.

THE PIGEONHOLE PRINCIPLE


GENERALIZED PIGEONHOLE PRINCIPLE
EXAMPLE 1
Among 100 people, there are at least 100 / 12 = 9 who were
born in the same month.

EXAMPLE 2
What is the minimum number of students required in a Discrete
Mathematics class to be sure that at least six will receive the same
grade, if there are 13 possible grades from 1.0 5.0, INC, and
DRP?

THE PIGEONHOLE PRINCIPLE


GENERALIZED PIGEONHOLE PRINCIPLE
EXAMPLE 1
Among 100 people, there are at least 100 / 12 = 9 who were
born in the same month.

EXAMPLE 2
What is the minimum number of students required in a Discrete
Mathematics class to be sure that at least six will receive the same
grade, if there are 13 possible grades from 1.0 5.0, INC, and
DRP?
ANSWER: To have at least 6 (=N / 13) students at the same box,
the total number must be at least N = 5 * 13 + 1 = 66.

THE PIGEONHOLE PRINCIPLE


GENERALIZED PIGEONHOLE PRINCIPLE
EXAMPLE 3
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?

THE PIGEONHOLE PRINCIPLE


GENERALIZED PIGEONHOLE PRINCIPLE
EXAMPLE 3
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?
SOLUTION: There are 4 suits. So we need to choose N cards,
such that N / 4 > 3. The smallest integer N such that N / 4 > 3
is 2 * 4 + 1 = 9.
How many must be selected to guarantee that at least three hearts
are selected?

PERMUTATIONS AND COMBINATIONS


Many counting problems can be solved by finding the number of
ways to arrange a specified number of distinct elements of a set of
a particular size, where the order matters.

PERMUTATIONS AND COMBINATIONS


Many counting problems can be solved by finding the number of
ways to arrange a specified number of distinct elements of a set of
a particular size, where the order matters.
Many other problems can be solved by finding the number of ways
to select a particular number of elements from a set of a particular
size, where the order does not matter.

PERMUTATIONS AND COMBINATIONS


Many counting problems can be solved by finding the number of
ways to arrange a specified number of distinct elements of a set of
a particular size, where the order matters.
Many other problems can be solved by finding the number of ways
to select a particular number of elements from a set of a particular
size, where the order does not matter.

EXAMPLES

In how many ways can we select 3 students from a group of 5


students to stand in line for a picture?

PERMUTATIONS AND COMBINATIONS


Many counting problems can be solved by finding the number of
ways to arrange a specified number of distinct elements of a set of
a particular size, where the order matters.
Many other problems can be solved by finding the number of ways
to select a particular number of elements from a set of a particular
size, where the order does not matter.

EXAMPLES

In how many ways can we select 3 students from a group of 5


students to stand in line for a picture?

How many different committees of 3 students can be formed


from a group of 4 students?

PERMUTATIONS AND COMBINATIONS


PERMUTATION
A permutation of a set of distinct objects is an ordered
arrangement of these objects. An ordered arrangement of r
elements of a set is called an r-permutation.

PERMUTATIONS AND COMBINATIONS


PERMUTATION
A permutation of a set of distinct objects is an ordered
arrangement of these objects. An ordered arrangement of r
elements of a set is called an r-permutation.

EXAMPLE
A combination lock
31 - 5 17

is not the same as

17 31 5

PERMUTATIONS AND COMBINATIONS


PERMUTATION
A permutation of a set of distinct objects is an ordered
arrangement of these objects. An ordered arrangement of r
elements of a set is called an r-permutation.

EXAMPLE
A combination lock
31 - 5 17

is not the same as

17 31 5

Though the same numbers are used, the order in which they are
turned to, would mean the difference in the lock opening or not.

PERMUTATIONS AND COMBINATIONS


PERMUTATION
EXAMPLE 1
In how many ways can we select 3 students from a group of 5
students to stand in line for a picture?

PERMUTATIONS AND COMBINATIONS


PERMUTATION
EXAMPLE 1
In how many ways can we select 3 students from a group of 5
students to stand in line for a picture?
ANSWER: Note that the order we select the student matters.
5 ways to select the first student, 4 ways to select the second, and
3 ways to select the third student.
5 * 4 * 3 = 60 ways to select the 3 students

PERMUTATIONS AND COMBINATIONS


PERMUTATION
EXAMPLE 2
Let S = {1, 2, 3}. The ordered arrangement 3, 1, 2 is a permutation
of S. The ordered arrangement 3,2 is a 2-permutation of S.
What are the other 2-permutations of S?

PERMUTATIONS AND COMBINATIONS


PERMUTATION
EXAMPLE 2
Let S = {1, 2, 3}. The ordered arrangement 3, 1, 2 is a permutation
of S. The ordered arrangement 3,2 is a 2-permutation of S.
What are the other 2-permutations of S?

EXAMPLE 3
Let S = {a, b, c}. What are the 2-permutations of S?

PERMUTATIONS AND COMBINATIONS


PERMUTATION
EXAMPLE 2
Let S = {1, 2, 3}. The ordered arrangement 3, 1, 2 is a permutation
of S. The ordered arrangement 3,2 is a 2-permutation of S.
What are the other 2-permutations of S?

EXAMPLE 3
Let S = {a, b, c}. What are the 2-permutations of S?
ANSWER: The ordered arrangements a,b a,c b,a b,c c,a
c,b.

PERMUTATIONS AND COMBINATIONS


PERMUTATION
EXAMPLE 4
The manager of a coffee shop needs to hire 2 employees, one to
work at the counter, and the other at the drive-through window.
Sarah, Megan, Tricia, and Jeff all applied for a job. How many
possible ways are there for the manager to place the applicants?

PERMUTATIONS AND COMBINATIONS


PERMUTATION
EXAMPLE 4
The manager of a coffee shop needs to hire 2 employees, one to
work at the counter, and the other at the drive-through window.
Sarah, Megan, Tricia, and Jeff all applied for a job. How many
possible ways are there for the manager to place the applicants?
ANSWER:
Counter
Sarah
Megan
Tricia
Jeff

Drive-through
Megan, Tricia, Jeff
Sarah, Tricia, Jeff
Sarah, Megan, Jeff
Sarah, Megan, Tricia

Outcomes
SM, ST, SJ
MS, MT, MJ
TS, TM, TJ
JS, JM, JT

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
If n is a positive integer, and r is an integer with 1 < r < n, there are
P(n, r) = n(n 1)(n 2) (n r + 1)
r-permutations of a set with n distinct elements.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
If n is a positive integer, and r is an integer with 1 < r < n, there are
P(n, r) = n(n 1)(n 2) (n r + 1)
r-permutations of a set with n distinct elements.

COROLLARY
If n and r are integers with 0 < r < n, then P(n, r) =

#!
#%& !

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
If n is a positive integer, and r is an integer with 1 < r < n, there are
P(n, r) = n(n 1)(n 2) (n r + 1)
r-permutations of a set with n distinct elements.

COROLLARY
If n and r are integers with 0 < r < n, then P(n, r) =

PROOF

Because

#!
#%' !

#!
#!

#!
#%& !

= 1 whenever n is a nonnegative

integer, we see that the corollary also holds when r = 0.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 1
How many ways are there to select a first-prize winner, a secondprize winner, and a third-prize winner from 100 different people
who entered a contest?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 1
How many ways are there to select a first-prize winner, a secondprize winner, and a third-prize winner from 100 different people
who entered a contest?
ANSWER: Because it matters which person wins which prize, the
number of ways to pick the winners is the number of ordered
selections of 3 elements from a set of 100, or 3-permutations of a
set of 100 elements.
P(100, 3) = 100 * 99 * 98 = 970,200

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 2
Suppose that there are eight runners in a race. The winner
receives a gold medal, the second-place finisher receives a silver
medal, and the third-place finisher receives a bronze medal. How
many different ways are there to award these medals, if all
possible outcomes of the race can occur and there are no ties?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 2
Suppose that there are eight runners in a race. The winner
receives a gold medal, the second-place finisher receives a silver
medal, and the third-place finisher receives a bronze medal. How
many different ways are there to award these medals, if all
possible outcomes of the race can occur and there are no ties?
ANSWER: P(8, 3) = 8 * 7 * 6 = 336 possible ways to award the
medals.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 3
Suppose that a saleswoman has to visit eight different cities. She
must begin her trip in a specified city, but she can visit the order
seven cities in any order she wishes. How many possible orders
can the saleswoman use when visiting these cities?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 3
Suppose that a saleswoman has to visit eight different cities. She
must begin her trip in a specified city, but she can visit the order
seven cities in any order she wishes. How many possible orders
can the saleswoman use when visiting these cities?
ANSWER: The number of possible paths between the cities is the
number of permutations of seven elements the first city is
determined.
7! = 7 * 6 * 5 * 4 * 3 * 2 * 1 = 5040 ways to choose her tour.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 4
How many permutations of the letters ABCDEFGH containing the
string ABC?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 4
How many permutations of the letters ABCDEFGH containing the
string ABC?
ANSWER: Because the letters ABC must occur as a block, we
find the number of permutations of six objects, namely, the block
of ABC and the individual letters D, E, F, G, and H.
6! = 6 * 5 * 4 * 3 * 2 * 1 = 720 permutations where ABC occurs in a
block.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 5
A computer program requires the user to enter a 7-digit
registration code made up of the digits 1, 2, 4, 5, 6, 7, and 9. Each
number has to be used, and no number can be used more than
once.
a) How many different registration codes are possible?

b) What is the probability that the first 3 digits are even numbers?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 5
A computer program requires the user to enter a 7-digit
registration code made up of the digits 1, 2, 4, 5, 6, 7, and 9. Each
number has to be used, and no number can be used more than
once.
a) How many different registration codes are possible?
(!
ANSWER: P(7, 7) = (%( ! = 5040, note that 0! = 1.
b) What is the probability that the first 3 digits are even numbers?
ANSWER: 3 * 2 * 1 * 4 * 3 * 2 * 1 = 144 ways. Probability is
144/5040 = 1/35.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 6
Ezra has 3 different CS books and 4 different Math books.
Determine the no. of ways all books can be arranged in the shelf if:
a)

there are no restrictions

b) the CS books on the left, and the Math books on the right

c) the books in the same subject must be kept together

PERMUTATIONS AND COMBINATIONS


FORMULA FOR PERMUTATION
EXAMPLE 6
Ezra has 3 different CS books and 4 different Math books.
Determine the no. of ways all books can be arranged in the shelf if:
a)

there are no restrictions


ANSWER: All 7 books are being arranged, P(7,7) = 5040

b) the CS books on the left, and the Math books on the right
ANSWER: CS books = 3!, Math books = 4!, 3! * 4! = 144
c) the books in the same subject must be kept together
ANSWER: 144 * 2 = 288 ways

PERMUTATIONS AND COMBINATIONS


COMBINATION
A combination of a set of distinct elements is an unordered
selection of elements from the set. An r-combination of elements
of a set is simply a subset of the set with r elements.

EXAMPLE
How many different committees of three students can be formed
from a group of four students?
ANSWER: We need only find the number of subsets with three
elements from the set containing the four subsets. There are 4
such subsets.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
The number of r-combinations of a set with n elements, where n is
a nonnegative integer and r is an integer with 0 < r < n, equals
C(n, r) =

#!
&! #%& !

PROOF
The P(n, r) r-permutations of the set can be obtained by forming
the C(n, r) r-combinations of the set, and then ordering the
elements in each r-combinations, w/c can be done in P(r, r) ways.
P(n, r) = C(n, r) * P(n, r)

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 1
Let S be the set {1, 2, 3, 4}. Then {1, 3, 4} is a 3-combination from
S. Note that {4, 1, 3} is the same 3-combination as {1, 3, 4}.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 1
Let S be the set {1, 2, 3, 4}. Then {1, 3, 4} is a 3-combination from
S. Note that {4, 1, 3} is the same 3-combination as {1, 3, 4}.

EXAMPLE 2
How many 2-combinations can we form from the set {a, b, c, d}?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 1
Let S be the set {1, 2, 3, 4}. Then {1, 3, 4} is a 3-combination from
S. Note that {4, 1, 3} is the same 3-combination as {1, 3, 4}.

EXAMPLE 2
How many 2-combinations can we form from the set {a, b, c, d}?
ANSWER: There are six subsets {a,b}, {a,c}, {a,d}, {b,c}, {b,d},
and {c,d}. Then C(4, 2) = 6.

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 3
How many poker hands of five cards can be dealt from a standard
deck of 52 cards? Also, how many ways are there to select 47
cards from a standard deck of 52 cards?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 3
How many poker hands of five cards can be dealt from a standard
deck of 52 cards? Also, how many ways are there to select 47
cards from a standard deck of 52 cards?
ANSWER: C(52, 5) = 2,598,960 different poker hands of five
cards. C(52, 47) = 2,598,960 different ways to select 47 cards from
a standard of 52 cards. C(52, 5) = C(52, 47).

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 3
How many poker hands of five cards can be dealt from a standard
deck of 52 cards? Also, how many ways are there to select 47
cards from a standard deck of 52 cards?
ANSWER: C(52, 5) = 2,598,960 different poker hands of five
cards. C(52, 47) = 2,598,960 different ways to select 47 cards from
a standard of 52 cards. C(52, 5) = C(52, 47).

COROLLARY
Let n and r be nonnegative integers with r < n. Then,
C(n, r) = C(n, n r)

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 4
How many ways are there to select six players from a 10-member
volleyball team to make a trip to a match at another school?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 4
How many ways are there to select six players from a 10-member
volleyball team to make a trip to a match at another school?
)'!
ANSWER: C(10, 6) = *! )'%* ! = 210

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 4
How many ways are there to select six players from a 10-member
volleyball team to make a trip to a match at another school?
)'!
ANSWER: C(10, 6) = *! )'%* ! = 210

EXAMPLE 5
A group of 30 people have been trained as astronauts to go on the
first mission to mars. How many ways are there to select a crew of
6 people to go on this mission (assuming they all have same job)?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 4
How many ways are there to select six players from a 10-member
volleyball team to make a trip to a match at another school?
)'!
ANSWER: C(10, 6) = *! )'%* ! = 210

EXAMPLE 5
A group of 30 people have been trained as astronauts to go on the
first mission to mars. How many ways are there to select a crew of
6 people to go on this mission (assuming they all have same job)?
+'!
ANSWER: C(30, 6) = *! +'%* ! = 593,775

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 6
Suppose that there are 9 faculty members in the math cluster and
11 in the CS cluster. How many ways are there to select a
committee to develop a discrete math course at a school if the
committee is to consist of 3 faculty members from the Math
cluster and four from the CS cluster?

PERMUTATIONS AND COMBINATIONS


FORMULA FOR COMBINATION
EXAMPLE 6
Suppose that there are 9 faculty members in the math cluster and
11 in the CS cluster. How many ways are there to select a
committee to develop a discrete math course at a school if the
committee is to consist of 3 faculty members from the Math
cluster and four from the CS cluster?
ANSWER:
C(9,3) * C(11, 4) =

,!
+! ,%+ !

))!

* -! ))%- ! = 84 * 330 = 27,720

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
The binomial theorem gives the coefficients of the expansion of
powers of binomial expressions.
Let x and y be variables, and let n be a nonnegative integer, then
+

= #34'

#
3

3 #%3 =

#
'

# +

#
)

#%) + ... +

#
#%)

#
#%) + #

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
The binomial theorem gives the coefficients of the expansion of
powers of binomial expressions.
Let x and y be variables, and let n be a nonnegative integer, then
+

= #34'

#
3

3 #%3 =

#
'

# +

EXAMPLE
What is the expansion of (x + y)4?

#
)

#%) + ... +

#
#%)

#
#%) + #

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
The binomial theorem gives the coefficients of the expansion of
powers of binomial expressions.
Let x and y be variables, and let n be a nonnegative integer, then
+

= #34'

#
3

#%3 3 =

#
'

# +

#
)

#%) + ... +

#
#%)

#
#%) + #

EXAMPLE
What is the expansion of (x + y)4?
ANSWER:
+ - = -34' -5 -%3 3= x4 + 4x3y + 6x2y2 +4xy3 + y4.

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
EXAMPLE 1
What is the coefficient of x12y13 in the expansion of (x + y)25?

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
EXAMPLE 1
What is the coefficient of x12y13 in the expansion of (x + y)25?
ANSWER: From the binomial theorem, it follows that coefficient is
23
25!
=
= 5,200,300
13
13! 12!

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
EXAMPLE 1
What is the coefficient of x12y13 in the expansion of (x + y)25?
ANSWER: From the binomial theorem, it follows that coefficient is
23
25!
=
= 5,200,300
13
13! 12!

EXAMPLE 2
What is the coefficient of x12y13 in the expansion of (2x - 3y)25?

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
EXAMPLE 1
What is the coefficient of x12y13 in the expansion of (x + y)25?
ANSWER: From the binomial theorem, it follows that coefficient is
25
25!
=
= 5,200,300
13
13! 12!

EXAMPLE 2
What is the coefficient of x12y13 in the expansion of (x + y)25?
ANSWER: Note that this expression equals (2x + (-3y))25.
25 12
25! 12 13
2 (3)13 =
2 3
13
13! 12!

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
COROLLARY 1
Let n be a nonnegative integer. Then
#

@
= 2#

34'

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
COROLLARY 1
Let n be a nonnegative integer. Then
#

@
= 2#

34'

PROOF
Using the binomial theorem with x = 1 and y = 1, we see that
#
#
3 #%3

2 = 1+1 = @
1 1
=@

34'

34'

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
COROLLARY 2
Let n be a positive integer. Then
#

@ (1)3
34'

=0

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
COROLLARY 2
Let n be a positive integer. Then
#

@ (1)3
34'

=0

PROOF
Using the binomial theorem with x = -1 and y = 1, we see that
#
#

#
3
#%3

0 = (1) + 1 = @
(1) 1
=@
(1)3

34'

34'

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
COROLLARY 3
Let n be a nonnegative integer. Then
#

3
@2
= 3#

34'

BINOMIAL COEFFICIENTS & IDENTITY


BINOMIAL THEOREM
COROLLARY 3
Let n be a nonnegative integer. Then
#

3
@2
= 3#

34'

PROOF
We recognize that the left-hand side is the expansion of (1 + 2)n
#
#
#%3 3
3

1+2 = @
1
2 =@
2

34'

34'

BINOMIAL COEFFICIENTS & IDENTITY


PASCALS IDENTITY
Let n and k be positive integers with n > k. Then
+1

=
+

BINOMIAL COEFFICIENTS & IDENTITY


PASCALS IDENTITY
Let n and k be positive integers with n > k. Then
+1

=
+

Pascals Triangle

BINOMIAL COEFFICIENTS & IDENTITY


VANDERMONDES IDENTITY
Let m, n, and r be nonnegative integers with r < m and r < n. Then
&

=@

34'

BINOMIAL COEFFICIENTS & IDENTITY


VANDERMONDES IDENTITY
Let m, n, and r be nonnegative integers with r < m and r < n. Then
&

=@

34'

COROLLARY 1
If n is a nonnegative integer, then
#
2

=@

34'

BINOMIAL COEFFICIENTS & IDENTITY


OTHER IDENTITY
Let n and r be nonnegative integers with r < n. Then
#

+ 1

=@
+1

34&

BINOMIAL COEFFICIENTS & IDENTITY


OTHER IDENTITY
Let n and r be nonnegative integers with r < n. Then
#

+ 1

=@
+1

34&

PROOF

Left-hand side shows that both sides show the ways to count bit
strings of length n+1 with r+1 ones. The right-hand side counts
the same objects, the final one must occur at r+1 or r+2 or or
n+1. Assume that it occurs at the k bit, there must be r ones in the
first k-1 positions.
#G)

@
34&G)

=@

54&

BINOMIAL COEFFICIENTS & IDENTITY


OTHER IDENTITY
EXAMPLE
Show that if p is a prime and k is an integer such that 1 < k < p-1,
then p divides H3 .

BINOMIAL COEFFICIENTS & IDENTITY


OTHER IDENTITY
EXAMPLE
Show that if p is a prime and k is an integer such that 1 < k < p-1,
then p divides H3 .
ANSWER: We know that

H
3

H!

= 3!(H%3)!. p divides the numerator

once only. We need to show that it does not divide the


denominator.
Since k < p, p cannot divide k!
Since k > 1, we know that p k < p, and thus p cannot divide (p-k)!

You might also like