You are on page 1of 18

Section 2.

3 1 Combinatorics

Section 2.3
2.3 Combinatorics

Purpose of Section To introduce some basic tools of counting, such as the


multiplication principle, permutations and combinations.

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 .

Although it is hard to formally define such a multifaceted subject,


combinatorics is simply the discipline of counting. Counting is so
commonplace, we generally dont give it a second thought, yet as the reader
will see, the techniques of counting are as ingenious as any in mathematics
and just as difficult. More than one good mathematician has been
embarrassed by a seemingly simply combinatorics problem.

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

Count the Dots


Figure 1

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.

How Many Paths from A to C?


Figure 2

This leads us to the formal statement of the multiplication principle.

Multiplication Rule for Counting: If a procedure can be broken into successive


stages, and if there are s1 outcomes for the first stage, s2 outcomes for the second stage,
, and sn for the n th stage, then the entire procedure has s1s2 ..., sn outcomes. .

Example 1 (Counting Subsets)


Subsets) Show that that a set A = {a1 , a2 ,..., an }
containing n elements has 2n subsets.

Proof: A subset of A can be formed in n successive steps. On the first step


one can pick or not pick a1 , on the second step one can pick or not pick a2 ,
and so on. One each step there are two options, to pick or not pick. Hence,
the number of subsets that can be selected is

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 .

Although the multiplication principle is very simple, it has far reaching


results. One is the study of permutations.

Permutations
Permutations

A permutation is simply an arrangement of objects. For example the


permutations of the three letters abc are the six arrangements

abc, acb, bac, bca, cab, cba

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

This leads to the definition of permutations of different sizes.

Definition: A permutation of any r elements taken from a set of n elements is


an arrangement of the r elements. We denote the number of such
permutations by P ( n, r ) .

1
We will talk more about functions in Chapter 4.
Section 2.3 4 Combinatorics

Using the multiplication principle we can find the number of such


permutations.

Theorem 1 Number of Permutations

The number of permutations of r elements taken from a set of size n is

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

the first element can be selected n ways.

the second element can be selected n 1 ways (since now


There are n 1 left).

the third element can be selected n 2 ways (since


now there are n 2 left).

the rth element can be selected n r + 1 ways

Hence, by the principle of sequential counting (or the multiplication


rule), we have

P ( n, r ) = n ( n 1) ( n 2 ) ( n r + 1) .

Example 3 Permutations of a Set with 3 Elements

Find the permutations of r = 1, 2 and 3 elements selected from {a, b, c} .

Solution

The underlying set {a, b, c } has n = 3 elements. The permutations of 1,


2 and 3 elements from {a, b, c } are listed in Table 1.
Section 2.3 5 Combinatorics

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

It is convenient to define 0! = 1 . Also, note the number of permutations of n


elements is
P ( n, n ) = n ( n 1) ( n 2 ) 2 1 = n !

Margin Note: Permutations: Order matters.

Margin Note: To evaluate P ( n, r ) start at n and multiply r factors.

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!

Another way to think of this problem is to momentarily distinguish the two


S ' s as S1 and S2 . In this way there are 6! permutations of the six letters.
However, there are 2! = 2 permutations of the S1 and S2 so we must divide
the 6! permutations by 2! getting the same result.

A second application of the multiplication principle is computing


combinations.

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 .

Definition: A combination is a subset of elements of a set.

Example 5 Find the combinations (i.e. subsets) of size r = 1, 2 and 3 taken


from the set {a, b, c} .

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 .

Theorem 2: Number of Combinations The number of combinations (or


subsets) of size r which can be selected from a set of size n , denoted by
n
C ( n, r ) or , is
r
n n!
C ( n, r ) = = .
r r !( n r ) !
Proof:

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.

Margin Note: Combinations: Order does not matter

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

Another approach is to find number of subsets of size 5 taken from a set of


size 10 and divide that number by 2, getting

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

