You are on page 1of 49

Elementary Counting

Techniques & Combinatorics


Combinatorics
the branch of discrete mathematics concerned
with determining the size of finite sets without
actually enumerating each element.
Combinatorics
The Sum Rule (task formulation):
Suppose that a task can be completed by performing
exactly one task from a collection of disjoint subtasks:
subtask
1
, subtask
2
, ... , subtask
n
;
Now suppose each subtask has a choice of ways to perform
it, e.g.
subtask
1
can be performed t
1
ways,
subtask
2
can be performed t
2
ways,
...
subtask
n
can be performed t
n
ways.
Then number the number of ways to perform the task is:
t
1
+ t
2
+ ... + t
n


The Sum Rule
Example:
Suppose either a CS faculty or a CS student must
be chosen for a committee, and there are 4 CS
faculty and 16 CS students. How many possible
choices are there?
Combinatorics
The Product Rule (task formulation):
Suppose a task needs to be done, and the tasks consists of a
sequence of n steps or subtasks:
task = task
1
, task
2
, task
3
, ..., task
n
where each task task
x
has a certain number of ways (t
x
) in
which it can be performed after the preceding tasks have
been performed, e.g.
task
1
= t
1
ways,
task
2
= t
2
ways after task
1
is complete,
task
3
= t
3
ways after task
1
and task
2
is complete, ... ,
task
n
= t
n
ways after task
1
... task
n-1
is complete
Then the number of ways the task can be performed is:
t
1
t
2
t
3
... t
n



Example - Product Rule
How many different ways can we chose from 4
colors and paint 3 rooms?
Tasks:
1 - paint room 1 - 4 ways to perform (4 colors)
2 - paint room 2 - 4 ways to perform (4 colors)
3 - paint room 3 - 4 ways to perform (4 colors)
Thus t
1
= 4, t
2
= 4, t
3
= 4, and
4 4 4 = 64
ways to paint the rooms
Example - Product Rule
How many different ways can we chose from
4 colors and paint 3 rooms, if no room is to be
the same color?
tasks:
1 - paint room 1 - 4 ways to perform (4 colors)
2 - paint room 2 - 3 ways to perform (3 colors left)
3 - paint room 3 - 2 ways to perform (2 colors left)
Thus t
1
= 4, t
2
= 3, t
3
= 2, and
4 3 2 = 24 ways to paint the rooms
Example - Product Rule
How many different orders may 9 people be
arranged in?
There are nine tasks - picking the first person,
picking the second,
The first task has 9 choices, the second 8, ... and
finally the ninth task has 1 choice:

9 8 7 6 5 4 3 2 1 = 362880
Combinatorics
The Product Rule (set formulation):
If A and B are finite sets, then:
|A B| = |A| |B|
The cardinality of the Cartesian product of two sets
is the product of the their cardinalities.
Note that ANY ordered list of items is trivially
equivalent to a Cartesian product.
Example - Product Rule
Let A = {a, b, c, d, e}, B = {1, 3, 5, 7}
How many pairs (x, y) exist where x e A and y
e B?

A B has cardinality |A| |B| = 5 4 = 20
Example - Product Rule
How many license plates are possible with 3
uppercase letters followed by 3 digits?

262626101010 = 17576000
Combinatorics
The Sum Rule (set formulation):
If A and B are disjoint finite sets, then:

|A B| = |A| + |B|

The cardinality of the union of two disjoint
sets is the sum of their cardinalities.
Example - The Sum Rule
Let A = {a, b, c, d, e}, B = {1, 3, 5, 7}
How many ways can one element be chosen?


|A B| = |A| + |B| = 5 + 4 = 9.
The Pigeonhole Principle
If k + 1 or more objects are placed in k
boxes, then there is at least one box
containing two or more objects.
The Pigeonhole Principle
If k + 1 or more objects are placed in k
boxes, then there is at least one box
containing two or more objects.
The Pigeonhole Principle
If k + 1 or more objects are placed in k
boxes, then there is at least one box
containing two or more objects.
The Pigeonhole Principle
If k + 1 or more objects are placed in k
boxes, then there is at least one box
containing two or more objects.
Proof: Suppose that none of the k boxes
contains more then one object. Then the
maximum number of objects would be k.
This is a contradiction, since there is at
least k + 1 objects.
The Pigeonhole Principle
The Generalized Pigeonhole Principle:

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

