Professional Documents
Culture Documents
3 1 Combinatorics
Section 2.3
2.3 Combinatorics
Introduction
If someone asks you a question that starts off how many ways , you
can be rest assured its a problem in combinatorics. Someone once said that
every mathematician is part combinatorist since combinatorial ideas and
arguments are important in every area of mathematics, pure and applied.
Today, the interest in combinatorial analysis is fueled by important problems
in science, including chemistry, biology, physics and computer science.
Problems in chemistry arise in studying the arrangement of atoms in
molecules and crystals, in physics in the study of statistical and quantum
mechanics, in biology in studying gene structure, and in computer science in a
myriad of problems such as computer networks and microcircuit design. The
general public too is familiar with combinatorics through games and puzzles,
asking questions like how many games are played in the annual NCAA mens
or womens basketball tournament? Sometimes it is easy to construct one
way to do something, but hard to find the total number of ways to do the thing.
For example, it is relatively easy to cover the 64 squares of an ordinary 8 8
checkerboard with dominoes (each domino covering 2 squares), but hard to
determine the number of ways to do it. The total number of different
coverings was discovered in 1961 by M.E. Fischer to be
2
24 ( 901) = 12, 988,816 .
Multiplication Principle
One of the most basic principles of counting, if not the most basic, is the
multiplication principle.
principle Although the principle is simple, it has far reaching
consequences. For example, how many dots are there in the array of dots in
Figure 1?
Section 2.3 2 Combinatorics
We suspect you counted the 10 dots in the first row and then multiplied by 3.
If this is true, then you used the multiplication principle. As a small step up in
complexity chain, try counting the number of paths from A to C in Figure 2.
No doubt this problem didnt stump you either, getting 4 5 = 20 . Again you
used the multiplication principle.
2 2 2 = 2n
Section 2.3 3 Combinatorics
Example 2: (Counting Functions1) How many functions are there from the set
A = {a, b, c} to the set of binary numbers B = {0,1 } ? Enumerate them.
Solution For each of the 3 values in A the function can take on 2 values.
Hence, by the multiplication rule the number of functions is 2 2 2 = 23 = 8 . We
leave it to the reader to draw the eight functions (See Problem 21.) In general
the number of functions from a set with cardinality n to a set with cardinality
m is m n .
Permutations
Permutations
The number of permutations increases dramatically as the size of the set increases. The
number of permutations of the first 10 letters of the alphabet abcdefghij is 3, 628,800 .
We certainly didnt arrive at that number by listing each arrangement. We used the
multiplication principle.
Suppose four individuals a, b, c, d are in a foot race and we wish to determine the
possible ways the runners can finish first and second. Each of the four runners can finish
first, and for each winner, there are 3 second-place finishers. Hence by the multiplication
principle there are 4 3 = 12 possible ways the runners can finish first and second, which
are.
ab ba ca da
ac bc cb db
ad bd cd dc
1
We will talk more about functions in Chapter 4.
Section 2.3 4 Combinatorics
n!
P ( n, r ) = = n ( n 1) ( n 2 ) ( n r + 1)
( n r )!
Proof:
Choosing r elements from a set of size n , we have
P ( n, r ) = n ( n 1) ( n 2 ) ( n r + 1) .
Solution
r =1 r=2 r =3
a ab abc
b ac acb
c ba bac
bc bca
ca cab
cb cba
Permutations P ( n, r )
Table 1
We dont use set notation for writing permutations2 since order is important.
The permutation ab is not the same as ba .
n Factorial
When counting sets, one often encounters the product of consecutive
integers from 1 to n . This product is called n factorial and denoted by
n ! = n ( n 1) ( n 2 ) 2 1
P ( 4, 2 ) = 4 3 = 12
P ( 7, 3) = 7 6 5 = 210
P ( 4,1) = 4 = 4
P (10,3) = 10 9 8 = 720
P ( 4, 4 ) = 4 3 2 1 = 24
2
Sometimes permutations are written with round parenthesis, such as ab is written as (ab) .
Section 2.3 6 Combinatorics
Example
Example 4
How many ways can one arrange the seven letters of the word SYSTEM?
Solution
The two Ss are indistinguishable so we find the arrangements of the
four letters Y,T,E,M taken from a set of size six and let the two Ss occupy the
remaining slots. Hence, we have
6!
P ( 6, 4 ) = = 6 5 4 3 = 360
2!
Combinations
Combinations are essentially permutations where order doesnt matter.
For example, the combinations (or subsets) of size 2 that can be selected from the 3
letters in the word cat are
{ca} , {ct} , {at}
Note that there are fewer combinations than the 6 permutations of the letters cat .
Solution
It is a simple matter to enumerate the combinations which are listed
Table 2. Note that the 8 subsets of {a, b, c} with the exception of the empty
set are listed. If we wanted a subset of size 0 we would include the empty
set.
Section 2.3 7 Combinatorics
r =1 r=2 r =3
{a} {a, b} {a, b, c}
{b} {a, c}
{c} {b, c}
Nonempty Subsets of {a, b, c}
Table 2
Note: Note that combinations are simply sets, so {a, b } is the same as the
combination {b, a} . Note too how this contrasts with permutations where the
permutation ab is not the same as ba .
Recall that the number of ways to permute r elements taken from a set
n!
of size n is P ( n, r ) = . But these r elements can be arranged in r !
( n r )!
different ways, so if we only want to count one of these permutations to obtain
the number of combinations, we divide P (n, r ) by r ! getting
P ( n, r ) n!
C ( n, r ) = = .
r! r !( n r ) !
n
The numbers C ( n, r ) or are called binomial coefficients because they are
r
the coefficients in the binomial expansion
Section 2.3 8 Combinatorics
2 2 2 2
(a + b) = a 2 + ab + b 2 = a 2 + 2ab + b 2
0 1 2
3 3 3 3 3
( a + b ) = a 3 + a 2b + ab 2 + b3 = a 3 + 3a 2b + 3ab2 + b3
0 1 2 3
4 4 4 4 4 4
( a + b ) = a 4 + a 3b + a 2b 2 + ab3 + b 4 = a 4 + 4a3b + 6a 2b 2 + 4ab3 + b 4
0 1 2 3 4
... ... ... ... ... ...
.
n
It helps in thinking about combinations to say as "n choose r " since it
r
denotes the number of ways one can choose r items from a set of n items.
4
For example = 6 is read as 4 choose 2 is 6 which means there are 6
2
ways to choose 2 things from 4 things.
Example 6 How many ways can 10 players choose up sides to play five-
on-five in a game of basketball?
Solution
As in many combinatorial problems, there is more than one way to carry
out the counting. Perhaps the simplest is to determine the number of ways
one fixed player can select his or her four teammates from the 9 other
players. In other words, the number of subsets of size four taken from a set
of size 9, or nine choose four, which
9 9! 9 8 7 6
= = = 126 ways .
4 4!5! 4 3 2 1
1 10 1 10! 1 10 9 8 7 6
= = = 126
2 5 2 5!5! 2 5 4 3 2 1
Section 2.3 9 Combinatorics
Poker Hands
In poker, five cards are dealt from a deck of 52 cards. The types of
poker hands (and examples) are
2 Straight Flush: Five cards of same suit in sequence (4(, 5(, 6(, 7(, 8()
3 4 of a Kind: Four cards of the same rank (7(, 7(, 7(, 7()
Find a) the total number of poker hands, b) the number of 4-or-a-kinds, c) the number
of full houses, d) the number of 3-of-a-kind hands.
Solution:
a) Total Hands: Each hand represents a subset of size 5 from a set of size 52. Hence
the total number of hands a player can receive is 52 choose 5 or
52 52! 52 51 50 49 48
= = = 2,598,960 total hands
5 5!47! 5 4 3 2
13 48
b) 4-of-a-kind: There are = 13 ways to select the quads and = 48 choices
1 1
for the remaining card. Using the multiplication principle, we get
48 13
= 48 13 = 6244 four of a kind hands
1 1
Section 2.3 10 Combinatorics
13 12
c) Full House: There are = 13 choices for the rank of the triple, and = 12
1 1
4
choices for the rank of the pair. There are also = 4 ways to choose the triple from a
3
4
card of a given rank, and = 6 ways to choose the pair from four cards of the other
2
rank. Hence, the multiplication principle gives us
13 12 4 4
= 13 12 4 6 = 3, 744 full house hands
1 1 3 2
13
d) Three of a Kind: There are = 13 choices for the rank of the triple, and
1
12
= 66 choices for the rank of the remaining 2 cards. There are also
2
4 4
= 4 choices for the triple of the given rank, and = 4 for each of the
3 1
remaining two cards. Using the multiplication principle, we have
3
13 12 4
= 54,912 3-of-a-kind hands
1 2 1
Three boys and two girls are going to a movie. How many ways can
they sit next to each other under the following conditions?
Solution
Section 2.3 11 Combinatorics
a) The only way they can sit is boy-girl-boy-girl-boy. But the boys can
be permuted 3! = 6 ways and the girls 2! = 2 ways, so the total number of
arrangements is 3!2! = 12 .
b) First think of the two girls are a single girl so you have 4 persons, 3
boys and 1 girl. Hence there are 4! = 24 ways to permute the two girls among
the 3 boys. But, for each of these arrangements, we can permute the two
girls 2! = 2 ways, and so the total number of arrangements is 4!2! = 48 .
How many paths are there from Start to End in the road system in Figure
5, always moving to the right and down?
Solution
Counting Paths
Figure 5
Solution Since all paths pass through the one-point gap, the problem is
subdivided into two parts; finding the paths from Start to the gap, then finding
the paths from the gap to End, then multiplying the results together. From
Start to the gap, note that we travel a total of eight blocks, four blocks to
the right and four blocks down. Labeling each block as R or D , depending
whether the move to the right or down, all paths can be written
{ x, x, x, x, x, x, x, x} , where four of the x ' s are R and four are D. The total
number of paths is the number of ways you can select 4 D ' s (or Rs) from a
Section 2.3 12 Combinatorics
8
set of size 8, which is 8 choose 4 or = 70 . Similarly, the number of
4
7
paths from the gap to End is = 35 Hence, the total number is
3
8 7
= 70 35 = 2, 450 paths. .
4 3
Card Trick3
Combinatorial Card
Here is a little trick you and a friend can perform before an audience. It
is very clever and involves two principles of combinatorics, the pigeonhole
principle4 and a set of three elements has 6 permutations. You can be the
magician and a friend the assistant. Beginning with a deck of 52 playing cards
a volunteer from the audience selects at random five cards from the deck and
gives them to the assistant. The assistant looks at the cards, places one card
face down on a table, and the other four face up. The magician then makes a
grand entrance, looks at the four upright cards, and announces the 5th card to
the audience. How did the magician do it?
To show how the trick is done, someone in the audience has selected the
cards shown in Figure 6 and gives them to the magicians assistant.
Selected Cards
Figure 6
3
This trick has been attributed to mathematician William Fitch Cheney. For more variations on this trick,
google Cheneys Five Card Trick.
4
The pigeonhole principle is a rather obvious principle from combinatorics which states if m objects are
attempted to be placed in n boxes and if m > n , then at least one box contains more than one object. The
principle is sometimes stated that if m pigeons try to nest in n pigeonholes and if m > n , then at least
one pigeonhole will contain more than one pigeon.
Section 2.3 13 Combinatorics
Since there are four suits in the deck and since five cards are selected, the
Pigeonhole Principle requires at least one suit will appear more than once.
The assistant focuses on this suit (hearts in our example) and then computes
the smaller clockwise distance between the 7 and 9, which is 2 (the
minimum distance of is always 1,2,3,4,5 or 6). The assistant then places the
mystery card, which is the larger 9 face down on a table, and the remaining
four cards upright in the order (order is important)
7 2 9 7
The first card of 7 tells the magician the secret card is a heart. The
remaining 3 cards 2 9 7 are placed in order which codes one of the
numbers 1,2,3,4,5, or 6 and tells the magician how many places past the 7
one must go to reach the mystery card of 9. To accomplish this the
magician and assistant agree upon a predetermined ordering of the 52 cards,
such as spades first, clubs second, diamonds third, and hearts last and within
each suite according to ace low, king high, like
Hence, the smallest card in the deck is the ace of spades and the largest is the
king of hearts. Using this ordering one can code one of the numbers 1,2,3,4,5,
or 6 according to one of six permutations of {S , M , L} where
SML = 1 SLM = 2
MSL = 3 MLS = 4
LSM = 5 LMS = 6
In our example the assistant wants to code the number 2 so the 3 cards are
displayed in order SLM = 2 7 9. After viewing these cards (and doing
some quick mental calculations), the magician decodes the cards and then
announces to the surprised audience, the last card to be 9.
Problems
a) P(5, 3)
b) P(4,1)
c) P(30, 2)
d) C (4,1)
e) C (10,8)
7
f)
2
9
g)
2
6
h) (a + b)
10
i) (a + b)
a) TO
b) TWO
c) TOO
d) TOOT
e) SNOOT
f) DALLAS
g) TENNESSEE
h) MISSISSIPPI
i) ILLINOIS
4. (Going
(Going to the Movies) Four girls and four boys are going to a movie. How
many ways can they be seated if no two girls sit next to each other?
Section 2.3 16 Combinatorics
8. (One Committee) How many ways can the Snail Darter Society, who has 25
members, elect an executive committee of 2 members?
9. (Two Committees)
Committees) How many ways can the Snail Darter Society, who has
25 members, elect an executive committee of 2 members and an
entertainment committee of 4 members if no member of the society can
serve on both committees?
10. (Three Committees) How many ways can the Snail Darter Society, who has
25 members, elect an executive committee of 2 members, an
entertainment committee of 3 members, and a welcoming committee of 2
members if no member of the society can serve on more than one
committees?
11. (Serving on More than One Committee) How many ways can the
Snail Darter Society, who has 25 members, elect an executive
committee of 2 members, an entertainment committee of 3 members,
and a welcoming committee of 2 members if members can serve on
more than one committee?
1 2 3 1 2 3 1 2 3
= = =
1 2 3 2 3 1 3 1 2
1 2 3 1 2 3 1 2 3
= = =
1 3 2 2 1 3 3 2 1
Section 2.3 17 Combinatorics
where the bottom row of each array shows how the top row is permuted.
Carrying out one permutation followed by another defines a
multiplication of the permutations. For instance = means we do
permutation first then permutation second, which yields the
permutation (check it yourself). Compute the following.
a)
b) 2
c) 3
d)
14. (Catala
(Catalan Numbers) Catalan numbers represent the number of ways to
dissect a polygon into triangles by means of non-intersecting diagonals.
Figure xx shows the first 4 Catalan numbers as 1, 2, 5, 14. Can you find
the 5th Catalan number?
15.. (Pigeon Hole Principle) Apply the pigeonhole to prove that at least two people
in New York City have the same number of hairs on their head. Hint: You may want
Section 2.3 18 Combinatorics
to make a few assumptions regarding the population of NYC and the maximum
number of hairs on the human head.
16. Subsets of a Set. Give another proof that the number of subsets of a set of size
n is 2n . Hint: Assign to each binary number of at most n digits in the
following way. Assign a 1 if the corresponding element in the set is selected to be
in the subset, otherwise a zero.
k
n
!n = n !
( 1)
k =1 k!
How many derangements are there for the members (1, 2,3, 4 ) ? Enumerate them.
19. (Counting Functions) How many functions are there from A = {a, b, c} to
B = {0,1, 2} ? Write them down and draw the graphs for a few of them.
19. (One-to-One Functions) How many one-to-one functions are there from
A = {a, b, c} to the set of binary numbers B = {0,1 } ?
20. (Onto Functions) How many onto functions are there from A = {a, b, c} to the
set of binary numbers B = {0,1 } ?
21. (Counting Functions) Draw graphs of all the functions from A = {a, b, c} to
{0,1 } . Hint: Plot the values a, b, c as points on the x -axis and the numbers 0,1
on the y -axis.