1 Royal Flush: A, K, Q, J, 10 of same suit (10, S, J, Q(, K(, A()

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()

4 Full House: Three of a kind plus a pair (7, 7, 7, K, K)

5 Flush: Five cards of the same suit (3 , 7 , 10, Q , A )

6 Straight: Five cards in sequence (5, 6, 7, 8 , 9 )

7 3 of a Kind: Three cards of the same rank (J, J, J)

8 2 Pairs: Two pairs of different rank (5, 5, 9, 9)

9 1 Pair: Two cards of the same rank (A, A)

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

Naming Results in Mathematics: It is a sorry state of affairs that in


mathematics, the most precise of all disciplines, is so lax about giving credit to
those who made major discoveries. Pascals triangle was well known by many
mathematicians centuries before Pascal described it in a paper, so why is it
called Pascals triangle? It probably goes back to another person giving
credit to Mr. Pascal, and others picking up on that. After a while it becomes
Pascals triangle. Mathematics is rife with all sorts of equations and
theorems attributed to one person that were actually discovered by another.

Example 7 (Going to the Movies)

Three boys and two girls are going to a movie. How many ways can
they sit next to each other under the following conditions?

a) Neither boy sits next to each other.


b) The two girls sit next to each other.

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 .

Example 8 (Finding Paths)

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

For convenience in mental calculations, we the 13 rank values of the cards in


a clockwise pattern shown in Figure 7.

Counting clockwise no two cards are more than 6 places apart


Figure 7

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

A< 2<3< < J <Q < K


Section 2.3 14 Combinatorics

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

S = smallest rank of the 3 cards


M = middle rank of the 3 cards
L = largest rank of the 3 cards

A typical code might be

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.

In case the audience is suspicious that the assistant is sending hidden


verbal or visual signals to the magician, another version of the trick might be
to have the someone from the audience select five cards from the deck and
then give them to the assistant, where after looking at them, the assistant
places one of them face down on a table. The assistant then places the other
four face up on the table. The magician then makes a grand entrance, looks at
the cards for a moment, and then announces the mystery card, then turns it
over to a surprised audience.

Another variation would be for the assistant to give an audience member


the four cards and the audience member say the card to the magician and have
the magician read the mind of the audience member to get the last card.
Section 2.3 15 Combinatorics

Problems

1. Compute the following.

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)

Permutations and Combinations

2. (Tree Representation of Permutations) Draw a tree diagram showing all


permutations of size 2 from the letters abcd . How many permutations are
there?

3. (Distinguishable Permutations) The number of distinguishable permuations of


5!
the word TOOTS is . Since there are five letters in the word one writes
2!2!
5! in the numerator. However, we cannot distinguish the 2 Ts and the 2 Os in
the word, hence we divide 2!2!. Find the number of distinguishable
permutations in the following words.

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

5. (Baseball Season) A baseball league consists of 9 teams. How many games


will be played over the course of a year if each team plays every other team
exactly 20 times?

6. (Hmmmmmmmm) How many 2-element sets are there in the set


{ x  :1 n 100} such that the sum of the 2 elements is even?
7. (Picky People) How many ways can 8 people sit next to each other at a
movie if a certain 2 of them refuse to sit next to each other?

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?

12. (Counting Softball Teams) A college softball team is taking 25 players on


a road trip. The traveling squad consists of 3 catchers, 6 pitchers, 8
infielders, and 6 outfielders. Assuming each player can only play her own
position, how many different teams can the coach put on the field?

13. (Permutations as Groups) The 3! = 6 permutations of set {1, 2,3} can be


illustrated by the 2 3 arrays

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)

After you get the hang of multiplying permutations, make a 6 6


multiplication table of all products. This table describes what in group
theory is called the symmetric group of order 3, denoted by S3 .

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?

First 4 Catalan Numbers


Figure 6

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.

17. (Derangements) A derangement is a permutation in which none of the elements


remain in their natural order. For example the only derangements of (1, 2,3) are
( 3,1, 2 ) and ( 2,3,1) . Hence we write !3 = 2 . Nicolas Bernoulli proved that the
number of derangements of a set of size n is

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.