Generalized Pigeonhole Principle
If N objects are placed into k boxes, then
there is at least one box containing at least
N/k( objects.
Generalized Pigeonhole Principle
If N objects are placed into k boxes, then
there is at least one box containing at least
N/k( objects.
Generalized Pigeonhole Principle
If N objects are placed into k boxes, then
there is at least one box containing at least
N/k( objects.
Generalized Pigeonhole Principle
Proof: Suppose that none of the boxes contains
more than N/k( - 1 objects. Then the total
number of objects is at most:
k (N/k( - 1).
But since N/k( < (N/k + 1), we get the following:
k (N/k( - 1) < k (((N/k + 1) - 1) = N, thus
k (N/k( - 1) < N
which is a contradiction since there is a total of
N objects.
Generalized Pigeonhole Principle
Among 100 people there are at least
100/12( = 9 people with the same
birthday month.
Generalized Pigeonhole Principle
In a class of 44 students, how many will
receive the same grade on a scale {A, A
-
,
B, B
-
, C, C
-
, D, E}.
Permutations and Combinations
Consider: How many ways can we choose r
things from a collection of n things?
pick
Pick 4 from 9
colored balls
Permutations and Combinations
Consider: How many ways can we choose r
things from a collection of n things?
This statement is ambiguous in several ways:
Are the n things distinct or indistinguishable?
Do the selected items form a set (unordered
collection) or a sequence (ordered)?
May the same item be selected from the r items
more then once? (Are repetitions permitted?).
Permutations and Combinations
Example using balls:
Are the balls identical or different colors? Are
some different colors, others the same?
Are balls tossed in a bucket (unordered) or lined
up in a line in the order chosen?
Each ball returned to the collection before the next
is selected?
Permutation
An ordered selection of objects.
If there is a collection of n objects to chose
from, and we are selecting all n objects, then
we call each possible selection a permutation
from the collection.

In the general case the items are all distinct,
and repetitions are not permitted.
Permutation
Possible permutations of three colored balls:
Permutation
Consider the set S = {a, b}. What are the
permutations?
ab ba

Permutation
Consider the set S = {a, b, c}. What are the
permutations?

abc acb bca bac cab cba
Permutation
Consider the set S = {a, b, c, d}. What are the
permutations?
abcd acbd bcad bacd cabd cbad
abdc acdb bcda badc cadb cbda
adbc adcb bdca bdac cdab cdba
dabc dacb dbca dbac dcab dcba
Permutation
Theorem: The number of permutations of a
set of n objects is the product of the first n
positive integers, that is
n(n -1) ... 1 = n = n!
Permutation
Justification:
Arranging n objects into order requires n tasks.
Task 1 Pick first object (n choices)
Task 2 Pick second object (n-1 choices)
...
Task n Pick last (nth) object (1 choice)

Thus, by the product rule, the number of ways to
arrange n objects is:
n(n -1) ... 1 = n!
r-Permutations
Consider ordering a subset of a collection of
objects.
If there is a collection of n objects to chose
from, and we are selecting r of the objects,
where 0<rsn, then we call each possible
selection a r-permutation from the collection.


r-Permutations
Consider a 4-permutation of 9 balls
pick
r-Permutations
Consider the set S = {a, b, c}.
What are the 2-permutations of S?
ab ba ac ca bc cb

What are the 3-permutations of S?
abc acb bca bac cab cba
r-Permutations
Consider the set S = {a, b, c, d}.
What are the 2-permutations of S?
ab ac ad ba bc bd
ca cb cd da db dc
r-Permutations
Consider the set S = {a, b, c, d}.
What are the 3-permutations of S?
abc acb bac bca cba cab (from {a, b, c})
abd adb bad bda dba dab (from {a, b, d})
adc acd dac dca cda cad (from {a, c, d})
dbc dcb bdc bcd cbd cdb (from {b, c, d})
r-Permutations
Theorem: The number of r-permutations of a
set of n objects, written P(n, r) is:


)! (
!
) 1 ( ) 1 ( ) (
r n
n
n-r ... n- n n, r P

= + =
r-Permutations
Justification:
Arranging r of n objects into order requires r tasks.
Task 1 Pick first object (n choices)
Task 2 Pick second object (n-1 choices)

Task r Pick rth object (n - r + 1 choices)
Thus, by the product rule, the number of ways to
arrange n objects is:

)! (
!
) 1 ( ) 1 (
r n
n
n-r ... n- n

= +
r-Permutations
Consider a horse race with 8 horses.
If a spectator were select three different
horses at random to bet on for first, second
and third places, how likely is he to be
completely correct?

P(8,3) = 8 - 7 - 6 = 336 permutations possible
Thus he has a 1 in 336 chance.
Combinations
Combination - an unordered selection of
objects.
Definition:
Consider a set S with n objects. Every
k sized subset of those objects (0<rsn)
is a combination of size r, or a r-
combination taken from S.
Combinations
Consider the set A = {a, b, c}.
What are the 2-combinations of A?
{a, b} {a, c} {b, c}
What are the 3-combinations of A?
{a, b, c}
What are the 1-combinations of A?
{a} {b} {c}
Combinations
Consider the set B = {a, b, c, d}.
What are the 2- combinations of B?
{a, b} {a, c} {a,d} {b, c} {b, d} {c, d}

What are the 3-combinations of B?
{a, b, c} {a, c, d} {b, c, d} {a, b, d}
Combinations
Notice the comparison of 3-combinations of
B with 3-permutations:
3-permutations 3-combinations
abc acb bac bca cba cab {a, b, c}
abd adb bad bda dba dab {a, b, d}
adc acd dac dca cda cad {a, c, d}
dbc dcb bdc bcd cbd cdb {b, c, d}
Combinations
This shows that each r-combination has
r-permutations possible. Thus the following
theorem:
Theorem: The number of r -combinations of a
set of n distinct objects is:
)! ( !
!
!
) , (
) , (
r n r
n
r
r n P
k n C

= =
Combinations



Justification: We find the number of
permutations, then divide by a factor which we
have overcounted. Since each r-combination of
the n objects can be ordered P(r,r) = r! ways, we
divide the number of r-permutations from n
objects by the number of r-permutations of r
objects.
)! ( !
!
!
) , (
) , (
r n r
n
r
r n P
k n C

= =
Combinations
The number C(n,r) is also written:




And is be read n choose r objects.
|
|
.
|

\
|
=
r
n
r n C ) , (

You might also like