Preview-9781439894996 A37928744
Preview-9781439894996 A37928744
COMBINATORICS
INTRODUCTION TO
COMBINATORICS
W. D. Wallis
Southern Illinois University
Carbondale, Illinois, USA
J. C. George
Gordon College
Barnesville, Georgia, USA
This book contains information obtained from authentic and highly regarded sources. Reasonable efforts
have been made to publish reliable data and information, but the author and publisher cannot assume
responsibility for the validity of all materials or the consequences of their use. The authors and publishers
have attempted to trace the copyright holders of all material reproduced in this publication and apologize to
copyright holders if permission to publish in this form has not been obtained. If any copyright material has
not been acknowledged please write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmit-
ted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented,
including photocopying, microfilming, and recording, or in any information storage or retrieval system,
without written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.
com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood
Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and
registration for a variety of users. For organizations that have been granted a photocopy license by the CCC,
a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used
only for identification and explanation without intent to infringe.
Visit the Taylor & Francis Web site at
http://www.taylorandfrancis.com
Preface xv
1 Introduction 1
1.1 Some Combinatorial Examples . . . . . . . . . . . . . . . . . 1
1.2 Sets, Relations and Proof Techniques . . . . . . . . . . . . . 13
1.3 Two Principles of Enumeration . . . . . . . . . . . . . . . . . 15
1.4 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.5 Systems of Distinct Representatives . . . . . . . . . . . . . . 20
Exercises 1A . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Exercises 1B . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2 Fundamentals of Enumeration 27
2.1 Permutations and Combinations! " . . . . . . . . . . . . . . . . 27
n
2.2 Applications of P (n, k) and . . . . . . . . . . . . . . . . 29
k
2.3 Permutations and Combinations of Multisets . . . . . . . . . 32
2.4 Applications and Subtle Errors . . . . . . . . . . . . . . . . . 36
2.5 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Exercises 2A . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Exercises 2B . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
ix
x
References 367
Index 375
List of Figures
xiii
xiv
A.1 R ∩ (S ∪ T ) = (R ∩ S) ∪ (R ∩ T ) . . . . . . . . . . . . . . . . 276
Preface
xv
xvi
Acknowledgments
This book has benefited significantly from the comments of Ken Rosen, and
those of anonymous reviewers. We would also like to thank David Grubbs and
Bob Stern of Taylor & Francis for their assistance.
The first edition of any textbook will, unavoidably, contain errors. Each of
us wishes to state categorically that all such errors are the fault of the other
author.
Chapter 1
Introduction
Passwords
We start with an enumerative problem. Enumeration (the theory of count-
ing) is an important part of combinatorics.
Most computer systems require passwords, in order to protect your informa-
tion and your privacy. For example, the social networking program YoufaceTM
requires everybody to have an eight-character password made up of letters and
digits. The passwords are case-sensitive, but the letter O is not allowed (to
avoid confusion with zero), so there are 60 symbols available. How many
different passwords could you choose?
1
2 Introduction to Combinatorics
There are 60 choices for the first character. For each of those there are 60
possible second characters, for 3600 possible 2-character starts. And so on.
In all, there are 608 , or about 168 trillion, passwords. This calculation is an
example of the Multiplication Principle, which we’ll discuss further in Section
1.3, later in this chapter.
Suppose a hacker wants to break into your YoufaceTM account. She has a
program that can generate and test a thousand passwords per second. Is she
dangerous?
Well, if she tests every possibility, it will take her over 5,000 years. So no,
your password is pretty secure.
However, you need to be careful about passwords. Dr John Walters, a
computer science professor that we shall meet again in this volume, always
uses the login jwalters. Having a poor memory, he always starts his password
with his initials, jw, and ends with the last two digits of the year. The hacker
found this out, so in 2009 she worked out that his password had the form
jw****09. There are 604 = 12, 360, 000 passwords of this form. That sounds
like a lot, but in 3.6 hours she could run every possible password. Even if
she is very unlucky, and her computer does not find the actual password until
very late in the run, she could still hack into his account in an afternoon.
In order to protect people like Dr Walters, YoufaceTM introduced some
further requirements. Your password cannot begin with the same two symbols
as your username, and the last two digits cannot be the last two digits of the
year. In 2010, when he rebuilt his account, Dr Walters could not choose any
password of the form jw****** or ******10.
How many possible passwords remained? We start with 608 possibilities,
and subtract the number that were banned. There were 608 passwords origi-
nally. There are 606 passwords of type jw******, and 606 of type ******10.
Subtracting these numbers leaves 608 − 2 × 606 . However, we have taken away
some passwords twice: those of form jw****10. There are 604 passwords like
this, so we have “oversubtracted” 604 from the total. So the final result is
608 − 2 × 606 + 604 .
This method of counting — subtract all objects in one class, do the same
with those in another class, then add back those that were common to both
classes — is the first case of the Principle of Inclusion and Exclusion. We
shall deal with this further in Chapter 4.
as: What is the maximum number of pieces remaining after cutting a pancake
with n cuts (none parallel and no three concurrent)?
2
1
3
5
4
6
7
The first thing we do is define a notation and try a few examples. This
is almost always a good start to any kind of problem. We let Pn be the
maximum number of pieces. Then it is easy to see that P0 = 1 (with no cuts,
the pancake is still one piece) and P1 = 2. When we notice that P2 = 4,
we see the progression 1, 2, 4 and wonder whether we might have powers of
two; perhaps, we think, Pn = 2n ? This would make sense if each cut passes
through every region, so that each region is cut into two. However, this does
not happen, and we find P3 = 7, as we can see from Figure 1.1. A few more
tries will give us P4 = 11 and P5 = 16. Clearly, another approach is needed.
How many new regions do we get by adding a new cut? If we have n − 1
cuts in the pancake, and add another cut, the rules require that the new cut
must intersect each of the n − 1 old cuts. If we start the cut on the edge of
the pancake in the middle of a region, we cut along the pancake and cut off a
new region when we reach the first of the n − 1 old cuts. Then as we continue
cutting in a straight line, we intersect each of the other old cuts, cutting off a
new region when we do. Then at the end, we reach the edge of the pancake,
and we cut off a final piece. This means that we have added n pieces; one
for each of the original n − 1 cuts, and one when we reach the edge of the
pancake. This tells us that Pn = Pn−1 + n. This is a formula for Pn , but not
a nice one because we cannot easily calculate, for example, P100 without a
great deal of effort. We will work a little harder and see whether we can find
a more efficient formula.
We start by repeating the formula for larger values of n. We get P1 = P0 +1,
and P2 = P1 +2 = P0 +1+2, then P3 = P0 +1+2+3, P4 = P0 +1+2+3+4, and
so on. The pattern becomes clear, and we write Pn = P0 +(1+2+· · ·+n). Now
we nearly have our answer. The reader may be familiar with the formula for
1 + 2 + · · · + n or of the first n terms of any arithmetic progression; the story
goes that the eminent mathematician Carl Friedrich Gauss (see Appendix
C) found the sum of the first one hundred integers almost immediately by
realizing how the formula worked (for more details, see [15], p. 509). The
4 Introduction to Combinatorics
1 2 3 ... n−1 n
n n−1 n−2 ... 2 1
Each of these rows clearly sums to the same value, S. If we add the columns,
we find that each column adds to n+1, and there are n columns; thus the sum
of all elements in both rows is 2S = n(n+1). Thus 1+2+· · ·+n = n(n+1)/2.
This gives us, finally, our formula for Pn , the maximum number of pieces
after n cuts.
n(n + 1)
Pn = 1 +
2
Sudoku
Over the last few years we have seen a great surge of interest in the sudoku
puzzle. For those few readers who have been vacationing on another planet,
the puzzle consists of a 9 × 9 array, partitioned into 3 × 3 subarrays (sub-
squares), in which some cells contain entries chosen from {1, 2, 3, 4, 5, 6, 7, 8, 9}.
The object is to complete the array so that every row, every column and every
subarray contains each symbol precisely once.
Sudoku was apparently invented by an American architect, Howard Garns
(see Appendix 3), in 1979, but did not achieve great popularity until 1986,
when it started appearing in Japanese publications. Worldwide circulation
dates to about 2004. A nice history can be found in [132].
We’ll use the phrase sudoku square for a completed 9 × 9 square that could
be the solution to a sudoku puzzle. In a well-posed puzzle, there is one and
only one sudoku square that completes the original partial array.
Figure 1.2 shows a typical sudoku puzzle in the top left-hand position. It
needs a 1 in column 3. There are already 1’s in the top left and bottom left
subsquares, so there is only one possible space in the column; the top right
array shows the 1 in place.
Now look at the top right subsquare. It needs a 2, 4, 5 and 7. The only
possible place for a 4 in this subsquare is the middle top. At first it looks
as though the 5 can go in any of the other three vacant cells. However, the
second row is not available (the 2 must go there), and the 7 must go in the
last column (there is already a 7 in the seventh column, and the 4 filled up
the eight column). So the 5 only has one possible home. The completion of
the top right subsquare is shown in the lower left copy.
Continuing in this way, we obtain the sudoku square shown at the lower
right of the figure.
The methods used in solving sudoku are combinatorial in nature. However,
not many of the millions who play sudoku realize that a sudoku square is
an example of a combinatorial object, called a Latin square, that is widely
used in statistical and geometric applications. We shall study Latin squares
in Chapter 11.
Introduction 5
9 6 2 8 1 9 6 2 8
1
1 8 3 1 8 3
2 1 6 9 2 1 6 9
7 8 4 3 7 8 4 3
5 9 4 6 5 9 4 6
6 3 7 8 6 1 3 7 8
5 4 7 8 5 4 7 8
1 9 5 1 9 5
3 2 5 9 4 3 2 5 9 4
9 6 2 8 5 4 1 9 7 3 6 2 8 5 4 1
1 2 8 3 6 1 5 9 4 7 2 8 3
2 1 6 9 7 8 4 2 5 3 1 6 9 7
7 8 4 3 7 2 8 1 6 4 9 3 5
5 9 4 6 5 3 9 8 7 2 4 1 6
6 1 3 7 8 4 6 1 3 9 5 7 2 8
5 4 7 8 2 5 4 7 1 3 8 6 9
1 9 5 1 9 7 4 8 6 3 5 2
3 2 5 9 4 3 8 6 2 5 9 1 7 4
FIGURE 1.2: A sudoku puzzle
from the middle needle to the rightmost needle. This will cause no problems
since the disk on the rightmost needle is the largest, so that any disk may be
placed on it without violating a rule.
It is at least intuitively clear that this technique gives us the most efficient
way to move a stack of n disks. Clearly the basis case uses the fewest possible
moves (one move for one disk, three moves for two disks). Also, it seems clear
that there is no shorter way to move n + 1 disks than by moving the stack
of n disks first. Without going through a rigorous proof, it is at least very
plausible that our approach uses the fewest moves possible.
Now the hard part: How many plays does this method take for n disks?
We denote this (still unknown) quantity by Hn . Clearly, we have H1 = 1 and
H2 = 3. For any n > 2, we can compute Hn = 2 · Hn−1 + 1. This follows
because we use Hn−1 plays to move the n − 1 disks to the middle needle, one
play to move the largest disk to the rightmost needle, and another Hn−1 plays
to move the n − 1 disks from the middle to the rightmost needle.
This kind of formula for Hn , like the formula for Pn of the previous example,
is called a “recurrence” because the expression we are solving for “recurs” in
the equation. This does not give us a simple formula for Hn , but it gives us
a way to calculate it. We will run through a few values.
n 1 2 3 4 5
Hn 1 3 7 15 31
everyone else once. If Adam is going to play every other competitor exactly
once, he would play in two matchups; writing the initials of each player to
represent a game, the schedule could include ABCD and AEFG. But who will
Beth play? One matchup is already given, ABCD. She cannot meet A, C or
D again, so the only possibility is BEFG. But a schedule cannot include both
AEFG and BEFG: pairs like EF would meet twice.
So they decided to try a schedule where everyone plays everyone else twice.
Everybody will have four games (each person must meet six opponents twice
each — 12 appearances — and each game accounts for three). We may as well
assume Adam plays in ABCD. He must play against Beth again, and the two
matches AB... could have a total of four, three or two players in common. If
we try four players — that is, use the matchup ABCD again — Adam’s other
two games must be AEFG twice. But Beth has been scheduled against A, C
and D twice, so her other two matchups must each be BEFG, and EF (as well
as other combinations) has occurred too many times. Similarly, if there are
two games with three players in common, say ABCD and ABCE, we strike
problems: Adam plays twice more, and must meet both F and G twice. The
only possibility is ADFG, AEFG. But the same argument shows that we must
have BDFG and BEFG. Now F and G have played each other too often.
Okay, this argument shows that the two AB... matchups have no other
member in common, and the same must apply to all other pairs. So no
two games can have three players in common. Try to start with ABCD and
ABEF. Adam’s other two matchups have the form A...G, in order for him to
meet Greg twice. They can’t use B again, and ACDG would have three in
common with ABCD, so they try ACEG and ADFG (or ACFG and ADEG,
which would be equivalent, just exchange two names). The same argument,
avoiding three in common with the first two games, leads to either BCEG or
BCFG, and BCEG clashes with ACEG, so they chose BCFG and BDEG. The
final matchup is CDEF, and the schedule is
The players are very happy — and then Helga joins their group. What
now? And what if other players join up?
Let’s write v for the number of players, and say each pair play together λ
times. Then each player has λ(v −1) instances of an opponent. Each matchup
accounts for three of these. So each player takes part in λ(v − 1)/3 games.
You can’t schedule partial games, so λ(v − 1) must be a multiple of 3. So, for
v = 8, λ must be 3 or 6 or . . . . For the 8-player version, the smallest possible
case is λ = 3, in which case there will be 14 games and each player is in three
of them.
The wargamers didn’t feel up to calculating a schedule for 14 games, so
they started playing the 7-player version again. Each week they scheduled
one game. Each week the other three players came to watch, and played a
game with Helga. And, at the end of seven weeks, they realized they had
Introduction 9
The problem here is, given a set with v elements (the players), to choose a
collection of subsets of equal size (4 in the example, more generally written
k) such that every pair of elements occurs in the same number of subsets (our
λ). This is called a balanced incomplete block design, and we’ll study them
in Chapter 12. The word “balanced” refers to fact that pairs occur together
equally often, “incomplete” to the fact that k is smaller than v (or else there
would be no problem), and the equal-size subsets are called “blocks.” It is
called a design because the main application is in the design and statistical
analysis of experiments. The numbers v, k and λ are the parameters of the
design (together with b, the number of blocks, and r, the number of blocks
in which a given object occurs; but b and r can be calculated from the other
parameters). It is common to refer to these designs by specifying their pa-
rameters, for example one says “a (v, b, r, k, λ)-design”; the wargamers’ first
example is a (7, 7, 4, 4, 2)-design.
We have already seen that some sets of parameters are impossible, because
r and b have to be integers. But there are other cases, for example v = 15, k =
5, λ = 2 (for which r = 7 and b = 21, both whole numbers) for which there
is no design; and there is an infinitude of parameter-sets for which we do not
know whether a design exists.
The second example — the 8-player schedule — is an (8, 14, 7, 4, 3)-design
in which the blocks can be partitioned into sets, where every object belongs
to exactly one member of each set. This special case is called a resolvable
balanced incomplete block design. These designs are of special interest for
statisticians and also arise in finite models of Euclidean geometry.
As you would expect, the players meet beforehand to discuss their options
and choose a strategy. The organizers say they decide on the hat colors by
tossing a coin for each player, so that the allocations are independent and
each player has a 50-50 chance of red or black. We’ll assume they are telling
the truth, and we’ll also assume the players don’t try to concoct any type of
cheating scheme. What is the team’s best plan?
One obvious strategy would be for the team to nominate one of their number
who will always say “red” while the other two players always pass. This
would give them a 50% chance of winning the prize. Can they do better?
Most people, and in fact most mathematicians, initially think not. Since
each person’s hat color is independent of the other players’ colors and no
communication is allowed, it seems impossible for them to learn anything just
by looking at one another; all the players can do, it seems, is guess.
But in three out of four cases, we expect two of the players will have hats of
the same color and the third player’s hat will be the opposite color. The group
can win every time this happens if the players follow the following strategy:
Once the game starts, look at the other two players’ hats. If you see two hats
of different colors, pass. If they are the same color, guess that your hat is
the opposite color. Every time the hat colors are distributed two and one,
one player will guess correctly and the others will pass, and the team will win
the game. When all the hats are the same color, all three players will guess
incorrectly and the group will lose; but on average this will happen in only a
quarter of cases.
There are eight ways the hats can be distributed: RRR, RRB, RBR, RBB,
BRR, BRB, BBR and BBB (from left to right). Suppose the game was played
eight times, and suppose it just so happened that every possible combination
occurred once. In the first and last cases, all three players make the wrong
guess; in the other six there is just one correct guess. So, of the twelve guesses,
half are right and half are wrong, as you would expect.
How about more players? With four team members, the easiest strategy is
to tell one player to stay silent throughout. The other three don’t even look
at that player! They play as they would if Number Four was not there: each
looks at the remaining two players and proceeds as if it was a team of size
three. They still have a 75% chance of winning.
The Hat Game problem was introduced by Todd Ebert in his dissertation
[27], and is in fact related to error-correcting codes. It has been discussed in
the press [86], and a recent survey paper is [16]. We’ll examine the problem
further, and explain the connection to error-correcting codes, in Chapter 10.
the concepts of Latin Squares and orthogonality (see Chapter 11.1). He also
made equally significant contributions to analytic geometry, trigonometry,
geometry, calculus and number theory.
In 1735, Euler spoke to the St. Petersburg Academy on a problem in recre-
ational mathematics. The Prussian city of Königsberg was set on both sides
of the Pregel River. It included a large island called The Kneiphof, and the
river branched to the east of it. So there were four main land masses — let’s
call them the four parts of the city, and label them A, B, C, D — connected
to each other by seven bridges, as shown in the rough map in Figure 1.4:
B
D
The problem was to find a walk through the city that would cross each
bridge once and only once, and visit all four parts. The only way to go
between the different pieces of land was to cross the bridges.
So we have a combinatorial problem. We have a set with seven elements —
the seven bridges — and we need to find out whether they can be arranged in
a certain way, specifically so that the corresponding bridges could be traversed
in the given order.
The solution is very easy. Look for example at the north bank of the river,
part A. Whenever you walk over a bridge that leads to A, your next bridge
must take you back out of A. So walking into A and out again uses up two
bridges (we say “uses them up,” because you can’t cross a bridge twice).
There are three bridges; the walk must take you onto A and off again once,
and there is one bridge left over. The only possibility is that the walk must
start or finish in A (but not both).
The same argument can be applied to C and D, (with three bridges each),
and to B (five bridges, so you walk through B twice). Each part of town is
either the start or finish. But a walk can have only one start, and only one
finish, and there are four parts of town! This is clearly impossible, so there is
no such walk.
Of course, Euler proved that no walk is possible. But he did much more.
As we said, he essentially invented graph theory and showed how it could be
used to represent any set of islands and bridges, or indeed any set of towns and
roads joining them, and concocted an algorithm for traversability problems.
12 Introduction to Combinatorics
similar diagrams were studied earlier by Leibniz and Euler, and related ideas
were studied by Lull as far back as the 13th Century (see, for example, [5]). It
has recently become fashionable to refer to “Euler diagrams,” but Venn was
primarily responsible for their modern usage.
For example, the Venn diagrams or R ∪ S, R ∩ S, R, R\S and R ∩ S ∩ T
are shown in Figure 1.5.
R S R S
R !S R"S
R R S
_
R R\S
R
S T
R"S"T
S × T = {(s, t) : s ∈ S, t ∈ T }.
The obvious equivalence relation is equality, on any set. In sets other than
number sets, equal objects are often called “equal in all respects.” More
generally, an equivalence relation can be considered as a statement that two
objects are “equal in some (specified) respects.” One example, on the integers,
is the relation α, where a α b is true if and only if a = ±b — a and b have the
same absolute value. Another, is congruence, on the set of all plane triangles.
Equivalence relations give us an alternative way to discuss multiple ele-
ments. You can view a multiset as an object based on a set of distinct ele-
ments on which an equivalence relation has been defined, so that the elements
of a multiset are the equivalence classes of the underlying set.
One of the most important proof techniques for working with finite sets or
with sets of integers is the method of mathematical induction, the application
of the principle of mathematical induction:
Suppose the proposition P (n) satisfies
(i) P (1) is true; and
(ii) for every positive integer n, whenever P (n) is true, then P (n + 1) is
true.
Then P (n) is true for all positive integers n.
If you are not familiar with induction, or need to review the topic, we treat
it in detail in Appendix 1.
nine entrees, and seven desserts, the number of meals consisting of one salad
and one entree and one dessert is 2 × 9 × 7 = 126.
Although these principles seem painfully obvious, each may be proved by
results from set theory; for instance, the Multiplication Principle follows from
the fact that the cardinality of a Cartesian product of sets is the product of
the cardinalities of the underlying sets. However, we prefer to emphasize the
uses rather than the proofs of these principles.
Example 1.1: We wish to have lunch at a fast-food place, and there are
three within walking distance. One place offers 8 soft drinks, 7 sandwiches,
and 2 choices of a “side dish” (French fries or onion rings); another offers only
6 drinks, but 10 sandwiches and 2 sides; and the last (a coffee shop) offers
16 drinks, 5 sandwiches, and only one side. How many different lunches are
possible?
The Addition Principle says that (because we can eat lunch at only one
place) the answer is the sum of the number of ways to eat lunch at each place.
The Multiplication Principle says that each place has a number of options
equal to the product of the options at each stage: drink, sandwich, and side.
So the first restaurant offers us 8 × 7 × 2 = 112 possibilities; the second,
6 × 10 × 2 = 120; and the third, 16 × 5 × 1 = 80. Altogether, then, there are
112 + 120 + 80 = 312 possibilities for lunch. !
The next few examples will introduce some mathematical concepts that
may already be familiar to the reader. These concepts arise frequently in
enumeration problems. The reader should already be familiar with n! to
denote the product 1 · 2 · · · · · n. By convention, we assume 0! = 1! = 1.
Example 1.2: A set has n distinct elements. How many subsets does it
have?
We line the elements of the set up in some order; beneath each, we will
place a mark if the element is in our subset, and no mark if the element is
not. We will make n decisions as we go through the list of elements, and each
decision has two alternatives, mark or no mark. Since no decision will affect
any other decision, we see that there are 2n subsets of a set of n elements. !
Example 1.3: Suppose we have five tunes stored on our portable digital
music player, and we wish to listen to each of them one after another. How
many ways are there to arrange the playlist?
We have five tunes, so there are five possibilities for the first tune. Once
we have chosen this tune, then regardless of which tune we choose to play
first there are four tunes left (because we don’t wish to repeat a tune). After
we choose the second tune, there are three possibilities left, and so on. The
result is that we may choose a playlist in 5! = 5 × 4 × 3 × 2 × 1 ways, by
the Multiplication Principle. In more general terms, we find that there are n!
Introduction 17
Example 1.4: A license plate consists of three letters of the alphabet and
three digits from 0 to 9, with the letters preceding the digits. How many
license plates are possible? How many are possible if we do not use any letter
twice? How many are possible if we may use letters twice but not digits? How
many if we do not use either twice?
We imagine six boxes in a row as shown.
For the first box, we may choose any of the 26 letters, so we have 26 choices.
For the first question, where we may repeat letters and digits, we have 26
possible choices for each of the next two boxes as well. The last three boxes
each have 10 possibilities. It follows from the Multiplication Principle that
there are 263 · 103 possible license plates. If we may not repeat a letter, then
we must work a little harder; the second box has only 25 possible letters, and
the third has only 24. We then get 26 · 25 · 24 · 103 possible plates. In the
same way, there are 263 · 10 · 9 · 8 plates where letters may be repeated but
digits may not; and 26 · 25 · 24 · 10 · 9 · 8 possible plates where neither may be
repeated. !
Example 1.5: How many n-digit numbers in base k are there if we do not
allow a leading digit of 0? How many numbers without leading zeros in base
k are there with at most n digits?
We recall that a number in base k has possible digits 0, 1, . . . k − 1, so that
each of the n digits may be assigned any of the k symbols, except for the
first. We apply the Multiplication Principle to see that there are (k − 1) · kn−1
possible numbers. To find how many numbers of at most n digits in base k
there are, we may simply permit leading zeros; so the number 1 (in any base)
might be considered a “five-digit number” 00001. We find that there are kn
such numbers. !
1.4 Graphs
A great deal has been done in the special case where all sets have precisely
two elements. In that case the members of the universal set are often repre-
sented graphically, as points in a diagram, and the set {x, y} is represented
by a line drawn joining x and y. Provided the universal set is not empty, such
a structure is called a graph. The sets are called edges (or lines), and the
elements of the universal set are vertices (or points). The universal set is the
vertex-set of the graph. For any graph G, we write V (G) and E(G) for the
sets of vertices and of edges of G.
The edge {x, y} is simply written xy, when no confusion can arise; x and
y are called its endpoints. When x and y are endpoints of some edge, we say
they are adjacent and write x ∼ y for short; the vertices adjacent to x are
called its neighbors. The set of all neighbors of x is its (open) neighborhood,
N (x). If x and y are not adjacent we write x (∼ y.
Two vertices either constitute a set or not, so a graph can never contain two
edges with the same pair of vertices. However, there are some applications
where two edges joining the same vertices might make sense. For this reason
we sometimes talk about networks or multigraphs in which there can be several
edges joining the same pair of vertices; those edges are called multiple edges.
Another generalization is to allow loops, edges of the form xx. There is
no very good term for a graph-type structure in which loops are allowed,
and we will usually call one of these a “looped graph” or “looped network”
or“network with loops” although strictly speaking it is not a graph or network
at all. Moreover, when no confusion arises, the word “graph” can be used for
any generalized graph.
Any binary relation can be represented by a diagram. If ρ is a binary
relation on the set S, the elements of S are shown as vertices, and if xρy is
true, then an edge is shown from x to y, with its direction indicated by an
arrow. Provided the set S is finite, all information about any binary relation
on S can be shown in this way. Such a diagram is called a directed graph
or digraph, and the edge together with its arrow is called an arc. If ρ is
symmetric, the arrows may be dropped and the result is a graph (possibly
with loops).
Several families of graphs have been studied. Given a set S of v vertices,
the graph formed by joining each pair of vertices in S is called the complete
graph on S and denoted KS . Kv denotes any complete graph with v vertices.
As you would expect, we often call K3 a triangle. The complete bipartite
graph on V1 and V2 has two disjoint sets of vertices, V1 and V2 ; two vertices
are adjacent if and only if they lie in different sets. We write Km,n to mean a
complete bipartite graph with m vertices in one set and n in the other. K1,n
in particular is called an n-star . Figure 1.6 shows copies of K6 and K3,4 .
Introduction 19
Suppose H is a graph all of whose vertices and edges are vertices and edges
of some graph G — that is, V (H) ⊆ V (G) and E(H) ⊆ E(G). Then H is
a subgraph of G; we write H ≤ G. Every graph G has itself as a subgraph;
if H is a subgraph of G but H (= G, H is a proper subgraph of G, and we
write H < G. In particular, if S is some set of vertices of G then +S,G is
the subgraph consisting of all edges of G with both endpoints in S. If G
is a complete graph whose vertex-set contains S then the subscript “G ” is
dropped, and +S, is the complete subgraph based on S. Any subgraph of a
complete bipartite graph is itself called bipartite.
Instead of saying Figure 1.6 shows two graphs, we could say it is a single
graph that consists of two separate subgraphs, with no edges joining one part
to the other. We call such a graph disconnected ; a graph that is all in one piece
is called connected. The separate connected parts of a disconnected graph are
called its components.
The graph G is trivially a subgraph of the complete graph KV (G) . The set
of all edges of KV (G) that are not edges of G will form a graph with V (G) as
its vertex set; this new graph is called the complement of G, and written G.
More generally, if G is a subgraph of H, then the graph formed by deleting
all edges of G from H is called the complement of G in H, denoted H − G.
The complement K S of the complete graph KS on vertex set S is called a null
graph; we also write K v as a general notation for a null graph with v vertices.
Figure 1.7 shows a graph and its complement.
A A
B C B C
D E D E
G G
FIGURE 1.7: A graph and its complement
20 Introduction to Combinatorics
Proof. Suppose the graph or multigraph has e edges; label the edges, say
y1 , y2 , . . . , ye . Consider a list in which each edge appears twice, once for each
endpoint. For example, if y1 has endpoints x4 and x7 , you might make entries
y1 : x4 and y1 : x7 . Vertex x will appear in precisely d(x) entries, so the total
number of entries equals the sum of the degrees of the vertices. On the other
hand, each edge appears twice, so the total number of entries equals twice the
number of edges. !
COROLLARY 1.1.1
In any graph or multigraph, the number of vertices of odd degree is even. In
particular, a regular graph of odd degree has an even number of vertices.
Suppose you will encounter two graphs with exactly the same structure but
different vertex-sets. For example, look at Figure 1.7 again; the two subgraphs
with vertex-sets {B, D, E} and {C, D, E} are both triangles. There is no
real difference between them until you need to consider the meaning of the
vertices. Formally, we say two graphs G and H are isomorphic if there is
a one-to-one correspondence between their vertex-sets V (G) and V (H) such
that two vertices of G are adjacent if and only if the corresponding vertices
of H are adjacent. For example, any two complete graphs with v vertices are
isomorphic.
Not all graphs with the same number of vertices are isomorphic; for ex-
ample, the graph G of Figure 1.7 and its complement are quite different, but
both have five vertices.
SDR for D to be a way of selecting a member xi from each set Bi such that
x1 , x2 , . . . are all different.
As an example, consider the sets
1, 2, 3, 5, 4, 6
(where the representatives are listed in the same order as the sets). There are
several others. On the other hand, the sets
have no SDR.
If the collection of sets D is to have an SDR, it is clearly necessary that
∪B∈D B have at least as many elements as there are sets in D. The example
above shows that this is not sufficient.
Exercises 1A
1. The seven wargamers decide to play a new game, where players compete
in groups of three. Show that they can find an equitable schedule of
seven games.
2. In each case, represent the set in a Venn diagram.
(i) R ∪ S ∪ T (ii) R ∪ S ∪ T
3. Show that the Hat Game team has at least a 75% chance of winning,
for any number of players greater than 3.
4. Find a formula for the sum of the first n odd positive integers,
1 + 3 + . . . + (2n − 3) + (2n − 1)
(i) using Gauss’s formula for the sum of the first n positive integers;
(ii) using induction.
5. Prove by induction that
n
!
i(i + 1) = 13 n(n + 1)(n + 2).
i=1
10. A state has license plates consisting of two letters and four digits. How
many license plates are possible?
11. Suppose a set X has 2n + 1 elements. How many subsets of X have n
or fewer elements?
12. What are the degrees of the vertices in these graphs?
13. A graph has 48 edges. There are no isolated vertices. What are the
minimum and maximum numbers of vertices the graph can have?
14. How many edges does the star K1,n have? What are the degrees of its
vertices?
15. Eight people attend a meeting. At the beginning various people shake
hands. In total there are eighteen handshakes.
(i) Show that there is at least one person who shook hands at least
five times.
(ii) Is it possible there were exactly three people who shook hands an
odd number of times?
16. Do there exist SDRs for the following sets?
(i) 12, 145, 12, 123
(ii) 123, 145, 12, 13, 23.
Exercises 1B
1. The seven wargamers have become more ambitious. They wish to play
a tournament as follows: each week two groups of three (with no one in
common) play; the seventh member acts as host. Find a schedule for
them to do this in seven weeks.
2. In each case, represent the set in a Venn diagram.