Escolar Documentos
Profissional Documentos
Cultura Documentos
Discrete Mathematics
for
Computer Scientists
and
Mathematicians
Joe L Mott
Abraham Kandel
Theodore P. Baker
The Florida State University
Department of Mathematics and ComputerScience
1986
\302\251 by Joe L. Mott, Abraham Kandel and Theodore P. Baker. All rights reserved. No part of
this book may be reproduced in any form, by mimeograph or any other means, without permission
in writing from the publisher.
-203-1502-0
ISBN-978-81
Published by Asoke K. Ghosh, Prentice-Hall of India Private Limited, M-97, Connaught Circus,
New Delhi-110001 and Printed by V.K. Batra at Pearl Offset Press Private Limited,
New Delhi-110015.
Contents
Preface,vii
Acknowledgments, xiii
A Note to the Reader, xiv
Foundations, 1
1.1 Basics, 1
1.2 Sets and Operations of Sets, 2
1.3 Relations and Functions,9
1.4 Some Methods of Proof and Problem-Solving Strategies, 17
1.5 Fundamentals of Logic, 33
1.6 Logical Inferences, 45
1.7 Methods of Proof of an Implication, 60
1.8 First Order and Logic Other Methods of Proof, 79
1.9 Rulesof Inference for Quantified Propositions, 97
1.10 Mathematical Induction, 103
Elementary Combinatorics,125
2.1 Basics of Counting, 126
2.2 Combinations and Permutations, 143
2.3 Enumeration of Combinations and Permutations, 147
2.4 Enumerating Combinationsand Permutationswith Repetitions,
162
2.5 Enumerating Permutations with Constrained Repetitions, 172
2.6 Binomial Coefficients, 189 ,
2.7 The Binomial and Multinomial Theorems, 201
2.8 211
The Principle of Inclusion-Exclusion,
RecurrenceRelations, 237
5 Graphs, 437
5.1 BasicConcepts, 437
Index, 739
Preface
00
i-o
IX
we discuss the asymptotic behavior of functions and the \"big O
Chapter 3
Chapter 2 Chapter 6
Chapter1 Chapter 4 -\342\226\272
Chapter 8
Chapter 5 Chapter 7
Chapter 8
isintroductory
Chapter 1,ofcourse, and as much or as little of it can be
discussed as needed depending on the background of the students. Most
students likely have been exposed to the material of Sections1.1,1.2,and
1.3 except possibly the definitions in Section 1.3of equivalencerelations,
composition
of relations, and one-to-one and onto functions.
We recommend covering, at the minimum, Section 1.7 (Methods of
Proof of an Implication) and Section 1.10 (Induction).Sections 1.5and
1.6 contain introductory material on logic and is the foundation upon
which Section 1.7 is built. A thorough understanding of proof by
induction is, in our opinion,absolutely essential.
Discrete I:
Sections 1.5 to 1.10of Chapter 1 (Section 1.9 is optional), Chapter 2,
and Chapter 5 (at least Sections 5.1 to 5.6)
DiscreteII:
Chapters 3,4, 7, and selected topics from sections5.7to 5.12as time
permits.
We appreciation
express to the Sloan Foundation for the grant
our
awarded departments of Mathematicsand ComputerScience
to the at
mathematics 'uq. the curriculum, and we appreciate the support that the
Foundation has given us.
To our colleagues and friends who have taught from an earlier version
of the book and madesuggestions for improvement we say a heartfelt
thank you.
The editorial staff at Reston Publishing have been a great help and we
thank them.
Portionsof
the material in Chapter 8 are based on recent work by Lofti
A. Zadeh [50], Maria Zemankova-Leechand Abraham Kandel [52],
L. Applebaum and E. H. Ruspini and many researchers [46],
in the fields
of fuzzy set theory and artificial intelligence. Special thanks are due
Dalya and Peli Pelled, who provided the desk upon which A. Kandel
wrote Chapter 8.
We wish to expressour gratitudeto severalpeople
who helped with the
preparation of themanuscript. SheilaO'Connelland Pam Flowers read
early versions and made severalhelpful suggestions while Sandy Rob-
bins, Denise Khosrow,Lynne Pennock, Ruth Wright, Karen Serra, and
Marlene Walker typed portions of the manuscript for the first edition.
XIII
A Note to the Reader
Abraham Kandel
Theodore P. fiaker
1
Foundations
1.1 BASICS
sets. The notation, terminology, and conceptsof set theory are helpful in
studying any branch of mathematics. Every branch of mathematics can
be considered as a study of sets of objects of one kind or another.For
example, algebra is concerned with sets of numbers and operationson
those sets whereas analysis deals mainly with sets of functions. The study
of sets and theirusein the foundations of mathematics was begun in the
latter part ofthe nineteenth century by Georg Cantor (1845-1918). Since
then, set theory has unified many seemingly disconnected ideas. It has
helpedto reducemany mathematical concepts to their logical
foundations in an elegant and systematic way and helped to clarify the
\342\200\242
a crowd of people,
\342\200\242
a herd of animals,
\342\200\242
a bunch of flowers, and
\342\200\242
a group of children.
1
2 Chapter 1:Foundations
Ijla(x)
= 1 if x G A,
Ijla(x)
= Oif x $ A,
for all x in [/, where Uis the universal set, sometimes called the \"universe
of discourse,\"or just the \"universe,\" which is a fixed specified set
describingthe contextfor the duration of the discussion.
If the discussionrefersto dogs only, for example, then the universe of
discourseis the classof dogs.In elementary algebra or number theory,
Section 1.2 Sets and Operations of Sets 3
3.
5. Describe a set by an operation (such as union, intersection,
complement, etc.) on some other sets.
Let A denote the set. Then the set A can be described in the following
ways:
1. A = {x | x is a nonnegative integer lessthan or equal to 5}.
2. A =
{0,1,2,3,4,5}.
(l for x = 0,1,.. .,5,
3. 0 otherwise.
pA(x)
Definition 1.2.2. Two sets A and B are equal iff A C B and B CA.
We write A = B.
Therefore, we have the following principle.
Principle. To show that two sets A and B are equal, we must show
that eachelementof A is also an element of B, and conversely.
the sets 0 and {0} are very different sets. The former has no elements,
whereas the latterhas the unique element 0. A set containing a single
element is calleda singleton.
We shall now describe three operations on sets; namely, complement,
union, intersection.
and These operations allow us to constructnew sets
from given sets. We shall also study the relationships among these
operations.
Definition 1.2.3. Let U bethe universal set and let A be any subset
of U. The absolute complement of A, A, is defined as {x \\ x $ A} or,
{x | x G f/and x $ A}. If A and B are sets, the relative complementof
A with respect to B is as shownbelow.
sets, thentheir union is the setofall objects which belong to at least one
of them,and is denoted by
\342\200\242
\342\200\242
AXUA2U^ UAn,orby \\jAj.
7-1
Union Intersection
Idempotent: AU A = A A C\\ A = A
Commutative: AU B = BU A A C\\ B - B C\\ A
Associative: A U (B U C) = (A U B) U C A D (B D C) = (A D B) D C
(A U B) H C # A U (B H C).
c n u u B) - (c n A) u (c n b),
c u (a n b) =
(c u a) n (c u b).
6 Chapter 1: Foundations
(A U B) - A O B,
(A O B) = A U B.
A U B = (A H B )=U- (A H B) - (A H B) U (A O B) U (A O \302\243).
Set B is contained
in set A
BCA
The intersection of
AH B *V\\ B
sets A and B
The symmetrical
difference of A A B
sets A and B
Example 1.2.2.
A -
(A - B) = A -
(A Pi B) (by definition of A - \302\243),
P(A) = {{0},{a},{6},{c},{a,6},{6,c},{c,a},{a,6,c}}.
(A U B) n (B U C) C A O B.
(A n B) n (A u b) n (a u o
is
(A U B) U (A H (B U C)).
A0
= {a | a < 1}
Ak
=
{a\\a<l + 1AU = 1,2,....
Provethat
9. List the elements of the set {a/b: a and 6 are primeintegers with
2. It is observed unrestricted
that freedom in using the concept of
\"set\" must to contradiction. One of the paradoxes,
lead exhibited
by Bertrand Russell, may be formulated as follows. Most sets do
not contain themselves as elements. For example, the set A of all
integers contains as elementsonly integers; A, being itself not an
integer but a set of integers, d oes not contain itself as element.
Such a set we may call \"ordinary.\" There may possibly be setsthat
do contain themselves as elements; for example,the set defined S
as follows: \"S contains as elements all sets definable by phrase of
less than ten words\"couldbe considered to contain itself as an
element. Such setswe might call \"extraordinary\" sets. In any case,
however, most sets will be ordinary, and we may exclude the erratic
behavior of \"extraordinary\" sets by confining our attention to the
set of all ordinary sets. Call this set C. Eachelement ofthe set C is
itself a set; in fact an ordinary set.The question now arises, is C
itself an ordinary setor an extraordinary set? It must be one or the
other.If C is ordinary, it contains itself as an element, since C is
defined as containingall ordinary sets. This being so, C must be
extraordinary, sincethe extraordinary sets are those containing
themselves as members.Thisisa contradiction. Hence C must be
extraordinary. But then C containsasa member an extraordinary
set (namely C itself), which contradicts the definition whereby C
was to contain ordinary sets only. Thus in either case we see that
the assumption of the mereexistence of the set C has led us to a
contradiction.
3. Suppose that there are two empty sets, 0 x and 0 2. Since 0 x and
Ax x A2 x \342\200\242
\342\200\242
\342\200\242
x An = {(ax, a2,..., an) | Ai9 i
a,- \302\243E
- 1, 2,..., rc}.
The expression (ax, a2,..., an) is called an ordered n-tuple.
From the definition of the Cartesian product we have seen that any
element (a,6) in a Cartesian product A x Bis an ordered pair. No
just
relationshipis required between the objects a and 6 for them to form an
dom R =
{x\\xEl A and (xfy) (E R for some y (E B\\.
ran R =
{y\\y G B and (x,y) R for
\302\243E some jc G A}.
Section 1.3 Relations and Functions 11
R is an
equivalence relation in N because the first two conditions are
clearly satisfied. As to the third condition,i f x + y and y 4- z are divisible
by 2, then x + (y 4- y) 4- z is divisible by 2. Hence x + 2 is divisible by 2.
In this equivalence relation all the odd numbersareequivalent and so are
all the even numbers.
general a = but,
\302\2616, in this case, since a and b are positive integers,
a = b.
0 n,
\342\200\242
so that a = a mod n for each integer a. Symmetry: If a = b mod n,
then a - b = /en, where & is some integer. But then b - a = (-k)n, so that
6 = a mod n. Transitivity: If a = b mod n, and 6 = cmodn, then a - b =
kn and 6 - c = mrc where & and m are integers. Therefore, by adding
thesetwo equations we have a - c = (k + ra)n, and we conclude a == c
modrc.
Now if a is a given integer, let [a] denote the set of all integers b such
that a = b mod n.The set [a] is called the congruence class (or
equivalence class) containingthe integer a and a is called a
of
representative the congruence class. Thus, [a] = {a + kn\\k is any integer}. In
particular, are five
if n = 5, then there different congruence classes for the
relation congruencemodulo5, namely,
= {5fe \\k G A}
[0]
= + A}
[4] {5fe 4|feG
Each integer belongs to one and only one of these equivalence classes
because the remainderis uniquely determined when an integer is divided
by 5.
Functions
Definition1.3.5. For any relation R from A to B and for any aG A
R-l = {(y,x)eBxA\\(x9y)eR}
=
R(a) {yGB\\(a9y)\302\243R}
R-\\b)-{xeA\\(x9b)ER}
Section 1.3 Relations and Functions 13
set R
~l is itselfa relationfrom B to A relates
The where, by definition, y
to x under R -1 iff x relates to y under R. Thus,ifR is the relation defined
on the set of real numbers by xRy iff x < y, then cR~ld meansc > d.
Likewise, if R is the relation on the set Z of defined
integers by xRy iff x
divides y, then R'1 is the relationwhere cR~ld means c is an integral
multiple of d. The set R(a) contains all elements of B to which the
elementa is related under R and can be viewed as the^setof images of a.
In general, R(a) may be either empty or contain many elements. But if R
is a function from A to B, then for each a G A, not only is R(a)
nonempty, but, morethan that, R(a) contains precisely one element.
Let us reiterate this observation in another way in the following
definition of function. The words mapping, transformation,
correspondence, and operator are among these words that are sometimes
usedas synonyms for function.
f(xi)
= y and f(x2) = y impliesxx =
x2. Thus, / is one-to-one iff for each b
G ran ~l(b)containsexactlyoneelement.
/, /
Ifwe describe/ ~l{b) as the set of preimages of b, then /is one-to-one
if for each b G ran /, b has precisely one preimage.
14 Chapter 1:Foundations
fl(r) = {1,2}.
/ = {(r,l),(5,2), (\302\243,2)}is a
The set function from A to B but / is not
one-to-onesince/ -1(2)= {s,t}. Likewise, / is not onto B since/ _1(3)
- 0,
the empty set.
The function g (5,2), (\302\243,3)}is both a one-to-one and an onto
= {(r,l),
function from B. Moreover, g\"1 = {(l,r), (2,5),(3,\302\243)}.
A to
On the other hand, the function h:C \342\200\224\342\226\272
B defined as h = {(r,l), (5,1),
(\302\243,2),(u,3)} is onto, but not one-to-one since /i-1(l) = {r,s}.
Definition1.3.9. Let R be a relation from A to B and S a relation
from B to C. The composition of i? and S, denotedby i? \342\200\242
S or simply
relation from A to C given
i?S, is the by aRSc iff there is an element 6GB
such that aRb and 6Sc.Inotherwords, a relates to c under RS iff a relates
to some 6GB under R where to c under S.
6, in turn, relates
ThesetB in the composition GB x C servesas an
of R C A x B and S
intermediary for establishing a correspondence between the sets A and C.
For instance, suppose that A is a set of hospital patients, B is a list of
symptoms, and C is a list of treatments. Suppose,moreover,that R
relates a patient to his symptoms,and S relates symptoms to appropriate
(c) R = {(j,k)\\(j-k)2\302\243A}.
(d) # - {(jjk)\\j/k is a prime}.
2. Let # be the relationfrom A -{1,2,3,4,5} to B = {1,3,5}
which is
10}. Find
(a) the domainand rangeofR
(b) A\"1
7. Let L be the setof lines in the Euclidean plane and let R be the
relation in L defined by \"x is parallel to y.\" Is R a symmetric
relation? Why? Is R a transitive relation?
8. Replace the sentence\"x is parallel to y\" by the sentence \"x is
a one-to-one correspondence.
14. If f:A \342\200\224+
B and C are both one-to-one
g:B \342\200\224\342\226\272 correspondences,
prove that / g is a one-to-one correspondence.
\342\200\242
15. Showthat the function / from the reals into the reals defined by
f(x)
= x3 -f is a one-to-one,ontofunction
1 and find / _1.
(a) b(x,y) = x - y
(b) b{x,y)=x2+ y2
(c) b(x,y) = max{x,y], where max{x,y}denotesthe largerof the
two numbers = 7,max{-6,2}
x and y. (For example,max{5,7} =
2.)
{integers}.
(b) f{x) = x2 where A ^/(positive integers}, where A - {integers/,
' whereA = {real numbers}.
20. If A - {1,2,3,4} and R =
{(1,2),(2,3),(3,4), (4,2)} and S = {(1,3), (2,4),
(4,2), (4,3)},then computeR.S,S-R, and R2.
Section 1.4 Some Methods of Proofand Problem-Solving Strategies *7
(c) /i = {(l,d),(2,6),(3,a),(4,c)}
22. Supposethat a,b,c are integers, where a ^ 0. Supposea divides 6
10. Any subset of the \"diagonal line\" of A x A, that is, any relation R
find this topic interesting, the booksby G. Polya, How to Solve it [32],
Induction and Analogy in Mathematics [33], Patterns in Plausible
Inference [33],and MathematicalDiscovery [34] are delightful reading,
instructive, and most informative.
To some \"prove\" is a frightening word,but it shouldnot be so;
the word
it only signifiesthis problem,\" and solving a problemjust means
\"solve
finding a way out of a difficulty, a way around an obstacle, a way of
attaining a goal that otherwisewas not immediately accessible. In other
words, solving problemsis a vital part of life, and, as in life, we may need
to improvise and apply ad hoc techniques.But with each successful
completion of a task, we become more capable of completing the next
assignment.
Problem solving is part science and part art but is mostly hard work. It
is a science in that there are severaloft-repeated principles applied to
varied types of problems. It is also an art because principles or rules
cannot be applied mechanically but involve the skill of the student.
Moreover,just as in playing an athletic game or a musicalinstrument,so
alsoin problem solving this skill can only be learnedby imitation and
practice. We contend that interest, effort, and experience are the
primary factors to solvingproblems.Thus, you the reader will be your
own best teacher. Any solution that you have obtained by your own effort
and insight, or one that you have followed with keen, intelligent
concentration, may become a pattern for you, a modelthat you can imitate with
success in solving similar problems.
We ask you to approach each problem with an attitude of research, to
not only solvethe problem at hand, but also to seek out the key ideas and
techniques that made the solutionpossible. The generalproblem-solving
methods taught in this section and throughout the book will never never
compensate for lack of relevant knowledgeor intelligenteffort. Our
discussion can take you only so far; you have to go the rest of the way on
your own.
of any problem worthy
The solution of the name will likely require
some critical insight.Consequently, you simply must become familiar
with the problem, gain information, and observe patterns to put yourself
in a position to have the critical insight.Without insight, method is
largely useless.
This insightis gainedthrough hard work and hard work only. We agree
with Thomas A. Edison who is supposedto have said that genius is two
percent inspiration and ninety-eightpercentperspiration.
We will get you started by introducing you to somegeneralmethodsof
approaching problems; specific tools like the inclusion-exclusion
principleand the methods of recurrence relations and generating functions are
all to be discussed in later chapters.
Severalthings must be clearly established before a solution of a
problemshould be attempted. For one thing, you must devisea plan of
Section 1.4 Some Methods of Proof and Problem-Solving Strategies 19
attack. We will give some more hints on this, but generally you will learn
best by experience, so for a while your best plan may be to imitate what
you have seen others do. It therefore becomesnecessary for you to
understand and record, for future reference, solutions suitable for
imitation.
But before you can imitate you will have to be able to analyze what has
been done. The solution of any problem consistsof two major parts: the
discovery of the solutionand the presentation ofthe solution. There are
two halves; one isn't completewithout the other. Discovery is the cause,
presentation is the effect; discovery is generally private while
presentationis public. In fact, you usually confront solutionsin their finished,
polished form rather than while they are in the making, and therefore all
the guesses, questions, false starts,and blind alleys have been eliminated.
The beauty of this newborn baby need not reflect the birth pains that
brought it into existence.Remember that you must not confuse the two
halves of a solutionand neithercanyou exclude either part.
argument that you will need to identify and analyze; these are: (1) goals,
(2) grounds, (3) warrants, and (4) the frame of reference. Let us briefly
explain what these kinds of elementsare,and how they are connected
together.
1. Goals. When we are asked to solve some problem or to present
some argument, there is always some destination, some claim, some
conclusion to which we are invited to arrive, and the first step in
having nothing to do with the assertion. The grounds may be true but
have no bearing on the conclusion; the grounds may be based on correct
information yet have no relevancy issue at hand.
to the
Given the starting point and the goal, the questionis: How do you
justify the move from these grounds to that conclusion? The reasonsor
principles offered as justification are the warrants. In focusing on the
warrants, the attention is not somuchon the starting point or goal but on
the correctnessof each step along the way.
Thus there are two concerns about the warrants cited in an argument:
Are they reliable and are they applicable? Frequently in a mathematical
argument the warrant is some known formula, some commonly accepted
fact, an established theorem, or a rule of logicalinference. Thus, in this
event, the reliability of the warrant may not be in question, but the
question asto whether or not the warrant applies is all the more crucial.
Moreover, even if the warrant is applicable, its correctapplicationisstill
required.The laws of algebra may apply but there arerestraintson their
application; for instance, one cannot divide by zero.
4. Frame of reference. Aside from the particular fact, rule,
theorem, formula, or principle that serves as grounds for an argument, we
need to determine the frameof reference,that whole interlocking web of
ideas, facts, definitions, theorems,principles, tacit assumptions, and
methods that is presupposed by the warrant appealed to in the argument;
otherwise, the warrant is likely to be meaningless.
Working Forward
precept, precept upon precept, line upon line, line upon line.\" We call
this method of presentation\342\200\224working forward\342\200\224and on occasion one can
Section 1.4 Some Methods of Proof and Problem-SolvingStrategies 21
Perform
Given data allowable Unknowns
or hypothesis variations, conclusion
draw inferences
Working Forward
Figure 1-2.
the Euclidean model and work forward from the hypothesis to the
conclusion. As a consequence, there may be a natural bias to work
forward in discoveringa solution,but this bias is often inappropriate in
problem solving because the orderin which we discover details is very
often exactly oppositefrom the order in which we relate those details.
Frequently, the critical insight is gained after focusing attention on the
goal,focusing on the conclusion rather than the hypothesis.
over steps 1 and 2 again and rethinkthe problem. As a general rule you
probably should focus your attention on the goal and how to get there
rather than focusingon the starting point.
the setA into such subsets which themselves can be countedwith ease.
Inductive Reasoning
equal to 1,2,3,4, ... in sequence and look for a pattern. Thus the
magnitude of the problem may be reduced to simpler casesand certain
patterns and relationships more easily observed.
It may be beneficial to make a diagram or tabulate several
observations.
than a clearly formulated guess; it is not provedyet. You may have much
confidence in your conjecture, but be careful\342\200\224your guess could be wrong.
A conjecture is merely tentative; it is an attempt to get at the truth, but
but does not prove it. A conflicting case disproves the conjecture. If
someoneclaimsa conjecture is true for all cases and there is at least one
exception, then his conjecture is false. This one exception is enoughto
refute any would-be rule or general statement. This oneobject that does
conjecture adds
plausibility conjecture and we becomemoreconfident
to the
about the possibility of its validity. But confidence is not a proof. Indeed
the fact that the conjectureholds for the first 63 odd integers does not
guaranteevalidity, for, in fact, the conjecture fails for the integer 127.
You might ask how do we see that 127 is a counter example?We have
at least two options: first, we could consider/(p) = 127- p,for all primes
p less than 127, and investigateif f(p) is ever a power of 2 for some value
24 Chapter 1: Foundations
n 0 1 2 3 4 5 6
g(n) - 127- 2\" 2(63) 5(25) 3(41) 7(14) 3(37) 5(19) 7(9)
n
\" + + \"\"' +
2! 3! (n + 1)!
are respectively 2!, 3!, 4!, and 5!. Is this coincidental? If not, then T5
should be (6!- l)/6!. In fact,
-T
5
-
119
4
5
- ?19- 6! \"
*\342\226\240
T 5 4
i '
6! 5! 6! 6! 6!
We note one other feature:so far Tn has had the denominator (n + 1)!for
each observation. Now we are emboldened to conjecturethat Tn is always
equal to [(n + 1)! - l]/(n+ Later we will discuss a method to prove
1)!.
this conjecture.
We have suggested that you focus on the goal largely to guide the
direction of your thoughts. You might do this in a variety of ways but two
methods frequently prove beneficial.
We call the first method \"analysis-synthesis\" Basically, we suppose
the problem has a solutionand then try to determine its characteristics.
Suppose that the problemis to prove a statement like: If A, then S.
The methodencompasses
two stages. The first stage\342\200\224the analysis\342\200\224is
Section 1.4 Some Methods of Proof and Problem-Solving Strategies 25
the laboratory work so to speak; here the plan is devised. The second
stage\342\200\224the synthesis\342\200\224is where the plan is actually carried out, where
what was discovered in the analysis stage is applied.This stageactually
constitutes the proof.
In the analysis stage, we start from what is to be concluded,takeit for
granted, and draw inferences from the conclusionuntil we reach
something already true, or patently obvious when
known, admittedly
considered in relation given information
to the A. In otherwords, we assume B,
derive or conclude C, from C we derive D, and so on, until we arrive at
statement Z that is obviousin conjunction with A. Now we are prepared
for the secondstage.
In the second stage, we simply reverse the process.Startingwith the
obvious statement Z, we work forward, following the Euclidean model of
expositions and attempt to reverse each step of the derivations to
conclude D and then Cand thenJ3.Of course, the success of the synthesis
stage dependson whether or not each derivation is, in fact, reversible.
Determine
Assume
a Draw characteristics
solution
inferences of a
solution
Analysis
Hypothesis
+
characteristics
Solution
of a Work
or
solution forward
conclusion
help determine
the direction of
-
inferences
Synthesis
= 6n+2(6- 1) + 72n+1(72- l)
- 6n+2(5) + 72n+1(48).
the goal in conjunction with the givens. Thus, the direction of inferenceis
from the goal statement to some new statements. In working backward,
the goal is not considered to be a pieceofgiven information. We start
with the goal, but insteadof drawing inferences from it, we try to guess a
precedingstatementor statements that, taken together, would imply the
goal statement. Frequently, there are theorems or facts in the frame of
referencethat will give such statements that imply the goal statement.
Thus, the person formulating a proof of an implication\"IfA, then B\" is
supposed to think like this: \"Icanprove B if I can prove C; I can prove C
if I can prove D; I can prove D if I can prove E. But I can prove E from
A.\"
Prove
recall Conclusion B
A- E
lengthc, has
equal area then T is an isosceles
to c2/4, triangle.
We must show a = b. But we can prove a = b by showing the equivalent
Fallacies
equivocation.
Another special kind of ambiguity gives rise to the fallacy of
Circular Reasoning
The fallacy of begging the question is also known as circularreasoning.
We commit this fallacy when we make an assertionand then argue on its
behalf by advancing what is purportedto begrounds but whose meaning
is simply equivalent to that of the originalassertion.We make an
assertion A and offer as grounds a statementB in support of the
statement A, but actually A and B turn out to mean exactly the same
things\342\200\224though this fact may be concealed because they are phrasedin
different terms. The error here is that in attempting to prove a certain
expect to have any idea of what it means to be canine. Nor, for that
matter, is it likely that someonewho has no idea of what distillation is
will know what is meant by distilling.
We commit the fallacy of \"jumping to conclusions\" or hasty
when
generalization we (1) make a general conjecture based on too few specific
instances or (2) drawa conclusion
from examples that are not
of
representative the whole class.
For example, we might concludethat for every prime integer N, the
integer N + 2 is also primebecause we have considered the pairs of
primes,3 and 5,5 and 7,11 and 13,17 and 19, and 29and 31.Of course, if
we consider the case whereN = 7,then N + 2 = 9 is not prime and refutes
the proposed conjecture.
The fallacy of false cause occurs when we take oneevent to be the cause
of another simply becauseone event happened before the other. The
Latin phrase that describesthis fallacy is post hoc ergo propter hoc
which literally means \"after this, therefore on accountof this.\" A political
party, for example, may take credit for an economic that took
upswing
place after their party took office without indicating what policy brought
about the upswing.
The fallacy of false cause also occurs when we are simply mistaken
about a given phenomenon. The history of science abounds with such
false attributions of causality; for example,the notion that the earth was
flat was maintained for centuries, and even now it is held by somethough
this notion was dispelled when Magellan sailed around the world.
1 1 1
1,,, '
1 \342\200\242
3 3 \342\200\242
5 (2n
- l)(2n + 1)
11,31,41,61,71,101,131,....
1 = 0 + 1,
2 + 3 + 4 = 1 + 8,
5 + 6 + 7 + 8 + 9 = 8 +27,
10 + 11 + 12 + 13 + 14 + 15 + 16 = 27 + 64.
d(n) 122324243 4 2 6 2 4 4 5
She is a pearl.
Hence, she is soft.
(b) David is telling the truth because he wouldn't lieto me.
(c) After Melinda insulted her, Anne was mad.
Mad peopleshould be put in a hospital.
Hence, Anne should be put in a hospital.
32 Chapter 1: Foundations
(d) The Democrats cannot blame the Republicans for the high
prices because in 1980, when price controlswere removed, the
Republicans were not in office.
(e) Peopleshould do what is right.
People have the right to disregardgood advice.
Therefore, people should disregard good advice.
( f) Nodesigning persons are deserving of trust.
Architects are designersby profession.
Hence, architects are to be distrusted.
(g) Killing people is illegal.
Capital punishment is legalizedkilling.
Hence, capital punishment is illegal.
(h) People in the hospital are ill.
Hence, they should have gone there.
never
(i) All members of the Marching Chiefs exercise daily.
If you exercise daily, you can be in the band.
(j) I will never see a doctor again. All my associates who were ill
over the past winter went to doctors.
(k) Joe declared that he is insane.But he must be sane because
the insaneneveradmit they are insane.
(1)1 walked under a ladder.
I was hit by a truck.
Walking under a ladder brings bad luck,
(m) The United Nations is necessary because it is vital that
nations work together.
(n) Life makes sensebecause Godexists.
Godexists because if He didn't life would be nonsense.
(o) Governmental break-ins are legitimate if sufficient reason is
given.
National security is a sufficient reason for a governmental
break-in.
In mattersof national security, the government should never
reveal its reasonsfor a break-in.
11.(a) Ambiguity.
OFLOGIC
1.5 FUNDAMENTALS
First of all, we shall restrict our attention only to those sentences that
satisfy two fundamental assumptions that correspondto two famous
\"laws\" of classical logic, the law of the excludedmiddleand the law of
contradiction. We hasten to say that some logicians may not be in
agreement with both of these assumptions, but they will serve our
purpose.
Sentences are usually classified as declarative,
exclamatory,
interrogative,or imperative. our Weattention
confine to those declarative
sentencesto which it is meaningful to assign one and only one of the truth
values \"true\" or \"false.\" We call such sentences propositions.
Of course, not all sentences are propositions because,for one thing, not
all sentences are declarative. But we also rule out certain semantical
paradoxes like the sentence: \"This sentence is false.\" For if we consider
this sentencetrue, then we must determine from the content of the
sentence that it is false, and likewise, if we consider it false, then it turns
out to be true.
For definiteness let us list our assumptions about propositions.
34 Chapter 1: Foundations
P Q p-+q
T T T
T F F
F T T
F F T
p implies q
ifptheng
p only if q
p is a sufficient conditionfor q
qifp
q follows from p
Section 1.5 Fundamentals of Logic 37
q provided p
ofp
q is a consequence
q whenever p
F F F F T T F
F F T F F F T
F T F F T T F
F T T F F F T
T F F F T T T
T F T F F \342\226\240
F F
T T F T T T T
T T T T F T T
Two functions are the same if they have the samedomain and range
and take on the same values at the same points. Thus, in the context of
propositions,since a truth table lists all the values of a propositional
function w6 two propositional functions are the sameif they
then see that
have the same identical truth tables. Now it is frequently the case that
mathematicians say, rather, that then two propositional functions are
logically equivalent or just equivalent, for short. Thus, if P and Q
are propositionalfunctions, then P and Q are equivalent if they have the
same truth tables, and we write P = Q to mean P is equivalent to Q.
Moreover, sad to say, mathematicians frequently somewhat
become
imprecise here and drop the word \"functions\" and say that two
propositionsP and Q are equivalent if Q have the sametruth table.
P and
A tautology is a propositional function whosetruth value is true for
all possible values of the propositional
variables; for example, p V ~p is a
tautology. A contradiction or absurdity is a propositional function
whose truth value is always false, such as p A -p. A propositional
function that is neither a tautology nor a contradiction is called a
contingency.
TFF F T F T
Since the last columnhas the value T in this case, the proposition must
bea tautology.
p q 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
'
F F T F T F T F T F T F T F T F T F
F T T T F F T T F F T T F F T T F F
T F T T T T F F F F T T T T F F F F
T T T T T T T T T T F F F F F F F F
q for
\342\200\224/-\302\273p ~(q-\302\273p).
40 Chapter 1: Foundations
T T T T T T T T
T T T T F F F F
T T F F T T F F
T F T F 7\" F T F
F F F~ F F F F F
T T T T F F F F
T T F F T T . F F
T F T F T F T F
The negationofpVq is:Itis false that God makes little green apples
or it rains in Indianapolisin the summer time. By DeMorgan's law,
since -(pVg) = (~p) A (~g), w6 see that the negation of p V q is also:
God doesn't make little greenapplesand it doesn't rain in Indianapolis in
the summer time.
Section 1.5 Fundamentals of Logic 41
precisely when p V q is false or when both p and q are false. In this case
(~p) A (~q) is true.
and \342\200\224\342\226\272
are
(~p) (~q) equivalent.
F F T T T T T T
F T T F T T F F
T F F T F F T T
T T F F T T T T
Implication Converse
q-
P\342\200\224 q^p.
j
If p, then q. If q, then p.
p is sufficient for q. q is sufficient for p.
Opposite Contrapositive
(~P)-M~<7). (~<7)-(~P).
Ifnot p, then not q (equivalent to Ifnot q, then not p (equivalent to
the converse). the implication).
42 Chapter 1:Foundations
Theorem Converse
Q
P\342\200\224 q-^p
If triangle I and triangle II are If the corresponding sides of
similar,then the corresponding sides triangles I and II are proportional, then
of triangles I and II are triangle I and triangle II are similar.
proportional. True
True
Opposite Contrapositive
~p-+~q
If triangle I and triangle II are not If the corresponding sides of
similar, then the corresponding triangles I and II are not proportional,
sides of triangles I and II are not then triangle I and II are not
proportional. similar.
True True
Theorem Converse
Q
P\342\200\224 Q-+P
If the quadrilateral ABCD is a If the sides of quadrilateral ABCD
square, then the sides of are equal,then the quadrilateral
ABCD
quadrilateral are equal. ABCD is a square.
True False
Opposite Contrapositive
~p-+~q ~q-+~p
If the quadrilateral ABCD is not a If the sides of quadrilateral ABCD
square, then the side% of quadrila- are not equal, then the
'
teral ABCD are not equal. ABCD
quadrilateral is not a square.
False True
Summary
9. If p \342\200\224\302\273
g is true, then either p is false or q is true, or both. (Note
that we cannot in this caseconcludeexplicitly that p is false and q
is true.)
10. If p \342\200\224*
q is false, then p must be true and q must be false.
11. If p \302\253-*
g is true, p and g must have the same truth value.
12. If p \302\253-*
g is false, then p and g have opposite truth values.
1. (a)
F F T F F F T
F T F T T T T
F T T T F F F
T F F T T T F
\342\226\240
T F T T F F T
T T F T T T T
T T T T F F F
3. (a) pVq
(b) (~p) A (~r)
(c) p A (~r)
(d) MAgAr
5. (d) K-Mart refunds the money or I will not shop there anymore.
(e) Lines AB and CD are not parallel or the alternateinterior
angles are equal.
7. (a) (Converse) If \\AB\\2 + |SC|2 - | AC |2, then triangleABC is a
right triangle.
(Opposite) If triangle ABC is not a right triangle, then | AB |2 +
\\BC\\2*\\AC\\\\
(Contrapositive) If | AB |2 + | BC |2 * \\ AC |2, then triangle ABC is not
a right triangle.
checking whether is
a conditional or is not a logicalimplication. All we
need do is check all possiblecasesin which the antecedent is true to see if
the consequent is also true. If this is the case, t hen the implication p \342\200\224\342\226
q
is, in fact, a logical implication. (Of course, we would draw the same
conclusionif we checked all possible cases where the consequentis false
and determined in those cases that the antecedentis alsofalse.)
The word inference will be used to designate a set of premises
accompanied by a suggested conclusion regardless of whether or not the
conclusionis a logicalconsequenceof premises. the Thus, there are
faulty inferences and valid inferences. Each inference can be
written as an implicationas follows:
of premises) \342\200\224\342\226\272
(conjunction (conclusion).
P
:.q
In this tabular of an argument, the assertions above
presentation the
horizontal line hypotheses or premises; the assertionbelow
are the
the line is the conclusion. (Observe that the premisesarenot
accompaniedby a truth value, we assume they are true.) The rule depictedis
known as modus ponens or the rule of detachment. The rule of
detachment is a valid inference because [pA (p \342\200\224* (? is a tautology.
q)]\342\200\224*
.*. s A [(~t) V u]
true.
(p
\342\200\224A
q) (q -* r) -* (p -* r)
is a tautology.
The transitive to a
rule can be extended larger number of implications
as follows:
p-^q
\342\200\224
r
q
r\342\200\224*s
\342\200\224
s
.\\p
Section 1.6 Logical Inferences 49
3. P [pA (p \342\200\224
q
g)]\342\200\224 modus ponens
Q
P\342\200\224
\342\200\242'.
Q
4. ~q NA (p \342\200\224
q)]-+ ~p modus tollens
p-+q
.\\ ~p
.*. P A q
8. (p \342\200\224
q)A (r-+s) l(p\342\200\224q)A s)A
(r\342\200\224 (pV r)]-\302\273[qV s] constructive
p V r dilemma
/. qV s
9. (p\342\200\224q)A (r\342\200\224s) q) A (r\342\200\224
[(p\342\200\224\342\226\272 s) A (-qV [~p
~s)]\342\200\224* V ~r] destructive
-QV-S dilemma
~pV ~r
Since most of the rules in the above table follow from the two
fundamental rules, DeMorgan's laws, and the law of contraposition,we
list them as fundamental rules.
50 Chapter 1: Foundations
Fallacies
converse).
form:
\342\200\224
p q
Fallacy
-\"\342\226\240
P
priceof gold at all but perhaps to the price of oil,the overall increase in
P \342\200\224
Q
\342\200\224
Fallacy
.\\ ~q
Section 1.6 LogicalInferences 51
P
:.q
This is like the pattern of the law of detachment with the premise
p \342\200\224*
q omitted. Of course, if this premise is known to be correct, the
argument is valid, though abbreviated.But conceivably the premise p \342\200\224\342\2
Socrates is a man.
Therefore,Socratesis mortal.
Here the conclusion may be thought to follow from the premise, but it
does so only becauseof the meanings of \"man\" and \"mortal,\" not by mere
inference.
Let us put the arguments in symbolic form. The first argument has the
form:
p-^q
P
.-. q
P
.\\q
Chapter 1: Foundations
It is the form of the first which makes it valid; any other argument with
the same form would also be valid. However, the second argument does
not share this quality. There are many arguments of the second form
which we would not regard as valid. For example:
A triangle has three sides.
Therefore, a triangle is a square.
h: a baby is hungry,
c: a baby cries,
m: a baby is mad, and
r: a baby has a red face.
h\342\200\224+c
m\342\200\224\302\273r
.*. fe \342\200\224
r
h-+c
m
c\342\200\224\342\226\272
m\342\200\224+r
.-. h-+r'
Section 1.6 LogicalInferences 53
In this final form, the form of the argument is nothing more than
FundamentalRule 2 and thereforeis valid.
Consider the following argument:
R~ T
A \342\200\224
R
/. R
R~ T
A \342\200\224
R
.-. R
We suspect that the non sequitur fallacy has been committed since
neither A nor T is a premise. Of course,we could consider the truth table
R) A (R *-* T)]
of [(A \342\200\224* R to see that we do not have
\342\200\224* a tautology and
thus that the inferenceis invalid. Nevertheless, a valid inference would
have been A In words:
\342\200\224\342\226\272
T, or
R-+ E
E
R
1984is a leapyear.
Hence1984is a presidential election year.
If today is Sunday, then I will go to church.
(c) Hence,...
2. (a) If x is greater than y, than u isless than v.
(b) If u is lessthan vf then z is greater than w.
(c) Hence,...
3. (a) If 1960 was a leap year, then 1964was a leap year.
(b) ....
(c) If 1960 was a leap year, then 1968 was a leap year.
4. (a) If New York time is five hours slowerthan London time,then
Denver time is two hours slower than New York time.
(b) If Denver time is two hours slowerthan New York time, then
San Francisco time is three hours slower than New York time.
(c) Hence,...
5. (a) Since \"X is guilty\" implies \"Y is innocent,\" and (b) \"Y is
IV. Fill in the blanks in the following arguments by using the law of
contraposition and/or modus tollens.
1. r\342\200\224+s 2. s
r\342\200\224\342\226\272 3. q
2l P^Q .'. (p A<7)
.-. ~r rVp '
.-. s V q
(ivVr)-^^ /.iv
7. ~r-* (s \342\200\224
~f) 8. p 9. ~r
p^q p\342\200\224<7
~p^s
-IV .*. r .-. ~p
.-. f^p
10. ~p 11. r
p^q P-^q
q-+ r
~r
VII. Verify that the following argument is valid by using the rulesof
inference:
I. 1. (c) No conclusion.
p q w r t ~t
T F T F T F
F T F T T T
7. Valid
(1) -rVu; premise
(2) ~w premise
(3) ~r by (1) and (2),disjunctivesyllogism
(4) (~r) \342\200\224(s\342\200\224~t) premise
proof; but, more than that, the student will have to add flesh to the bones
of the skeletonby supplying the details and documentation for each
deduction.Every conclusion must be made according to valid inference
patterns.
Section 1.7 Methods of Proof of an Implication 61
inference.
5. Proofofp contradiction.
\342\200\224\342\226\272
q by This method of proof exploits
the fact [derived from DeMorgan's laws and the equivalence of p
\342\200\224
q to
(~p) V q] that p \342\200\224is true
q iff p A (~q) is false. Thus, a proof by
contradiction is constructed as follows:
and -> q.
Pi ~^Q,P2-^ <?,- \342\200\242 pn
\342\200\242>
1: Foundations
verify that p is, in fact, false, then obviously we must conclude that q is
true.
To be sure,this method of proof is nothing more than the law of
[{(Pi V p2 V . . . V
pj V q] A (~px) A (~p2) A \342\200\242
\342\200\242
\342\200\242
(~pj]
\342\200\224
q
(p A q) \342\200\224>
r are equivalent. Therefore, a proof of the conditional
Section 1.7 Methods of Proof of an Implication 63
give some of
examples proof following these basic patterns. Since we are
trying to illustrate themethodsofproof,we will not be so concerned with
the importance of the facts that we are proving; we view them primarily
as instruments for practice.
that if the product of two numbers is zero then one or the otherofthe two
factors must be zero. Hence, X-3 = 0orX-2 =0. ButX - 3 = 0
=
implies X 3, and X - 2 0 impliesX 2. Thus,
= = X = 3 or X = 2. \342\226\241
Example 1.7.4. Two integers a and b have the same remainder when
divided by the positive integer n iff the integer a \342\200\224
bis divisible by n.
rx < n. Likewise, b = nq2 4- r2, where q2 and r2 are integers with 0 < r2 < n.
The statement p that just asserts
the remainders rx and r2 are equal.
Now, let us give a direct proof of p \342\200\224\342\226\272
q. Thus, we assume rx = r2 and
attempt to prove that a b has -
n as a factor. But
a- b =
(m(?! + r^ - (nq2 + r2)
=
n(qx
- q2) + (rx
-
r2) = n((?i - q2)
since rx r2
=
\342\200\224 0. Therefore, a \342\200\224
b is divisible by n since gx
\342\200\224
q2 is an
integer.
Next, let us give a direct proof cf the converse implicationq \342\200\224\342\226\272
p. Thus,
we assume that a - b is divisible by n or, in other words, a - b = nk,
where k is an integer. Then, if a = nqx + rx and 6 = ng2 + r2, we are to
rx = r2. In the equation a 6 = nfc, we substitute the
that \342\200\224
prove
nq2 + r2 + nk = n(q2 + k) + r2. But since0 < r2 < n and quotients and
remainders are unique when we apply the division algorithm, we
concludethat the remainder
rx must equal r2. \342\226\241
Section 1.7 Methods of Proof of an Implication 65
Input: a positiveintegern.
Output: The smallest prime divisor of n.
66 Chapter 1: Foundations
Method:
1. Consider the integer n.If n is even, 2 is the smallest prime divisor of
n. If n is odd, go to Step 2.
2. Find the largest integer s less than or equal to the squarerootofn.
Let P be the set of all primes lessthan or equal to s. Go to Step 3.
3. For each x\302\243P considered in order, determine if x is a divisorof n.If
the currently considered x is a divisor of n, then output x. If no x G P is
a divisor of n, output n.
or X10+ Xx + X2 > 17
(since the tenth and the first and second positions are consecutive on a
circularwheel).
Section 1.7 Methods of Proof of an Implication 67
Xx 4- X2 + X3 < 17,
X2 + X3 + X4 < 17,
+ \342\200\242
\342\200\242
\342\200\242
3(XX + X2 4- X10) ^ (10)(16).
Example 1.7.12. The same idea of proof can be usedto prove the
pigeonhole principle.
Let <7i represent the statement \"the ith box contains at least mt
objects,\" and let p represent the statement \"mx + m2 4- \342\200\242 + mn -
\342\200\242
\342\200\242
n 4- 1 objects are put into n boxes.\" Then we are asked to prove:p \342\200\224*
(Qi v 92 v v Qn)- We do this by contradiction,that is, we assume
\342\200\242
\342\200\242
\342\200\242
p
and~(gx V q2 V . . . V qn).
ByDeMorgan'slaws, ~(qx V q2 V . . . V qn) = (~qx) A (~g2) A ... A
(~gj. Thus we are assumingp (~(?i)
A A (~g2) A - - - A (~qn). Now -*</,
means that the ith box contains lessthan m, objects; in other words, the
ith box containsat most mt - 1 objects. But since we are assumingthe
conjunction of all the statements ~qh we are assumingthat the first box
has at most mx \342\200\224 I objects, and the second box containsat most m2 \342\200\224 1
a2 4- 14,.. .,a30 4- 14. Moreover, these numbersall liein the range between
1 and 59. Thus, we have 60 pigeons in 59 pigeonholes, so there must be 2
of these numbers that are equal.Sincealfa2,.. .,a30 are all different and
70 Chapter 1:Foundations
8. If*i>*2v \342\200\242
'9xsare 8 distinct integers, then there is somepair of these
integers with the same remainder when divided by 7.
If each integer is divided by 7 and their remainders are recorded, the
only possibilities 3,
for these remainders are 0,1, 2, 4, 5, and 6. Thus, we
have 8 remaindersto bedistributedamong the 7 possibilities from 0 to 6.
In otherwords, it is like distributing 8 pigeons among 7 pigeonholes.We
conclude that there are at least 2 pigeons in somehole or in this
framework, tliere are at least 2 of the remainders which are equal.
Let us rephrase what we have proved in yet another way. The division
algorithm impliesthat the set of integers can be partitioned into 7
disjoint subsets (called congruence classes) which we denote by
[0L[1]>[2],[3],[4],[5],[6]. Moreover, an integer x is in [r] iff r is the
remainder when x is dividedby 7.
Therefore, in the above example, we have 8 integers which are
distributed among 7 congruence classesso that, by the pigeonhole
principle, two of these integers must be in the same congruence class. By
the definition of congruenceclass,these2 integers must have the same
remainder when divided by 7.
This latter approach, while in fact the sameasthe former,nevertheless
requires a slightly deeper technical understanding becauseof the appeal
to congruences. The concept of congruence class is useful in the next
example.
9. Given any set distinct integers, there must exist2 integersin
of 7
this set whose difference is divisible
sum or by 10.
If we apply what we learned in (8) above, we see that we need 6
pigeonholesfor which if 2 integers a and b are in the samepigeonhole,
then we must conclude that either a 4- b or a - b is divisible by 10.
Our first thought is to let pigeonholes bethe sets [r] = {integers x such
that x has remainderr when divided by 10}. This choice for pigeonholes
would have the feature that if 2 integers a and b are in the same hole, then
their difference a - b is divisible by 10. But we have too many
pigeonholes using this choice for we have 10 pigeonholes (congruence
classes) determined by r = 0,1,2,.. .,9L We need to reduce the number of
holes and also incorporate the extra featureabout sums beingdivisible by
10. We use the following ploy: group the 10congruence classes into a
group of 6 pigeonholes according to the following scheme:
pigeonholes, {[2],[8]} for example, then it may be that a and b are in [2], in
which case a - bis divisible by 10, but their sum is not divisibleby 10. Or
it may be that a is [2] and b is in [8]. In this case, a + b is divisible by 10
but their differenceis not. Nevertheless,
we have accomplished what we
set out to prove.
proposition (i) to another equivalent form (iii). But we have not proved
(g) Ifp = p\\ + pi 4- p2, wherep,px,p2, andp3 are primes, then one
of themisthe prime3.Hint: use 1(c).
(h) If x is an integer, then x3 - x is divisible by 3.
(i) Ifp isa prime> 3, then p2 has the form 12& + 1, wherek is an
integer,
(j) If integer
an is simultaneously a square and a cube (as is the
case 64 with = 82 = 43), verify that the integermust be of the
form In or In + 1.
2. Give direct proofs for the following: For integers a, b, c, and d,
prove that
(a) a divides 0; the integer1 divides a; and a divides a.
(b) a divides 1 iff a = 1 or a = -1.
(c) If a divides b and c dividesd, then ac divides bd.
for x and y.
10. Use the pigeonholeprincipleto prove the following:
(a) Given 10 distinct integers, then somepair of them have the
same remainder when divided by 9 and so their difference is
divisibleby 9.
pigeonhole principle.)
15. A typewriter is used for 102 hours over a period of 12 days. Show
\342\200\224\342\200\224
(a) q-+t (b) ~p (q ~w)
s\342\200\224+r ~s\342\200\224+q
qV s ~t
.*. w\342\200\224+s
w\342\200\224+
(r\342\200\224+s)
.-. (w A r) \342\200\224*
s
29. Provethat in a group of n people there are two who have the same
number of acquaintancesin the group.
30. Given the information that no human beinghas morethan 300,000
hairs on his head, and that the stateof Florida has a population of
10,000,000, observe that there are at leasttwo persons in Florida
with the same number of hairson their heads. What is the largest
integer that canbeused for n in the following assertion? There are
n persons in Florida with the same number of hairs on their
heads.
31. (a) Prove that are prime integers,
421 and 2477
(b) Write 91001 of prime integers.
as a product
32.* (a) Twin primes are primes a and b such that b - a + 2. Thus5
and 7 are twin primes. Find 4 other pairs of twin primes.
Whether or not there are infinitely many twin primes is not
known.
(b) Threeprimesa,b,csuch that a + 4 = b + 2\302\253c might be called
triple primes. Find a set of triple primesand prove it is
unique.
(c) Adjacent primes are primes and a b such that b - a + 1.Find
a pair of adjacent and prove primes that no other pair exists.
(d) Quadruple primes are primes a,b>c,d where a + 8 = 6+6=
c + 2 - d. Thus, 11,13,17,19 are a set of quadruple primes.
Find another set of quadruple primes.
(e) Show that in a set of quadrupleprimesa,b,c,d if the number
a + 4 is as largeas 15,then in fact a + 4 is a multipleof 15.
Section 1.7 Methods of Proof of an Implication 77
give a direct
proof that the 5 integers are 3,3,3,3, and 2.
+ + am is divisible
\342\200\242
\342\200\242
\342\200\242
by n.
39. Let p be a prime different from 2 or 5. Showthat there is some
power of p whose last two decimal digits are 01.Hint:Consider p*
for i - 1,2,.. .,100.
40. (a) Let A be the set of all integers that can bewritten as a sum of
two squares of integers. Provethat if a and b are in A, then so
is ab.
(b) Prove that no integer of the form 8n + 7 is a sum of 3 squares.
Hint:Look at possible squares modulo 8.
78 Chapter 1:Foundations
11. Let Xi
- distance hiked in the ith hour.
xx + xl2 = 10
xx + x2 +
\342\200\242
\342\200\242
\342\200\242
4- x12 - 71
( implies x2 4- \342\200\242
\342\200\242
\342\200\242
4- xn - 61. If
Xi 4- x2 < 12
x2 4- xz < 12
2(x2 + \342\200\242
\342\200\242
\342\200\242
4- xn) < 122
xx + x2 < 17,and
x3 4- x4 < 17
x5 4- x6 < 17
\\xx 4- x2 > 17 or
jc3 4- xA > 17 or
23. Let's hold the outerdisk fixed and rotate inner disk through
the
the 200possible
alignments. For each alignment, let us count the
number of The sum of the counts for the 200 possible
matches.
P
Q
.-. r
According to what we have learned thus far, this is not a valid argument
form.
But, in fact, the argument is valid and the validity depends, in this
case, not upon the form of the argument, but upon relationships between
parts of the sentences
and upon the form of the sentences themselves;in
short, upon the content of the sentences.
First-order logicis that part of logicwhich emphasizes the content of
the sentences involved in
arguments as well
form as the
arguments. of
From a purely grammatical point of view, simple declarative sentences
must involve a subject and a predicate,eachof which may consist of a
single word, a short phrase,ora whole clause. Putting it very roughly, the
subjectisthe thing about which the sentence is making an assertion,and
the predicaterefers to a \"property\" that the subject has.
From a mathematicalpoint of view, it is convenient to represent
predicatesby capital letters and subjects by small letters and thereby to
At first glance, we may think these statements are not unlike the form
p
\342\200\224*>
q. However, there are two differences. First, the word \"always\" or
the phrase \"in all cases\" indicates that more is beingassertedthan just an
We have not specified the universe of discoursein any of the above but
we would presumablychoosesetsofnumbers for the universe in (1), (2),
and (3)to avoid meaningless assertions such as \"Joe > 5.\"
Just as in our subject-predicate analysis of sentences, let us introduce
functional notation to emphasize that open propositions are functions of
only one x suchthat.\" For example, the sentence \"there is one and only
\"
one even prime\" can be written 3! x, [x is an even prime].\"Moreover,if
we had already designated P(x) as the openproposition\"x is an even
prime integer,\" then the above sentence could be written even more
cryptically:3! x,P(jc).
1:Foundations
1. the subject,
2. the predicate,
3. the quantifiers,
4. the quality, and
5. the universeof discourse.
list:
following
Thus, the eight expressionscan be grouped into four groups of two each,
where the two have the same meaning. We list these four types as
equivalences:
Statement Negation
quantifies.
The
Statement Is True Is False
real coefficients and odd degree must have a real root. But the proof of
this theoremdoesnot say how to find this real root. Thus, the proofof
this theorem is nonconstructive.
Lagrange's interpolation formula shows how to construct a
polynomial with specific values at specified points. Suppose xu x2f...9xn
and yu y2>- ->yn are
\342\200\242 specified real numbers, where the x/s aredistinct.
Then the polynomial
(X - Xl)(X -*,)... (X
-
xn)
(X2 - -
*i)(*2 *3> *
\342\200\242
\342\200\242
(*2
- Xn)
y2
Then,
(X
-
1)(X - 3)
+
(4 - 1)(4- 3)
+ (X2 - 4X + 3)
\302\251
make a proof
To show how to by exhaustion, we consider the
following proposition:
Thereare no rational roots to the polynomial
1 + 1 + 1 + 1+ 1,2 + 1 + 1 + 1,2 + 2 + 1, 3 + 1 + 1,
3 + 2, 4 + 1, and 5,
we have p(5)
= 7. In fact, it is easy to establishthat
p(l)
- 1, p(2) = 2, p(3) - 3,p(4)- 5, p(5)
- 7,
(Vx) (3y) [x +y =
5], ( 3y) (Vx) [x + y = 5],
the first is true, while the second is false. The first sentence says that if x
is any real number,then there exists a real number y such that the sum of
x and y is 5. Of course,y is just 5 - x. The second sentence says that every
real number x is equal to the samenumber, 5 - y, where y is somefixed
real number. Thus, the second sentence says, in effect, that all real
numbers are equal.
There are logical relationships between sentences with two quantifiers
if the same predicate is involved in each sentence. We depict these
relationshipsin the following diagram:
(Vx)(Vy) (Vy)(Vx)
(Vx)(3y) i^ ^i(Vy)(3x)
\342\226\240\342\231\246\342\226\272\342\200\242
Oy)(3x) (3*)(3y)
two quantifiers.
What this diagram tells us, for example, is that the sentences (Vx)
(Vy) P (x,y) and (Vy) (Vx) P (x,y) are logically equivalent while (Vx)
(Vy) P (x,y) logically implies (3y) (Vx) P (x,y). Let us restate all the
above relationshipsin the following list:
Section 1.8 First Order Logicand Other Methods of Proof 91
(Vx)(3y)P(x,y)-*(3y)(3x)P(x,y_)
(Vy)(3x)P(x,y)-(3x)(3y)P(x,y)
(3y)(3x)P(x,y)~(3x)(3y)P(x,y)
The negation of any sentence involving more than one quantifier can be
accomplished by systematically applying the rulefor negating a sentence
with only one quantifier. Let us illustrate. Suppose your were asked to
prove by contradictiona sentencethat has the following form:
Thus, you must show that the negationof this sentence implies some
false sentence such as r A -r. Letting F = F(x,y), etc., we find the
negation as follows:
-(3x)(Vy)[~(F-GvlrY)]
= (3x)(Vy)[FA~(GV#)]
= (3x)(Vy)[FA(~G)A(~if)]
Therefore, with the knowledge of a few tautologies and rulesof logic,the
work of negating a complicated sentence becomes almost mechanical.
Q(x): x>3.
R (x): x is a multiple of 2.
S(x): x2 = 25.
(,b)
1< 2.
(c) Heis a baseball player.
Foundations
P(X) =
Yl Li(X)yi is the unique polynomial such that
i-i
P(*i) = yi for each i.
_ (X+1)(X)(X-1) X3-X
L4(X) - = 'We S6e that
(2 + 1)(2)(2
- 1) \342\200\2246\342\200\224
p(x) = 1-
6(x3\" x) = -x3 + x + 1
6
(b) Using the fact in (a) compute the Lagrange interpolation
formula polynomialP(X) for the following table of values:
xt I 1 2 3 4
y, 1 1 1 4
Section 1.8 First Order Logic and Other Methods of Proof 95
Xi 2 3
yi
Xi 1 3' 5 7
yi
f]iL,.(X)-Xand
i-l
i-l
Can you generalize?
12. Derive P(X) for the following table:
Xi l 2 3 4 5
yi l 1 1 1 V
Xi l 2 3 4 5
yi l 2 3 4 V
(d) Change the magic squares problem to use the digits 0 through
middle 3x3 square using the entries 9 through 17. you Can
(d) 3x9[B(x)Al(x)].
(e) M(x) \342\200\224
G(x).
(f) 3x, [M(x) aG(x)].
(j) 3x,[S(x)AM(x)A~H(x)].
(k) 0(x)AP(x).
(1) Let the universe be the set of integers Vx, (0(x) A P(x)).
(n) 3x, [0(x) AP(x)].
(p) 3x,[iV(x)Afl(x)].
(r) ~[Vx, [N(x)-+ R(x)]] or 3x, [N(jc) A ~R(x)].
(s) ~[V*,(G(*) \342\200\224P(*))].
where
C(x): x is complete,
jB(x): x is bipartite,and
P(x): x is planar.
3xy[C(x)AB(x)A(P(x)]
Vs,P(s)
..Pic) for all c'
the sentence \"Vx, Mix),99 that is, \"allmen aremortal,\" then the rule of
universal specification allowsus to conclude\"Socrates ismortal.\"
Informally stated the next rule says that what is true for arbitrary
objects in the universe is true for all objects. This rule permits the
universal quantification of assertions.
This rule holds provided we know P(c) is true for eachelement c in the
universe.
The next rule, informally stated, says that if a statement is true of
someobject then we may refer to this object by assigningit a name.
Fundamental Rule 7. Existential Specification. If 3x, Pix) is
assumedto be true, then there is an element c in the universesuchthat
Pic) is true. This rule takes the form
3x,Pjx)
'
.'. Pic) for some c
Notethat the element c is not arbitrary (as it was in Rule 5), but must
be one for which Pix) is true. It follows from the truth of 3 x> Pix) that at
least one suchelementmust exist, but nothing more is guaranteed. This
placesconstraints on the proper use of this rule. For example, if we know
that 3x, Pix) and 3x, Qix) areboth true, then we can conclude Pic) A
Qid) is true for some elements c and d of the universe, but as a general ^
rule we cannot conclude that Pic) A Qic) is true. For example, suppose
that the universeis the setofintegers and Pix) is the sentence \"x is even\"
while Qix) is the sentence \"x is odd.\" Then 3x, Pix) and 3x, Qix) are
both true, but Pic) A Qic) is false for every c in the universe of integers.
Section 1.9 Rules of Inference for Quantified Propositions 99
Let M(x) denote the assertion \"x is a man,\" K(x) denote the assertion
\"x is a king,\" and F(x) the sentence \"x is fallible.\" Then the above
argument is symbolized:
\342\200\224
Vx, [M(x) F(x)]
\342\200\224
Vx, [K(x) M(x)]
.\342\200\242.Vx,[K(x)-F(x)]
Assertion Reasons
2.
M(c)-+F(c) Step 1 and Rule 5
3. Vx, [K(x)-\302\273M(x)] Premise 2
4! K(c)-^M(c) Step 3 and Rule5
5. K(c)\342\200\224>F(c) Steps 2 and 4 and Rule 2
6. Vx, [/C(x) \342\200\224
F(x)] Step 5 and Rule 6
100 Chapter 1: Foundations
validity:
Vjc,[L(jc)-DW]
3x,L(x)
.-. 3xD(x).
Assertion Reasons
1. 3xtL(x) Premise 2
2. L(a) Step 1 and Rule 7
3. Vx, [L (x)-* D(x)] Premise 1
4. L{a)-+D(a) Step3 and Rule 5
5. D(a) Steps 2 and 4, Rule 1
6. 3x, D(x) Step 5 and Rule 8
P(x): x is a plant.
A(x): x is an animal
Thenthe inferencepatternis:
Vjc, [P(x) V A(x)].
~P(a).
Vx,[A(x)-+H(x)].
Hence, if (a).
The proofof validity is the following:
at general rule by
a conjecture for a inductive reasoning. Frequently we
may arrive at a conjecture that we believe to be true for all positive
integersn. But then before we can put any confidencein our conjecture
we need to verify the truth of the conjecture.Thereisa prooftechnique
that is useful in verifying such conjectures. Let us describe that
technique now.
1. P(l) is true.
2. Forallk > 1,P(k) implies P(k -f 1).
If one (1) and (2) by (1') P(n0) is true, and (2') For all k > n0,
replaces
P(k) implies + 1), then we can prove
P(k P(n) is true for all n > n0, and
the starting point n0, or basis of induction, may be any integer\342\200\224positive,
negative, or zero. Normally we expect to prove P(k) \342\200\224+
P(k + 1) directly
so there are 3 steps to a proof using the principle of mathematical
induction:
n 1 2 3 4 5 6 7
S(n) 1 3 6 10 15 21 28
The task of guessing a formula for S (ra) may not be an easy one and
there is no sure-fire approach for obtaining a formula. Nevertheless, one
might observe the following pattern:
2S(1)= 2 = 1-2
2S(2)= 6 = 2-3
2S(3) = 12 = 3- 4
2S(4) = 20 = 4- 5
2S(5) = 30 = 5- 6
2S(6) = 42 = 6 - 7
+
S(n) -
\"(\"
2 S(n) = n(n + 1) or that X).
(fc + 1) (k + 2)
2
and the formula holds for k + 1. So, by assumingthe formula was true for
k, we have been ableto prove the formula holds for k + 1, and the proofis
complete by the principle of mathematical induction.
The principle of mathematicalinduction is based on a result that may
be considered one of the axioms for the set of positive integers. This
axiom is calledthe well-ordered property of the positive integers; its
statement is the following: Any nonempty set of positive integers
contains a leastpositiveinteger.
Example1.10.2. Find and prove a formula for the sumof the first n
13 = 1 = 12
13+ 23 = 9 = 32
l3 + 23 + 33 = 36 - 62
l3 4- 23 4- 33 4- 43 = 100 = 102
[S(l)]2
= l2, [S(2)]2 = 32, [S(3)]2\302\253
62, [S(4)]2 \302\253
102, and [S(5)]2 = 152.
106 Chapter 1: Foundations
k(k + 1)
l3 4- 23 + + k3 4- (* 4- l)3 = + (* + D3
k2
+ k +1 - (* +1)2
(*+\302\273\"[g)' 14
\\k2
+ 4fc + 41
(k +1)2
I 4 ]
\"* + 21 2
(k +1)2
. 2 ]
Uk + 1) (k + 2)12
1 2
Let P(n) bethe proposition: there are more than n prime integers.
1. P(l) is true since 2 and 3 are primes.
2. Assume P(k) is true.
In case (a), the number of 5-cent stamps is at least seven sincen > 35.
Thus, replace those seven 5-centstampsby four 9-cent stamps
we can
and make up n + 1 centspostage.
In case (b), the n cents postage includes at least one 9-centstamp.
Therefore, if we replace that one 9-cent stamp by two 5-cent stamps we
can make up n + 1 cents postage.
Therefore, in either case we have shown how to make up n + 1 cents
postagein terms of only 5- and 9-cent stamps.
108 Chapter 1: Foundations
Example 1.10.6. Prove that for all integers n > 4, 3n > n3.
2. Assume P(n) is true for n > 4, that is, assumeSn > n3 for n > 4.
3. We prove P(n 4 1) is true on the basisof our assumption. Thus, we
/ (4)
= 1 + 3/4 4- 3/42 4- 1/43 = 125/64
is obviously less than 3, we have for any integer n > 4, 3 > 1 4 3/n 4
3/n2 4 1/n3. Thus, combining the two facts: 3 > 1 4 3/n 4 3/n2 4
Recursion
In computer programming the evaluation of a function or the
execution of a procedure is usually achieved at machine-languagelevel by the
(0 T(0) = 1
(ii) T(n + 1) = 3T(n) for all integers n > 0.
Here part (ii) embodies the salient feature of recursion, namely, the.
feature of \"self-reference\".
It is clear that T(n) = 3n satisfies the conditions (i) and (ii),but it may
not be clear that the two conditions alone are enough to define T.
The property of self-reference is the area of concern\342\200\224we have
satisfying
110 Chapter 1: Foundations
1. /(0)=s0,and
2. f(n + 1) = F( f (n)) for all integers n G N.
(i) MO)-9
(ii) h{n + l) = 5Mn) + 24
1. /(0)-l
2. f(n + !)-(* + l)/(n)foralln>0
1. A(0) = a
2. A(n + 1) - A(n) + d for all n > 0
l.F0-l-Fl
2. Fn+1 = Fn + Fn_x for all integers n > 1.
F2 = F, + F0= 2
F3
= F
2 + Ft = 3
F4 = F3 + F2 - 5,etc.
In this example we have conditions which are required
two initial
because the recurrence relation defined in terms of both n and
for Fn+1 is
n - 1. A stronger form of the Recursion Theorem is neededto prove the
Example 1.10.8. Prove that for each positive integer n, the nth
Fibonacci number Fn is less than (7/4)n.
Let P(n) be the sentence: Fn < (7/4)n. Then clearly P(l) and P(2) are
truesinceF, 1 7/4 and F2
= < = 2 < (7/4)2.Assume that P(i) is true for all
< <
1 i ft, where ft 2, that is, suppose Ft (7/4)1
> < for each 1 < i < ft. Then,
show Fk{l < (7/4)*+1 on the basis of the strong inductive hypothesis.
Since ft > 2, ft - 1 is a positive integer and thus Fk < (7/4)* and Fk_x <
(7/4)* l. Hence,Fk+1 - Fk + F^ < (7/4)*+ (7/4)*\"1 - (7/4)*\"1 (7/4 + 1)
- (7/4)* l (11/4) < (7/4)*-1 (7/4)2 = (7/4)*+1since (11/4) = 44/16<
(7/4)1
First, it is easy to check that b(n) = 2(3n) - 5 does,in fact, satisfy the
relations (1) and (2).
Next, we claim that if a(n) is any other function satisfying relations (1)
and (2), then a(n) = b(n)for all n. LetP(n) be the statement: a(n) = b(n).
We prove P(n) is a true statement for all nonnegative integers n by strong
induction.
- (8)(3*) - 2(3*)- 5
- (6)(3*)
- 5 - 2(3*+1)- 5
= b(k + 1)
Likewise when n = 1,
\"-^[P-tT-P-tTI
'\".-il^r-P-rTl
114 Chapter 1: Foundations
a= and b = .
2 2
^n = -F [<*n+1
-
&n+1] and
V5
Fn+x
=
[an+1 - bn+l + an - bn]
~fE
= + l)-6n(6 + D].
-^[an(a
Now
,
ar23+V5
-
a + 1 = 1+V5.3+V5
+ 1 = and = \342\200\224
2 2 2
= -t= [an+2 -
6n+2] and the proof is complete.
V5
V(n
- 1) + 1 for all n > 1. We wish to showthat V{n) = - 1 for all
Fn+2
integers n > 0.
Basis of induction. When n = 0, V(0) = 1 and F2 - 1 = 2 - 1 = 1.
Likewise, V(l) = 2 and F3 = 3 - 1 = 2.
5(3n) + 7(2n).
3. I2 + 22 + 32 + \342\200\242
\342\200\242
\342\200\242
+ n2 = m(m + 1) (2m + l)/6 for n >: 1.
+ (2m - l)2 = m(2m
4. I2 + 32 + 52 + \342\200\242
\342\200\242
\342\200\242
-1) (2n + l)/3.
5. 1/(1)(2) + l/(2)(3) + \342\200\242
\342\200\242
\342\200\242
4- l/n(n 4- 1) = n/(n 4- 1).
6. 1 \342\200\242
3 + 3 \342\200\242
5 + 5 7 + \342\200\242
\342\200\242 \342\200\242
\342\200\242
+ (2n - 1) (2n + 1) - n(4n2 + 6n -
D/3.
7. I3 + 33 + 53 + \342\200\242
\342\200\242
\342\200\242
+ (2m - l)3 = n2 (2n2
- 1).
8. 1 \342\200\242
2 + 2 \342\200\242
3 + 3 4 + \342\200\242
\342\200\242 \342\200\242
\342\200\242
+ n(n + 1) = n(n + 1) (n + 2)/3.
9. 1 \342\200\242
2 \342\200\242
3 4- 2 \342\200\242
3 \342\200\242 \342\200\242
4 4- \342\200\242
\342\200\242
4- n(n + 1) (n + 2) = n(n + 1) (n + 2)
(n 4- 3)/4.
10. I2- 22 4- 32 - 42 \342\200\242
\342\200\242
\342\200\242
(-ir-V - (-l)\"\"1 n(n + l)/2.
II. x -
y is a factor of the polynomial xn -
yn.
12. x 4- y is a factor of the polynomial x2n+1 4- y2n+1.
19. Show that the sum of the first n terms of a geometric progression
with initial term a and common ratio r # 1isa [(rn - l)/(r - 1)] =
a[(l-r\/(l-r)].
20. Let Dn be the number of diagonals of an n-sided convex polygon.
Make a table of values of Dn for n > 3, and then conjecture
a
34. For each integer n > 1,the nth Fibonacci number Fn is less than
Section 1.10 Mathematical Induction 117
an = 2n
35. - 1 is the unique function defined by
(1) a0 = 0
= 1
ax
(2) an = -
3a\342\200\236_x 2an_2 for rc > 2
(a) gcd(a,b) = a if b = 0
(b) gcd(afb) =gcd(b,r) if 6 * 0
and a = b q + r where0 < r < 6.
Thus the greatest common division of 22 and 8 canbefound by applying
the above facts recursively as follows:
gcd(22,8)
= gcd(8fi) = \302\243cd(6,2)
=
gcd{2fi) = 2.
1.10.4
1. (a) In example we used that every integer a > 1is
the fact
either a prime or is divisible by prime. Give a contradiction
a
proof of this fact by using the well-ordered property of the
positive integers.
(b) Extend (a) to concludethat every integer
the proof in a > 1 is a
of
product primeintegers.
(c) Write 1235 and 5124 as products of primes.
(d) (The FundamentalTheoremof Arithmetic.) Prove that the
factorization of an integer a > 1 into a product of primes is
unique except for rearrangement of factors. Hint: use
contradiction and the well-ordered property.
(e) Show that if px,p2,.. .,pk are distinct primes and eue2,.. .9ek are
PeiPe2- -Pkk is
\342\200\242 (ex + l)(e2 + 1).. .(ek+ D- Hint: Note that each
prime pt will appear 0 or 1 or 2 or or e, times as a factor of ...
any positive division of n.
(e) Show that the product of two integers of the form 6rc + 1,
where n is an integer, is again ofthat form.
(f) Modify the proof of Example 1.10.4 to show that there are
infinitely many primes of the form 6rc 4- 5.
(g) Show that there are infinitely many primes p suchthat p
- 2
is not a prime. Hint:useexercise 4(f).
Mathematical Induction 119
sequence consecutive
of m integers is divisible by m.
thatm = g(n0) > 1 and g(n) > m for all values of n > n0. Then
observethatg(n0 + m) - g(n0) is divisible by m.
The sameideas of proof prove that for any nonconstant
polynomial g(x) with integer coefficients there is a value k
such that g(k) is not prime. The only other technical fact
required to complete the proof of this fact is the Binomial
Theorem of Section 2.7. For instance, use the Binomial Theo-
120 Chapter 1: Foundations
rem to observe that for any integersm and n0, (n0 + m)1 - nl0 is
4- 1)
+ ,(n + ^2
. 4- l)(2rc
1 +292
i2 j. 4-
_l rc
+,
/
4- \342\200\2362
\342\200\242
\342\200\242
\342\200\242 + 1) =
(n \302\2611^2
n(n
1)J
6
)
n(n + l)(2ra + 1) + 6(n + D:
(n + l)[(n)(2i i + 1) + 6(n + D]
6
(n + l)[2n2 + In + 6]
6
(n + !)[(\302\273 + 2)(2n + 3)]
5. Inductive step:
11 4- + \342\200\242
\342\200\242
\342\200\242
4- \342\200\224
1 4-
1-2 2-3 n(n 4- 1) (n + l)(n + 2)
4-
n 4- 1 , (rc 4- l)(n 4- 2)
= n(n 4- 2) + 1
~
n2 4- 2rc 4- 1
\"
(n + l)(n 4 1)
(n + l)(n + 2) (n + l)(n + 2) (n + l)(n 4 2)
=n + 1
n 4- 2
13. Truefor n - 1
Inductive hypothesis: Supposen(n2 + 5) - where
6\302\243, t is some
integer.
Inductive step:
26. Suppose that / (n) is any sequence satisfying (1) and (2). We show
that f (n) = g(n) for all integers n > 0 by strong mathematical
induction.
(a) Basis of induction. Clearly g(0) = 10 = / (0) and g(l) - 29 =
fill
(b) Inductive hypothesis. Suppose thatg(t) = / (i) for all integers
0 < i < k where k > 1.
(c) InductionStep. that g (k + 1)
~ f (k Show + 1).
/(fc)-*(*)-(3)5*+ (7)2*
and / (k -
1) - g(fe - 1)
- (3)5*\"' + (7)2*\"'.
But then
f(k + 1) = 7(3 \342\200\242
5* + 7 \342\200\242
2*)
- 10(3 \342\200\242
5*\"1 + 7 \342\200\242
2*\"1)
= 5*-!(7 \342\200\242
3 \342\200\242
5 - 10 \342\200\242
3) + 2*_1(72 .2-10-7)
= 5*-!(3 . 52) + 2*-1(22 \342\200\242
7)
- 3 \342\200\242
5*+1 + 7 2*+1 =
\342\200\242
g(k + 1),
1317 = (23)(56) + 29
56 - (1)(29) + 27
29 = (1)(27)+ 2
27 = (13)(2)+ 1
2-(2)(l) + 0
-
gcd(1317,56) = gcd(56,29) gcd(29,21)
=
gcd(21,2) =gcd(2,l) -gcd(l,0)
-1.
then...\" form.
(a) x is an integer or y is an integer.
(b) In order for a relation to be asymmetric, it is necessarythat it
be antisymmetric.
14. Suppose that no pine tree has more than 9000 pine cones and that
there are 6,381,400 pine trees in Leon County. What is the largest
integerthat can be used for n in the following assertion?Thereare
at least n pine trees in Leon County with the same number of pine
cones.
15. Constructa truth table for the propositional function
(p~ ~r) A [(r\342\200\224q) V ~q]
16. Prove that {[(p V q) \342\200\224*
r] A (~p)} (q
\342\200\224is a
\342\200\224\342\226\272
r) tautology by
appeal to an abbreviatedtruth table.
17.Find the error in the following \"proof\" by induction that 1 +
2 + \342\200\242
\342\200\242
\342\200\242
4- n = (l/8)(2n+ l)2 for all positive integers n. \"If 1 +
2+ \342\200\242
\342\200\242
\342\200\242
+ n - (1/8)(2m + l)2, then l + 2+...+n + n + l =
(l/8)(2n + l)2 + (* + l) - (l/8)(4n2+ 4n + 1 + 8n + 8) -
(l/8)(4n2 + 12m + 9) - (l/8)(2n + 3)2 - (l/8)(2(n + 1) + l)2.Thus,
the truth of the statement for n impliesits truth for n + 1.\"
2
Elementary
Combinatorics
INTRODUCTION
12G
Chapter 2: Elementary Combinatorics
will take more than 1047 years just to perform the additions required by
this algorithm.
Therefore, we need to find algorithms better than mere exhaustive
searching. If on the other hand, another algorithm could be found that
required only n2 operations, then for n = 50 cities, a shortestroutecould
be found after only 2500 operations and these could be performed less in
If Ei9... J5n are mutually exclusive events, and Ex can happen ex ways,
E2 cart happen e2ways,..., En can happen en ways, then Ex or E2 or... or
En can happen ex + e2 4- \342\200\242
\342\200\242
\342\200\242
4- en ways.
two distinguishable dice (say one die is red and the other is white) are
rolled? Howmany ways can we get an even sum?
Let label theus outcome of a 1 on the red dieand a 3 on the white die as
the ordered pair (1,3). Then we see that the outcomes (1,3),(2,2),and
(3,1) are the whose sum is 4. Thus,thereare 3 ways to obtain
only ones
the sum 4. Likewise,we
obtain the sum 8 from the outcomes(2,6),(3,5),
(4,4), (5,3), and (6,2). Thus, there are 3 4- 5 = 8 outcomes whose sum is 4
or 8. The number of ways to obtain an even sum is the sameas the
number of ways to obtain either the sum 2,4,6,8,10, or 12. There is 1 way
to obtain the sum 2,3 ways to obtain the sum 4,5 ways to obtain 6,5 ways
to obtain an 8, 3 ways to obtain a 10, and 1 way to obtain a 12. Therefore,
there are 1 + 34-54-54-34-1 = 18 ways to obtain an even sum.
Example 2.1.3. How many ways can we get a sum of 8 when two
indistinguishable dicearerolled? An even sum?
. \342\200\242
|SxxS2x \342\200\242
xSJ-IISLJSJ.
Figure 2-1
Section 2.1 Basics of Counting 129
tossed. Likewise there are 6100 possible outcomes when 100 dice are
tossed.
There are 73 such 3-digit numbers in (a) since eachof the3 digits can be
filled with 7 possibilities. Likewise,the answer to question (b) is 7 \342\200\242
6 \342\200\242
5
since there are 7 possibilities for the hundreds digit but once one digit is
usedit is not available for the tens digit (since no digit can be repeated in
Example 2.1.7. (a) How many different license plates are there
that involve 1, 2, or 3 letters followed by 4 digits?
(b) How many different plates are there that involve 1, 2, or 3 letters
followed by 1, 2, 3, or 4 digits?
Followingthe patternofthe solution to (a) we see that there are (26+
The number of digits are not specified in this problem so we can form
one-digit numbers, two-digit numbers, or three-digit numbers, etc. But
since no repetitions are allowed and we have only the 7 integers to work
with, the maximum number of digits would have to be 7. Applying the
product rule, we see that we may form 7 one-digit numbers, 7 \342\200\242
6 = 42
numbers, 7 \342\200\242
6 \342\200\242
5 \342\200\242
4 \342\200\242
3 five-digit numbers, 7 \342\200\242
6 \342\200\242
5 \342\200\242
4 \342\200\242
3 \342\200\242
2 six-digit
numbers, and 7-6-5-4-3-2-1 seven-digitnumbers.
The events of forming one-digit numbers, two-digit numbers, three-
digit numbers,etc.,are mutually exclusive events so we apply the sum
ruleto see that there are 7 + 7-6 + 7-6-5 + 7-6-5-4 + 7-6.5-4-3 +
7-6-5-4-3-2 + 7-6-5-4-3-2-1 different numbers we can form under the
restrictionsof this problem.
are mutually exclusive, the sum rule gives 9-8 + 8-8-4 even three-digit
numberswith no repeated digits.
Indirect Counting
One-to-OneCorrespondence
There is, finally, another technique that is often used in counting. In
this technique the problemat hand is replaced by another problem where
it is observedthat there are exactly the same number of objects of the
first type as there are of the second type. In other words, a one-to-one
correspondence is set up between the objects of the first type with those
of the second. (A one-to-one correspondencebetween2 sets A and B is
just a one-to-one function from A onto B.) Of course, we would hope that
in the new context we can see how to count the objects ofthe second type
more readily than those of the first type.
number of matches is the sameas the total number of losers. At the start
there are 101 players and at the end thereis only one undefeated player.
Consequently, there must have been 100 losers and hence 100 matches
are requiredto determinewinner. a
One of the nice features of the secondapproachis that the problem and
its solution can be generalized. Any single elimination tournament
similar to the one above that starts with n contestants will require n - 1
matches in orderto determinea winner.
elements.
T factors
0000 0
0001 1
0010 1
0011 0
0100 1
0101 0
0110 0
0111 0
1000 1
1001 0
1010 0
1011 0
1100 0
1101 0
1110 0
1111 0
unchanged after all the O's and l's in the truth table are interchanged.
How many self-dual 2-valued Boolean functions of n variables are
there?
Partitionthe set of 2n binary n -tuples into 2n_1 blocks, each block
containing an n-tuple and its l's complement. In constructing a self-dual
assignments may be made for only 2n~l of the 2n rc-tuples. Thus, there are 22\"_l
different self-dual Boolean functions of n variables.
The applicationsof the 2-valued Boolean functions, and self-dual
Boolean functions is quite important to computer scientists who study
the nature and applicationsof switching functions and logic design. It is
136 Chapter 2: Elementary Combinatorics
Factorials
Thus, 4! = 4 3 \342\200\242
2 \342\200\242
\342\200\242
1,
6! = 6 \342\200\242
5 \342\200\242
4 \342\200\242
3 \342\200\242
2 \342\200\242
1,
\342\200\236
\342\200\236
K A 7! 7.6.5.4.3.2.1
and 7 \342\200\242
6 5 4 = \342\200\224
\342\200\242
\342\200\242 \342\200\224-\342\200\224
.
3! 3-2-1
0!-l, 1!-1, 2! = 2,
3! =
6, 4!- 24, 5!- 120,
6! = 720, 7! = 5,040, 8! =
40,320,
9. How many integers between 1 and 104 contain exactly one 8 and
one 9?
10. How many different license plates are there (allowing
repetitions):
involving
(a) 3 letters and 4 digits if the 3 letters must appear
together either at the beginning or at the end of the plate?
boys
messenger if the telegrams are distinguishable?
(b) In how many different ways can the telegrams be distributed
to the messenger boys and then delivered to 10 different
people if the telegrams are distinguishable?
(c) Rework (a) under the assumption that the telegrams are
indistinguishable?
20. A shoe store has 30 styles of shoes.If eachstyle is available in 12
different lengths, 4 different widths, and 6 different colors, how
many kinds of shoes must be keptin stock?
21. A chain letter is sent to 10peoplein the first week of the year. The
next week each person who received a letter sends lettersto 10new
people, and so on.
(a) How many people have received letters after 10 weeks?
(b) at the endofthe year?
22. A company has 750 employees. Explain why there must be at least
2 people with the same pair of initials.
23. A tire carries 10 different sizes of tires, eachin both
store tube and
tubeless variety, each with either nylon, rayon cord, or steel-
belted, and eachwith white sidewalls or plain black. How many
different kinds of tires does the store have?
24. How many integers between 105 and 106
(a) have no digits other than 2, 5, or 8?
(b) have no digits other than 0, 2, 5, or 8?
25.In how many different orders can 3 men and 3 women be seated in
a row of 6 seats if
(a) anyone may of the seats?
sit in any
(b) the first and must be filled by
last seats men?
(c) men occupy the first 3 seats and women occupy the last three
seats?
(d) all membersof the samesex are seated in adjacent seats?
(e) men and women are seated alternately?
26. Find the sum of all 4-digit numbersthat can be obtained by using
(without repetition) the digits 2, 3, 5, and 7.
Chapter2: Elementary Combinatorics
35. Each of n different li^ht posts can be made to beama red,a yellow,
or a green light. How many different signalscan be beamed by the
1. 8 \342\200\242
8 \342\200\242
9 \342\200\242
104.
2. 263 \342\200\242
103.
7. (a) 52 \342\200\242
51.
(b) 4 \342\200\242
4.
(c) 4 \342\200\242
47.
(f) 1 . 48 + 12 \342\200\242
47.
(g) 48 \342\200\242
47.
(h) 52 \342\200\242
51 - 48 \342\200\242
47.
9. 4 \342\200\242
3 \342\200\242
82.
(b) (2 \342\200\242
10 + 3 \342\200\242
102 + 4 \342\200\242
103 + 5 \342\200\242
104)(26 + 262 + 263).
11. (a) 212 \342\200\242
263.
52 \342\200\242
263.
(b)
52 \342\200\242
213.
(c)
(d) 262 \342\200\242
213 - 21B + 2 \342\200\242
5 \342\200\242
214 + 52 . 213.
(e) 32 \342\200\242
20 \342\200\242
24 \342\200\242
23 \342\200\242
5 22; 24 \342\200\242
4 \342\200\242
\342\200\242 23 \342\200\242
5
22;
\342\200\242
4 \342\200\242 20 \342\200\242
21 \342\200\242 19;
5 4 . 21
\342\200\242 \342\200\242
20 \342\200\242
19 + 5 21 . 20
\342\200\242 . 19 . 18 + 5 . 21 . 20. 19.
18 + 21 - 20 - 19 - 18 - 17.
142 Chapter 2: Elementary Combinatorics
14. (a) 5 3 =
\342\200\24215.
(b) 15 + 3 = 18.
(c) 182.
(d) 152.
(e) 15 - 45.
\342\200\242
3
(f) 3 15 =
\342\200\242 45.
(g) 15 3 + 3 \342\200\242
\342\200\242 15 + 152 - 182 - 32 = 15 . 18 + 3 . 15.
(h) 15 \342\200\242
8.
\342\200\242
10.
(b) (15!/7!)
(c) 4 \342\200\242
10 \342\200\242 5 \342\200\242
7 \342\200\242 4 \342\200\242
6 \342\200\242 4 \342\200\242
3 \342\200\242
2.
18. In (a) the identifiers are of length5 and the first character may be
one of 26 letters,while the remaining 4 characters can be any of the
26 letters a through 2 or 10 digits 0 through 9. Thus, eachof the
23. 10 \342\200\242
3 \342\200\242
2 \342\200\242
2.
26. There are 24 = 4!such numbers. Each digit occurs 6 times in every
Thesum
oneof the4 positions. of the digits is 17. Hence the sumof
these 24 numbers is (6)(17) \342\200\242
(1111).
Section 2.2 Combinations and Permutations 143
27. Choose the color for the first stripein 4 ways. The secondstripe
can be one of the 3 remaining colors.Thenthe third stripe can be
any of3 colorsexcludingthe colorofthe second stripe, and so on.
The number is 4 \342\200\242
35.
28. 10 . 9
29. (a) 5!
(b) 6!/2
/
144 Chapter 2: Elementary Combinatorics
If we are selections
considering where each object has oo as its
repetition then we
number designate such selections as selections with
unlimited repetitions. In particular, a selection of r objects i n this case
will be called r-combinations with unlimited repetitions and any ordered
arrangement of these r objectswill be an r-permutation with unlimited
repetitions.
ofa,b,c,dwith
Example 2.2.5. The3-combinations unlimited
repetitions are the 3-combinations of {oo
.
a\\ oo .
b, oo .
c, oo . d\\. There are 20
such 3-combinations,namely:
2-Combinations 2-Permutations
With Unlimited Repetitions With Unlimited Repetitions
aa aa
ab ab, ba
ac ac, ca
ad ad, da
bb bb
be be, cb
bd bd,db
cc cc
cd cd,dc
dd dd
10 16
Of course, these are not the only constraints that can be placed on
selections;the possibilities
are endless. We list some more examples just
for concreteness. We might, for example, consider selectionsof {oo.a, oo .
b9 oo
. c} where b can be chosen only an even number of times. Thus,
5-combinationswith these repetition numbers and this constraint would
be those5-combinations with unlimited repetitions and where b is chosen
0, 2, or 4 times.
Example 2.2.6. The 3-combinations of {<\302\273
. .
6, 1 \342\200\242
a, \302\253> c, 1
\342\200\242
d}
where b can be chosen only an even number of times are the 3-
combinations of a,b,c,d where a can be chosenup to 3 times, b can be
chosen 0 or 2 times, and c and d can be chosen at most once.The
subjectto
3-combinations these constraints are:
aaa,aac,aadybba,bbctbbd,acd.
146 Chapter 2: Elementary Combinatorics
2-Combinations 2-Permutations
Without Repetitions Without Repetitions
ab ab, ba
ac ac, ca
ad ad, da
be be, cb
bd bd, db
cd cd, dc
6 12
Section 2.3 Enumeration of Combinations and Permutations 147
3-Combinations 3-Permutations
Without Repetitions Without Repetitions
4 24
Notethat to eachofthe3-combinations
without repetitions there are 6
possible 3-permutations without repetitions. Momentarily, we will show
that this observation can be generalized.
2.2
ExercisesforSection
1. List all 5-combinations of {oo . a, oo .
6, oo . c}, where b is chosen an
even number of times.
2. List all 64 3-permutations of {oo . a, oo .
b, oo .
c, oo . d}.
repetitions).
P(n,r) = n(n - 1) (n - r + 1) =
-
(n r)\\
be filled in n \342\200\224
1 ways since no repetitions are allowedand there are
n - 1
objects left to choosefrom. The third can be filled in n - 2 ways
and soon until the rth position is filled in n - r + 1ways (see Figure 2-2).
By applying the product rule,we conclude that
n\\
P(n,r) - r)\\'
\342\226\241
(n
n\\
P(nfn) - - n\\.
-^
When explicit reference to r is not made, we assume that all the objects
are to be arranged;thus when we talk about the permutations of n
objectswe mean the case r = n.
Figure 2-2
Section 2.3 Enumeration of Combinations and Permutations 149
place a and 6,and then to arrange any 7-letter word treatedas one
20! ways
unit along with the remaining 19 letters. The total is P(24,5)(20!) (2).
Number of Permutations
Class in the Class
Total 7! + (2)(6)P(7.5)
+ (56) P (6,3) + (504) P (5,2)
150 Chapter 2: Elementary Combinatorics
1. The hundred thousands digit is 1 (and thus the ten thousands digit
is not 2). The seconddigit can be chosen in 7 ways. Choose the
position 2 in 4 for ways; then fill the other 3 positions P(6,3) ways.
Hence,thereare (7)4 P(6,3) numbers in this category.
2. The units digit is 1 (and hence the tens digit is not 2). Likewise,
thereare P(6,3) (7)4 numbers in this category.
3. The integer 1 appears in a position different from the hundred
thousands digit and the units digit. Hence, 2 cannot appear
immediately to the left the right of 1. Since1 can be any one of the
or to
digits from the digit up to the ten thousands digit, 1 can
tens be
(2)(7)(4)P(6,3) + (4)(7)(6)(3)P(5,2)
elements in all four classes. (Look for the shorter indirect counting
solution.)
The permutations we have been considering are more properly called
linear permutations for the objects are being arranged in a line. If
insteadof objects arranging in a line, we arrange them in a circle,then the
number of permutations decreases.
Figure 2-3
repetitions).
P(n,r) n\\
C (n,r) =
r! - r)\\
r\\(n
52! 52 51 . 50
\342\200\242 . 49 . 48
C(52,5)
5! 47! 5.4.3.2.1
52 \342\200\242
51 \342\200\242
10 \342\200\242 2 =
49 \342\200\242 2,598,960 such hands.
L(lSfb)=w&r 5.4.3.2.1
- 13 9 =
11 \342\200\242
\342\200\242
1,287.
C(13,3).
Answer. C(13,2)
(d) How many 5-card hands have 2 cards of one suit and 3 cards of a
different suit?
Fora fixed choice of 2 suits there are 2C(13,2)C(13,3)ways to choose 2
from one of the suits and 3 from the other. We can choose the 2 suits in
C(4,2) ways. Thus, there are 2C(13,2) C(13,3) C(4,2) such 5-cardhands.
Recall that two of a kind means2 aces,2 kings, 2 queens, etc. Similarly,
3 tens are calledthreeofa kind. Thus there are 13 \"kinds\" in a deck of 52
cards.
(e) How many 5-card hands contain 2 aces and 3 kings?
(f) How many 5-card hands contain exactly 2 of one kind and 3 of
another kind?
Choosethe first kind 13 ways, choose 2 of the first kind C(4,2) ways,
choose the second kind 12ways and choose 3 of the second kind in C(4,3)
ways. Hence there are (13) C(4,2) (12) C(4,3) 5-cardhands with 2 of one
kind and 3 of another kind.
Section 2.3 Enumeration of Combinations and Permutations 153
C(15,4) ways.
(d) In how many ways can the committee in (c) be formed if teacher A
refuses to serve if student B is on the committee?
We answer this question by counting indirectly. First we count the
number of committees where both A and B are on the committee. Thus,
there are only 8 teachers remainirg from which 4 teachers are to be
chosen.Likewise, there are only 14 students remaining from which 3
more students are to be chosen.Thereare C(8,4) C(14,3) committees
containing both A and B, and hence there are
many ways can a committeeof 10be chosen so that there are exactly 5
femalesand 3 juniorson the committee?
Juniors Seniors
Number of
Female Male Female Male Ways of Selecting
Thus, the total number of ways is the sum of the terms in the last
column:
7. (a) How many ways are thereto seat10boys and 10 girls around a
circular table?
(b) If boys and girls alternate, how many ways are there?
8. In how many ways can the digits 0, 1, 2, 3,4, 5, 6, 7, 8, and 9 be
arranged so that
(a) 0 and 1 areadjacent?
(b) 0 and 1 are adjacent and in the order01?
(c) 0,1,2, and 3 are adjacent.
9. A group of 8 scientists is composed of 5 psychologistsand 3
sociologists.
(a) In how ways can a committeeof 5 be formed?
many
(b) In how many ways can a committeeof 5 be formed that has 3
psychologists and 2 sociologists?
10. A bridge hand consists of 13 cards dealt from an ordinary deck of
52 cards.
(a) How many possible bridge hands are there?
(b) In how many ways can a -person get exactly 6 spadesand 5
hearts?
17. A multiple choice test has 15 questions and 4 choices for each
answer. Howmany ways can the 15 questions be answeredso that
(a) exactly3 answers are correct?
(b) at least 3 answersare correct?
18. Suppose there are 50 distinguishable books including 18 English
books,17 French books, and 15 Spanish books.
(a) Howmany ways can 2 books be selected?
(b) How many ways can 3 books be selected that there so is 1 book
from each of the 3 languages?
(c) How many ways are there to select 3 books where exactly 1
language is missing?
(f) 6 people, 3 of each sex, and Mr. and Mrs. A cannot both be on
the committee?
A man has 15 close friends of whom 6 are women.
(a) In how many ways can he invite 3 or more of his friends to a
party?
(b) In how many ways can he invite 3 or moreof his friends if he
women?
this pool?
(b) How many 5-member committeescan be formed that have at
least 1 statistician member?
(c) The chemist, Professor C, and the psychologist, Professor P,
do not get along. How many 5-member committes can be
formed that have at most 1 of Professor C and ProfessorP on
the committee?
(d) How many 5-member committees can be formed so that the
number of chemists is greaterthan or equal to the number of
psychologistsand the number of psychologists is greater than
or equal to the number of statisticians?
36. How many ways can 3 integers be selected from the integers
1,2,.. .,30 so that their sum is even?
37. How many ways can a person invite 3 of his 6 friendsto lunch every
day for 20 days?
39. Four people can sit on each sideofa boat.How many ways can one
select a crewfor the boat if out of 30 candidates 10preferthe port
side, 12 prefer the starboard side, and 8 have no preference?
3. (a) 11!.
(b) 2!6!5!.
(c) 5-6!5!.
6. 3 \342\200\242
4!.
7. (a) 19!.
(b) 10!9!.
9. (a) C(8,5).
(b) C(5,3) C(3,2).
10. (a) C(52,13)
(b) C(13,6)C(13,5)C(26,2).
11.104-P(10,4).
13. (a) C (100,10)
<\302\253>
G'Kf)
+
(i')G5)
+ G8)(i5) \342\231\246
(i8)(!5)
\342\231\246
GfKi7)
+
Recall C(\302\273,r)
-
(}8)(\.") (\.
Section 2.3 Enumeration of Combinations and Permutations 161
(c) C(8,5).
21. 4!5!6!3!7!.
\302\253.w
*\342\200\242-.-(!\342\200\242)-(?).(5B)
+
(jB)
+ ... +
Q
26. \342\200\242
(a) (J)
48.
*>(!3)\302\251-^
<c)63)0\302\251-\302\253.
(e) 10 45 (choose
\342\200\242 the top card in 10 ways).
^ (l )(2/(3 )^^3
(ch\302\260ose the kind, choose the pair, choose the
other3 kinds, choose the 3 cards),
(j) \302\251(10).
<\302\253(?)-4.
O (J3)
\302\253(f)
* erer (?)\342\200\242
29. There are C(26,6) combinations with all 6 letters distinct; C(26,l)
C(25,4) combinationswith 1 pair of letters and 4 other letters,etc.
Total:C(26,6)
+ C(26,l) C(25,4) + C(26,2) C(24,2) + C(26,3).
30. (a) C(30,10)220.
(b)
2 4 24
2 5 23
2 6 22
2 7 21
3 6 21
repetitions. That is, if aua2, ... ,an are the n objects, we are counting
r-combinations and r-permutations of {oo
.
al9 oo .
a2,..., \342\200\242
<\302\273
aj.
We have already used U(n,r) (without so designating) in examples
2.1.5, 2.1.6, 2.1.10,2.1.11,and 2.2.5.
U(n,r) - nr
Section 2.4 Enumerating Combinations and Permutations with Repetitions 163
Answer: 325.
Example 2.4.2. The results of 50 football games (win, lose or, tie)
are to be predicted. How many different forecasts can contain exactly 28
correct results?
Answer. Choose28 correct results C (50,28) ways. Each of the
remaining22games has 2 wrong forecasts. Thus, there are C(50,28)-222
forecasts with exactly 28 correct predictions.
Answer. Since there are two choices for each character,the number
of different sequences of length k is 2\\ The number of nontrivial
sequences of length n or + 2n = 2n+1 - 2.If n - 4
less is 2 + 22 + 23 + - - \342\200\242
this total is 30, which is enough to encode the letters of the English
alphabet, but not enough to alsoencode the digits. To encode the digits
we need to allow sequences of length up to 5 for then there are possibly
25+1 - 2 = 62 total sequences. (This is why in Morse code all letters are
transmittedby sequences of four or fewer characters while all digits are
transmitted by sequences of length 5.)
subset of 4 positionsfor the O's). Thus, there are C(10,6) = C(10,4)- 210
such binary numbers.
We might recall that the formula for C(n,r) was obtained by dividing
P (n,r) by r! since each r-combination without repetitions gave rise to r!
permutations.The formula for V(n9r) (when unlimited repetitions is
allowed) is more difficult to obtain\342\200\224we cannot simply divide the
permutation result for unlimited repetition, U(n,r) = n\\ by an
factor
appropriate since different combinations with repetition will not in general
give rise to the samenumber of permutations. For example, the 3-
combination aab gives rise to 3 different permutations while the 3-
combination abc
gives rise to 6 permutations.
To give what we believe is an understandable explanation of the
formula for enumerating combinations with unlimited repetitions, we
will reformulate the problem different ways.
in several
Let the distinct objectsbe al9a2, ,an so that selections are made
...
from {oo
.
ax, oo .
a2, ..., oo \342\200\242
an}. Any r-combination will be of the form
{xi
\342\200\242 \342\200\242
au x2 a2,..., xn \342\200\242
an] where xu ..., xn are the repetition numbers,
each xt is nonnegative, and xx + x2 + \342\200\242 \342\200\242
\342\200\242 = r.
4- x\342\200\236 Conversely, any
sequence of nonnegative integers xu x2,..., xn where xx 4- x2 4-
\342\200\242
\342\200\242
\342\200\242
We summarize:
numbered boxes
= the number of binary numberswith n - 1 one's and r zeros.
- C(n
- 1 +
ryr)
= C(n - 1 + r,n - 1)
=
(n 4- r - -
l)!/[r!(n 1)!].
(e) The number of binary numbers with ten l's and five 0's is C(10 +
5,5)- C(15,5)3,003. =
(e) How many ways are there to fill a box with a dozen doughnuts
chosenfrom 8 different varieties of doughnuts?
We analyze this problemas follows: First, place one ball in each of the 5
boxes. Then we must count the number of ways of distributing the 15
remaining balls into 5 boxes with unlimited repetitions. By Theorem
2.4.2, we can do this in C(5- + 15,15) = C(19,15) ways. 1
Of course, we can alsomodelthis problem as a solution-of-an-equation
problem. If xt represents the number of balls in the ith box, then we are
asked to enumerate the number of integral solutionsto xx 4- x2 4- x3 4-
x4 + *5 = 20 where eachxt > 0. After distributing 1 ball into eachof the5
boxes,we then are to enumerate the number of integral solutionsof yx +
^2 + y3 4- y4 4- y5 = 15 where each y( > 0.
Likewise we can solve the following:
First, distribute3ballsin box 1, 2 balls in box 2,4 ballsin box 3,6 balls
in box 4, and 0 balls in box 5. That leaves 5 ballsto be distributed into 5
boxes with unlimited repetition. Th&t is, we now wish to count the
number of integral solutions of yx 4- y2 4- y3 4- y4 4- y5 = 5 where each yt >
0. There are C(5 - 1 4- 5,5)
= C(9,5) such solutions.
xn
= r where each xt > 0
C(24?5)
= C(4
\302\243 + *,k) = EC(fe + 4,4).
'k-0 *-0
(a) indistinguishable?
(b) distinguishable?
6. How many solutions are there to the equation xx + x2 4- xz + x4 4
= 50 in nonnegative
xb integers?
7. Find the number of distinct triples (xlf x2, x3) of nonnegative
integerssatisfying xx + x2 4- *3 < 15.
8. How many integers between 1 and 1,000 inclusivehave a sum of
digits
(a) equal to 7?
(b) less than 7?
adjacent hearts?
20. How many ways are thereto place20identical balls into 6 different
boxes in which exactly2 boxesareempty?
21. (a) How many ways are there to distribute20 chocolate
doughnuts, 12 cherry-filled doughnuts, and 24 cream-filled
doughnuts to 4 different students?
(b) How many ways can the different kinds of doughnuts be
distributedto students the if each student receives at least 2of
each of doughnut?
kind
29. In how many ways can we place 4 red balls, 4 white balls,and 4 blue
21.
\302\253(20+^\342\226\240')(1!t,S ~l)?i+A -1)-
<\302\273(u+,i-
-w+i- i)r+d- -1)-
22.
(0 (g).
<\302\253
(!o)-
24. \302\251
aaa 1
aab 3 (aab, aba, baa)
aac 3
aad 3
bba 3
bbd 3
bbc 3
cca 3
ccb 3
ccd 3
abc 6
abd 6
acd 6
bed 6
14 52
axa2bca3 a2axbca3
a2a3bcai a3a2bcal
aiajbca2 a3aibca2
2.5.1, we see that there are 3\\x permutations if we replace the a's by al9 a2,
and a3. Likewise there are (4!)(3bc) permutations if we also replace the b's
by bu b2, 63, and b4 corresponding to the number of ways of arranging
bub2,b3,b4. Continuing we see that there are (2!) (4!)(3!)x permutations if
we also replace the c's by cx and c2. But then we know that there are 10!
permutations of {aua29a39bub2yb3yb4ycuc29d}. Hence,
C(10,3) - -
C(7,4) C(3,2) C(l,l)
^^L ^
(Note the cancellation of certain factorials.)
Now let us introducethe following notation. Suppose that qX9q29..., qt
moreover, that au ..., at are t distinct objects. Let P(n;quq2, ... ,qt)
Section 2.5 Enumerating Permutations with Constrained Repetitions 175
- \342\200\242 \342\200\242
\342\200\242
\302\2532, y Qt aj.
Armed with the above two examples and this notation we prove the
following theorem.
repetitions).
P{n\\qu...,qt)
qx\\q2\\ ...qt\\
= Cin^i) C(n - qlfq2) C(n
-
qx
- q2,q3)
permutations.
However, we know that there are n\\ permutations of n distinct objects.
Equating these two quantities and solving for x gives the first equality of
the theorem.
The second is obtained as follows. First choose
equality the qx positions
for the from the remainingn - qx positions, choose q2 positions
a^s; then
for the a2'sand so on. Note that at the last we will have left n \342\200\224 qx
-
-
\342\200\242
<?2 \342\200\242 Qt-i
\342\200\242 = Qt positions to fill with the qt a/s, so C(n - qx
-
q2...
-Qt-uQt) = C(qt,qt).
The last equality of the theorem follows because both numbers
representthe samenumber of permutations, or we can obtain it by
cancelingfactorialsas in Exaipple2.5.2. \342\226\241
1L
P(ll; 3, 2, 2, 2,1,1)
3!2!2!2!1!1!
since this equals the number of permutations of {3 \342\200\242
A, 2
\342\200\242
E, 2
\342\200\242
L, 2
\342\200\242
S,
1 \342\200\242
if, 1 \342\200\242
The
T). number of arrangements of these that begin with letters
T and end with E is 9!/3!l!2!2!l!.
176 Chapter2: Elementary Combinatorics
Number of Arrangements
Types of Number of From Number of
Selection 5-Combinations Each Selection 5-Permutations
Let S denote the set of 1,000rugs.By attaching a tag bearing one of the
numbers 1, 2, or 3 to eachof the rugs, the manufacturer has defined a
/ whose domain is S and whose is {1,2,3}. This function
\342\231\246
function range
defines the following three subsets of S:
Al-{aeS\\f(a)-l],
A2
=
|a\302\243S|/(a) - 2}, and
A3^(aGS|/(a) = 3|.
178 Chapter 2: Elementary Combinatorics
S = Ax U A2 U \342\200\242
\342\200\242
\342\200\242
U At
Ai Pi Aj = 0 for i * j.
Example 2.5.6. Ax
=
{a,6}, A2 = {c},A3 = {d} form a 3-part partition
of S = {a,6,c,d} whereas (AlfA2fA3)y(A2fAlfAs)y(A2fA3fAl)y(A39A29Al)9
(A3yAlfA2)f(AuA3fA2) form 6 different ordered partitions of S using these
same 3 subsets.
1 A2 ^M '
Figure 2-4
({a},{&},{c,d}) ({bUaUc,d})
({a},{c},{6,d}) ({c},{a},{6,d})
({a},{d},{6,c}) ({d}f{aUb,c})
({bUd{a,d}) ({cUbUa,d})
({b},{d},{a,c}) ({dUb},{a,c})
({cUdUa,b}) ({d},{c},{a,6}).
|S| = nis
n\\
P(n;ql9...yqt)
qx\\q2\\. .qt\\'
-
Qt-iyQt) and we know that this equalsP(n;ql9... ,qt). \342\226\241
4, <?!- 1, q2
= 1, and q2 - 2. Thus,thereare 4!/l!l!2! - 12 such ordered
partitions.
(a) Howmany ways can the 52 cards be dealt to the four players?
(b) In how many ways will one player be dealt all four kings?
Answer. Choose the 7 hearts for North (and automatically give the
other 6 hearts to South) in C(13,7)ways; then partition the remaining
hands.
cards. C(13,7) 39!/6!7!13!2
(d) In how many ways will North and South have together all four
kings?
48!
0 4
9!13!3
48!
1 3 cu u
CK1)12!10M3!2
48!
2 2^ n ( a o\\v
CK2)
111*13!'
48'
3 1 CU 1)
C(4,1)12!10!13!2
4 0 48!
9!13!3 |
Section 2.5 Enumerating Permutations with Constrained Repetitions 181
14! 14!
P(14;3,2,3,2,2,2) =
3!2!3!2!2!2! 3!22!4
such ways.
(b) In howmany ways cari 12 of the 14peoplebe distributed into 3
teams where the first team has 3 members,the second
has 5, and the third
has 4 members?
Answer. 14!/(2!4!3!22!4)
(14!/3!22!3l!l!)
Answer. (7!/2!3!2!)
Some Hints
settings. What we need are some clues that will help determine whether
Section 2.5 Enumerating Permutations with Constrained Repetitions 183
Type of
Order Set of r Repetition Theorem
Counts Objects Allowed Name Number Reference
repetition
repetition
partition 2.5.2
Figure 2-5
184 Chapter 2: Elementary Combinatorics
2. A store has 25 flags to hang along the front of the store to celebrate
a special occasion.If thereare 10 red flags, 5 white flags, 4 yellow
flags, and 6 blueflags, how many distinguishable ways can the flags
be displayed?
3. In how many ways can 8 students be divided into
(c) 3 teams one with 1 student, one with 2 students, and onewith 5
students?
14. How many ft -digit binary numbers are there without any pair of
consecutivedigits beingthe same?
15.Compute the number of rows of 6 Americans,7 Mexicans,
and 10
17. (a) In how many ways can we choose 3 of the numbers from 1 to
only odd integers, and vice versaor (c)no repetition is allowed, and
the smallest number of the first group is larger than the largest
numberof the secondgroup?
24. A shop sells 20 different flavors of ice cream. In how many ways
can a customerchoose
4 ice cream cones (one dip of ice creamper
cone) if they
5. P(24;l,l,l,l,l,2,2,2)2)2,3,3,3).
n . v 15!
7- (a)
^
15!
(b) 7!4!2
12. (a) For k = 0,1,2,3,4 there are (* J X)
=
(k+*) ways to place ft balls
~ ~
in the first 2 boxes. ( ) t
to ways distribute the
\302\261(* +1)
(V)
Total =
f:(1l)2k410-k.
16!
19. P(16;2,2,2,2,2,2,l,l,l,l) = -^.
20!
,20. (a)
5!(4!)5
20!
(b)
2!23!24!5!2'
21. The messagesare partitioned 3 into cells of sizes 3,1,1 or 2,2,1.
+ 3(5!/2!2!l!)
Hence3(5!/3!l!l!)
\342\204\242
32!
99
(12!)28!
(Note: there are 32 black squaresso8 will not have a pawn on them.)
Section2.6 Binomial Coefficients 189
chosenin^gj + flljgjways.
(c)
y rjj9
since the 2 groups are determined oncethe 7 integers are
selected.
1 +
(b)
(20- 4) .(23)
<c>ra-H)-2o
(d) There are (
g) ways
to choose 3 flavors times 3 ways to fill 4
Combinatorial Reasoning
The symbol C(n,r) has two meanings: the combinatorial and the
factorial.In other words, C(n,r) represents the number of ways of
choosing from n distinct objects (the combinatorial
r objects meaning)
r\\{n-r)\\
for every pair of integers n and r where n > r > 0. This identity was
- r) =
(n -
C(n,n - -
(n r))l(n r)\\
But since n - (n - r)
= r, we have (n - (n - r))\\
= r! and C(n,r) =
C(nyn
- r).
(3d) C(nyr + 1) = [(n - r)/(r + 1)] C(n,r) for integers n > r + 1>
1.
Sir Isaac Newton (1646-1727) discovered the importance of this identity:
it shows how to compute C(rc,r+1) from C(n,r).
It might be instructive at this point to list some formulas for r-
(4a) P(n,r)
- P(n,r - 1) (n - r + 1).
Row Number
n = 0 C(0, 0)
n= 1 C(1,0) C(l, 1)
/
\342\200\242v
remaining
- 1 objects (excludingx) in C(n - l,r) ways. Since these two
n
classes are disjoint, we can apply the sum ruleto obtain the identity.
Thus, the number of committeesof r people is the sum of the number
of committees that containa given person and the number of committees
that do not containthat person.
This identity gives us an alternate methodfor determining the
numerical values of C(n,r). For example, if we know C(4,0), C(4,l), C(4,2),
C(4,3), and C(4,4), we can determine C(5,l), C(5,2),C(5,3),and C(5,4)
simply by addition.
Using identity (5) and the fact that C(rc,0) = C(n,n) = 1 for all
nonnegative integers n, we can build successive rows in the table of
binomialcoefficients,calledPascal'striangle (Figure 2-6).
What Pascal's identity says is that the numbers on the rth row are
found by adding the two nearest binomial coefficients in the row above it.
For instance, C(5,3) is the sum of the two circled binomial coefficients
above it. Since C(4,2) = 6 and C(4,3)= 4 we see that C(5,3) = C(4,2) +
C(4,3)- 6 + 4 - 10.
Let's list Pascal's triangleagain (Figure2-7) with the numerical values
of the binomial coefficients entered. The number row along
on the nth
the rth diagonalis C(n,r) or, in other words, the rth number on the nth
row is C(n,r).
We can construct the row correspondingto n = 8 by using row 7 and
Pascal's identity as follows:
n = 7- 1 7 21 35 35 21 7 1
h = 0 \342\226\272
1
n= 1 *\342\200\242
1 1
\302\253=2 *-1 2 1
n = 3 13
*\342\226\240 3 1
, = 4
n=4 *~14 6 4 1
n = 5 15
\342\226\272 10 10 5 1
/i = 6 \342\226\272
1 6 15 20 15 6 1
1 \342\226\272
1 7 21 35 35 21 7 1
Figure 2-7. Pascal's triangle with the numerical values of the binomial coefficients
entered.
C(n,0) = 1 - C(n,n).
n C(/7,0) C(/i.1) C(nt2) C(nt3) C(nA) C(nt5) C(nfi) C(nj) C(/i,8) C(/?,9) C(/i,10)
0
1 1
2 2 1
3 3 3 1
4 4 6 4 1
5 5 10 10 5 1
6 6 15 20 15 6 1
7 7 21 35 35 21 7 1
8 8 28 56 70 56 28 8 1
9 9 36 84 126 126 84 36 9 1
10 10 45 120 210 252 210 120 45 10 1
11 11 55 165 330 462 462 330 165 55 11
12 12 66 220 495 792 924 792 495 220 66
13 13 78 285 715 1287 1716 1716 1287 715 286
14 14 91 364 1001 2002 3003 3432 3003 1001 2002
15 15 105 455 1365 3003 5005 6435 6435 3003 5005
16 16 120 560 1820 4368 8008 11440 12870 11440 8008
17 17 136 680 2380 6188 12376 19448 24310 24310 19448
18 18 153 8163060 8568 18564 31824 43758 48620 43758
19 19 171 969 3876 11628 2713250388 75582 92378 92378
20 20 190 1140 4845 15504 38760 77520 125970 167960 184756
For coefficients missing from the Table use the relation C(ntr)
= C(ntn - r)
C(20,11) = C(20,9)= 167,960
from the extreme right to left.This follows because C(n,r) = C(n,n - r).
Thus, we need only know approximately one half the values of the
binomial coefficients in Pascal's triangle as the other values are known
from symmetry. Thus, if we have computed C(20,0), C(20,l), ..., and
C(20,10)then by symmetry we know C(20,ll) = C(20,9), C(20,12)=
C(20,8),C(20,13) C(20,7), =
etc., and the rest of the binomialcoefficients
on row 20. Thus, we can list more in a tabular form by omitting those
values of C(n,r) that we can obtain by symmetry (see Figure 2-8).
Note oneotherthing about Pascal's triangle or the table of Figure2-8:
the sum of all numbers on a diagonal (proceedingdownward from left to
right) is the number immediately below the last number on a diagonal.
For example, take the entries of the diagonal of Figure 2-8starting with
example, for row 21, we know C(21,0) = 1, C(21,l)= 21, but then we
compute C(21,2) by using identity (8), by computing the sum of the
diagonal 1 + 19 + 190 or using identity (5), C(21,2)= 20 4- 190 -
C(20,l) + C(20,2). Thus, C(21,2)= 210.Likewise, C(21,3) = 1 + 18 4- 171
elements and this number is also the sum of the number of all the subsets
of S respectively with 0 elements, 1 element, 2 elements,..., r elements,
..., and n elements.
Following the pattern of Example 2.4.8,we see that the above identity
counts in 2 different ways the number of nonnegative solutions of the
inequality
*i + *2 + * * * + xr+i ^n - r
permutations.
r! C(n - 1) + r! C(n
-Xyr
- l,r) r[(r
- 1)! C(n - l,r - 1)] = +
or
n-l
X! C(k 4- 2,2)
= C(n 4- 2,3).
r,t m , . (r + m + n)l
C(r + m + n,r)
\\
C(m + n,m) ;\342\200\224\342\200\224\342\200\224
rlmlnl
(fc
\302\243
- 2) (fe - l)fc = 6 \302\243C(fc,3) = 6C(\302\253 + 1,4) by (11).
1 - (* + y)\302\260
x + y - (x + y)1
x2 + 2xy + y2
- (* + y)2
x3 + 3x2y + 3xy2 + y3
- (* + y)3
x4 + 4x3y + 6x2y2 + 4ry3 4- y4 - (x 4- y)4
: . . + C(n,n)yn - xn 4-
4- C(nfr)xn-ryr +
(j) (j) xn~ly
+ (5)x-y + ...
+ xn~ryr + \342\200\242
\342\200\242
\342\200\242
+ /* - C(n,r)x-y.
\302\243
(?) (J)
r-0
The binomial coefficients C(n,r) = I'M receive their name from their
Example 2.7.1.
(X + =
y)\302\253 C(8,0)x8 + C(8,l)*7y + C(8,2)*Y
+ C(8,3)*Y4- C(8,4)*V + C(8,5)*Y
+ C(8,7)xy74- C(8,8)y8
4- C(8,6)*Y (2.7.1)
= x8 4- 8x7y 4- 28*Y +
56xV + 70*y
4- 56*V 4- 28*y 4- 8xy7 4- ys;
(2a 4- 56)6 - C(6,0)(2a)6 4- C(6,l)(2a)5(56) + C(6,2)(2a)4(56)2
4- C(6,3)(2a)3(56)3 + C(6,4)(2a)2(56)4 (2.7.2)
4- C(6,5)(2a)(56)5 + C(6,6)(56)6.
Letx - 2a and y
= 56 in Theorem 2.7.1. Then
(x+y)
= * + y
\\t
C(n,r)*-y) (^ C(n,r)*-yj (E C(n,r)x\"-y)
= C(n,0)jcri+14- E C(n,r)x,1-r+y
r-l
4- \302\243C(n,r)xn-y+1 4- C(n9n)yn+l.
r-0
Section2.7 The Binomial and Multinomial Theorems 203
(X + y)\302\273+i
_ x^1 + \302\243[C(n,r) + C(n,r - l)]xn+1-ryr+ yB+1.
r-l
or
n+1
(x + y)n+l = X]C(n + l,r)xn+1-y.
r-0
(x + y)n - C(n,n
\302\243
-
r)jcn\"V - C(n,r)*yi-r
\302\243
r-0 r-0
- C(n,n
\302\243
-
r)xry\"-r
r-0
The first of these follows from Theorem 2.7.1 and the symmetry property
C{nyr)
=
C(nyn
- r) for r - 0, 1, ..., n. The other two follow by
interchanging x with y.
The case y = 1 occurs frequently enoughto warrant recording it as a
special case.
(x + l)n - C(n,r)xn-r
\302\243
= c(*>*
\302\243
- r>*n\"r - 21 C(n,r)xr.
r-0 r-0 r-0
^
Replacing x by \342\200\224
x we have
(13) C(n,0)
-
C(n,l) + C(n,2) + \342\200\242
\342\200\242
\342\200\242
+ (-l)n C(n9n) = 0.
This says that the alternating sum of the members of any row of Pascal's
triangleis zero.
We can also write this as
number of elements.
C(n
- l,n - -
l)ln (2n - l)/n.
1. combinatorial
reasoning;
n\\
P\\n\\qu <?2, \342\200\242
\342\200\242
\342\200\242
> Qt)
=
-7
\342\200\224j\342\200\224j
C(18,4) C(14,5)C(9,6)C(3,3) = .
-^^
P(18:4W) =
4!^3!-
xt)\\
Xj X4
X\302\247 X5 IS
P(10;2,0,l,3,4) = 12,600.
=\342\200\224^
Corollary 2.7.2 states that there are tn \302\243-part ordered partitions of a set
S with n elements.
andPn(3)
= (3nl + l)/2.
(b) Generalizeto find the sum 2?_0 C(nfr) tr for any real number
L
(c) Likewiseprove that T - 2?_0 (-l)r C(n,r) 3n~r.
4. Use the multinomialtheoremto expand(xx + x2 4- xs + x4)4.
5. (a) Determinethe coefficient of x\\ x\\ x\\ x\\ in (xx + x2 4- x3 4- x4 4-
x5)10.
(b) Determine the coefficient of xVVu;6 in (x - ly 4- 3z - w)25.
(c) Determine the numberoftermsin the expansion of (x - ly 4-
3* - u;)25.
(d) Determine the coefficientofx5in (a + bx + ex2)10.
6. What is the sum of all numbersofthe form l2\\/qx\\q2\\q$\\ where ql9
q2i q3 range over all sets of nonnegative integerssuch that qx 4-
q2 4-g3 = 12?
7. (a) UsePascal'sidentity to prove C(2n 4- 2,n
that 4- 1) -
C(2n,n 4- 1) 4- 2C(2n,n) 4- C(2n,n - 1).
(b) Therefore
C(2n 4- 2,n 4- 1) = 2[C(2n,n) 4- C(2n,n - 1)].
(c) Consider a set of 2n men and 2 women and give a
combinatorial
argument for the equation in (a).
8. Obtain relationsby equating the coefficients of xk in the
following:
1
(a) (1 4- x)n
+ - (1 4- x) (C(n,0) + C(n,l)x 4- ... 4- C(n,n)xn);
(b) (1 4- x)n+2 = (1 4- 2x 4- x2) (C(n,0) 4- C(n,l)* + . . . +
C(n,n)xn);
(c) (1 4- x)n+z = (1 4- 3x 4- 3x2 4- xz) (2;_o C(n9r)xr).
9. Prove that:
[C(n,0) 4- C(n,l) + \342\200\242\342\200\242\342\200\242'
+ C(n,n)]2 - C(2n,0) 4- C(2n,l)
\342\200\242\342\200\242\342\200\242
4-
4- C(2n,2n).
(-l)nSnC(n,n).
where
( n if n is even
= J
(7
n \342\200\224
1 if n is odd.
19. (a) Among 2rc objects, n of them are indistinguishable. Find the
number of ways to select n of these 2rc objects. (Hint: first
select r objects from the n distinguishable objects; then select
n- r objects from the indistinguishable objects.)
(b) Among 3n + 1 objects,n of them are indistinguishable. Find
the number of ways to select n of these 3n + 1 objects.
20. The Stirling number of the second kind, S(n,t), denotesthe
number of t-part unordered partitions of a set with n distinct
elements where each cell is nonempty (that is, each <?, > 0). Show
210 Chapter 2: Elementary Combinatorics
22. Let P(n) denote the number of unordered partitions of a set with n
distinct elements where the number of cellsis not specified, that is
(1 + x)n + (1 - x)n 2
r = C(n,0) + C(ra,2)x2 + \342\200\242
\342\200\242
\342\200\242
4- C(n,q)xQ where
( n if n is even
n n is odd
\342\200\224
1 if
Figure 2-9
Section2.8 The Principle of Inclusion-Exclusion 213
If F is the set of faculty who speak French and R isthe set of faculty
who speak Russian,then we know that | F | = 200, | R |
- 50 and | F O R | -
20. We are asked to compute| F U R | which by the formula is 200 + 50 -
20- 230.
We will give 3 solutions; one using the sum rule, one by counting
indirectly, and one using the principle of inclusion-exclusion.
The number of committeesincludingboth Professor A and Professor B
is C(8,3) = 56. The number of committees including Professor A but
excluding Professor B is =
C(8,4) 70,(since Professor A fills one position
there are only 4 more positionsto fill and since Professor B is excluded
there are only 8 people from which to choose). LikewiseC(8,4)is the
number of committees including Professor B and excludingProfessorA.
Consequently by the sum rule the total number of ways of selecting a
committee of 5 including ProfessorA or Professor B is C(8,3) +
2C(8,4)= 56 + 2 \342\200\242 70 = 196. By counting indirectly we obtain a second
professors.
A third solution uses the principle of inclusion-exclusion.Among the
252 committees of 5 members, let Ax and A2 be the set of committeesthat
includeProfessor and A Professor JB, respectively. Since | Ax |
=
C(9,4) =
126 -1A21 and | Ax D A2 | = C (8,3) - 56,it follows that | Ax U A2 |
- 126 +
126 - 56 = 196.
214 Chapter 2: Elementary Combinatorics
A = (A O B O C) U (A Pi B O \"C) U (A O B O C) U (ADBDC),
jb - (\"J n b n c) u (A n b n c> u (J n' b no u (A n jb n o,
C = (A O B O C) U (A O B O C) U (A H B O C) U (A O B O C).
Therefore since these are disjointunions we can use the sum rule to
compute:
|A| =
|AnBnc| + AnBnc| + |AnBnc| + |AnBnc|,
(2.8.4)
\\b\\-\\a n b n c\\ + \\a nb n c\\ + \\Xnb n c\\ + \\a n b n c\\,
(2.8.5)
\\c\\-\\a n En c\\ + \\a n5n c\\ + \\a n b n c\\ + \\a nb n c\\,
(2.8.6)
Figure 2-10
Section 2.8 The Principle of Inclusion-Exclusion 215
|AUBU C| =
|A| + |B| + |C|-|AnB|-|A n C|
-|BH CI + IAHBH C|
Let F be the set of faculty who speak French, R be the set of faculty
who speak Russian, and S be the set of faculty that speak Spanish. We
| J nB|-|TU\"B|-|l/|-|A UB|
= |[/|-{|A| + |B|-|AnB|} (2.8.8)
-|tf|-|A|-|fl| + |Anfl|.
then
altogether, there are 1,000 -\\F\\-\\R\\ + \\F C) R\\ = 1,000 - 200 - 50+ 20=
1,000
-
\\F U R | = 1,000 - 230 = 770people who speak neither French
nor Russian.
languages.
Example2.8.5. In a survey of students at Florida State University
the following information was obtained:. 260 were taking a statistics
course, 208 were taking a mathematics course, 160 were taking a
computer programming course, 76 were taking statistics and
48
mathematics, were taking statistics and computer programming,62were taking
mathematicscourses and computer programming, 30 were taking all 3
kindsof courses, 150 and were taking none of the 3 courses.
Let
S =
{students taking statistics},
M = {students taking mathematics},
C- {students taking computer programming}.
The Venn diagram illustrated in Figure 2-11 will also be helpful in our
analysis.
WeknowthatlSl = 260,|Mh208,|Chl60,|SnMl = 76,|SnC| =
48,|MO C| = 62,|SnM.n =
C| 30,and|SUMU C |- 150; sowe can
immediately insert the number of students in 2 of the 8 regions of the
\\s n m n c\\
=
\\s n m- s n mn c\\
=
\\s n m\\
-
\\s n mn c\\
- 76 - 30 = 46.
Figure 2-11
218 Chapter 2: Elementary Combinatorics
Is ( 46\\ M \\
V C J 150
Figure 2-12
Thus, we can insert some more numbersin the appropriate regions of the
Venn diagram (see Figure2-12).
Only the computation of the number of students taking coursesin
exactly one of the 3 subjects remains, and that is preciselythe contentof
parts(e), (f), and (g).
\\S O MO C\\
= 260 - 46 - 18 - 30- 166.
(f)IAfnsnci = \\m\\
-
iMnsnci - \\Mncns\\ -
|Mnsnc_| = ioo
\\cnsnM\\ -
_
ig)\\cnsnM\\ - |c| - \\cnsr)M\\ -
|cnsnM| = 80
Thus, we can fill in the numbers for all 8 regions in the Venn diagram
illustrated in Fig 2-13.
Let us now proceed to give formulation of the principleof
a general
If
inclusion-exclusion. PlfP2f -,Pn
\342\200\242
\342\200\242
properties that elements of a
are
universal set U may or may not satisfy,then for each i, let A, be the set of
thoseelements ofU that satisfy the property Pz. Then Ax U A2 U \342\200\242 \342\200\242
\342\200\242
U
An is the set of all elementsof U that satisfy at least one of the properties
P1,P2,* \342\200\242
\342\200\242while
9Pn> Ai Pi Aj is the set of elements that satisfy both the
properties P, and P;,At D Aj P) Ak is the set of elementsthat satisfy.the 3
properties Pi9 Pj9 and Pk. The set Ax O A2 H \342\200\242
\342\200\242
\342\200\242 is
flA\342\200\236 /the set of
elements that satisfy all of thepropertiesP^ P2, \342\200\242 \342\200\242The
\342\200\242
^. set of
elements that donot satisfy P, is A, and Ax D A2 D \342\200\242
\342\200\242
\342\200\242
H An is the set of
elementsthat satisfy none of the properties.
Let us list a few facts that will be useful. Suppose A, B, Ai are subsets of
U.
1. |A| = |[/|-|A|(countingindirectly).
2. |B- A\\
- |J3 n A| = |S- (AOB)| =
|B|
- |A H B| (counting
relative complements).
Section 2.8 The Principle of inclusion-Exclusion 219
Figure 2-13
\342\226\240
\342\226\240
(-l)n-1\\A1DA2. DAn\\,
=
\\AX U A2U A3U A4\\ \\Ai\\ + \\A2\\ + \\A3\\ + \\Ai\\
-lA.nAjl-lA.riAal-lAxn^l
-|A2nA3|-|A2nA4|-|A3nA4|
+ \\Ai n a2 n a3\\ + \\At n a2 n a4\\
+ a3 + n a4| + \\a2
|Ai n n a3 n a4|
-\\At n A2n a3d a4\\.
I^UAjU. \342\200\242
\342\200\242
U^UiO-KAiU.
\342\200\242
-UAJUAJ
= |AtUA2U. \342\200\242
.UAj + |An+1| (2.8.11)
-|(AXUA2U. \342\200\242
.UAn)PiAn+1|
\342\200\242
\342\200\242
\342\200\242
|AXUA2U UAJ-JlA,-!- EI^HAJ
+ JLlAiHAjHA^ (2.8.13)
+ .. . + (-l)-1
\\AlnA2n.. \342\200\242
ha\342\200\236|
and
I (a, n u
a\342\200\236+1) (a2 n u
a\342\200\236+1)
\342\200\242..
u (An n |
=
a\342\200\236+1)
| a;
\302\243
n An+1 | -\302\243 | a,- n An+1 n <a, n An+ly\\
\342\226\240-i >j
n An+1) n n n n An+1) |
(2-ai4)
+ \302\243 | (A, (A,- a\342\200\236+1) (a*
Aj
C\\ Ak D An+l, we have
|AXUA2U \342\200\242
\342\200\242
\342\200\242
UAnUAn+1| =
|A,UA2U \342\200\242
\342\200\242
\342\200\242
UAnUA\342\200\236+1|
=
EI * I
-
I*
\302\243 n.A,-1 + EI Ai n a, n a h\\ (2.8.16)
the third sum is taken over all 3-combinations of {1,2, ,n 4- l}, \342\200\242
\342\200\242
\342\200\242 and
so on. In other Equation (2.8.16) is
words, just Equation (2.8.10) with n
replaced by n 4- 1.
The theorem,then, is proved by mathematical induction. \342\226\241
Corollary 2.8.1
Let U bethe setofsolutions (xl9 x2y x3) where 2 < xu 4 < x2, ~ 2 < xz.
We know that | U\\
= C(20 -2-4 + 2+ 3-1,3-1)- C(18,2).
Let
Ax
- {(xux2,x3) G (7|x!>6}
Section2.8 The Principle of Inclusion-Exclusion 223
A2
- {(xux2,xs) E t/|x2 > 8}
A3
=
{(xx ,x2 ,x3) U
\302\243 | xz > 10}.
,A|_A4!3!'' lAl-iL
11 ~
5!3!
Ul-M \"
5!4!'
|A1nA2|-||,|A1nAa|-||,|A8n>4,|-^,
I A, O A2D Aal-3!.
Thus,
Eratosthenes who lived in Alexandria in the third century B.C. gives a way
of listing all primes between 1 and n. His procedure is the following:
Remove all multiples of 2 other than 2. Keepthe first remaining integer
exceeding 2, namely, the prime 3. Remove all multiples of 3 except 3
itself. Keepthe first remaining integer exceeding 3, namely, the prime 5.
Remove all the multiples of 5 except 5, and so on.The retained numbers
are the primes. This method is called the \"the sieve of Eratosthenes.\"
We now compute how many integers between 1 and 1,000 are not
divisibleby 2,3,5, or 7, that is, how many integers remain after the first 4
steps of Eratosthenes' s ieve method. The problem is solved using the
principleofinclusion-exclusion.
Let U be the set of integers x such that 1 < x < 1,000.
Let Au A2, A3, A4
be the set of elementsof U divisible by 2, 3, 5, and 7, respectively. Thus,
Ax Pi A2 denotes those positive integers <1,000that are divisible by 6,
Ax n A3 those divisible by 10, A2D A3 = {all integers^ 11 ^ x < J.,000and
x is divisible by 15} and so on. We wish to I Ax compute D A2 H A3 D A41.
We know that
1,000=
|A3| =
^-
200,
|A4| =
[\302\261^j=142,
,000
= 166
1^0^1 = =
100,
^
|A2nA3| =
[^j=66,
Section2.8 The Principle of Inclusion-Exclusion 225
M.n*|-[!g!j-47.
= 23,
lA.nA.n^i-^J-g,
Then,
I Ax U A2 U A3 U A41 = 500 + 333 + 200+ 142 - 166
- 100 - 71- 66 - 47 - 28
+ 33 + 23 + 14 + 9 - 4 = 772.
Thus,
| A, O A2 O A3 O A4\\
- 1,000 - 772 = 228.
An | = |
- divides
O U\\ | Ax U A2 U \342\200\242
\342\200\242
\342\200\242
UAJ. If d rc, then there are n/d
multiples of d in U.Hence
\\At\\-^,\\AinAj\\-^,...,\\AlnAan...nAh\\- ^.
226 Chapter 2: Elementary Combinatorics
E + ' \342\200\242
\342\200\242
+
0(n)-*-\302\243\302\243+ TTp (-\302\273*P pU p-
14 04-041- \342\200\242
\342\200\242
\342\200\242
-I40 4-04I-.-
14 UA2U . \342\200\242
\342\200\242
U4|-n|4|-C(n,2)|A,0 4|
+ C(ra,3)14 O A2 O As | + . \342\200\242
\342\200\242
(2.8.20)
\342\200\242
\342\200\242
\342\200\242
+ (-D\"-Il4n4n oaj,
and
\342\200\242
I4040 \342\200\242\342\200\242
0 4|-|t/|-\302\273|4l
+ C(n,2) 14 O 41 - C(n,3) 14 O A2 O 41 + .. . (2.8.21)
+ \342\200\242
\342\200\242
\342\200\242
(-l)\302\273|A1OA,0 OAJ.
Let U be the set of n\\ permutations of {1,2,.. ,,n}. For each i, let At be
the permutations (bub2f:. .,bn) of {1,2,^..,n]such that b, = i/Then the set
of derangements is preciselythe set Ax D A2 H \342\200\242
\342\200\242
\342\200\242
H An. Therefore
Dn = \\AlC\\ A2D
\342\200\242
\342\200\242
\342\200\242
HAJ. The permutations in Ax are all of the form
(l,b2f.. .,6n)where (b2f...,&\342\200\236)
is a permutation of {2,3,.. .,n}. Thus | Ax | =
(n \342\200\224
1)!; similarly |At| = (rc - 1)!. Likewise,Ax P) A2 is the set of
permutations of the form (1,2,63,.. .fbn) so that | Ax P) A2 \\
= (n \342\200\224In
2)!. a
similar way we see that | At D Aj\\
= (n - 2)!. For any integer k where
1 < fc < n, the permutations in Ax H A2 D \342\200\242
\342\200\242
\342\200\242
D Ak are of the form
(1,2,.. .,k9bk+u...,6n)where (6/5+1,.. .,6n) is a permutation of {k 4- 1,.. .,n}.
Thus, |AX OA2n nAj=(n- k)\\y and more generally, |Atl D
1^2,.. .,ifc} a ^-combination of {1,2,.. .,n}.
Thus, we have the conditions prevailing in (2.8.20), so that
\\U\\-\\AXUA2U \342\200\242
\342\200\242
An\\ =
\342\200\242
U n\\-C(n,l)(n- 1)!
4- C(n,2)(n
- 2)! + + (-l)nC(n,n)
, n\\
+
n\\ n\\
+ (-\302\273<
\"ra!\"l! 2!-3!+'
Thus, (2.8.22)
In particular,
D, = ~
1!+ 2!
5! ~
+ ~ 44.
3! 4! 5!.
Answer: The first time the books are distributed n\\ ways, the
second time Dn ways. Hence, the total numberof ways is given by
1 1
n\\Dn
= (\302\253!)2 + + + {-IT-.
l! 2! n\\,
228 Chapter 2: Elementary Combinatorics
Answer, (a) The integers 1,2, 3,4, and 5 can be placed into the first
5 places in D5 ways; the last 5 integers 6, 7, 8, 9,and 10 can be placed in
the last 5 places in D5 ways. Hence, the answer is D5 . D5 = 1936. (b) Any
arrangement of 6, 7, 8,9,and 10 in the first 5 places is a derangement so
there are 5! possibilities; the same is true for the integers 1,2,3,4, and 5 in
the last 5 places.Hence, there are (5!)2 = 14,400 such derangements.
advertising. Suppose that \\T\\ = 415, |A| - 350, \\N\\ - 280, 100
Section 2.8 The Principle of Inclusion-Exclusion 229
(b) How many clients use radio and newspaper advertising but
not television?
(c) How many use televisionbut do not use newspaper
advertising
and^do
not use radio advertising?
(d) Pind|rn/?nN|.
5. In a survey of 800 voters, the following information was found: 300
17. At a theater 10 men check their hats. In how many ways can their
hats be returned so that
(a) no man receives his own hat?
(b) at least 1ofthemenreceives his own hat?
(c) at least 2 of the men receive their own hats?
18. Howmany ways are there to select a 5-cardhand from a deck of 52
cards such that the hand containsat leastone card in each suit?
19. How many 13-card bridge hands have at least
(a) onecardin each suit?
(b) one void suit?
(c) oneof eachhonor card (honor cards are aces, kings, queens,
and jacks)?
20. How many ways are there to assign 20 different people to 3
different rooms with at least 1 personin each room?
24. In how many ways can each of 10 people selecta left glove and a
right glove out of a total of 10 pairs of gloves so that no person
selects a matchingpair of gloves?
25. The of a chessboard
squares are painted 8 different colors. The
squares of each row are paintedall 8 colors and no 2 consecutive
26. How many arrangements are there of the letters a, 6,c,d,e, and /
with either a before b, or b before c, or c before d? (By \"before,\" we
mean anywhere before, not just immediatelybefore.)
27. How many arrangements are there of the letters of the word
MATHEMATICS with both T's before both A% or both A's
before both M's, or both M's before the \302\243?
28. How many integers between 1 and 50 are relatively prime to 50?
(The integer a is relatively prime to the integer b iff 1 is the only
common positive divisor.)
*29. How many arrangements are there of MISSISSIPPI with no pair
of consecutive letters the same?
30. Suppose that a person with 10 friends invites a different subset of 3
friends to dinner every night for 10 days. How many ways can this
bedoneso that all at least once?
friends are included
31. How many arrangements of 3 a's, 3 b% and 3 c's
are there
(a) without 3 consecutive letters the same?
(b) having no adjacent letters the same?
32. Same problemas 31for 3 a's, 3 b% 3 c's, and 3 d's.
33. A secretary types n letters and their correspondingenvelopes; in a
digits?
41. How many 4-digit numbers can be composed of the digits in the
number 123,143?
44. How many 5-digit numbers can be composedof the digits of the
number 12,123,334 if the digit 3 must not appearthreetimes in a
row?
45. (a) In how many ways can we arrange the digits in the number
11,223,344 if the same digit must not appear twicein a row?
(b) Solve part (a) for the number 12,234,455.
46. Use the sieve of Eratosthenes to compute all prime integers<
200.
1. 100 - 47 - 35 + - 41.
23
2. 100- 47 - 35 - 20 + 23 + 12+ 11- 5 = 39.
4. (a) 75.
(b) \\RHNn T| = 80
(c) |rn^nfl|-i75.
(d) I T n R n N\\
=
| T U R U N\\
- 1,000 - 625 = 375.
Section 2.8 The Principle of Inclusion-Exclusion 233
5.
325
E l
/ 1 90 \\ \\
I 55 /
4.5 )
9\"4
71 V/
nL61
99
Figure 2-14
C3 - PS
\302\253\342\226\240 - - - + + \342\231\246 + - (!)
PS) PS) (1) \302\251 (!) (!) (!)
= 217.
-
9. 1,000 (200 + 166 + 125) + (33 + 25+ 41) - 8 - 600.
,b,0. + (>, +
(>.
+ 0. + Qz,,.
(c) 10!- (3)9! + (3)8!
- 7!.
14. 48 -
(fj3e + g)28 g)l8 40,824.
- =
15. Let A, be the arrangements where the 4 a's are one block, A2 the
arrangements with the 3 b 's in a single block, and A3 the
arrangements with the 2 c's in a block. Then,
9! / 6! 7! 8! \\
\\AtnA2nA3\\ + +
4!3!2! I 3!2! 4!2! 4!3!/
4! 5! 6!
+ + +
o1
871.
2l 3! 4!-3!
16. 310 -
(3)210 + 3 ways.
17. (a) Ac
-
(b) 10! D10.
(c) 10! - D10
-
10D9.
-
'Ml) <(1) + \302\253PD-\302\253P3-
234 Chapter 2: Elementary Combinatorics
*\302\253(S)-G)\302\256*G)(S)-G)-
3(3!)25! + 27 . 3!(2!)25! - 9 +
(3!)22!4! (3!)4.
23. A*.
24. (10!)D10.
25. The first row can be painted8!ways. Each row after the first can be
paintedDs ways. Hence the number of ways is 8!(D8)7.
(g) ways can the girls be divided into teams with 2 members
each?
(h) ways can the students be divided where the first team and the
second team each have 4 students, the third and fourth teams
have 3 each and the fifth team has 2 members?
(i) committees of 6 students canbeformed with 3 of each sex but
girl G and boy B cannot both be on the committee?
6. A test with 20 questions is a multiple choicetestwith 5 answers for
each question but only 1 correctanswer to each question. How
many ways are thereto have
(a) exactly 6 correct answers?
(b) at least 6 correctanswers?
7. How many integral solutions are there of xx + - 20
where 2 < xu 3 < x2i 0 < x3, 5 < x4?
different shelves?
(o) -(\") +
(*) O-o.
-\302\251\342\200\242\342\200\242\342\200\242\342\231\246<-\302\273\342\226\240
[(S)+ft)+---+fc)r-g(^).
12. Find the number of 7-card hands that have at least one card in
each suit.
13. Find the number of permutations of the letters of TOMTOM so
that the same letters do not appear together.
\"
14. Use the notation M to stand for (n * + r) . Then prove
(a) +
(;)-(\302\253_-1) (V)
15. How many different arrangements are there of the lettersof the
word CONNECTICUT
Recurrence
Relations
(0 if0<r<4
2 if5<r<9
br =
3 ifr=10
4 ifll<r
is the sequence
where b0
= bx = b2 = b3 = b4
= 0, b5 = b6 = b7
=
b8 =
b9 = 2, bi0
= 3, and br = 4 for all subscripts r > 11 thus, B =
(0,0,0,0,0,2,2,2,2,2,3,4,4,...).The sequence C {Cr}^0> where Cr = = r + 1
for each value of r, is the sequence (1,2,3,4,5,...), the sequence D and =
{dr)r-owhere, each r, dr
for= r2 is the sequence(0,1,4,9,16,25,...).
The letter we use for the subscript has no particular significance,
another will do just as easily; in other words, there is no differencein the
sequence denoted by {at}r-o and that denoted by {ar}\"_0- Normally we will
be interested in sequences A = {ar}\"-0 where ar is the number of ways to
237
238 Chapter 3: Recurrence Relations
*i 4- x2 + \342\200\242
\342\200\242
xn =r
\342\200\242
4- (3.1.1)
\\C(n,r) if0<r<n
ar =
0 if n + 1 < r.
[
a0
= 1, ax = 3, a2 - C(4,2),a3 = C(5,3) - 3, a4 - C(6,4)- 9,
a5
= C(7,5)
- 3C(4,2), a6 = C(8,6) - 3C(5,3)
+ 3.
Of we could place all sorts of complicatedrestrictionson the
course,
values and you might well imaginethat the difficulty
for xt for giving an
expression for each ar could become insurmountable. We don't deny that
this would be the case using the methods developedup to this point.
Nevertheless, it is our intention to introduce a method in this sectionthat
will handle problems like the last case fairly easily.
Oddly enough, the clue to the new method is found in something quite
old and familiar:multiplication of polynomials. Since polynomials only
involve finitely many nonzero terms and sequences caninvolve infinitely
technique used in this textto solve combinatorial problems, but once this
method is masteredit will be the easiest method to apply to a broad
spectrumofproblems.
To the sequence A = {ar}\"_0, we assign the symbolA (X) = a0 + ax X +
... + anXn ... - 2\".o ar^r- The expressionA(X) is called a formal
power series, a, is the coefficientofX\\ the term a,X' is the term of
degree i, and the term a0 =
X\302\260 a0 is called the constant term. The
coefficients are really what are of interest; the symbol X1 is simply a
device for locatingthe coefficient aif and reason, the formal
for this power
series A(X) = arXr
2\302\243_0 is called an (ordinary) generating function for
the sequence A = {ar}^0-
The words \"generating function\" are usfed because, in some sense,
A(X) generatesits coefficients. The word \"ordinary\" is used to denote
the fact that powers of X are used; other kinds of generatingfunctions
could use, by contrast, other functions like Xr/rl,sin (rX), or cos (rX) in
place of Xr. Forthemostpart we will suppress the word \"ordinary\" in our
usage. We use the word \"formal\" to distinguish between the abstract
ar Xr and the concept of powerseriessome
symbol A (X) = 2\"_0 students
A(X) = X>X',
r-0
B(X) = 2X5 + 2X6 + 2X7 + 2X8 + 2X9 + 3X10
C(X) = + l)Xr,
Y.(r
r-0
=
\302\243>(X) f>2)X'
r-0
in the product A (X) B(X) is obtainedby taking the sum of all possible
products of one terma; Xj from A(X) and one term bk Xk from B(X)
such that the sum of exponentsj + k = n.
Of course, this can be accomplished very systematically by starting
with the exponent 0 and thus with the constant term A(X) and a0 of
multiply it by the coefficient bn of Xn in B(X); then proceed to the
coefficient ax of X in A (X) and multiply it by the coefficient bn_x of Xn_1
in B(X)y and so on, using the coefficients of increasing powers of X in
A(X) and the coefficients of corresponding decreasing powers of X in
B(X) as follows:
n
Thus,
factor and X8 in the second;X3 in the first and X5 in the second; X4in the
first and X4 in the second; or X8 in the first and in the
X\302\260 second factor.
Thus, the coefficient of X8 in the product A (X) B(X) is such that P8 -
po b6
4- a3 65 4- a4 64 4- a8 b0f because (0,8),(3,5),(4,4) and (8,0) are the only
pairs of exponentsofA(X) and B(X) whose sum is 8.
Section3.1 Generating Functions of Sequences 241
Generating FunctionModels
Thus, if we wanted to count the number of nonnegative integral
solutions to an equation ex 4- e2 = r with certain constraints on ex and e2,
we would expect that we need only find the coefficient of Xr in the
product of generating functions A(X) B(X), where the exponents of
A(X) reflectthe constraints on ex and the exponents of B(X) reflectthe
constraints on be 0,1, or 9,
e2. Thus, if ex let A(X) = 1
can only then 4-
4- <
X X9. If e2 can only be even and 0 e2 8, < B (X) - 1 4- X2 X4 then 4- +
X6 4- X8. On the other if ex can be any nonnegative integer
hand, value,
then we let A(X) = 1 4- X 4- X2... [in this case, A(X) has an infinite
number of Jerms]. Likewise, if e2 can only take on the integral values, say,
242 Chapter 3: RecurrenceRelations
B(X) - J2bjX\\
ax) =
\302\243>***.
Then
=
A(X)B(X)C(X) f^PrXr
r-0
where
i+j+k~r
that is, the the product is obtainedby taking any one term
term Pr Xr in
a, X1 from A (X), any 6; Xj from B (X), and any one term ck Xk
one term
from C(X) such that the sum of exponentsi + j + k = r. Of course, the
reader can extend this idea to productsofseveralfactors. Thus, here is
our rule:
(X2 + X3 + X4 + X5 + X6)2
(X + X3 -t- X5 4- X7 + X9).
gives all the coefficients and thus we know the numberofsolutionsto the
above equation is C(n,r).
each i.
In particular,
\302\273
2 \302\260\302\260
and
(r 4- 2)(r 4- 1)
y ^
r-0 2
244 Chapter 3: Recurrence Relations
(2r.x Xr)n, which by Theorem 2.4.3must equal 2?_n C(r - l,n - l)Xr.
(The reader should a combinatorial explanation
give as to why the
Here we can take two approaches. Of course we are looking for the
coefficient of X10 in (1 + X + X2 4- X3 + \342\200\242
\342\200\242
\342\200\242
)3. But since the equation is
a model for the distribution of 10 similar balls into 3 boxeswe see that
each et < 10 for we cannot placemorethan 10 balls in each box. Thus we
could also interpretthe problem as one where we are to find the
coefficient of X10 in (1 + X + X2 + \342\200\242
\342\200\242
\342\200\242
4- X10)3.
Section 3.1 Generating Functions of Sequences 245
(b) 2 < et
< 5 for each i.
1 if0<r<2
ar - 3 if3<r<5
0 ifr>6
1. (a) (1 + X + X2 + X3)3.
(b) (X2 + X3 + X4 + X5)3.
X7).
\342\200\242
\342\200\242
\342\200\242 \342\200\242
\342\200\242
(b) (1+ +X\"+ -)4.
(c) (1 + X2 + \342\200\242
\342\200\242
\342\200\242
+ X12)(X + X3 + X5 + X7)(l + \342\200\242
\342\200\242
\342\200\242
+ X\"
\\n-2
(e) (1 + X + \342\200\242
\342\200\242
\342\200\242
+ X9)3.
3. (a) Solve ex + e2 4- \342\200\242
\342\200\242
\342\200\242
4- e10 - 23 where et = 0,5,9. This can be
done only with one 5, two 9's and seven O's. Hence the
coefficient is 10!/l!2!7!.
(b) 32 can be otained only with three 9's, one 5, and 6 0's. Thusthe
coefficient of X32 is 10!/3!l!6!.
4. The only solutionsto ex + e2 4- \342\200\242
\342\200\242
e10 =
\342\200\242
+ 16 where et = 0,4,8are
those with four 4's, no S's, and six 0's; two S's, no 4's, and eight O's;
or two 4's, one8,and seven 0's. Thus the coefficient is
Section3.2 Calculating Coefficients of Generating Functions 247
6. (1 + X- \342\200\242
-)3(X + X2. \342\200\242
-)4.
(1 + X + X2 + \342\226\240
\342\226\240
\342\200\242
+ Xm)
(1 + X5 + X10 + . . \342\200\242
+ X100)
COEFFICIENTS
3.2 CALCULATING OF GENERATING FUNCTIONS
a0b0 = 1
a0bx 4- axb0 = 0
a0bn 4- axbn_x + . . . +
anb0 = 0,
and soon.
From the first equation, we can solve for b0 =
l/a0; from the second, we
find
-axb0 v -ax
=
61 n\342\200\224 ~^~;
a0 a0
-axb2 - a2bx
-
a3b0
b3 .
a0
We can substitute into this expression for b0, bx, and b2 to obtain an
expression for b3 involving only the coefficients of A(X). Continuingin
this manner,we can solve for each coefficient of B(X).
Thus, we established that a formal power series A (X) = 2\302\243_0an Xn has
a multiplicative inverse iff the constant term a0 is different from zero.
The reader is doubtless familiar with division of polynomials and, in
fact, the discovery of the coefficients of B(X) = 1/A(X) as above is
nothing morethan an extension of that idea.
Definition 3.2.2. If A(X) and C(X) are power series, we say that
A(X) divides C(X) if there is a formal power series D(X) such that
C(X) = A(X)D(X), and we write D(X) = C(X)/A(X).
Of course, for arbitrary formal power series, A(X) and C(X), it need
not be the case that A (X) divides C(X). However, if A (X) - 2\302\243_0
a>n Xn is
such that a0 # 0, then A(X) has a multiplicative inverse B(X) - 1/A(X)
Section 3.2 Calculating Coefficients of Generating Functions 249
C(X), that is, C(X) - X* CX(X) where CX(X) is a formal power series. If
this is the case,then cancel the common powers of X from both A (X) and
C(X) and then we can find C(X)/A(X) = CX(X)/AX(X) by using the
multiplicative inverseof AX(X).
Geometric Series
&0-l-lf
a0
, -axbo (-D(l) n
^-\"^r\342\200\224iir\"1'
and so on. We see that each bt = 1 so that we have an expression for the
geometric series:
(3.2.2,
j-^-M
\342\200\224^\342\200\224
= - 1 - X X2 - X3 ... , (3.2.3)
1 + A
\302\243(-DrXr
r_0
4-
\342\200\224^\342\200\224=
J(-ira^ (3.2.4)
-i\342\200\224 = - C(n
- 1 + r,r) X'. (3.2.5)
(1 (J X*)n \302\243
The first equality follows from the above comments and the fact that
Xk
2\302\243_0 is the multiplicative inverse of 1 - X; we have already observed
the second equality in Example3.1.7.The equality 1/(1
- X)n =
2?_0C(n - 1 4- r,r)Xr could also be proved by mathematical induction
and use of the identity C(n
- 1,0) 4- C(rc,l) 4- C(n 4- 1,2) 4- \342\200\242
\342\200\242
\342\200\242
+
\342\200\2241\342\200\224-
=
J C(n
- 1 4- r,r)(-l)'X'. (3.2.6)
\\i 4- a; r_0
n
*
YVt
-
E C(n
- 1 4- r,r)arXr, (3.2.7)
*
- - 1 + r,r)( -a)'X'. (3.2.8)
n Yv. C(r\302\273
\302\243
Section 3.2 Calculating Coefficients of Generating Functions 251
= = 1 + Xk + X2k + \342\200\242
\342\200\242
\342\200\242
, (3.2.9)
Y.Xkr
\342\200\224^\342\200\224k
\342\200\224
1 A r\342\200\2360
and
=
\342\200\224^ E(-DrX*r. (3.2.10)
If a is a nonzerorealnumber,
1 1/ 1 \\
l^Xr ,oo,,x
a - X a \\1- A/a/ a 73 a
and
X \342\200\224
a a \342\200\224
X a r_0 a
1+ X 4- X2 + \342\200\242
\342\200\242
\342\200\242
+ Xn -
1~Xy \342\226\240 (3.2.13)
If ra is a positive integer,
(1 + X)n = 1 + (J) X +
(j)
X2 + \342\200\242
\342\200\242
\342\200\242
+
(J)
X\" (3.2.14)
(1 + -
X*)\302\273 1 +
(J)
Xk +
g)
X2* + \342\200\242
\342\200\242
\342\200\242
+
(J)
X\"* (3.2.15)
- X)n = 1 -
(1 (l) X +
(j)
X2 + \342\200\242
\342\200\242
\342\200\242
+ (-1)\"
(J)
X\" (3.2.16)
(1
- X*)\" = 1- (1) X* +
g)
X2* + \342\200\242
\342\200\242
\342\200\242
+
(-1)\"(|J)
X\"*
(3.2.17)
an (X \342\200\224,ai)Tl(X
-
a2Y2 \342\200\242
\342\200\242 -
\342\200\242
(X akYk, and if is
C(X) any polynomial of
degree less than the degree of A(X), then C(X)/A(X) can be written as
the sum of elementaryfractionsas follows:
C(X) An Al2 Alri
+ 7T7 rm + \342\200\242
\342\200\242
\342\200\242
+
A(X) (X-a,)\" (X-a,)\"\"1 (X-\302\253x)
^21 , A22 A^
T T
T(X -
T
(X - a2r (X
-
a2p~l a,)
+...+ A>1\342\200\224
+ ^ .+ ...+ + Akr>
(X -
+ +
(X-a*)'\302\273 (X - a*)\"\"' a,)
To find the numbers An,... Akn
we multiply both sides of the last
equation by (X
- )r'
ax (X - a2 V2
\342\200\242
\342\200\242 -
\342\200\242
(X to clear
ak )r\302\273 of denominators
and then we equate coefficientsof the same powers of X. Then the
required coefficients can be solved from the resulting system of
equations.
Since X2 - 5X + 6- (X - 3) (X
-
2), we see that 1/(X2- 5X + 6) =
A/(X + B/(X - 2).Thus,
- 3) -
2) + A(X B(X - 3) = l.LetX = 2and
we find B = -1. Let = 3 and we see that X A = 1. Thus 1/(X2 - 5 X +
6) = 1/(X - - 1/(X - 2). Then 3) use we (3.2.11) and (3.2.12) to see
that
= + +
X2-5X T6 ^^\\~\302\245ri \302\245^xr~^0(~\302\245ri \302\245^)xr
Section 3.2 Calculating Coefficients of Generating Functions 253
X5
X2- +
5X T6-g(-F* 3N*-\302\243***
and what this final equality says is that
do
=
di = d2 = d3 = d4 = 0
1 1
(1*.= h
-
5
3 2
. 1 1
1 1
X2 - 5 X +3
Z.
r.o
' Vr _
~X4-5_X2 + 4-
Since X4 - 5 X2 + 4 = (X2 -
1) (X2 - 4) = (X - 1) (X + 1) (X
- 2)
(X + 2) we can write
X2-5X + 3 A B C D
X4-5X2 + 4 X-1X + 1X-2X + 2'
X4 - 5X2 + 4 gives
Multiplication by
Thus,
254 Chapter 3: Recurrence Relations
X2 - 5X +3 17
X4 - 5X2 + 4 6(X - 1) 2(X + 1) 4(X - 2) 12(X+ 2)
1 3 17
-
+
2 I 3(1 1+ X^
- X)\342\226\240+ 4(1
- X/2) 12(1 + X/2)J
Therefore,
<*r
= +
-| 3(-1)r+2^5-Y(-1)r2^5.
1
:r is even
2
1
+ + ifriS\302\260dd-
12 R-3 2^(1+T)H(-5 2^)
After doing these examples we see that it is desirableto write
By Bt
[1 - (X/ai)]r< [1
- (X/o,)]
ri-l
B lr, 5\302\253
-
+ \"T
[1 (X/a,)] [1- (X/a*)]\"
Bk2 5*r,
[1 - (X/a,)]r\302\273-l [1 - (X/aA)]
where A(X) = an(X
-
axr (X - a2)r> ... (X - a,)'*
and then solve for the constants Bllf ..., Blri, ..., Bkl, ..., B^ by
algebraic techniques. This is desirablebecause in this form we can readily
apply the formulas (3.2.1) through (3.2.8) without having to resort to the
intermediate
stepof applying (3.2.11) and (3.2.12).
Section 3.2 Calculating Coefficients of Generating Functions 255
as
15. = X
-
v3 (1 X4) (1
- X7) (1 - X16)
(1 + X + \342\200\242
\342\200\242
\342\200\242
+ X15)
(1-X) 1-X 1-X
3 (1
- X4) (1 - X7) (1 - X16)
(1
- X)3
(1 - X4) (1
- X7) (1 - X16)
(1 - X)3
= (1 - X4) (1 - X7) (1
- X16)
\\y C(r +
2,r)X').
Since the of X12 in a product of severalfactorscan be obtained
coefficient
(l_X4)(l-X7)f;C(r + 2,r)X'
r-0
Using the successive terms of the first factors and the corresponding
terms of the secondfactorsothat the sum of their exponents is 12,we see
thatC(14,12)
- C(10,8) - C(7,5)+ C(3,1) isthe coefficient we seek.
Note that A (X) is a generating function such that the coefficient of Xr
boxes where the first box can have any number of balls between 2 and 5
inclusive, the secondbox can contain any number between 1 and 7
inclusive, and the third box can contain any number up to 15 balls.
FactoringX2 out of the first factor and X out of the secondfactor
amounted to the combinatorial strategy of placing2 balls in the first box
and 1 in the second to begin with. Then finding the coefficient of X12 in
A(X)/X3 amounted to counting the number of ways of distributing 12
balls into 3 boxes where the first box could contain up to 3 balls, the
secondbox could contain up to 6 balls, and the lastup to 15 balls. Had we
done this problemin Chapter 2 we would have used the principleof
inclusion-exclusion, and the form of the answer suggests that that is
preciselywhat is going on behind the scenes in all the algebraic
manipulation.This is the major reason for using generatingfunctions: the
First, we will count the solutions where 1 < ex and 2 < et for i = 2,3,4,5,6.
We do this by placing 1 ball in boxnumber one, 2balls eachin the other 5
boxes, and then counting the number of ways to distribute the remaining
9 balls into 6 boxeswith unlimited repetition. There are C(14,9) ways to
do this.
But then we wish to discard the number of solutions for which 6 < ex
and 2 < et for i = 2,3,4,5,6. There are C(9,4) of these. Hencethe total
number of solutions subject to the stated constraints is C(14,9) -
C(9,4).
Now let us solvethis problemwith generating functions. The
function
generating we consider is:
Section 3.2 Calculating Coefficients of Generating Functions 257
Linearity
C(X) = &ar
\302\243 + Ebr)Xr = DA(X) + EB(X),
r-0
where
A(X) =
X>rXr and B(X) = \302\243>rXr
r-0 r-0
(r + 2)(r + 1)\342\226\240
J
and 71 - 1_g v\\3 generates o i
(i 5xy 2
J
r-0
3 7
the sequence
1 - 2X /
(1
- 5X)3 generates
+ 2)(r +
3<2f_7(r l);
r-0
258 Chapter 3: Recurrence Relations
1- 11X+ 28X2'
1
(b)
1 + 3X + X2'
1 + 2X
(c)
1+ 3X + X2'
(d) (g)
(1 -
(a)
T^x> 3^x' 5X)3'
1
(h)
(b)lT5x' (e)arW' (3 + xr
1 1 i
(f)
(C)3TX' (1 - X)8' (\302\260(3 + X)<
3. Use partial fractions to compute:
1
(a)
1 -- IX + 12X2' 7X2 + 3X + 2
(d)
1 (X - 2)(X + l)2'
(b)
1 -- IX + 10X2' 1 - 7X + 3X2
X + 21 (e)
(1
- 3X)(1 - 2X)(1 + X)
(c)
(X-5)(2X + 3)'
4. Write the generating function for the sequence {ar)7-o defined by
(a) ar-(-l)r,
(b) ar
=
(-m\\
(c) a, = 5',
(d) ar = r + 1,
(e) ar
= 6(r + 1),
(f) ar = C(r + 3,r),
(g) a,
= (r + 3)(r + 2)(r + 1),
(-l)'(r+2)(r + l)
(h) ar
2!
- + r^ +
1 ^
(a)
X 1 + 2X (1 - X)5'
3 7 8
(b) yr\342\200\224^
~
- X)2 (1 - 2X)3
77\342\200\224^7^ +
2X'
(1 3 +
8 1
(c)
(3 + 2X)2 (5 + X)
-14~ +
13 9
3(X + 1) 12(X-
+
X - 1 2) 4(2 + X).
Find the coefficient of X10 in
(a) (1 + X + X2 + \342\200\242
\342\200\242
\342\200\242
)2,
'
<b,
(1 -X)3'
1
(c)
(1 -X)6'
1
(d)(TTxF
(e) (X3 + X4 + \342\200\242
\342\200\242
\342\200\242
)\\
(f) X4(l + X + X2 + X3)(l + X +X2 + X3 + X4)(l +X + X2
+ . \342\200\242
\342\200\242
+ x12).
Find the coefficient of X12in
1- X4 - X7 + X\"
(1 - X)5
(X + X2 + X3 + X4 + X5)(X2 + X3 + X4 \342\200\242
\342\200\242
\342\200\242
f.
(X2 + X3 + X4 + X6 + X6)7.
260 Chapter 3: RecurrenceRelations
(g) (1 -
(a)
(1 - X)10' 4X)15,
X5 (h) (1 + X3)-4,
(b)
(1 - X2
(\302\273)
- 3X,
X)10'
(c) (1 - X)20, (1
- X)4
+ X)20, - 2X)19.
(d) (1 (j) (1
-20
(e) (1 + X)
12. Let ar be the number of ways the sum r can be obtained by tossing
50 distinguishabledice. Write a generating function for the
sequence {ar}~_0- Then find the number of ways to obtain the sum
of 100, that is, find al00.
13. Let ar be the number of nonnegative integral solutionsto Xx +
X2 + X3 = r.
(a) Finda10 if 0 < X, < 4 for each i.
(b) Find a50 where 2 < Xx < 50, 0 < X2 < 50, 5 < X3 < 25.
20. Write a generating function for ar, the number of ways of selecting
r letters from {5 \342\200\242
a, 8 \342\200\242
6 \342\200\242
6, if c} each selection must include at
least onea, at least one 6, and at least two c's. Find a8.
21. Find the generatingfunction number of ways to A(X) for ar, the
select r objectsfrom n distinguishable objects, where unlimited
repetition is allowedand eachkind of object must appear an even
number of times.Derive a single series expression for A(X) and
find an expression for a12.
22. Solve exercise21 in case each object must appear a multiple of 3
times.
23. Find a generating function for determining ar, the number of
r-combinationsof the letters M>A,T,RJ9X in which M, A, and T
can appear number of times
any but R, I, and X appearat most
once. Find a10.
3+ X I
X\\ 3 U W 3 to \\ 3/
+
3(1 ir)
262 Chapter3: Recurrence Relations
(DffT\302\273'-?(,+fr-ss(-iw<r+iw6)'jr
*3- /(a)
^
1 1 -3 4
1 - nv
= \342\200\224
= \" +
, <CTV1 t* ^JFTT^ -
- 3X)(1 ^
- 3X - 4X
7X + 12X2 (1 4X) 1 1
OO CO
- 3 21 3rXr + 4 Y. 4rXr
r-0
-
L (4r+1- 3r+1)Xr
r-0
- X + 21
(c) A(X)
(X
-
5)(2X + 3) X - 5 2X + 3
-\302\243[(-lH-f)1-
--(-i)ar-(-ir\342\200\224
^v^ 7X2 + 3X + 2
~ 3 2 4
(d)
/a\\ = \342\200\224\342\200\224rr7^ ^ = \342\200\224 - '
\342\200\224\342\200\224\342\200\224
X - 2
A(X) +
(X
- 2)(X + l)2 X + 1 (X + l)2
3 2 2__
1+ X (1 + X)2 /
_ X\\
-
2^)']X';
= - 2(r + l)(-l)r
LJ3(-l)r
simplify,
(e) =
C-9/4)(3\")
o\342\200\236 + (7/3)(2n) + (11/12) (-1)\"
5. (b) ar
= 3C(r + l,r) - 7 (2)' C(r + 2,r) + 8/3 (-l)r (2/3)'
(d) 1- (4/3) (-1)\"
- 13/24 (1/2)\" + 9/8 (-1/2)\"
Section 3.2 Calculating Coefficients of Generating Functions 263
6. (a; n 1Y.2
= Y.C(r+l,r)X' = 'jr(r + l)Xr;
coefficient of X10 is 11.
+ + 1>
(b) - Or + 2,r> X- - t (r 2>'r
*i
jr-^ \302\261
v4\\io
\342\200\224 n _ y4\\10
(iirrxi =a-xr
= (1 - X4)10 C(r
\302\243 + 9,r) Xr
r-0
- [1 - C(10,l) X4 + C(10,2) Xs - C(10,3)X12 + \342\200\242
\342\200\242
\342\200\242
+ X40]
X;C(r + 9,r)X<;
r-0
coefficient of X14is C(23,9)- C(10,l)C(19,10)
9. C(14,9) - C(9,4)
(b) C(17,H)
- 7C(12,6) + C(7,2)C(7,l)
(j) (-2)12C(19,12)
12. (X + X2 + X3 + X4 + X6)50-
+ Xs X50 (1
- X6)80 1/(1 - X)80;
+ X5)9 = X9(1-X6)9(1-X)-9.
a25
- C(24,16) - 9C(18,1(\302\273 + C(9,2) C(12,4)
The expressions
for permutations, combinations, and partitions
developed in Chapter 2 are the most fundamental tools for counting the
elements of finite sets. Nevertheless, these expressions often prove
inadequate for many combinatorial problems that the computerscientist
must face. An important alternate approach uses recurrence
relations (sometimes called difference equations) to define the termsof
a sequence. We desire to demonstrate how many combinatorial problems
can be modeled recurrence
with relations, and then we will discuss
methods of solving several common types of recurrencerelations.
A formal discussion of recurrence relation beyond that of Section 1.10
is somewhat difficult within the scope of this book but the concept of
recurrence relations is straightforward. Many combinatorial problems
can be solved by reducing them to analogous problems involving a
smallernumberof objects, and the salient feature of recurrence relations
is the specification of one term of a collection of numbersas a function of
a2 - 10ax4- 40a0
= 10(10) 4- 40(0) = 100, /
a3
- 10a2 4- 40ax - 10(100)4- 40(10)
= 1400,
a4 = 10a3 4- 40a2
- 10(1400) 4- 40(100)
= 18,000,and so on.
Thus, all the examplesabove are linear recurrence relations except (8),
(9), and (10);the relation(8), for instance, is not linear because of the
squared term.The relations (5), and (7) are linear with
in (3), (4),
constant coefficients. Relations and (3) have degree
(1), (2), 1; (4), (5),
and (6) have degree 2; (7) has degree 3. Relations (3), (4), and (6) are
homogeneous.
There are no general techniquesthat will enable one to solve all
recurrencerelations.Thereare, nevertheless, techniques that will enable
us to solvelinearrecurrencerelations with constant coefficients.
because an - 5an_x
= c5n - 5c5n_1 = 0 for n > 1.
Just as in algebra, recurrencerelationsmay have no solution. Equation
(10) above is an exampleofthis since there are no reaZ-valued functions /
suchthat (f(n))2 + (f(n - l))2 = -1 since the squares of real numbers
are always nonnegative.
More generally, if a and c are any real numbers, then an = can satisfiesthe
recurrence relation: an
= aan_x for n > 1. (b) If cx and c2 are arbitrary
constants, then an
=
cx 2n + c2 5n satisfies the recurrence relation: an \342\200\224
7an_x + 10an_2 = 0 over the set S of integers n > 2. For by substituting
this expressionfor an into the recurrence relation, we have
an
- 7 an_x + 10 an_2 = (cx 2n + c2 5n)
- 7 (cx 2n~l + c2 bn~l)
+ 10 (cx 2n\"2 + c2 5n\"2)
=d 2n - 7 d 2\"\"1 + 10 d 2n~2 + c25n - 7 c2 5\"-1 + 10 c2 5n~2
verification as an exercise.
Note that in each of the above examples there are infinitely many
different solutions, one for each specificvalue of the constants. Suppose
we are askedto find a solution of the recurrence relation in (b) for which
a0 = 10 and ax = 41. Theseso-called
boundary conditions are
requirements that must be satisfied in addition to that of satisfying the
recurrence relation.
10 = cx + c2 and 41 = 2 cx + 5 c2.
Solving these two equations for cx and c2, respectively, we find that cx = 3
and c2 = 7. Thus, an = (3) 2n + (7) 5n is a solution of the recurrence
relation that satisfies the boundary conditions.
If we are given a recurrence relation describing the nth term of a
sequence A = {ar}~_0 as a function of the terms a0, ax,..., an_x, what we
desire is a closed-form expression for an in terms of n alone as in (b)
above. But even if we do not have such a closed-formexpressionthe
recurrencerelation is still very useful in computation. For we can
compute an in terms of an_x,..., ax, a0; then computean+l in terms of an,
O'n-iy \342\200\242
\342\200\242
ao;
\302\253\\ and so on, provided the value of the sequence at one or more
points is given so that the computation can be initiated. That is why we
opposite sexes. Find the number of rabbits after 12 months and after n
months.
We start with one pair of newly born rabbits. After one month we still
have only one pair of rabbits sincethey are not yet mature enough to
reproduce. After 2 months we have 2 pairs of rabbits becausethe first
pair has now reproduced. After 3 months we have 3 pairs of rabbits since
thoseborn just lastmonth cannot reproduce yet, but the original pair has
reproducedagain. After 4 months we have 5 pairs of rabbits because the
first pair is continuingto reproduce,the second
pair has produced a new
pair, and the third pair is still maturing.Foreach integer n > 0, let Fn
denote the number of pairs of rabbits alive at the end of the nth month.
Here we mean that F0 = 1, the originalnumber of pairs of rabbits.Then
what we have said is that F0 = 1 = Fu F2 = 2, F3 = 3, and F4 = 5.
Note that Fn is formed by starting with Fn_x pairs of rabbits alive last
month and adding the babiesthat can only come from the Fn_2 pairs alive
2 months ago. Thus, Fn = Fn_x + Fn_2 is the recurrencerelationand F0 =
Fx = 1 are the initial conditions.
Using this relation and the values for F2, F3, F4 already computed we
see that
^6 = F4 + F3
= 8,
= 5 + 3
^6 = F5 + F4 = 8 + 5 - 13,
Fn
- F6 + F6 - 13 + 8 - 21,
F8
= F7 + F6 - 21'+ 13 = 34,
F9 _ F8 + F7 = 34 + 21 = 55,
F10 = F9 + F8 = 55 + 34 = 89,
Fn = Fw + Fg = 89 + 55 = 144,
Thus, after 12 months there are 233 pairs of rabbits alive. We could
continue this process to compute F36, and so on. Indeed this numerical
approach,even for more complicated recurrence relations is quite
practicalespecially if an electronic computer is used.
270 Chapter 3: Recurrence Relations
example.
n 0 1 2 3 4 5 6 7
Fn 1 1 2 3 5 8 13 21
Sn 1 2 4 7 12 20 33 54
Section3.3 Recurrence Relations 271
= \342\200\224
^o ^2 F\\
Fx =
\342\200\224
F3 F2
F2 = F4 - F3
F3
= F5 - FA
Fn
= Fn+2 \342\200\224
Fn+i
F2 4- \342\200\242
Fn - Fn+2
\342\200\242
\342\200\242
4- - F, butF1 - 1.
Likewise we have:
(2) F0 4- F2 + F4 + \342\200\242
\342\200\242
\342\200\242
4- F2n = F2n+U and
+
,._Cl(l\302\261*)- <.(i^)-.
where the constants are completely determined by the initial conditions.
sequence Then
{Fn}\342\200\236_0. note that
+ (F3
- F2 - FJX3 + \342\200\242
\342\200\242
\342\200\242
+ (Fn
- Fn_x -
Fn_2) X\"+...
- F0 + (Fx
- F0)X + OX2+ OX3 \342\200\242
\342\200\242
\342\200\242
- F0 + (F, - F0)X.
Thus,
+ (Fl
~ FQ)X F0+(Fl-F0)X
- F\302\260
F(.Y)
i-x-x>
\"(1_(ui)X][1_(i^X]
FiX) = +
1- (1 + V5)X/2 1 - (1 - V5)X/2'
1 - aX 1- 6X \302\2433 \302\2433
=
\302\243(C1a\302\273+ C2b\X\302\273") X;FnX'1
n-0
In other words,
c, and
TshH c\302\253-^h-
Section3.3 Recurrence Relations 273
F0
F2
F,
FA
F5 1
F6 6
Figure 3-1
4- C(n
- 3,1) 4- . \342\200\224
4- C(0,n
- 2)
= C(n - 1,0)4- [C(n - 2,1) 4- C(n - 2,0)] 4- [C(n
- 3,1)
+ C(n - 3,2)]+ \342\200\242
.
\342\200\242
both numbers we = (n - 1)
derangements, and hence by adding get Dn Dn_x +
example, the growth of one population may affect the growth of another
population either favorably or unfavorably because they may compete
for food, one may prey on the other, or eachpopulation may prey on the
other, and so on.
An example will illustrate the nature of this kind of problem.
denote the number of men in the two armies at the end of the nth day.
Thus an_1
- an represents the number of soldiers lost by the first army
during the battle on the nth day. Likewise bn_x
- bn represents the
number of soldiers lost by the secondarmy on the nth day.
unknowns.
276 Chapter 3: Recurrence Relations
given. In each case, show that the function is a solution of the given
recurrencerelation.
(a) an
- an_x = 0; an - C.
(b) an
-
an_x - 1; an C. = n +
(c) an
-
an_x = 2; an
= 2n + C.
0; an = Cx + C22n.
-
(d) an 3an_x + 2a\342\200\236_2
=
(e) an
- 3an_x + 2an_2 = 1; an = Cx + C22n - n.
(f) an
-
7an_! + =
12an_2 0; an = CxSn + C24n.
(g) an
-
7an_x + 12an_2 - an 1;
- Q311 4- C24\" + 1/6.
2. For eachof the recurrence relations in Exercise 1, we will give
(b) a0 - 6. ^
(c) a0 - 6.
(d) a0
=
5, ax = 6.
(e) a0
= 4,
ax - 6.
(f) 00
=
4,^ = 6.
(g) a0
= 19/6, ax = 31/6.
3. (a) Considera 1x n chessboard. Suppose we can color each square
ofthe chessboard red or white.
either Let = the number of an
12. (a) Suppose a coin is flipped until 2 heads appear and then the
experimentstops. a recurrence relation for
Find the number of
experimentsthat end the nth flip or sooner. on
satisfies the
following initial conditions.
(a) F0
- 2, Fx = 1 (the Lucas sequence).
(b) Fo
= 0,Fx = l.
17. Let F0 = 1 = FlfF2y... be the Fibonacci sequence.By evaluating
each of the following expressions for small values of rc, conjecture a
generalformula and then prove it.
(a) Fi + F3 + \342\200\242
\342\200\242
- +
F2n_x.
(b) F0-Fx + F2 + ... +(-irFn.
(c) FnFn+2/+(-ir.
18: The relation Fn
=
Fn_x + Fn_2 holds for all integers n > 2,explain
how that relation can be translated to the relation Fn+2 ='
Fn+i 4- Fn for all integers n. Also observe that Fn+3 = Fn+2 + Fn+1.
(a) Combine these to give an expression for Fn+3 in terms of Fn+l
and Fn.
(b) Express Fn+4 in terms of Fn+l and Fn.
(c) ExpressFn+3 in terms of Fn_x and Fn_2 for rc > 2.
19. (a) Find r, given that Fr = 2Fm 4- Fm.
(b) Finds, given that Fs = 3F200 4- 2F199.
(c) Find t, given thatFe = 5F317 + 3F316.
20. Let L0,LU...bethe Lucas sequence. That is, Ln = Ln_x + Ln_2 for
n > 2 and L0 = 2, Lx = 1..
(a) Prove that L0 4- Lx + Ln = Ln+2 - 1.
+ L2 + \342\200\242
\342\200\242
\342\200\242
(c) L2 4- L5 4- L8 4- \342\200\242
\342\200\242
\342\200\242
4- L3n+2.
Pn-2].
9. (a) If the first digit is not 0,then there are 2an_x (n - l)-digit such
ternary sequences. If the first digit is 0, thenwe must count the
number - 1)-digitternary
of (n sequences that have an odd
number of 0's. Sincethereare 3n-1 total (n - l)-digit ternary
sequences an_x with an even number of 0's, thereare
and 3n_1
- an odd number of 0's. Hence there are 3n_1 -
an_x with an_x
n-digit sequences with an even numbers of 0's and that start
with 0. Thus, an = 2an_x + 3n_1 - an_x - an_x + 3n_1.
(c) Fn_xFn+3 + 3.
19. (a) r = 103.
(c) t = 321.
20. (b) - 2.
L2n+2
<*i
- a0 + /(l)
a2
- ax + /(2) - (a0 4- /(I)) + /(2)
<*n
- a0 + /(I) + /(2) 4- \342\200\242
\342\200\242
\342\200\242
+ /(n)
n
= a0 + H /(ft).
Thus, is just
a\342\200\236 the sum of the / (k)'splus a0.
- ca^
a\342\200\236 + f(n) - c^\"-1^ + c\"-2/(D + + c/(\302\273-
\342\200\242
\342\200\242
\342\200\242
2)
+ -
/(\302\273 1)) + /(\302\273)
=
cno0 + cn-V(l) + c\"-2/(2) + \342\200\242
\342\200\242
\342\200\242
+ c/(n
- I) + /(\302\273).
or
a\342\200\236-c\"ao + iy-*/(\302\253.
282 Chapter 3: RecurrenceRelations
l-2n
an =
\342\200\224\342\200\224
= 2n - 1 for n > 0.
Chapter 4.)
of the subdivisions
An illustration and the merges necessary in sorting
the input list {5,4,0,9,3,2,8,6,23,21}is shown in Fig. 3-2. The top half of the
diagram exhibitsthe subdivision of the lists; the bottom half illustrates
the merging of lists successively as described above.
An estimate sorting an input list by Mergesort
of the cost of can be
obtained by counting the maximum number of comparisons are
t hat
5,4,0,9,3 | 2,8,6,23,21
5, 4,0 | 9, 3 2, 8, 6 | 23,21
/ \\ / \\
5, 4 | 0 9 | 3 2, 8 | 6 23 | 21
/ \\ /.\\ I \\ I \\
5 | 4 0 9 3 2 | 8 6 23 21
/ \\ / \\
5 4 2 8
\\/ \\/
4,5 0 9 3 . 2,8 6 23 21
\\ X \\/
0,3,4, 5,9 2,6,8, 21,23
0, 2,3,4,5,6,8,9, 21, 23
Figure 3-2
284 Chapter 3: RecurrenceRelations
recurrence relation:
an = 2 an/2 4- (n \342\200\224
1) for n > 2, where ax = 0
n
2an/2
=
22an/4 + n
- 2
= + n/4-l]
22an/4 22[2an/8
= 23an/8+ n-22,
an
-
2an/2 = n
- 1
2an/2
-
22an/4 - n - 2
22an/4
-
23an/8 = n
- 22
2*~1a\342\200\236/2*-1
-
2kan/2>
- n - 2k~\\
an
= n-l + n-24-n-22+-\302\253-+n- 2k~1
= kn- (1 + 2... + 2*-1)
- kn - (2k - 1)
\342\200\242=
kn - (n - 1)
- nlog2 (n)
- (n - 1).
Section 3.4 Solving Recurrence Relations 285
Divide-and-Conquer Relations
Xk A(X) - X* an Xn = an Xn+k.
\302\243 \302\243
n-0 n-0
Thus,
U \342\200\224
-AJ n-0 r-2
X
\342\200\224
I1 A) n-0 r-1
*L, - L (n + 1) *n+? - (r
- 1) Xr
n \302\243
(1 ~ X) \342\200\236_0 \342\200\236_0 2
\\{n + 2) (n + 1) /l \342\200\242
2 2-3 3-4 \\
' '
\\ 2 2 2 \"'T
Section3.4 Solving Recurrence Relations 287
2X
n(1 - A)
yT5
-
E in + 2) (n + 1)X\"+1 - (r
\302\243
+ 1) (r) Xp
\302\243J \302\2437
2X =
\" =
(1 - 5 (r
\302\243 + l)(r)X' \302\243(r + l)(r)X',
X)3 \302\243l
2
2X
= \302\243> + 2)(i\302\273+ DXn+2 =
\302\243(r)(r
- 1)X' - (r)(r
\302\243
- 1)X'
(1-X)3 tn=0 r-2 r\302\253G
2X X X(l + X)
(1
- X)3 (1 X)2 (1 - X)3
-
- (r
\302\243 + 2)(r + l)(r)X'
r-0
6X2
]T (n + 3)(n + 2)(n +
(1 -
l)Xn+2
X)4 n-0
(r
\302\243 + l)(r)(r - l)Xr = f] (r + l)(r)(r - 1)X'
r-2 r-0
anXn
2\302\243_fc generates (0,0,.. .,0,ak,ak+l...), where there are k zerosbefore
ak.
But then by powers of X shifts the sequence
dividing to the left. For
instance, (A(X) - a0)/X = S^ an Xn~l generates the sequence
(aua2,a3y...); (A(X) - a0
-
axX)/X2 generates (a2,a3,a4,...); and, in
general, for k >i 1, (A(X) - a0
-
axX - ... - ak_iXk~1)/Xk generates
MX)
1
(3) a\"
1 - aX
1
(4) (-1)\"
1
1
(5) (-l)V- (-a)\" 1 + a*
(6)
C(k - 1 + n, n)
1
kis a fixed positive int\302\253
(1 -xf
-
1
(7) C{k 1 + n, n))an
(1
- 1+
1
(8) C(k n,ri)(-af
(1 + aXf
1
(9) n + 1
(1 - *)2
X
(10) n
(1-xf
2
(n + + 1)
(\302\2531) 2)(\302\253
(1- Xf
2X
(12) (\302\273+1)(\302\273)
(1- Xf
X( I + X)
(13) n*
(1
- xf
6
(14) (n+ 3)(n+ 2)(/J+ 1)
(1 -xf
ex
(15) (n + 2)(a + 1)(#\302\273)
(1 -x)4
X(1 + AX + X2)
(16) /\302\2733
(1 -xf
1
(17) +
(1 -
(n 1)a\"
aX)2
aX
(18) na\"
(1 - aX)2
1 + aX)
(19) ifa\"
(1 -aXf
(aX)(\\ + 4aX + a2X2)
(20) ifa\"
(1 -\302\253*7
290 Chapter 3: Recurrence Relations
IfA(X) = \302\243a\342\200\236Xn,then
n-0
X\" = A(X)
a\342\200\236
\302\243
- oo
-
OxX Ok.xX*\"1,
n-k
Xn
a\342\200\236_2
\302\243
- X2(A(X) - oo
-
o,X a,_3X*-3),
n-fc
an_3X\"
\302\243
= X3(A(X) - a0
-
a, X - , .
\342\200\242 - a*_4X*\"4),
n-fe
\\ (
= X*(A(X)).
X>n_*Xn
n-k
an
- 7 an_x + 10 an_2 = 0 for n > 2.
1. LetA(X) = 2Z_0anXn.
2. Next multiply each term in the recurrencerelationby Xn and sum
from 2 to oo:
anX\"
\302\243
- 7
f] c.xX\" + 10Y. <*n-2Xn - 0-
n-2 n-2 n-2
4. Thensimplify:
A(X)(1
- IX + 10X2) - a0 + axX
- 7a0X
or
{ ~ \"
(1 - 2X)(1-
>
i _ 7X + 10X2 5X)*
7. Expressa\342\200\236
as the coefficient of Xn in A(X) and in the sum of the
otherseries:
= + C25n.
an Cx2n
J anXn
- 9 f] an^Xn + 26 f] an_2X\302\273
- 24 an_3X\"
\302\243
- 0.
n-3 n-3 n-3 n-3
+ 26X2(A(X)
- a0) - 24X3A(X)= 0.
Simplify:
A(X)(1
- 9X + 26X2 - 24X3)
=
a0 + GlX + a2X2
- 9aoX - 9aiX2 + 26aoX2
or
A(y. _ a0
+ (ai - 9a0)X + (a2
- 9a t + 26a0)X2
1 - 9X + 26X2 -
AK*}-
24X3
- (ci2n
\302\243 + c23n + C34n)Xn.
X + X2
MX) = (1 - 2X)(1
- 3X)(1 - 4X)
C\\ C2 C3
(1 - 2X) (1 - 3X) (1
- 4X)
-4, and C3- 5/2.Thus, in this case, an - 3/2 (2\") -4 (3\") + 5/2 (4n).
JT anXn
- 8 Y. an-iXn+ 21\302\243an_2X\" - 18 f] an_3Xn
- 0,
n-3 n-3 n=3 n-3
(A(X) - a0 - axX
-
a2X2) - 8X(A(X) - a0
-
axX)
+ 21X2(A(X) - a0)
- 18X3A(X) - 0,
or
P(X)
MX)-La'X'-Q(X)
+ (\302\253i
\302\253o
-
6a0)X + (a2 - 6at + 12a0)X2
=
- 6X - 8X3
'
1 + 12X2
- +' 7:
A(X) - 2X
;\342\200\224^
1 (1 - ^2X)2 +
(1
- 2X)3
= C, \302\2432\"X\" + C2
+ 2\"X\" + C3
+
f] (\" X) ]T (ra 2) 2nX\"
(\" + + 1]
C,2\" + C2(n + 1)2\" + C3 2)j\" 2\"| Xn,
n-0 I
so that
(\" + + 1}
=
\302\253. Cl2\" + C2(n + 1)2\" + C3 2)i\" T.
Functions
Outline of the MethodofGenerating
two.
If the factorization of Q(X) is known, say Q(X) = (1 - <7iX)(l
-
q2X)
\342\200\242
\342\200\242
(1
\342\200\224
\342\200\242
<7*X), then use partial fractions and the different identities for
familiar generating functions to get A(X) as a sumof familiar
series, and
hence that an is the sum of the coefficients of known series.
However, even when we cannot factor Q(X) if we are given initial
conditions we can solve for as many coefficients of A(X) as we desire by
long division of Q(X) into P(X) [or by finding the multiplicative inverse
of Q(X) since the constanttermofQ(X) is nonzero].
= 60 (1 + \342\200\242
cxX 4- \342\200\242
\342\200\242
4- ckXk)
\342\204\242 \302\243p<xi
A(X) >
\342\226\240k
Q(X) 1 4- cxX 4- \342\200\242
\342\200\242
\342\200\242
+ ckX
and the coefficients of A(X) are discoveredby using partial fractions and
296 Chapter3: Recurrence Relations
(g) an
=
an- 4- 3m2 4- 3m 4- 1 where a0 = 1.
(h) an = an_ 4-3n wherea0 = 1.
(i) an
=
an_ 4- n3n where a0 = 1.
(a) an
- 6a x
= 0 > 1 and a0 = 1.
for n
(b) an - 9an_x x -t-
4- ^uan_2
20an_2 = 0 for n > 2 and a0 v = -3, c^ 10.
(c) an
- 5an_x 4- 6an_2 = 0 for n > 2, and a0 = 1, ax = -2
(d) an
-
4a\342\200\236_20 for n
= > 2 and a0 = 0, ax = 1.
(e) an
-
an_l - 9an_2 4- 9an_3 = 0 for rc 3 and a0 = 0, ax = 1,
a2
- 2.
(f) an - 3an_2 4- 2an_3 = 0 for n > 3 and a0 - 1, ax 0, a2 = 0.
(g) -
a\342\200\236 4- an_6
2a\342\200\236_3
- 0 for n > 6 and a0 - 1, ax 0 = a2 = a3
a4 = a6.
Section 3.4 Solving Recurrence Relations 297
(h) an + an_l
- 16an_2 4- 20an_3- 0 for n > 3 and a0 = 0, ax - 1,
a2 = -1.
(i) -
10an_x 4
a\342\200\236 33an_2 - 36an_3
= 0 for n > 3 and a0 =
1, ax ==
1,
a2 = -23.
4. Find a generalexpression
for an using generating functions.
(a) an - 7an_l 4 12an_2 = 0 for n > 2.
(b) an
- 4an_x - 12an_2 - 0 for n > 2.
(c) an
-
5an_x + 6an_2 \302\253
0 for n > 2.
an_3 - 0 for
(d)' - - n >
3an_x + 3a\342\200\236_2
a\342\200\236 3.
(e) an
-
9an_x + 27an_2 27an_3 - = 0 for n > 3.
(f) an
-
lan_x + 16an_2
- 12an_3 = 0 for n > 3.
5. If A(X) = anXrt
2^\342\200\2360 generates the sequence {an}^_0> and an = / (n)
is somefunction of n\342\200\224like/ (n) = n2 4 3rc 4 1, what generates
(a) &\342\200\236-/(* +1)?
(b) 6n = /(n4 2)?
(c) 6n
=
/ (n - 2) for n > 2 and 60 = &i
- 0?
(b) an = 2an/4 4- n
where n = 4k and ax = 1.
(c) an = an/2 + 2n - 1
where n = 2k and ax = 1.
8. Verify by mathematicalinductionthat
an
= Axn + A2
is a solution to
a>n
= ^
an/d + e
where
where n =* dk and
an = C an/d 4- e for
n = d*, C # 1 and
ax
= e.
11. Show by substitution that C(2n - 2,n - l)(n- 1)!is the solution
of the relation
ax = 1.
(b)an
=
(i)n
(0
-.-(-!)'
Section 3.4 Solving Recurrence Relations 299
(d) an
= 3\" + 5\"
= +
(e)a\342\200\236
5(i)\"-7(5)\302\273 3(^3)
+
(f)a\342\200\236=(ra 2)5\"
(g) an = 7(ra + 3)(ra + 2)(ra+l)
(h) an - (ra + l)(ra)(ra
- 1)
(i) = ra23n
a\342\200\236
,(c) . =
ra2(ra
a\342\200\236
+ D2 ,
+ 5
e
H 1111 11
=
1+--t + ---4---- +
1223 nn+1
ra + 1 ra + 1
2ra + 1
ra + 1
(f) - (ra +
a\342\200\236 l)2
= + l)3
(g) (ra
a\342\200\236
3\"+1 - 1
\342\204\242 =
(h) o\342\200\236
2
=
1 + 7X
2. (a) A(X)
1+ 5X + 3X2
3. (b) = 2
a\342\200\236
\342\200\242
5\" - 5 \342\200\242
4\"
<c> *\302\273
- - - 5(2\"> - 4<3\">
-1 -\302\253\"\302\253\342\226\240 r^ix r^x; \"\342\226\240
= !
(d) 0
o\342\200\236 if ra is even, f- 2\"
a\342\200\236 if ra is odd
(e) = 1/12
a\342\200\236 {-3 + 4 3\" -
\342\200\242
(-3)\"}
(f) = 8/9
a\342\200\236
- 6/9 ra + 1/9 (-2)\"
X
= -2/49 + 7/49 5/49
20X3 1 - 2X (1- 2X)2
\"
(h) A(X) -i + X- 16X2 + 1 + 5X'
=-2/49
a\342\200\236 (2\") + 7/49 (ra + 1)2\" - 5/49 (-5)\"
300 Chapter 3: Recurrence Relations
1 ~ 9X 1 \342\200\224
9X
(i) \"
- \"
1 - 10X + 33X2 -
lU A(X\\
36X3 (1 - 3X)2(1 - 4X)
15 6 20
1- 3X (1
- 3X)2 1 - 4X'
an
- 15(3\") + +
6(\302\253 l)(3n) - 20(4\
11. Let
-
a\342\200\236(4 n - 6ra\342\200\236_!
- (4 n - 6)(4 (n - 1)- 6)a\342\200\236_2
= (4 n - 6)(4 n - 10)a\342\200\236_2
- - 6)(4
(4 \302\273 n - 10)(4(n - 2)
-
6)a\342\200\236_3
= (4 n - 6)(4 n - 10)(4 n -
14)a\342\200\236_3
= (4 n
- 6)(4 n - 10)(4 - n 14).. .(6) (2)^
- (4 n - 6)(4 n - 10)(4 n - 14).. .(6)(2)
an
- 2(2 n - 3) (2)(2 n - 5) (2) (2 n - 7).. .(2)(3) (2) (1)
- 2\"\"1 [(1) (3) (5).. .(2 n - 7)(2 n - 5)(2 ra - 3)]
2\"-1(2 ra - 2)!
-
o\342\200\236
(2)(4)... (2ra - 6)(2 n - 4)(2 n - 2)
2\"'1 (2 n - 2)!
2\"-1(l)(2)... - {n 3)(n - 2)(n - 1)
(2n- 2)! (2 n - 2)! (n - 1)!
(n
-
1)! (n - 1)!(\302\273
- 1)!
C(2n-2,n-l)(n- 1)!
This new method is nothing more than a synthesis of all that we have
learned from the method of generating functions. If we want to solvean +
+
CiO\342\200\236-i
\342\200\242
\342\200\242
\342\200\242
+ ckan_k = 0 where ck =\302\243
0, then we can find A(X) =
P(X)/Q(X) where Q(X)is a polynomial of degree k. Then the factors of
Q(X) completelydeterminethe form of coefficients of A(X).
Section 3.5 The Method of Characteristic Roots 301
P(X) P(X)
\" \"
A(X)
Q(X) 1 - 9X + 26X2 - 24X3
WO
3X)(1-
=
(1 - 2X)(1 - 4X)
and the form of the solution for that recurrence was an = Ci2 4- C20 4-
C34\302\273.
Note again that the roots of Q(X) are 1/2,1/3,and 1/4, but the roots of
C(t) = t* Q{l/t)
= t3 - 9t2 4- 26t - 24 = (t - 2)(t - 3)(t- 4) are 2, 3,4,
and these roots are in directrelationship to the form of the solution for
On-
The polynomial called the characteristic polynomialofthe
C(t) is
recurrence that if the recurrence relation is an 4-
relation. Note
cian-i 4- \342\200\242for n > k, whereck # 0, then the characteristic
\342\200\242
\342\200\242
4- ckan_k = 0
polynomial for this recurrence relation is C(t) = tk 4- cltk~1 4- \342\200\242
\342\200\242
\342\200\242
4- ck,
and this, in turn, equals tk Q(l/t), where Q(X) = 1 4- cx X 4- \342\200\242
\342\200\242
\342\200\242
4- ckXk.
Then if C(t) factors as (t - ax)ri \342\200\242
\342\200\242 - a8)rt then in the expression
\342\200\242
(t
A(X)
=
P(X)/Q(X), the denominator Q(X) factors as (1 - axX)r'
\342\200\242
\342\200\242
.(l-a,X)\\
Distinct Roots
If the characteristic polynomal has distinct roots au.. .9ak9 then the
general form of the solutions for the homogeneous equation is an -
Clot\" 4- \342\200\242
Ckotk where
\342\200\242
\342\200\242
4- CuC2i.. .Ck are constants which may be chosen
to satisfy any initial conditions.
Cx 4- C2= 2
2CX 4- 3C2 = 5.
Multiple Roots
3.4.7
In Example we discovered by using generating functions that the
general to an solution
- 6an_x 4- 12 an_2 - 8an_3
= 0 for n > 3 wasof the
form an
= Cx 2n 4- C2 (n 4- 1) T 4- C3 [(n 4- 2) (n 4- 1) 2n]/2 because
Q(X) = 1-6X+ 12X2- 8X3 - (1 - 2X)3.But then this corresponds to
the fact that the characteristic
polynomial C(t)
- 6t2 4- 12\302\243
= \302\2433 - 8 =
(t - 2)3has 2 as a repeatedrootwith multiplicity 3.
Let us make an observationhere.If we rewrite
(\" + 2) (ri + ^
an = Cx2n 4- C2(n 4- 1)2* 4- C3 2- as
Cx 4- C3 = 1
an
= (5)(2n) + (3)(n2n) - (4)(3n).
roots are complex then an need not be real and in our discussionand
definitions we have always discussed real-valued sequences. Hence we
have restricted our attention in the examples to linear recurrence
relationswhose characteristic polynomials have had only real roots. We
intend to do the same in the exercises.
(f) an
- + 10a\342\200\236_4
7a\342\200\236_2
- 0, a0 - 7, ax - 8 V2 + 5 V5, a2
= 41,
a3 - 16 V2 + 25 VB;
(g) - - for n > 2 and, a0 - 12, ax
o\342\200\236_!6o\342\200\236_20
a\342\200\236
= = -1;
(h) + 6an_2
+ 5a\342\200\236_!
a\342\200\236
= 0 and, a0 4, at - -7;
(i) -
a\342\200\236
6a\342\200\236_i
= 0 where
+ 8o\342\200\236_2 o0 = 1 and c^- 0;
(j) -
2a\342\200\2367o\342\200\236_i
= 0 where
+ 3a\342\200\236_2 a0 = 1 and at= 1;
(k) an
-
6a\342\200\236_!
=
+ 9a\342\200\236_20 where o0 = 1 andax= 1;
(1) -
a\342\200\236 5on_! + 6a\342\200\236_20
= where a0 = 7 and 0!= 1;
(m) a\342\200\236
-
+ a\342\200\236_i5a\342\200\236_2
+ 3a\342\200\236_3 - 0 where a0 - 0,at = 1, and a2- 2;
(n) 6o\342\200\236
-
19an_! + 15a\342\200\236_2 0
= where o0 = 0 and ox = - -.
(b) d - -6 C2
- 9 C3 = 0
(c) Cj- -8 C2
= 21 C3 = -18
7. (a) an
=
\\4n
+
\\(-\\)n
0 u
an
= +
(b)
^6\"
o J(-2)n
o
5 3
(c) = -2n
a\342\200\236 + -n2n
(e)0\342\200\236.2(z^r-2(zi_^)-
(f) C(t) = (t - V2) (t
- V2) (t - V5) (t + V5)
an = 3(V2)\302\273
- 5(- V2)B + 7 (V5)B + 2(- V5)B
Chapter 3: RecurrenceRelations
Let us turn our attention now to learn how to solve the inhomogeneous
recurrencerelation(IHR): an + cxan_x + . . . + ckan_k =
f (n) for n > k,
where ck =5* 0, and where / (n) is somespecifiedfunction of n. Call f(n) the
and where a0 = 2.
Let A(X)
=
2^.o Multiply
a\342\200\236Xn. each term of the recurrence relation
by Xn and sum from 1 to oo. Then we have
E anXn
- f] an.t Xn = 3 (n
\302\243
- l)Xn.
n-1 n-1 n-1
3X7(1
- X)3. Using Table 3-1, the shifting property of generating
functions, the inverse transformation, and the fact that a0
- 2, we have
A(X) = 2 S^o Xn + 3/2 (2-.0 n(n - l)Xn) so that an
- 2 + 3/2 (n) (n -
1) for n > 0.
get
anXn
\302\243
- 5 an-i
\302\243
^n + 6 a^jX11
\302\243
-
f] (n) (n-1) X\".
n-2 n-2 n-2 n-2
Replacing sums by
the infinite equivalent expressions, we have (A (X) -
a0
-
axX) - 5X(A(X) - a0) 4- 6X2 A(X) = 2^2 (n) (n -,l)Xn. Using
thp shifting properties of generating functions and Table 3-1,we see that
2-.2 (n) (n - l)Xn = 2X7(1- X)3. Thus, A(X)(1
- 5X + 6X2) = a0 4-
Section 3.6 Solutions of Inhomogeneous Linear RecurrenceRelations 307
(a,
- 5a0)X + (2X7(1 - X)3) and
\342\200\236/V, a0
+ (a1-5a0)X 2X2
(1 - 5X + 6X2) (1
- X)3(l - 5X + 6X2) '
If we are given initial conditions for a0 and ax then we can find the
coefficients of A(X). Suppose,for example, that a0 = 1 and aY
=
5, then
2X2
A(X) =
1- 5X + 6X2 (1 - X)3(l - 5X + 6X2)
1 - 3X + 5X2 - X3
do + (<*i
-
5a0)X 2X2
a(x)-,v'
(1 - t^ 5X
7\"2; + (1 - X)3(l -
+ 6X2) 5X + 6X2)\"
B(l
- X) (1 - 2X) (1 - 3X) + C(l
- 2X) (1 - 3X) + D(l
- X)3 (1 -
3X) + E(l - X)3 (1
- 2X) = 1 - 3X + 5X2 - X3. Let X - 1,1/2,and
1/3 and find C - 1, D = -10, and E - 21/4. Let X = 0 and we get the
equation A + B - 19/4. Solve for the coefficient of X4 and get 6A + 3D +
2E = 0, but sinceD - -10 and E = 21/4, we find that A = 39/12, and then
that B = 3/2.Then by the inverse transformation process, we have
+ 1) + +
(|(\342\200\236 <^L\302\261i)_(10)2. (|)
\"f +
+
3\302\273 \" 10<2\"> + 3*
^ (t)
Now this process works in general for the IHR above. For if we let
A(X) = ?Tn\342\200\236QanXnymultiply each term of the IHR by Xn, sum from k to oo,
where
\342\200\242
\342\200\242
\342\200\242 + \342\200\242
\342\200\242
\342\200\242
4-
4- 4- (a*_! 4- c^.2 ck_xa0)Xk~\\
308 Chapter 3: RecurrenceRelations
Hf(n)X\302\273>
A(X) - ^ 1 tUL.
Q(X) Q(X)
Y]4nXn - 5a0)X
^/^ = jzj . go + (Qi
1- 5X + 6X2 1 - 5X + 6X2
Now
4\302\273X\"= 42X2
\302\243 X] 4n-2Xn\"2,
ra-2 n-2
= 42\342\200\224\302\245\342\200\224.
42X2X>X\302\273
tTo 1 - 4X
Therefore,
. - 5a0)X
(, 4^ a0 + (fll
(1 - 4X)(1 -
W +
+
1-5X + 6X2
\"
5X 6X2)
But - 5X +
since 1 6X2 = (1 - 2X) (1 - 3X) we see that the
homogeneous solutions have the form Cx2n + C23n. But likewise by
partial fractions
42X2 C D E
+ Z - ^7 + -
(1 - 4X)(1 - 2X)(1 - 3X) 1 - 4X 1 2X 1 3X
^2\"Xn P(X)
(1 - 3X)(1 - 2X)
T
(1 - 3X)(1 -_2X)
Now
-
2X
JT 2nXn = 22X2 f^ 2^r
\342\200\224
\302\2433 f=o (1 2X)
Thus,
22X2 ABC
-
(1 - 3X)(1 2X)2 1 - 3X 1 - 2X + (1 - 2X)2
Thus? 22X2/(1
- 3X) (1 - 2X)2 generates a sequence {6J ^,0 where bn =
A3\" + B2\" + Cin + 1)2\"= AS\" + (B + C)2n + Cn2n. Again note that
310 Chapter 3: RecurrenceRelations
(1) Any solution the IHR is the sum of a particular solution of the IHR
and a solution of HR;
Proof. We only prove (2); the proofs for the others are similar. Since
a>n + Ci<d + \342\200\242
\342\200\242
\342\200\242
+ cka*_k = / (n) and a% + cxa^_x + \342\200\242
\342\200\242
\342\200\242
+ cka%_k - 0,
we can add thesetwo equations to get + a\")
(a\342\200\236 + cl{a^_l + a\") + \342\200\242
\342\200\242
\342\200\242
4- ck (a\342\200\236
+ a\") = / (rc), which is the desired
conclusion.
Section 3.6 Solutions of Inhomogeneous Linear RecurrenceRelations 311
The import of Theorem 3.6.1 is that the task of finding the complete
solution for the IHR falls into two parts: first, solve the HR in full
generality, listing all possiblesolutions, and second, discover any
particular solution at all of the IHR itself.The sum of these two parts
provides a general solution to the IHR and if appropriateinitial
conditions are given, the arbitrary constants in the solutionmay be
10an_2 - 4\\ Then we have C4n - 7C4\"1 + 10C4n\"2- 4\", or C4n \"2 (42 -
4 + 10) - 4\". Thus, C = -8, apn = (-8)4\"
7 \342\200\242 is a particular solution, and
an
= (-8)4n + Cx2n + C25\"is the completesolution.
If, in addition, we are given the initial conditionsa0 = 8 and a{ = 36,
then substituting n = 0 and n = 1 into the above expression for any we
have 8 = (-8) + Cx + C2 and 36 = -32 + 2C\\ + 5C2. Simplying and
solving, we find C1 = 4 and C2 = 12as the solutions to these two equations
in two unknowns. Thus, an = (-8)4n + (4)2n + (12)5n is the unique
solution of an \342\200\224
lan_1 + 10an_2 = 4n satisfying the initial conditions a0 = 8
and aY - 36..
undetermined coefficients.
In order for this method to be successful we require a little insight and
more experience.We use generating functions to gain that experience
and to verify what forms are good guesses for solutions. Oncewe have
done this for several types of situations, we will not have to resort to
312 Chapter 3: Recurrence Relations
A(X)
-
\302\243>nX\".
n-0
D^anXn + P(X)
A(X)
- -\302\243=* ,
Q(X)
where
and
Now
D ]T anXn = DakXk
ak~kXn~\\
\302\243
k
J2 or kxn
Section 3.6 Solutions of Inhomogeneous Linear RecurrenceRelations 313
becomes
Thus,
D > a\"X\" = ,
DXkak + (1 - aX)P(X)
A(X)
(1 - aX)Q(X)
Q(X) - (1 - axX)ri (1
- a2X)r> ... (1- asX)r.
~
(1 - a,Xr (1- a2X)
+ 73 7777 + 71
777 +\342\200\242\342\200\242\342\200\242\342\226\240+\342\226\240 777 -(-\342\200\242\342\200\242\342\200\242
1 ~ aX (1 - axX)
+ ^ + . . . 4- \302\243*!
+ . . . + ^
(1 - (1 - cv,X)r
'
(1
- anX)
a2X)r2
for constants C, Cu, C12,... , C,v Note that all terms above except the
first give rise to homogeneoussolutions of the recurrence relation.
Therefore, in case a is not a root of the characteristic polynomial C(\\),
314 Chapter 3: Recurrence Relations
We from Example
know 3.4.5 that the characteristicpolynomial C(t) =
t2 - It
4- = (t
10- 2) (t 5) and that the - homogeneous solutions have
the form a\" = Cx2n + C25n. Since 3 is not a root of C(t) we take a trial
solution for ap = C3n where the constant C is yet to be determined.
Substituting C3n for an in the recurrence relation gives C3n - 7C3\"\"1 +
10C3n~2 - 7 \342\200\242
3n, or C3n\"2 (32 - 7 . 3 + 10) - 7 . 3\". This,
in turn, implies
that C(-2) - 7 32 or C -
\342\200\242 -63/2. Thus, a particularsolution is ap -
an
- 3\" + 0,2\" + C25\".
(~)
7 \342\200\242
3n 4- 4n.
finding particular
-
solutions
7an_l 4- to an =
10a\342\200\236_2 7
\342\200\242
3n and an -
lan_x + 10an_2 = 4n. We know from Example 3.6.6 thatc# =
(-63/2) 3n is
a solution of the first relation. We know from example 3.6.5 that a\342\200\2362 =
as a sum of partial fractions, there will be one term of the form C/(l -
aX)m+1. Hence a particular solution for the IHR has the form ap =
Section 3.6 Solutions of Inhomogeneous Linear Recurrence Relations 315
~, , (n 4 m)(n + m -
1)... (n 4 1)
C(n 4- m,rc)
m!
: ,
an + Cxan_x 4- \342\200\242
\342\200\242
\342\200\242
4- Ckan_k - Dan
multiplicity m.
is the generalsolution.
n-0
Then
i - 5X + ex2
Now
and we let r = rc -
2, then we have
]T n24nXn = n2X2 (r
\302\243 + 2)2 4rXr.
n-2 r-0
42X2 (r
\302\243 + 2)2 4rXr - 42X2 2 ]T C(r + 2,r)4rXr
r-0 I r-0
= 42X2
(1 - 4X)3 (1
- 4X)2 1 - 4X\\
(1
- 4X)3
Thus,
F(X)
A(X)--
(1-4X)3(1-2X)(1- 3X)
A B C
Aiir\\ =
(1 -
MX) +
-\342\200\2243 JZ - 4X)2
TTTTo +
(1 -- 4X)3 (1 4X)
D E
(1 - 2X) (1 - 3X)
A B C
(1 - 4X)3 + (1 - 4X)2
+
1 - 4X
3. apn
=
(A0 4- Axn 4- \342\200\242
\342\200\242
\342\200\242
4- A8ns)an is a particular solution
ofthelHR:
an + Cxan_x 4- \342\200\242
\342\200\242
\342\200\242
4- Ckan_k - (P0 + Pxn 4- \342\200\242
\342\200\242
\342\200\242
4- Psn5)an
4. a\302\243
- nm (A0 4- Axn 4- \342\200\242
\342\200\242
\342\200\242
4- A8ns)an is a particular solution of the
IHR if a is a root of C(t) of multiplicitym.
we use apn = An2 + Bn3 as a candidate for a solution and solve for A and B.
Upon substitution, we have [An2 + Bra3]
- 2[A(n - l)2 + B(n - l)3] 4-
[A(n
- 2)2 + B(rc - 2)3] = 5 + this simplifiesto (2A
3n, and - 6B) +
6Bn = 5 4- 3rc. In particular, this holds for all n, hence for n = 0 we must
have 2A - 6B - 5 and for n - 1,2A - 6B + 6B - 5 4- 3 or 2A - 8 or A - 4
and hence -B = J/2. Thus, a particular solution is apn = 4n2 4- V2M3, and the
general solution is an = 4n2 4- ^n3. 4- CY 4- mC2, where Cx and C2 are
constants that can be determined by initial conditions.
generally the form of the particular solution will include the product of
powers of n with / (n).
Table 3-2.
Remark: In each of the last four types of Table 3-2, the form of the
particular solution is the same if Dns is replaced by [P0 4- Pxn 4- \342\200\242
\342\200\242
\342\200\242
4-
Psn\302\260l
Thus, an
=
Cx4n 4- C22n 4- 3. Now using the initial conditions a0 = 10 and
Section3.6 Solutions of Inhomogeneous Linear Recurrence Relations 319
ax
=
25, we have the system of equations Cx 4- C2 4- 3 = 10 and 4CX + 2C2
4- 3 = 25. But these equationssimplify to Cx 4- C2 = 7 and 4C\\ 4- 2C2 = 22,
which in turn have the solutionsCx = 4 and C2 = 3. Thus, an = (4)(4n) 4-
(3)(2n) + 3.
Here the particular solution takes the form n(A0 4- Axn)4n since 4 is a
root of characteristicpolynomial of multiplicity 1. Substituting this
expression into the recurrencerelationgives
Now this is an expression that holds for all values particular for
of n, in
n = 0 we obtain the simplified equation A0 4- Ax = 0, and then for n = 1 we
obtain A0 4- 3AX = 2. These equations have the unique solution A0 = -1
and Ax
= 1. Hence, apn
= n(-l 4- rc)4n = n(n - l)4n is a particular
solution.
But then an
= n(n - l)4n 4- Cx4n 4- C22n is the general solution of the
0>n K
An
and observethat
for n > 2. (In fact, this equality holds for n > 1, since we could adopt the
convention
1 0
=
A\302\260
0 1
Thus,
an-i bn-i \"3- ll
An =
Cn-l dn-i. 0 2J
-
'3a\342\200\236_x26\342\200\236_i
a\342\200\236_ij
-
3C\342\200\236_! -i
2d\342\200\236 Cn^l
(1) an
- 3an.!, (2) bn
=
2bn_x
- an_l9
Where ax
- 3, bx
=
-1, cx = (0, and dx
- 2.
The recurrence relations (1) and (3)with their initial conditions imply
that
an
= 3n for n > 1 and cn = 0 for n > 1.
Section3.6 Solutions of Inhomogeneous Linear Recurrence Relations 321
(5) 6n-26n_1=-(3'l-1)and
(6) dn - 2dn.l = 0.
Therefore,
3\" 2n - 3n
An =
0 2n
and
Sometimesnonlinearrecurrence
relations can be made into a linear
recurrenceby a substitution.
Let 6n
=
a% This substitution changes the relation aj^~- 2a^_x = 1
into the linear relation bk = Cbk_x + f(dk) for k > 1.But for k - 0, =
d\302\260 1,
and any initial condition, ax = A becomes
b0 = A.
Of course, after we solvethe transformed relation for a general
expression bk, for we can then solve for an using the fact that k - logdn.
Let illustrate
us this technique in the following example.
&*=-~(3*)+B7\\
+ (4)(7*)'
6*^(3*)
Now let us give a solution for an in terms of n rather than k. Herewe use
the facts that n = 3* and k = log3n.We observe then that
+ (4)(7k\302\253l).
6*-all-(-|)(n)
/
_
7iogs\302\273 niog37 so that an
= + (4)(niog37)
|L
c) an
-
2anix + an_2 - 2n.
d) an- 2an_x an_2 + - 4.
e) an- 3an^ + 2a\342\200\236_2
- 3\".
f) an - 3an_x + -
2a\342\200\236_2 3.
- - 2\\
+ 2a\342\200\236_2
g) <*\302\273 3an_!
-
h) a\342\200\236 - 5n + 3.
+ 2a\342\200\236_2
3an_j
i) an + 3an_!
- 10an_2 - n + 1.
j) an + -
3a\342\200\236_x 10a\342\200\236_2
- *2
n2 + n + 1.
k) an + 3an_! - 10an_2 - (-
1) aB - 10a,,.!+ 25an_2 - 2n.
(m) an + 6an_! + 12an_2 + 8an_3 - 3n.
2. Write the general form of a particular solution a* (you need not
solve for the constants) to the following recurrence relations.
a) an - 2an_ -3.
- = 2n.
b) a\342\200\236 2an_
-
2an_ -n2n.
c) a\342\200\236
-
d) a\342\200\236
7an_ + 12an_2 - n.
e) an - lan_ + 12an_ _2 \342\200\224
2n.
f) an
- + 12an_2
lan\342\200\236
- 3\".
g) an
- 7an_ + 12a\342\200\236_2
- 4n.
(a) an
\342\200\224
an_i
=- n for n > 1 and a0 - 0.
(b) -
a\342\200\236an_! - 2(n - 1) for n > 1 and a0 - 2.
(c) an
-
2an_x = 4n_1 for n > 1and a0 - 1, ax - 3.
(d) an
-
2an_x - 2n~2 for n > 2 wherea0 - 2 and ax =
+ a\342\200\236_2 1.
(e) an
\342\200\224
ban_x + -
6a\342\200\236_2 4\"~2 for n
> 2 and a0 - 1, ax = 5.
(f) an
-
10an_x + 21an_2 - 3*-2 for n > 2 and a0 - 1,^ - 10.
6. Find the complete solution (homogeneous plus particular
solutions) to an
- 10an_! + 25an_2
- 2n where a0 - 2/3and ax
- 3. Use
the result of Exercise1 (1).
7. Find the complete solution to an + 2a\342\200\236_1
- n + 3 for n > 1 and
with a0 - 3.
8. Suppose that satisfies
a\342\200\236 the relation an \342\200\224 +
9a\342\200\236_1 26an_2
\342\200\224
-
24a\342\200\236_3 5n where a0 - 1, ax = 18, a2 = 45. Write the generating
function
A(X)-f>\342\200\236X\"
as a quotient of 2 polynomialsP(X)/Q(X).
9. Solve the following recurrence relations for a particular solution.
(a) an
- 5an_! + -
8a\342\200\236_2 4an_3
- n.
(b) an
-
ban_x + 8an_2 - =
4a\342\200\236_3 2n.
bfc
=
2b*_i + 2*- lforife^l
and b0 = 0
by using the method of undeterminedcoefficients, and
then finding a2* from bk.
11. Choosean appropriatesubstitution to translate
a0 = 8. Hint: let bn
}
(c) a\\
- = 0 where
2a\342\200\236_!
=
log2an.
(d) an
- nan_i = n! for n > 1 wherea0 = 2.
19. LetF= . For n > 0, solve for the entries of'F\" using
3 2
20. Let A - For n > 0 solve for the entriesofA n
using recurrence
1 4
relations.
6l
21. Solve exercise 20 for the matrix A = [4
[l 5J
\302\2601
22. Solve exercise20 for the matrix A = [2
[l 3J
n + 1 if m = 0
A(m
-
l,A(m,n - 1)) otherwise.
1. Among all n -digit decimal numbers, how many of them contain the
digits 2 and 5 but not the digits 0,1,8,9?
3 5 X2
+ rz ^ +
(1-2X) (1-X)3\" (1-3X)3*
-3.Thus,a\302\243 = -3ra.
(j) Since C(t) = (t + 5)(t and 1is not a characteristic
- 2) root,
try -
a\302\243 An2 + Bn + C. Substitutingand equating
coefficients, get A - -1/6,34A - 6B - 1,-37 A + 17B - 6C = 1.
Solve for A, B, and C.
(1) apn
- A2\"; A - 4/9; a* - 2n+2/9.
(m) -
a\302\243 (27/125)3\".
2. (a) a* = A.
(b) ap = An2\" root.
since 2 is a characteristic
(d) ap = An + B.
(e) ap = A2n.
(f) ap - An3\" since 3 is a characteristic root of C(\302\243)= t2 - 7t +
12 = (t - 3)(t - 4).
= n(Ara + B)4\".
(h) Leta\302\243
1 X
(c) A(X)-z 1 - ^ + (12X -
2X)(1 - 4X)
!/2 1/2 1 1 M
\342\200\236\342\200\236
+ -4n.
1 - 4X'
:; = -2\"
1 - 2X
a\342\200\236
\"
2 2
2 \342\200\224
3X X2
Observe that A(X) = +
(d)
^ _ x^ (i _
2XH1 - X)2
2- 7X + 7X2
~
(1 - 2X)(1 - X)2
3 2 1
~(1-X) (1-X)2 1-2X'
Thus,
= 3
a\342\200\236
- 2(n + 1) + 2\" - 1 - In + 2\".
1 X2
=
\342\226\240
(f) A(X)
(1- 3X)(1
-- 7X)
+
(1 - 3X)2(1 .-7X)
-35 1 29 1
48 (r J_)_J__
- 3X/ 12(1- -
3X)2
+
16 (1 - 7X)
-35 1 29 \342\200\236\342\200\236
an' 3\" ~
(ra + 1)3\"+ \342\200\224
7\".
48 12 16
<
2n+2
6. a, + \\nbn
a.-\302\247F 5 ~9~'
16, n
\342\200\236sn 11
8 _ (1
+ 9X -
- 91X2)(1 5X) + X353
aia
\302\273. )
(l _ 5X)(l _ 9X + 26X2 _ 24X3)
\342\200\242
4
Relations and
Digraphs
relations goes beyond this, however. After sets, relations are probably the
most basic and extensively used tools of mathematics. All functions are
relations. The connectives G, C, and = of set theory are relations.
Mathematical which
induction, on virtually all of mathematics rests, is
based on orderingrelations.Applications of relations are found
throughout
computer science and engineering, including relations between the
inputs and outputs of computer programs, relations betweendata
attributes in databases, and relations between symbols in computer
languages.
331
332 Chapter 4: Relations and Digraphs
subgraph given below is adequate for all kinds of graphs. That is why
334 Chapter 4: Relations and Digraphs
\342\200\242
Isaac
E2-{(f(v),f(w))\\(v9w)EEl}.
graphs that are isomorphic have the same values of invariants, but that
there isno known set of invariants that can guarantee that two graphs are
isomorphic.
Example 4.1.3. The digraphs in Figure 4-3 are isomorphic. They
both have five vertices, eight edges, and degree spectrum (2,1),(2,1),
(2,1),(2,1), (0,4). A digraph that is not isomorphic to either of the
Section 4.1 Relations and Directed Graphs 335
e
\302\273\302\273$
(a) (b)
(a) The relation \"divides,\" defined by \"a divides b iff there exists a
positive integer c such that a c =
\342\200\242 b\" on the integers
{1,2,3,4,5,6,7,8}.
(b) TherelationC on all the nonempty subsets of the set {0,1,2}.
(c) The relation # on the set {0,1,2}.
2. Specify the in-degree and out-degree of each vertex in the digraph
in Figure4-1.
3. (a) Give the edge sets for the digraphs (a) and (b) shown in Figure
4-3 as sets of ordered pairs.
(b) Give a specific isomorphismfrom (a) to (b), described as a set of
orderedpairs [vertex in (a), vertex in (b)].
(c) Howmany isomorphisms are there between (a) and (b)?
4. Provethat the digraph shown in Figure to
4-4 cannotbe isomorphic
eitherof the ones shown in Figure 4-3.
Figure 4-4.
336 Chapter 4: Relations and Digraphs
Figure 4-5.
edges.
(d) Do the same for all subgraphs with four vertices and five
edges.
6. Prove that each of the invariants cited in this section is truly an
invariant:^
(a) the number of vertices;
(b) the number of edges;
(c) the degree spectrum.
y SupposeG is an arbitrary digraph with n vertices. What is the
largest possible number of isomorphisms between G and itself?
(Choose G to maximize this number.)
8. Suppose G is an arbitrary digraph with n vertices. What is the
largest possiblenumber of distinct subgraphs with k vertices that G
may have? (Treat isomorphic subgraphs as distinct. Choose G to
(b)
(c) \342\231\246 fc
^ \"
*.^
A ^\342\200\224\342\200\224\342\200\224
\"*
u
^I-f 1 2
2. vertex
JD. -degree out-degree
Terah 0 3
Nahor 1
Hanan 2
Abram 1
Milcah 1
Sarai 1
Bethuel 2 1
Isaac 2 2
Rebecca 1 2
Esau 2 0
Jacob 2 0
3. (a) {(a,6),(6,^),(e,d),(d,a),(c,a),(c,d),(c,6),(c,e)}
[(a,b)Aa,c),(a,d),(a,e),(b,c),(c,d),(d,e),(e,b)}
(b,c) There are four possible isomorphisms. Vertex c in (a) must
correspondto vertexa in (b),sincethese are the only vertices
with out-degree four and in-degree zero. Once one of these
{(c,a),(6,6),(e,c),(d,d),(a,e)}
[(c,a)9(b,c)9(e,d),(d,e),(a,b)}
{(c,a),(6,d),(e,e),(d,6),(a,c)}
{(c,a),(6,e),(t?,6),(d,c),(a,d)}
338 Chapter 4: Relations and Digraphs
5. (a) \342\200\242
-\342\226\272\342\200\242
-\302\253-
\342\200\242 -*\342\226\272\342\200\242
-\342\226\272\342\200\242-*-
u v w JC V z
s^~
\342\200\242 \342\200\242 \342\200\242 \342\200\242 9f \342\200\242 \302\273
\342\200\242
o o p
x y z
y z
relation. [The edges (xfx), (yfy), and (z,z), which would be required by the
definition, are missing.]
A digraph is reflexive if every vertex has an edge from the vertex to
itself (sometimescalleda self-loop). It is irreflexive if none of the
vertices have self-loops. Figure 4-8 illustrates a reflexive relation on
{x,y9z} and Figure 4-9 illustrates a relation on {x,y,z}that is irreflexive.
(Note also that it
possible is that a graph be neither reflexive nor
(a)
(b) o
(c)
(d) Q O O
342 Chapter 4: Relations and Digraphs
Ot- fc
\342\226\272
\342\200\242- ^\302\273-\342\200\242
14. Let A be the set of rational numbers. For a,b G A, define (a,b) G R
if a-b is an integer. Provethat R is an equivalence relation on A.
15. LetD be the diagonal of A x A, that is, D - {(a,a) \\ a G A} is the
(c>
(d)
'(e)
a \302\251. \302\251
(c) Counterexample:
b c
\302\251
344 Chapter 4: Relations and Digraphs
\"big oh notation,\" that has proven very useful in many areas of applied
mathematics,especiallyin analysis of the running times of algorithms.
This notation is particularly interesting because it expresses a relation
between functions that is neither a partial ordering nor an equivalence
relation, though it is sometimes mistakenly applied as if it were one or the
other.
Definition 4.2.1. Let g: N \342\200\224\302\273 R be a function from the set of
nonnegativeintegers into the real numbers. 0(g) denotes the collection
of all functions f:N\342\200\224+R for which there exist constants c and k (possibly
different for each /) such that for every n > k, | / (n) | < c \342\200\242
| g(n) |. If / is in
0(g) say we that / is of order g.
It is worthwhile taking note that the definition of Big 0 can be
simplified, by dropping the absolute values, when the functions involved
are well behaved. This is expressedby the following lemma.
Lemma 4.2.1. If there existsa constant kx such that for every n >
ku f (n) > 0 and g(n)
> 0, then / is in 0(g) if and only if there exist
constants c and k2 such that for every n > k2, f (n) < c \342\200\242
g(n).
Proof. Since / (n) and g(n) are both nonnegative for n > kl9 we have
\\f(n)\\ =J^(n) and \\g(n)\\ - g(n) for n > max(kuk2). The lemma then
follows immediatelyfrom Definition 4.2.1. \342\226\241
We shall use this lemma implicitly in the examples below, where all the
functions are positive valued for sufficiently large arguments.
implies
l\302\260g\302\260C
n* ,
a contradiction.
Section 4.2 SpecialPropertiesof Binary Relations 345
,, v
~
_ J2n
if rc is an even integer
\\n otherwise
and
( \\ ~ f^n
_
^ n ^s an oc^^integer
\\n otherwise.
This avoids introducing special names, like / and gy for the functions
being compared. It is alsocustomary to write 0( / (n)) instead of 0( f),
and to use 0(f (n)) where a value of a function in 0( f) is intendedbut
the exact function may be unknown. For example,sincel2+ 22 + \342\200\242
\342\200\242
\342\200\242
+
n2 = (1/3)n (n + 1/2) (n + 1) = l/3n3 4- l/2n2 + l/6n, we could write
12 + 22 + \342\200\242
\342\200\242
\342\200\242+ n2 - (1/3)n3 + 0(n2). In this case 0(n2) stands for
g(n) = l/2n2 + l/6n, which is a specific function g in 0(n2). (The fact
that g is in 0(n2) is a consequence of a theorem that is given in the
exercises for this section.)
equivalence relation.
346 Chapter 4: Relations and Digraphs
1. Since| f(n) |
< I \342\200\242
| f(n) | for all n > 1, we know that (/,/) is in Q for all
and
/:#\342\200\224\342\226\272#, so Q is reflexive.
2. Suppose (fg) and (g,h) are in Q. Then there exist cu c2,ku and k2
such that for all n > felf \\f (n) | < Cj |, and for all n > fe2, \\g(n) I <
\342\200\242
|g(n)
c2 -\\h(n)\\. It followsthat for all n greater than or equal to the maximum
of kx and k2y |/(n)|< cx \342\200\242
|g(n)|< cx> c2- \\h(n)\\, and so Q is transitive.
AW-i /B<*)-*2
f2(n) = n /6(rc)=V
/3(n) = log2(n) /7(m)
= m2 \342\200\242
log2(M)
/4(m) = n \342\200\242
log2(n) /8(n) = 2n
/ (y) for all x and y. Suppose a, fe, and c are nonnegative integer
constants. Prove that any positive valued monotone increasing
function T:N\342\200\224+R that satisfies the recurrence relations
must be in
(a) 0(n) if a < c;
(b) 0(n \342\200\242
log(n)) if a = c;
(e) 3n + 2 \302\2430(1)
(f) 5(2n) + n2 G 0(2\
-
(g) 10n2 + 5m 6 \302\243
0(n)
(h) 0(logan) = 0(logbn) wherea and 6 are integers greater than I.
10. Give necessary and sufficient conditions for a function to be in
0(1).
11. Suppose that /: N \342\200\224+
R is a function. We say that a numberL is the
limitoff (n) as n approaches oo if for every numbere > 0,there is a
(c) If lim\342\200\236_\342\200\236/
(n) - A and lim\342\200\236_0og(n)
- then
\302\243 lim/ (n) + g(n) -
A + B, /
lim\342\200\236_^ (ra)g(n) = AB, and lining / (n)/g(n)
- A/B
(provided B # 0).
(d) Suppose lim\342\200\236_^/(n)/g(n)
- L. If L > 0, then / E L > 0,
0(g). If
then / E O(g) and gE 0 (/). If L =
0, then / E 0(g) but g $
O(f).
12. Use exercise 11(d) to show the following:
(a) 0(n + 1) = O(10ra + 3) - 0(n + log2n) - 0(n)
(b) 0(n3 + n2 + n + 3) = -
0(n3 5) - 0(\302\2533)
(b) The crucial fact here is that \\x + y\\<\\x\\ + \\y\\. Suppose for all
n > ku\\ fi(n) | < ax \342\200\242
|g(n) | and for all n > k2, I f2(n) I ^ a2 \342\200\242
|g(n) |. Then for all n > max (kx,k2),| /x(n) + /2(rc) | < | /x(n) | +
j f2(n) |
< ax \342\200\242
|g(rc) I 4- a2 \342\200\242
|g(rc) | < (ax + a2) \342\200\242
\\g(n) |.
(c) The crucial fact hereis that \\x -
y\\
= \\x\\-\\y\\. Suppose for all n >
ku\\fx(n)\\<ax |gx(rc)|andforallrc> \342\200\242
k2,\\f2(n)\\<a2 \342\200\242
\\g2(n)\\.
Then, for all n > max (kx,k2)y \\ fx (n) \342\200\242
/2(rc) |
= | fx (n)\\-\\ f2(n) | <
<*i
\342\200\242
\\gi(n) |
\342\200\242
a2
\342\200\242
|g2(rc) I
- (ax a2)
\342\200\242
\342\200\242
\\gx(n)
\342\200\242
\302\2432(rc)|.
If 0 < a/c < 1, the sum 2 -10 (o/c)1 is bounded by some constant k,
so
T(rc) < kbn + nlogcab. Since logca < 1 for a < c, we have
T(n)<(k + l)6n.
For example,if
not matter. a person wants to purchase something that
costsonedollar,it would not matter whether he or she has a dollarcoinor
a dollar bill, or any particular dollar bill, since all of these would be
very unlikely to say that all dollar bills are equivalent, since minor
differences, such as serial numbers and errorsin printing, may greatly
affect the value of a bill as a collector'sitem.The meaning of equivalent
thus depends on context and expressesthe notion of being the same in
those respects relevant to the context.
In terms of formal mathematics, a binary relation is an equivalence
relationif it is reflexive, symmetric, and transitive. These properties
expressimportant aspects of being the same which are ordinarily taken
for granted and are usually obviousfor specific equivalence relations. For
example, consider the relation \"was born in the same month as.\" This
relationis clearly reflexive, since each individual was born in the same
month as himself. It is equally clearly symmetric\342\200\224if individual A was
born in the same month as individual B, then B was born in the same
month as A. There is no question about transitivity either. Beingtold
that A and B were born in the samemonth and B and Cwereborn in the
samemonth, no one is likely to deny that A and C must also have been
born in the samemonth.
Another way of looking at equivalence relations is as ways of dividing
things into classes. For the exampleabove, the relation \"was born in the
same month as\"partitionsthe setofall living human beings into twelve
to the twelve
disjoint classes,corresponding months of the year. Each of
these equivalenceclassesconsists of all the people who were born in a
given month. Any time a set is partitioned into disjointnonempty subsets
1. foranyBGP,BC A;
Proof.
1. Clearly by the definition of [x], [x] C A.
2. [x] Pi [y J = \\z G A |x R z and y R z}. If this set is not empty,then for
some z A, x
\342\202\254z R z and y R z; but then, sincei? is transitive and
symmetric, x R y, so that [x] = [y],
1. Tell how many distinct equivalence classes there are for each of the
following equivalence relations.
(a) Two people are equivalent if they are born in the sameweek.
(b) Two people are equivalent if they are born in the sameyear.
(c) Two people they are of the samesex.
are equivalent if
2. Suppose R is an arbitrary transitive reflexive relation on a set A.
Prove that the relation E defined by x E y iff x R y and y R x is an
equivalencerelationon A.
(c) the sets {2i,2i + 1}for all i > 0 (infinitely many classes).
(d) the even numbers; the odd numbers.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCDABCHACCLMMABCRCDABHCAC
15. Use Theorem 4.3.1to verify that the following relations are
equivalence relations.
(a) Let A be the set of all people in the world and let (a9b) El Rift a
and b have the same father.
(b) Let A be the set of positive integers and defineR on A by (a9b)
Giiiffo and b have the same units digit in their decimal
expansion.
(c) Let A be the set of positive integers and defineR on A by (a,b)
G R iff a and b have the same remainder upon division by 7.
(d) Let A be the set of positive integers and defineR on A by (a9b)
G R iff a and b have the same prime factors. (Thus, for
your classroom.
(i) Let A be the United States citizensand defineR on A by
set of
(a9b) G R iff b have the same zip code.
a and
(j) Let A be the set of all students at your university and defineR
on A by (a,b) G R iff a and b have the same grade point
average.
16. Suppose that a relation R on a set A satisfies the following
properties:
(a) For each a G A, there exists 6 G A such that (a,b) G R.
(b) If (a,c) G R and (6,c) G fl, then (a,6) G #.
Must R be an equivalencerelationon A?
determined by R.
20. Let A = R x R, where R is the set of realnumbers, and let P =
(*o>yo)be a given point in A. If a and b are in A, define aRb iff the
distance from a to P is jbhe same as the distance from b to P. Prove
that R is an equivalence relation on A and that the equivalence
classes are the circlesin the plane having P as the center.
unbounded number
(c) two, one for m#les and one for females
2. Transitivity: If x E y and y E z> then x R yf y R x, y Rz, and z R y.
Since R is transitive, this means xRz and z R x, which means xEz.
Reflexivity: Since R is reflexive, x R x, and so also x E x.
Symmetry: If x Ey, then xRy andy R x, which meansy Ex.
M 4- [y] - [x 4- y];
[*] \342\200\242
[y]
= [* \342\200\242
y].
Proof.
1. Supposexx =
x2(mod m) and yx ^ y2(mod m). We need to show
that xx + yx = x24- y2(mod m). (Thisisthe sameas supposihg that
yx =
\342\200\242 \342\200\242 \342\200\242 a b \342\200\242\342\200\242
\342\200\242 so that xx =
\342\200\242
*2 ^2 4- (x2 b 4- y2 a 4- m) m, yx
\342\200\242 D
x2 y2(mod m).
1. [x] + [y]
- [y] 4- [x] (Addition is commutative.)
2. [x] [y]
=
\342\200\242
[y] \342\200\242
[x] (Multiplication is commutative.)
3. l[x] 4- [y]) 4- [2] = [x] 4- ([y] 4- [2]) (Addition is associative.)
4. ([*] \342\200\242 \342\200\242=
[y]) [2] [x] \342\200\242 \342\200\242
([y] [z]) (Multiplication is
associative.)
5. ([x] 4- =
\342\200\242
[x] \342\200\242
4- [y] \342\200\242
[y]) [z] [2] [2] (Multiplication
distributes over addition.)
relatively prime.
[w 4- 2 \342\200\242
x],.. .,[w 4- (m - 1) \342\200\242
x] are all distinct.
m in r =c \342\200\242
x + d \342\200\242
m, we obtain r = (c \342\200\242
a 4- d \342\200\242
6) \342\200\242
s. Because r and 5
are both positive,c also be positive.Thismeansthat r >
a + d - b must
\342\200\242
(1) x \342\200\242
(i
-
j) = y \342\200\242
m. Since x and m are relatively prime, gcd(x,m)=
1, and, by the preceding lemma, there exist c and d suchthat
(2) c \342\200\242
x + d m = 1. From (1) we obtain
\342\200\242
(3) c \342\200\242 - j)
x \342\200\242
(i
- c \342\200\242
y m = 0. And from (2) we obtain
\342\200\242
(4) c -
x \342\200\242
\342\200\242
(i ;) 4- d \342\200\242
m \342\200\242
(i
-
y) = (i - j). Subtracting (3) from (4),
we obtain
(5) m (d \342\200\242
\342\200\242
(i
-
j) 4- c =
\342\200\242
y) i - y.
(/ (x)+ 2 \342\200\242
g(x)) mod m ... (/ (x) + (m
- 1) \342\200\242
g(x)) mod m, called the
\"probe sequence\"for x. (Here / and g are functions chosen for their
can be relied upon to include every location of the table, provided g(x)
and m are relatively prime. In practice this is often achieved by choosing
g(x) to be odd and m to be a power of or
2, choosingm to be a prime
number.
a \342\200\224
6.
12. (a) What is the last digit in the ordinary decimal expansion of
3400?Hint: Note that 34 = 1 mod 10 so that 34\" \302\273
1 mod 10 for
any integer n.
(b) What is the last digit in the ordinary decimal expansionof
94009
(c) What are the last 2 digits in the ordinary decimal expansion of
3400? Hint: 320 = 1mod 100.
13. (a) Prove that any integer that is a square must have one of the
following for its units digit:0,1,4,5,6,9.
(b) Prove that any fourth power must have one of 0,1,5,6 for its
units digit.
14. Prove that 19 is not a divisor of 4rc2 + 4 for any integer n.
15. Prove that if n is not a prime integer and n > 4, then (n
\342\200\224=
1)! 0
modrc.
16. Determine whether or not the 328th day and the 104th day of the
year fall on the same day of the week.
17. What is the remainder when 51101is divided by 6? When 3100 is
divided by 8? When 5110is divided by 4?
1 mod 16.
19. Show that the following statements are true:
(a) 5 = 21mod 8 (d) 117 0 mod = 39
(b) -3 = 7 mod 5 (e) 8 - -6 mod 7
(c) 57 =0 mod 19 (f) 35- mod 17 9
digit of x is divisible by 2.
360 Chapter 4: Relations and Digraphs
ao
- fli + a2 - a3 + ... 4- (
\342\200\224 is divisible
l)nan by 11.
23. Using propertiesof congruences,
solve the following congruences
for x: \342\200\224'
28. Show that some positive multiple of 63 has 452as its final three
digits.
30. (a) Find the remainder when l!+2! + 3!+ ... +99! +100!is
divided by 12.
(b) What is the remainder when l5+25+35+ ... + 1005 is divided
by 4?
31. (The Coconut Problem). Three sailors are shipwrecked on a desert
islandand gathera pileofcoconuts for food. They decide to retire
for the night and divide the coconuts in the morning.One awakens
and distrustfully decides to take his share during the night. He
attempts to divide the pileof coconuts into three equal shares, but
finds there is one coconutleft over.He discards the extra one,
takes his share to a hiding place,and goes back to sleep. Later,
another of the sailorsawakens and, upon dividing the pile of
remaining coconuts into three equal shares, finds there is one left
over. He also discards the extra one, hideshis share, and goes back
to sleep. Finally,the third sailor repeats the process once again. He
finds, as the others did, that by discarding one coconutthe
remaining pile of coconuts can be divided into three equalshares.
How many coconuts were in the original pile? Also solve the
coconut problem for:
(a) 4 sailorsand 4 equal shares with a remainder of 1 after each
division.
33. (a) When eggs in a basket are removed 2, 3, 4, 5,6at a time, there
remain, respectively, 1,2,3,4,5 eggs. But when 7 are taken out
at a time, none are left over. Find the smallest number of eggs
that could have been in the basket,
(b) Supposethat one egg remains in the basket when the eggsare
removed 2, 3, 4, 5, or 6 at a time, but no eggsremainif 7 are
removed at a time. Find the smallestnumber of eggs that
could have been in the basket.
34. A band of 17 pirates stole a sack of gold coins.When they tried to
divide the fortune into equal portions,3 coinsremained. In the
ensuing brawl over who should get the extra coins,onepiratewas
killed. The wealth was redistributed, but this time an equal
distribution left 10 coins. Again an argument developed in which
another pirate was killed. But now the total fortune was evenly
distributed among the survivors. What was the least number of
coins that could have been stolen?
36. How old was a man in 1900 if his age at death was 1/41 times the
year of his birth?
37. About know of Diaphantus' life is his epitaph,from
all we which
his death is to be deduced:\"Diaphantus
age at spent one-sixth of
his life in childhood, one-twelfth in youth, and another one-
seventh in bachelorhood. A son was born five years after his
marriage and died four years before his father at half his father's
final age.\"
38. Find that integral solution to 13*+ 21y = 1 for which x is as small
a positiveintegeras possible.
39. Three men possessa pile of money, their sharesbeing 1/2,1/3, and
1/6 of the pile. Each man \302\243akes some money from the pile until
nothing is left.The first man then returns 1/2 of what he took,the
second1/3, and the third 1/6 of what he took. When the total so
returned is divided equallyamongthe 3 men it is found that each
then possesseswhat he is entitled to. How much money wasin the
original pile, and how much did each man take from the pile?
defined.
(b) Take m - 3. Then [2]/[2]= [1], but also [3]/[2] = [1]. It follows
1. V a G A9 a < a (reflexivity)
Example4.4.1.
(a) Let U be an arbitrary set and let A = P (U) be the collection of all
subsets of U. Then [P(f/); C] is a poset but if U contains more
than one element, then P([/) is not totally ordered under set
inclusion. For if U contains the two distinct elements x and y, then
P(\302\2437) contains two distinct elements \\x) and {y}9 and these sets are
incomparableunder inclusion.
(b) If Z is the set of integersand < isthe usual ordering on Z, then not
only is [Z;<]partially ordered, but, more than that, it is totally
ordered.
(c) Another familiar poset involves the set P of positive integersand
the relation \"divides\" where we write a \\ b iff a divides b or iff b =
ac forsome integer c. Then [P;|] is a partially ordered set. See
Example 1.3.6of Chapter 1 for verification. But [P; | ] is not totally
ordered since2 and 3 are incomparable, that is, 2 doesnot divide 3
Poset Diagrams
ofminimal
In a totally ordered set the concepts and least coincide, as
do those of maximal and greatest.But in a partially ordered set (that is
not totally ordered) these concepts are quite distinct. For example, the
posets of Figure 4-12 (a),(b),(c),(d),(e), and (h) have a unique least
element. The posetsof (f) and (g) have several minimal elements,
namely, 2 and 3 for (f) and 2,3, and 5 for (g).The posetsof(a),(b),(c),(d),
and (g) have a unique greatest element while the poset [712, | ] of (e) has
maximal elements 7, 8, 9, 10,11,12.Likewise, the poset of (f) has two
maximal elements 12and 18 while the poset of (h) has maximalelements
4,6, and 9.
Section 4.4 Ordering Relations, Lattices,and Enumerations 365
{a, by c}
t4 {a.b} {*.c-}
42
(a) [D\342\200\236;|]
(b) [9({a. b, c});C]
Weil-Ordered Sets
A total order < on a set A is a well order if every nonempty subset B
of A contains a least element. Moreover, [A;<] is said to be well
ordered.
Since A is a totally ordered set it follows that if a set B contains a
minimal element, thenB contains only one minimal element and
moreover, this element is a least element of B.
Example 4.4.2.
(a) The poset [Af;<], where N is the set of nonnegative integers, is well
ordered. In actual fact, the well-ordering property of < is
equivalent to the principle of mathematical induction, and is usually
taken as an axiom.
(b) On the otherhand, the poset [Z;<] is not well ordered becausethe
subsetof negative integers does not contain a minimal element.
(c) The relation < on
Q of rational numbersis a total ordering
the set
but not a well ordering because some subsetsof (?do not containa
minimal element. For example, the set P of positive rational
numbers contains no minimal element for if x G P, x/2 < x, and
x/2 e p.
(d) Any finite totally ordered set is well ordered.
1. P(a0) is true;
2. for any a in A, if P(x) is true for all x in A such that x < a, then P(a)
is true.
Section 4.4 Ordering Relations, Lattices, and Enumerations 367
Enumerations
N: 0 1 2 3 4 5 6 ...
1 1 1 i 1 i i
Z: 0 -1 1 -2 2 -3 3 ...
In other words, pair the even integers in N with the positive integers of
Z and the odd integersof N with the negative integers of Z. Then we
definea new ordering R of Z by aRb iff/-1(a) < /_1(b).Thus, (-1)#(-3)
because 1< 5.
The correspondence
/ above is a special case of an enumerationwhich
we now define.
Lattices
Example4.4.4.
(a) If U is any set, [(P(U); C] is a lattice in which the least upper
bound of two subsets B and C of U is just B U C and the greatest
lower bound of {B,C}isBHC. (Proof: Note thatB H C C B and
B Pi C C C so that BHCisa lowerbound of lB,C}.On the other
hand, if D C B and D C C, then D C B H C. Thus, B H C is the
(c) The poset [P;| ],where P is the set of positiveintegers, isa latticein
which a A b = gcd(a,6) and a V b - lcm(a,6) where gcd and 1cm
respectively stand for greatest common divisor and least common
multiple.For instance, 6 A 9 = 3 and 6 V 9 - 18.
(d) Of the posets in Figure 4-12, (a),(b),(c), and (d) are lattices, (e)and
(h) are meet-semilattices, (g) is a join-semilattice, while (f) is
Section 4.4 Ordering Relations, Lattices, and Enumerations 369
RofS.
10. For each of the following posets, draw a poset diagram and
determine all maximal and minimal elementsand greatest and
least elements if they exist. Specifywhich posets are lattices.
(a) [D20;\\]
(b) [D,^]
(0 [/i5;|]
(d) [A; <] where A =
\\x \\ x is a real number and 0 < x < 1}
(e) [A; | ] where A = {2,3,4,6,8,24,48}
370 Chapter 4: Relations and Digraphs
(associative).
(d) a A (a V b) = a, a V (a A 6) = a (absorption).
(e) c<6iffaA6 = oiffaV6 = 6 (consistency).
greatest element.
(d) An infinite poset [A;<] with a subset B for which there is a gib
but suchthat B doesnot contain a greatest element.
(e) An infinite poset [A;<] with a subset B for which there is an
upper bound for B but no lub.
21. (a) Determine necessaryand sufficient conditions on n such that
[Dn; | ] is totally ordered,
(b) What will be the nature of the posetdiagramsfor [Dn; \\ ] where
n = p\\lp\\* or where n = p^p^p^3 where Pi,p2, and p3 are
distinct primes and kl9k2f and ks are positiveintegers?
22. Show that in the poset of real numbers with the usual order
relation<, no elementcoversany other.
23. Draw as many as possible distinctposetdiagrams of posets with
one, two, or four elements. Label all greatest elements and least
elements which appear.
24. The set of all n-digit binary sequences by Bn. Draw the
is denoted
poset diagram for [J34;<] where (bub2,b3,b4) < {aua2ia^a^ iff 6, < a{
372 Chapter 4: Relations and Digraphs
such that at<b < ai+l then the chainis called a maximal chain
with endpoints ax and ak.
(a) If A = P(t7) fe the set of all subsets of U = {ax,a2,..
.,aj,
determine all maximal chains in [P(U)y with
\302\243] endpoints <t>
andf/.
*<40-/<0
g(4i + 1) - (-a,6)
g(4i + 2)-(a,-&) where f(i) = (a,6)
*(4i + 3)-(-a,-\302\253
n > 0 define g(n 4- 1) = f{k)f for the least k suchthat f(k) is not in
Section 4.4 Ordering Relations, Lattices, and Enumerations 373
G(n) = {g(i)|i < rc}. Observe that the set G(n) is always finite, so
that there is such a k for every n. (A complete solution would also
include a proof that g is an enumeration of D and has no
repetitions.)
4.4.1 Application:
Strings and Orderings on Strings
While the orderingrelations< and < on the integers and real numbers
are probably so familiar as to be taken for granted, there is another
domain, of special importancein computer science, where the ordering
relations are probably less familiar. This is the domain of character
strings.
Definition4.4.4. Let 2 be any finite set. A finite sequence of zero or
more elements chosenfrom 2 is a string over 2. In this context,2 is
called an alphabet. The length of a string w is denoted by | w |. The
string of length 0 is denotedby A and called the null string. The set of
all strings of length k is denoted by 2\\ That is,
-
2\302\260 {A}, and
2*+1 - [wa | w G 2* and a G 2} for k > 0.
2* \302\253
(^J 2*, denoting the set of all strings over 2.
2+ =
\\^J 2*, denoting the set of all nonnull strings over 2.
k>0
1. x <Lyandy <Lx;
2. x <Ly and y ^L x;
3. if a <A b then x <L y and y ^L x, elsex \302\243L
y and y <Lx.
Theorem 4.4.1. Given any finite alphabet A and any total ordering
<4 on A, the lexicographic ordering <L defined by extending <A is a total
ordering on A*.
xx <L x2 and (j) is the case by which x2 <L x3. In order not to miss any
cases, we label the sections of the proof according to this system. To keep
the proof short, we combinecaseswhenever possible.
Case 2. (2,1),
(3,1). In these cases x2 = x3. By substituting x3 for x2 in
xx <L x2 we again obtain xx <L x3.
proof. \342\226\241
A,a,b,aa,ab,ba9bb,aaa9aab,aba,abb,baa,....
A B =
\342\200\242
{a6|aG AandbGB}.
3. For eachof the following pairs of values for x and y, classifyx and y
according to the (1-3) of the definition
cases of lexicographic
ordering. Also, identify the longest commonprefix of x and y, and
state the relationshipbetween x andy.
(a) x - \"RED\", y
- \"RED\"
(b) x - \"REDOLENT\", y - \"REDONE\"
(c) jc = \"REDUCE\",
y = \"REDONE\"
(d) x - \"RED\", y
= \"REDONE\"
2. (a) nk
(b) aaa, aab, aba, abb, baa, bab, bba, bbb
(c) bbb,bbc,bcb, bcc, ebb, cbc, ccb, ccc
(d) aac, abc, bac,bbc
5. Define (wl9.. ,,wn) < (xu.. .,xm) iff n < m, or n = m and there exists
1<k < n suchthat for all 1 < i< k, Wi = xiy and, if k <nywk< xk and
wk * xk.
Section 4.4 Ordering Relations, Lattices, and Enumerations 377
computed by any program g(i) then f(i)(i) would equal d(i), but that
would contradict the definition of d. This completes the proof of the
following theorem.
0 I
/(0)(0)
/(1)(D
/(2)(2)
f(i)(i)
di < 9.
5. Use a diagonal constructionto show that the functions /: N \342\200\224\302\273
N
cannot be enumerated.
Section 4.5 Operations on Relations 379
4. Suppose /: N \342\200\224\342\226\272
[0,1] is an enumeration of the realnumbersbetween
0 and 1. Let dig(x,i) denote the ith digit in the decimal fraction
When one is
working with relations, it is often useful to think of one
relation derived from another. For example,
as being the relation < on
AY x
\342\200\242
\342\200\242
\342\200\242
x An. Thenflx = (Ax x \342\200\242
\342\200\242
\342\200\242
x An)
- Rx is the complement of
Rv Suppose further that R2 C^x- \342\200\242
\342\200\242 The
xA\342\200\236. union RY U R2 is also
a relation, as are the intersection Rx D R2 and the difference Rx
-
relational modelsfor
Work on computer database systems has led to
application the union,
of intersection, complement and projection
operations on rc-ary well as a number of moreesoteric
relations, as operations.
jB2 x \342\200\242
\342\200\242
\342\200\242
x Bm be relations and suppose At =
B; for some i and j. The
join ofRi and R2 with respect to component i ofRx and component
j of R2 is the relation
{(al9...,an,bl9.. .9bm) \\ (alv . .,an) G Rl9 (bl9.. .9bm) G J?2, and at - &,}.
{(a9b9c9a9y)9(a9b9a9a9x)9(a9c9c9a9y)9
(a9c9a9a9x)9 (b9a9a9b9x)).
R R~
^\342\200\2426
\342\200\242o
c \342\200\242
/?\342\226\240 R, Ri -R2
abed
# \302\273\302\273# ^# \302\273\302\273t #
a >
R R+
certain elements to the set,we can call P a closure property and define
the P-closure
of a set to be the smallest set that containsit and satisfies
property P.
positive integers}.
(a) What is R D R~l? Is R symmetric? Reflexive?
Section4.5 Operations on Relations 385
7. Give the transitive closure, the transitive reflexive closure, and the
symmetric closure, represented as digraphs,for each of the
relations:
following
(c) i? \342\200\242
S is symmetric iff i? S - S \342\200\242
. /?.
(b) i? (T H
\342\200\242
WO
= (R T) O
\342\200\242
(/? \342\200\242
W)
1. (b) (d) b
a*
<\342\200\242>
Vi_i) for each 1 < i < n. A path is simple if all edges and verticeson the
path are distinct, except that v0 and vn may be equal. A path of length s* 1
with no repeated edges and whose endpointsare equal is a circuit. A
simple circuit is calleda cycle.
Note that the definitions of simple, circuit, and cycle apply equally to
directed and nondirected paths. It is alsoimportant to notice that a path
of length zero is permitted, but it does not have a unique pair of
endpoints. Such a path has no edges and can be viewed as being from
a vertex to itself. When we wish to exclude paths of length zerowe will
use the term nontrivial path. Ordinarilythe termpath will be qualified
Section 4.6 Paths and Closures 389
Theorem 4.6.1. If A =
(V,E) is a digraph, then for n > 1, (x9y) G
En iff there is a directed path of length n from x to y in A.
#> so
\302\243
(y\302\273-i\302\273y\302\273) that (u0, vn) G \302\243n.
and composition
Paths are also related to the property of transitivity.
If A = (VJE) is a digraph then E istransitive iff every directed path in A
has a \"short-cut.\" That is, if there is a nontrivial directed path from a
vertex x to a vertex y there must alsobean edge directly from x to y. This
reasoningleadsto a useful corollary.
R2 = {(a,a),(a,6),(a,c),(6,e),(6,d),(c,e)}
i?3 =
{(a,a),(a,6),(a,c),(a,d),(a,e),(6,e)}
i?4 = {(a,a),(a,6),(a,c),(a,d),(a,e)}
i?5 = {(a,a),(a,6),(a,c),(a,d),(a,e)}
Notice that jR4 = R5 so it will follow that R4 = i?5 = R6 = #* for all fe > 4.
Then R+ is just the union of these sets, so that
R+ - {(a,a),(a,6),(a,c),(a,d),(a,e),(6,c),(6,d),(6,e),(c,(i),(c,e),W,e)}
compute paths of all possible lengths from each vertex. Then, for
example, we know (a,d) G R+ because there is a path of length 3 from a
well).
We can continue this process,but wheredoesit end? Note that there is
a path of length 20 from a to c by going around loop (a,a) 18times, then
along (a,6), and finally along (6,c). But note that since there are only 5
vertices, any path of lengthgreaterthan 5 between vertices x and y must
have repeated a vertex and so must includea circuit. Therefore, such a
Example 4.6.3. The graph shown in Figure 4-18 illustrates all of the
connectivity relations.
a \342\200\242 c
\342\200\242
1. (a) (a,6),(6,c),(c,d)
(a,c),(c,d)
394 Chapter 4: Relations and Digraphs
Wehave seen that digraphs and binary relations are closely related to
each other. They are both relatedjust as closely to another important
mathematical structure: matrices. We will now therefore review the
definition of matrix, to seehow a matrix can represent a binary relation
and how this matrix representation can be useful in extracting
about
information a digraph.
Definition 4.7.1. be
Let S any set and ra,n be any positive integers.
An m n matrix
x over S is a two-dimensional rectangular of array
indexed, with the first,index indicating the row number and the second
index indicating the column number, as shown in Figure 4-19.
Matrices interesting are in their own right and are the subjectofa rich
mathematical However, theory. most of this theory is beyondthe scopeof
Figure 4-19
396 Chapter 4: Relations and Digraphs
the present book. We are presently only interested in matrices for one
special application\342\200\224the representation of digraphs or binary relations.
For this purpose we will consider Boolean matrices, which are
matrices over the set {0,1}. There is a natural one-to-onecorrespondence
between the binary relations and the square Boolean matrices,as
demonstrated the by following definition.
1 1 1
|\"l l]
0 1111
0 0 111
0 0 0 11
Lo o o o lj
Notice all that the diagonal entries in the matrix above are 1. This is
because< is reflexive, and will be true for any reflexive relation.
adjacency matrix,
To i o o ol
0 0 10 0
0 0 0 11
110 0 0
I 0 0 0 0 OJ
Section4.7 Directed Graphs and Adjacency Matrices 397
Vi y2 v3
* \302\273.# ^ #
Figure 4-20
Definition 4.7.3. Let S be any set and let \302\251and \302\256be any two
binary operators defined on the elementsof S. Assume that \302\251is
E(i9j)-A(i,j)\302\256B(iJ).
x y x OR y x AND y
0 0 0 0
0 1 1 0
1 0 1 . o
1 1 1 1
[l
1 1 1 ll
11111
110 11
110 0 0
[o
o o o oj
We will show how
representative twoelements of this matrix are
obtained. entry The 2, column 2 is obtained
in row from the second row of
A and the second column of B, and is (0 AND 1) OR (1 AND 0) OR (1
AND 0) OR (1 AND 1) OR (1 AND 0) = 1. The entry in row 2, column3 is
obtainedfrom the second row of A and the third column of B, and is (0
AND 1) OR (0 AND 1) OR (1 AND 1) OR (0 AND 0) OR (0 AND 0) - 1.
RA
\342\200\242and
RB, the matrix (OR.AND)nA is the adjacency matrix of the
relation RnA. Here (OR.AND)2^ means A OR.AND A.
Proof. Recallthat RA =
\342\200\242
RB Rc where Rc - {(viyvk)\\ (vhVj) G RA and
(vjtvk)
G RB for some j}. Thus if C is the adjacency matrix of Rc then
Section 4.7 Directed Graphs and Adjacency Matrices 399
C(i,k) = 1 iff for some j, A(vhVj) = 1 and A(vjyvk) = 1. This is exactly the
same as saying C(ijk)
- (A(i,l) AND B(1J)) OR ... OR (A(i,n) AND
B(n,j), which is (A OR.AND B)(iyj). The theorem is thus a direct
consequence of the definitions. D
Proof. This follows from the preceding theoremand the fact that
i?+ = R U R2 U \342\200\242
\342\200\242
\342\200\242
U Rn. \342\226\241
1 0
0 1
Lo o ... i.
Proof. Thisis left to the reader as an exercise. \342\226\241
1 1 0 0 0 1110 0
0 0 1 0 0 0 0 0 11
Aj- 0
0 0 0 0 1 1
11 A%-
AS- 0 0 0 0 1
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
400 Chapter 4: Relations and Digraphs
11111 11111
0 0 0 0 1 0 0 0 0 0
A3 0 0 0 0 0 AJ
- AR = 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
11111
0 0 111
AR+ =ARVA2RVARVA4RVAR = 0 0 0 11
0 0 0 0 1
0 0 0 0 0
Making use of operations other than \"AND\" and \"OR\", and integer
matrices, it is possible to extract other useful information from an
adjacency matrix. Among such useful information is the number of
distinct paths of a given length from one vertex to another in a digraph,
the lengthof the shortest path between two vertices, and the length of the
x if x >y
x \302\256y
=
y otherwise,
and
A for k = 1
Then Lk(iJ) is the length of the longest nontrivial directed path from ut to
Vj
that has length <&, unless Lk(i,j) = 0, in which case no such path
exists.
length <k. We need to showthat L*_1(i\\ ;) and all of the L*\"1^) \302\256
A(t j)
are zero in this case. We will argue that if oneis nonzerothere
of these
must be a nontrivial directed path from u, to Vj
of length <k. If Lk~l(if j) is
nonzero, then by induction there is a nontrivial path length<k - 1
of
from Vi to Vj.
If Lk~l(i,t) \302\256 j)
A(\302\243, is nonzero for some t, then by induction
thereisa directed path from vt to ut and an edge from vt to Vj
that can be
combined to form a directed path of length <k from y,- to Vj. (This is
shown in Figure 4-21.)
Figure 4-21
402 Chapter 4: Relations and Digraphs
(a) If / = 1, sincewe are considering the case where k j> 1, we know thac
/ is also the length of the longestpath of length <fc - 1, and so by
induction Lk~1(iyj)
= 1. This means that Lk(ifj) is at least 1,but we are
not done, since it might be that one of the Lk~l(i,t) A(t, j) is greater. To
seethat this cannot be, suppose that Lk~l(i,t) \302\256A(t, j) is nonzero. Then,
as wasalready seen in Case 1, there must be a directedpath from vt to Vj of
length >1 and <k, which would be longer than /, a contradiction (see
Figure 4-21). Thus Lk(i, j) = 1.
(b) If / > 1, thereis a nontrivial directed path from t>f to vt of length
/ \342\200\224
1. There can be no directed path from ut to vt longer than /
- 1 and
shorter than k, since otherwise such a path couldbejoinedwith (vt9Vj) to
obtain a path longer than / from ut to vjt contradicting the definition of /.
Thus, by induction, Lk~l(ift) = / - 1. It follows immediately from the
definition of \302\256that Lk~l(iyt) \302\256
A(t,j)
= /. Once again, we have only
shown that Lk(if j) is at least I.Suppose that Lk(i, j) is greater than /. This
can only be if either Lk~l(iJ) is greater than / or some term Lk~1(i,t) \302\256
there must bea path of length Lk~l(i,t) from vt to vt and this must not be
longerthan k \342\200\224 1. Such a path could be joined with (vt ,v}) to obtain a path
of length greater than / and less than or equal to k from vt to vj9 a
contradiction of the definition of / (see Figure4-21). Thisconcludes the
Note that this theorem deals with paths which in our definition need
not be simpleand so may include repeated vertices and edges. Finding
the of the longest
length simple path between two vertices is a much
harderproblem.
Adjacency matrices provide a simple and very elegant means of
representing digraphs and for describing algorithms on digraphs. In the
next section we will look at one such algorithm, due to S. Warshall, for
however, we must point out that adjacency matrices are only one of several
convenient representations of digraphs, and are not the best
for
representation some purposes. They are especially inefficient for graphs with
many vertices and very few edges. Regrettably, however, a complete
study of graph representations
and algorithms is beyond the scope of this
book.
Exercisesfor Section4.7
1. (a) Give the
adjacency matrix of the digraph G - ({a,6,c,d},#),
where J? = {(a,6),(6,c),(<i,c),((i,a)}.
Section 4.7 Directed Graphs and Adjacency Matrices 403
8. For ofrelations
each of the 6 properties defined in Section 4.2, give
an interpretation of their definition in terms of adjacency matrices.
(c) [1
1 1 Ol
0 1 1 0
0 0 1 0
Li 1 1 lj
(d) 1 2 ol
r\302\260
0 0 1 0
0 0 0 0
Li 2 3 oj
4.7.1 WarshalFs Algorithm
and proof.
After the next most basicissuein the study of algorithms
correctness,
is efficiency. The most widely accepted approach to studying the
of
efficiency algorithms is in termsof complexity measures, or functions
that relate the resource requirementsof an algorithm, such as time or
memory, to the sizeofthe input. Because the details of how a computer
Section 4.7 Directed Graphs and Adjacency Matrices 405
algorithm is implemented,
such as the computer on which it is executed,
may affect its exact resource requirements, and becauseexactfigures are
increase the order of the running time. In this way, the choice of data
structures may affect the orderofthe running time of an algorithm.)
We emphasize that the orderofthe running time indicates the rate of
increase of running time with input size. Thus, for example, if the
running times of two algorithms are, respectively, 0(n2) and 0(n3), then
we know that for large values of n, a two-fold increasein input sizewill
increase the running time of the first algorithm by a factor of 4 and the
second by a factor of 8.
Essentially, then, it is the time complexity of an algorithm that
determines problem an algorithm can solve.Forexample,
how large a if
approximately 10.
Therefore, the order of the running timeof an algorithm gives us an
estimate of its practicalfeasibility. Nevertheless, we should not forget
that the orderofthe complexity of an algorithm is a measureof
function
All the problems listed above belong to a larger classof problems called
NP-complete problems, a class of problems introduced by Stephen
Cook of the University of Toronto in 1972. This class of NP-complete
problems is now known to contain literally hundreds of different
problems notorious for their computational intractability.
NP-complete problems,which computer science,
occur in such areas as
mathematics,operations research, economics, some sense the
and are in
hardestproblems that can be solved in polynomial time by algorithms
that are allowed to \"guess\" and then verify that their guesses arecorrect.
These problems have two important properties: First, all are equivalent
in the sense that all or none can besolved by efficient algorithms. (More
precisely, each NP-completeproblem can be transformed into any other
Section4.7 Directed Graphs and Adjacency Matrices 407
{vly.. .,vn].
Output: A new adjacency matrix M, which is the adjacencymatrix of
+
(V,E ).
408 Chapter 4: Relations and Digraphs
{v, v*_,}
This is not enough. We also need to know that M(iyj) = 1 at the end of
the algorithm only if there is a nontrivial directed path from Vi to Vj. The
next theorem proves that.
Algorithm not specify precisely in what order the pairs (ij)
4.7.1 does
are to be but in any execution of the algorithm we assume
considered,
that some order is chosen. Thus the step(*) is performed repeatedly, for
different values of ij and k in someorder.By time t we will mean that
step (*)has been performed t times. Thus time 0 is beforethe step(*) has
been performed at all, time 1is just afterit has been performed once, and
so forth. This will enable us to prove the following theorem by
induction.
M(ifj)
= 1 = 0 it must be true that (vi9Vj) is an
at time t > edge in E. For t
0, suppose entry M(i,j) is changed from 0 to 1 at time t. Then at timet -
1itmust be true for the current value of k that M(i,k)= 1and M(kJ) = 1.
By induction, there must be nontrivial directed paths from vt to vk and
from vk to Vj. Joining these at vk we obtain a nontrivial directed path from
\342\226\241
VitOVj.
First, we let
110 0 0'
0 0 10 0
Mo 0 0 0 11
0 0 0 0 1
0 0 0 0 0
Next we Mv To sSe if there are any new l's, we observe
find that M0
has l's in position 1 of column 1 and positions 1 and 2 of row 1. Thus,
Mx(l,l) = 1 = Mi(l,2), but since the (1,1) and (1,2) entriesof M0 were
already transferred to Mu we introduceno new l's. Thus, Mx = M0.
Now we compute M2 so that in this computation we let k = 2. In
column 2 of Mu thereisa 1 in position 1 and there is a 1 in position 3 of
row 2. Thus, M2(l,3) = 1. This is the only new 1 to be added to Mx.
Hence,
1110 0\"
0 0 10 0
M2 0 0 0 11
0 0 0 0 1
0 0 0 0 0
Proceed next to compute M3. We observe that positions1and 2 of column
3 have l's, while positions 4 and 5 of row 3 have l's. Thus, M3<1,4) =
412 Chapter 4: Relations and Digraphs
11111\"
0 0 111
Afft- 0 0 0 11
0 0 0 0 1
0 0 0 0 0
(a) 0 10 0 (b) 10 0 1
10 10 110 0
0 0 0 1 0 0 0 0
0 0 0 0 0 0 10
(e) 0 10 0 (f) 10 0 1
0 0 0 1 0 110
0 10 0 0 110
0 0 10 10 0 1
4.7.1
SelectedAnswers SolutionsforSection
1. We will consider the vertices a,.. .,e to be numbered 1 5. The
c 0 0 0 10
d 0 10 0 1
e LI 0 0 0 0J
During the first iteration, which looks at paths through a, edges are
added from e to b and from e to c, resultingin the matrix shown
below.
0 1 1 0 0'
0 0 10 0
0 0 0 10
0 10 0 1
LI 1 1 0 0J
During the second iteration, which looks at paths throughb, an edge
is added from d to c, resulting in the matrix shownbelow.
0 1 1 0 0'
0 0 10 0
0 0 0 10
0 110 1
LI 1 1 0 0J
414 Chapter 4: Relations and Digraphs
[o i i i ll
0 1111
0 1111
0 1111
ll 1 1 1 ll
During the fifth and final iteration, since every vertex now has an
edgeto e, and e has an edge to every vertex, all remainingpossible
edges are added, resulting in a matrix full of l's (the adjacency
matrix of the completedigraph on 5 vertices).
(au.. .,an) of elements chosen from D is said to be sorted if a, < ai+l for
every i such that 1 < i < n. Sortedsequences are encountered frequently
in computer algorithms, sometimesin the guises of lists, arrays, files, or
tables. One important property of sorted lists is that each item is greater
than or equal to all the items precedingit and lessthan or equal to all the
items following it in the list. The following lemma expresses this
formally.
Let
id) if x < a m(i)
Hi + 1) = m(i) if x = a,\342\226\240ro(i)
>
and
m(t) -- 1 ifx<am(0
1 1 4 8 < 1,3,3,4,7,12,13,15
2 5 6 8 <7,12,13,15>
3 6 6 <12>
one of x < amt x = am, and x > am must hold. What remains to be shown
thereforeis that in case(a) i < m and in case (b) i > m. By the preceding
lemma, am is the minimum of (am,.. .,an), so in case (c), if i > m, x < am <
a,-, which would be a contradiction.Thusi < m in case (a). Similarly, am is
the maximum of (al9.. .,am), so that in case (b) if i < m then a^ < am < x, a
contradiction. Thus i > m in case(b). \342\226\241
of the algorithm, it must be that the previous three steps were 2,3,4. By
induction, the theoremheldthe last time Step 2 was reached. At that
time the value of i was one lessthan it is now, since the only changeto i is
Method:
1. Searchthe current arrangement of the sequence for a pair (ahaj)
that is out of order.
2. If no such pair is found, halt.
Section4.8 Application: Sorting and Searching 419
Algorithm 4.7 the nondeterminism was in the orderin which the pairs
(ij) were considered. In the presentalgorithm the nondeterminism is in
the choice of a particular pair that is out of order, to be interchanged.
This is in contrast to Algorithm 4.8.1, which specifies uniquely what to do
at each step,and is therefore called deterministic.
When analyzing an algorithm it is ordinarily desirable to describe it in
the simplest, most abstractform, so that whatever results are obtained
can be appliedto the widest possible range of implementations. Stating
an algorithm in a nondeterministic form is a useful technique for
achieving this objective.In the caseof Algorithm 4.8.2, there are a
number of distinct deterministicsorting algorithms in use that may be
viewed as refinementsof this algorithm, including algorithms that have
becomerather well known under the names \"Bubble Sort\", \"Successive
Minima\" and \"Shell Sort\". Any results we can prove about this abstract
nondeterministic algorithm will also apply to all of these deterministic
versions of it.
Largely because of their generality, nondeterministic
algorithms tend
obvious that Algorithm 4.8.2 cannot terminate unless the list has been
arranged into the desired order, it is less obviousthat algorithm must the
eventually terminate. Assuming the algorithm doeseventually terminate,
it is still less obvious how many interchanges may be performed before
this happens. We could solve this problem by making the algorithm
deterministic,by specifying a particular order in which pairs are
considered, and then apply the technique of invariant assertions, as we did for
Algorithm 4.8.1. It will be more instructive, however, to analyze this
algorithmin its most general,nondeterministic form. In doing so we shall
see how the theory of ordering relations can be put to gooduse.
Tosimplify the discussion of these problems, suppose that the list A to
be sorted has no duplications. (It will be seen, when all is done, that this
restrictioncanbe lifted.)
ffx (i>j)
= 1 iffXi > Xj and ax (ij) = 0 otherwise.
The ideais that d(x) measures the number of pairs that are out of orderin
x.
<60,22I28I8I14I81I3I69) (6,4,5,2,3,8,1,7) 15
<22,60l28i8,14,81,3,69) (4,6,5,2,3,8,1,7) 14
(22,28,8,14,60,3,69,81 > (4,5,2,3,6,1,7,8) 9
(22,8,14,28,3,60,69,81 > (4,2,3,5,1,6,7,8) 6
(8,22,14,3,28,60,69,81 > (2,4,3,1,5,6,7,8) 4
(8,22,3,14,28,60,69,81) (2,4,1,3,5,6,7,8) 2
(8,3,14,22,28,60,69,81) (2,1,3,4,5,6,7,8) 1
(3,8,14,22,28,60,69,81) (1,2,3,4,5,6,7,8) 0
In the above chart there was one interchange in going from the
<Tx(p>q)
= 1 and oy(p,q)
= 0;
ox{p,k)= <Ty(q,k), <jx(kyp)
=
ay(k,q)y ax{q,k) - oy(p,k),and
VxikyQ)
=
<Ty(k,p) for all k ^ p,q;
\302\260x(iJ)
=
\302\260y(iJ)
for all ij * p,q.
422 Chapter 4: Relations and Digraphs
= 1+ X! MM) + <Ty(k,p))
\\<k<p
+ X! (\302\260y(q>k) + <*y(k,p))
p<k<q
-
\302\253(*) \302\253(y)-1 + X] M?>fe) + ^y(*\302\273p)
-
^y(p\302\273fe)
-
MM)).
p<a<9
>
0y(q>k) + <ry(k,p) <ry(p,k) + o>y(k,q)
for all p <k <q.
So far, we have shown that Algorithm 4.8.2 must always terminate. The
intuitive notion of relative degrees of disorder, corresponding to dis-
Section 4.8 Application: Sorting and Searching 423
\302\273 -
_ izi
\302\253(*>- \302\243 *x(ij)
* X] E i - X>
\302\273pl
- o - n(n 1)
\342\226\240
9
Thus, since each step of the algorithm reduces5(x)by at least one, it can
never take morethan n(n
- l)/2
steps on any input sequence of length
n.
Of course,we have not shown that this number of steps is required for
any input sequence, though there are several widely taught sorting
algorithms that do perform this numberof interchanges for some inputs.
One of these is the \"BubbleSort,\"which makes repeated bottom-to-top
passes over the sequence to be sorted,comparing adjacent pairs of
elements.
Though Algorithm 4.8.2 has provided an interesting example of the
\\(bx) \342\200\242
merge (A, <62>.. .,6m>) if a! ^ bx.
Here the symbol\" \342\200\242\"
stands for catenation of sequences. That is,
(au.. ,,an)
\342\200\242
(blf.. .,6n) = (au.. .,an,bu.. .,6n).
424 Chapter 4: Relations and Digraphs
Example If A =-(1,2,5,12,12,16)
4.8.3. and B - < 2,3/7,13,21) then
merge (A,B) = (1,2,2,3,5,7,12,12,13,16,21). The important propertiesof
the merge of two sequences are stated in the following lemma.
A-23orC = 23 = A-23. Supposing| A \\ > 0 and |B \\ > 0, there are two cases
left: eitherax <
bx or bx < ax. (One must hold,since< is assumed to be
total.) In the first case, C = (ax) \342\200\242
merge argue that
((a2,.. .,an), B). We
this is clearly a permutation of A \342\200\242
23, since we may assume by induction
(on n and m) that (c2,...,cn+m) =
merge((a2,.. .,an), 23) is a sorted
permutationof <a2,...,a\342\200\236) 23. To show that C is sorted, we rely on
\342\200\242
(5) (4)-(4,5)
<1,2)<6) \342\200\224
(1,2,6)
(4,5X1,2,6) \342\200\224(1,2,4,5,6)
\342\200\224
(1,2,4,5,6) (2,3,3) (1,2,2,3,3,4,5,6)
Method:
merges. It can be shown that by the endofthe ith stage there is no list of
length lessthan 21.
Theorem 4.8.3. By the end of the ith stage(i > 1), the sequences
produced by Algorithm 4.8.2 all have lengths >2\\ except for (possibly)
the last one.
that one of the two lists is of size >21'\"1.Thus n > 21'\"1 + 1, which implies
i < log2(n - 1) + 1.
Analysis of the complexity of merging would show that merging two
sequences of combined length t takes0(C) time. Thus each stage of
Algorithm 4.8.4 takes 0(n) time. Since the algorithm goesthrough at most
426 Chapter 4: Relations and Digraphs
log2(n -1) + 1 stages, the total time complexity of the algorithm is thus
0(n \342\200\242
log2n).
There is no need to show separately that this algorithm must
terminate, for we have already shown a stronger result by demonstrating a
sequences (10), (8,9), (7), (5,6), (4), (2,3), (1). Give the
collection of sequences as it would be at the endof each succeeding stage,
until the algorithm terminates.
6. Complete the proof of Theorem 4.8.1.
7. Derive and prove a formula for the total number of (recursive)
evaluations of the function merge to evaluate merge{AyB)> where A
and B are sequences of length n and m, respectively.
8. Which properties of a total ordering are actually used (explicitly or
that
counterexample, this lemma fails if any one of these propertiesis not
satisfied.
and B = < bx,.. .,6n) and rearranges the sequence A according to the
permutation described by B. (Assumethat B is a permutation of
<1,2,.. .,n). The desired output is <a6i,a6z,.. .,a6n).Useonly pair-
wise interchanges.)
11. An important variation on merging is taking the union of two
sorted sequences, each of which has no repetitions.Thisis defined
by
A if|B| = 0;
B if| A |
= 0;
{ax)
\342\200\242
union((a2,.. .,an>,<62,.. .,6m)) if ax = bx;
\342\200\242
(bx) union(A,<62>-\342\200\242-,bm>) if&i<a!.
1 1 6 12
2 1 3 5
3 4 4 5
4 5 5
3. (a) 0
Lemma. Let A =
(au.. .,an) and B = (6lv ..,6m> be sorted
sequences without repetitions, and C = union(A,B) = <clf...,cg). C Then
{c,-|l< i < =
\302\243} {a,-| 1 < i < n] U {6,.|1 < i < m}.
compilation units. Each unit includes a list specifying certain other units
which must be compiled before it. From this information an Ada
compiler must discover an order in which these units may be compiled
that is consistent these with
specifications, provided such an order exists.
This is a problem fits naturally that into the terminology of binary
relationsand digraphs.Let be the set U of compilation units. Let R be the
binary relation on compilation units defined by ux R u2 iff it is specified
that ux must be compiled before u2. The compiler'sproblemis thus:
1. Determine whether J?* is a partial orderingon U [i.e., whether the
digraph (U,R) containsany nontrivial directed cycles]. If not, report that
there is no legalorderofcompilation.
2. If R* is a partial ordering, constructa sequence (ulf...fun) such
that U = [uly.. .,uj and for each (ujfuk) in R*9j < k.
fairly simple to state and prove, though not necessarily the most
efficient.
Method:
1. Let U0
= V, S0 = ( ) (the sequence of length zero),and T0(v)
-
{u | (u,v) E
\302\243 and u / v}.
2. Repeat the following for i = 1,.. .,rc:
G*
1. Si = <$!,.. .,st > is a sequence oft distinct vertices in Vand [/,- consists
{a | (u,u) G
3. = Tf(y) u
\302\243, + v, and a {*lf..
\302\243 for all v G V;
.,sj}
4. If (s,,s*) G 2?* and 1 < ,/,/z < i then j < &.
step 2(b) of the algorithm, St - (slf.. .,$;)and [/,- = [/,-_! - {sj, wherest is
in !/;_! and therefore distinct from sl9.. .,s,_i. It follows that slv . .,st are
distinct and [/,- consists of all the vertices in Vthat are not in St.
(2) If Ti_l(si) were not empty, s, would not have been chosen in step
2(a) of the algorithm.[The algorithm would have terminated early if all
the T^iiv) were nonempty.]
(3) By induction, Ti_1(v) = {u \\ (u,v) G E,u v, and
=\302\243 u (J {sl9.. .,sj}. By
step 2(b) of the algorithm, Tt(v) = T^t(v) - fo}
= {u | (u,u) G E, u * vy
and u $ {slf.. .,sj}.
(4) By if (s,-,s*) G JS* and 1 < ./,& < i - 1 then ; < k. We
induction,
therefore only to consider the case when
have one or both; and k is equal
to i. Suppose(sjtsk) G E* and 1 < jyk <i.lik = i, there is no problem,
sincethis implies./ < k. The only remaining caseto prove is thus for j = i.
Supposepart (4) of the theorem isfalse for some k < i; that is, (si9sk) G E*
and k < i. Choosek to be the smallest k for which this happens.This
meansthat for some v in V, (shv) G E* and (v,sk) G E. [Note that it
might be that v = st and (si9sk) G E.] We have already shown that Ti\342\200\236x
(st)
= 0, and by induction we know that T^isi) = {u | (u,st) E Eyu ^ st
and a It follows
$ {$!,...,$;_!}}. that v = st for some t < i. If = i
\302\243 then i> =
st
and (s,,Sfc) G 2?.Otherwise,by induction, since (st,sk) G E* and and
\302\243 k
are both less than i, we know that < k.
\302\243 Since & was chosen to be the
smallest k for (si9sk) which G jE* k. We have
and & < i, we know that t =
shown so far that (si9sk) must be in E. By induction, TV^s*) = 0 and
7Vi(s*)
= {u\\(u,sk) E E, u f sky and a $ {slf.. .,**_i}}.This is a
since
contradiction, (s,-,s*) G J5 and s, $ {$!,.. .,sj. It follows that part (4)
of the theorem must be true. \342\226\241
Parts (1) and (4) of the theorem immediately yield the following
corollary, for the case when i = n.
Section 4.9 Application: Topological Sorting 431
/
Proof. (1 \342\200\224\342\226\272
We
2) prove the contrapositive, that is, we prove that if
G contains no nontrivial directed cycles, then in each nonempty
subgraph of G without loops there is a vertex with zero in-degree.
Let H be any nonemptysubgraph of G without loops. Since G contains
no directed cycles neither does H. Let P denote a directed path
(ui,l>2)>- \342\200\242
->(up_i,i>p) in H of maximal
length. We assert that the in-degree
of v i is zero. (Actually, the out-degree of vp is also zero, but we leave that
result as an exercise.)
If the in-degree v v is of not zero, then there existsa vertex w in H such
that the edge (wyVi) is in H. Two cases present themselves:
Case 2. Supposew =
v{ for some i. Then in H, thereis a directed
circuit C: (vltv2)f.. .,0>i\302\273Vi)- This again is a contradiction, since H has no
loops and no nontrivial directed cycles.
The contradiction in the above two leads to the conclusion that
cases
there is no edge(w,vx) in if. In other words, the in-degreeof vx is zero.
432 Chapter 4: Relations and Digraphs
(2 \342\200\224\342\226\272
3) Suppose G satisfies (2). Let (l>i,l>2), \342\200\242
\342\200\242
Avk,vx) such a cycle.
be
Since it is nontrivial, we can assume vx =\302\243
vk. Then (vuvk) and (u*,tfi) are
both in E+f by Corollary 4.6.1, which means that E+ (and henceE*) is not
antisymmetric.
(3 2) not antisymmetric. Then thereexistv =\302\243
\342\200\224\342\226\272
Suppose E* is w such
(1). \342\226\241
algorithm that can choose the fcth largest element out of an input
sequence by means of pairwise comparisons must use at least n \342\200\224
1
comparisons.
1. e,d9c9b9ayg,f
A
Chapter 4: Relations and Digraphs
(a) R - S
(b) R \342\200\242
S
(c) Rl
(d) R H S
(e) The transitive closure of R.
antisymmetric.
(b) The lexicographic ordering on the set of strings on an alphabet
A is a well ordering.
ri i o o o]
1 1 0. 0 0
0 0 110
0 0 111
|o o o o lj
13. Find an integer x where 0 <x < 12and 5243 = x mod 13.
14. Let A =
{2,5,8,10,20,25,50,60,100} and define the relation R on A by
(afb) G R iff a divides b. Then R is a partial orderon A. Find the
minimal and maximal elementsof A under the relation R.
15. Given the words:MY, ME, MINE, MAMA, MOO, MOST, MARE,
MAID, MADE, MEAL, MAIL, MART, MARRY, REST, RAIL,
RED, REASON,
(a) Arrange them into ascending order accordingto the definition
of lexicographic ordering.
(b) Arrange them into ascendingorderaccordingto the definition
of enumeration ordering.
16. Give the degreeof disorderofthe following permutations:
(a) (2,3,4,5,1,6)
(b) (3,2,1,6,5,4)
436 Chapter 4: Relations and Digraphs
18. Use the binary search algorithm to search for 15 in the sequence
(1,2,2,4,5,7,8,10,10,12,14,15,16,16,18,20,21).
19. Prove by mathematical induction:
(a) a symmetric relationdefined
If R is on a set A, then Rn is
symmetric for each positive integer n.
(b) If R is a reflexive and transitive relation defined on a set A,
then R = Rn for each positive integer n.
Graphs
5.1 BASIC
CONCEPTS
437
Chapter 5: Graphs
G G' b G\" b
mb G'\"^#t
\342\200\242d *d *d ^*f
(a) (b) (c) (d)
5-l(a).
The terminology of Chapter 4 for directed graphs is retained and
extendedin the presentchapter:
Figure 5-2.
=
\302\243,deg(vi) 2\\E\\.
If G is a directed graph,then
=
\302\243deg+(^) Edeg-(<;;)=|\302\243|.
Proof. The proof is easy, since when the degrees are summed, each
edge contributes a count of one to the degree of eachofthe two vertices
on which the edge is incident. D
Section 5.1 Basic Concepts 441
Proof. Let W be the set of vertices of odd degreeand let U be the set
of verticesof even degree.Then
\302\243 deg(v)
=
\302\243deg(v) + ]T deg(v) = 2\\E\\.
vEV(G) v\342\202\254.W vGU
Certainly, deg(v)
2\342\200\236ei/
is even; hence 2uew deg(v) is even, implying
that | W | is even and thereby proving the corollary. \342\226\241
Example 5.1.4.
Figure 5-3.
ir-O
a*
Figure 5-4.
of length 3. The
path {a,6},{6,c},{c,d},{<i,a}is a cycle of length 4. Moreover,
is
{a,6},{6,c},{c,c},{c,a} a circuit of length4; it is not a cycle because the
sequence of vertices a-b-c-c-a includes more than one repeated vertex.
Similarly the of
sequence edges{a,6},{6,c},{c,a},{a,d},{d^c},{c,a} forms a
closed path of length 6, but this path is not a circuitbecause the edge {c,a}
is repeated twice.
a-d-c-e-f-j-d-a 7 no yes no no
b-c-e-f-g-j-f-b 7 no yes yes no .
a-b-a 2 no yes no no
(c) (1,3,3,3)
(d) (2,3,3,4,5,6,7)
(e) (1,3,3,4,5,6,6)
(f) (2,2,4)
(g) (1,2,2,3,4,5)
(h) Any sequence (dud2.. .,dn) where all the c^s are distinct and
n > 1.
(i) (1,1,3,3,3,3,4,5,8,9)
4. Supposethat G is a nondirected graph with 12 edges. Suppose that
G has 6 verticesof degree3 and the rest have degrees less than 3.
Determinethe minimum number of vertices G can have.
5. Let be a nondirected
G gfaph of order 9 such that eachvertex has
10. How many vertices will the following graphs have if they contain:
(a) 16 edgesand all vertices of degree 2;
(b) 21 edges,3 verticesofdegree 4,and the other vertices of degree
3;
(c) 24 edges and all vertices of the same degree.
11.For each of the following questions, describe how the problem may
be viewed in terms of a graph model, and then answer the
question:
Must
(a) the number of people at a party who do not know an odd
number of other people be even?
(b) Must the numberof people ever born who had (or have) an
G.
16. Which of the following are true for every graph G? For those
statements that are not true for every graph give a counter
example.
(a) Therearean odd number of vertices of even degree.
(b) Therearean even number of vertices of odd degree.
(c) There are an odd number of vertices of odd degree.
(d) There are an even number of verticesof even degree.
17. Applications of Graph to Organic Chemistry: Molecules
Theory
are made up of atoms
a number that are chainedtogetherby
of
chemical bonds. (We can model this by a graph. Theatomswill be
vertices and the bonds will be the edges of the graph.) A
molecule
hydrocarbon contains only carbon and hydrogen atoms. Moreover,
eachhydrogen atom is bonded to a single carbon atom and each
carbonatommay be bonded to 2,3, or 4 atoms,which can be either
Section 5.1 BasicConcepts 447
H
\342\200\242
H\302\273- -\342\200\242H
\342\200\242
H H
We know that in any such graph the degree of any carbon atom
must be 4 and the degreeofany hydrogen atom must be 1.
A. Find the number of bonds in
(a) the cyclobutane molecule C4H8
(b) a cyclohexane molecule C6H12
(c) a hydrocarbonmoleculeCnH2n
(d) a decane molecule .C10H22.
(e) a hydrocarbonmoleculeCnH2n+2.
B. Can there exist (at least theoretically)a hydrocarbon molecule
(b) C5H10
(c) C5HU
(d) C20H39
18. Prove that the number of simplepaths of length 2 in a graph G is
d\\ + d\\ + ... + dl, where (dud2i.. is the degree
.,d\342\200\236) sequence for
G. Hint: for each vertex v in G, count the number of paths of length
2 with v as midpoint.
19. How many different simplegraphs are therewith the given vertex
set{vlyv2y.. .,uj?
\"20. (Havel-Hakimi) Prove that there existsa simplegraph with degree
sequence (dud2,.. .,d\342\200\236)
where dx < d2 < dn ... < if and only if there
exists one with degree sequence (d\\ydl2i.. .,di_i)> where
5. Usethe PigeonHolePrinciple.
8. Hint: Represent this situation by a graph where the vertices
correspond to people and each edge represents a handshake. Now
consider the degreesof this graph. The degree of any vertex is at
most 6.The 7 different responses must have been 0,1,2,3,4,5, and
6.
10. (a) 16
(b) 13
(c) Solve k | V\\
= 48 for all divisors k of 48.
12. 2\\E\\
> 31 V\\or 2/3 \\E\\
* (2/3) 35 > | V\\implies| V\\
< 23.
(i) / is one-to-one,
(ii) / isonto, and
G', then intuitively the only differencebetween the graphs is the names
of the vertices. Indeed, if we were to change the names of the verticesof
G' from f(v) to v for each v G V(G), then G' with the newly named
vertices would be identicalto the graph G, for then they both would have
the same lists of vertices and edges.
Of course, if G and G' are isomorphicgraphs the isomorphism / is by no
means unique, there may be several isomorphisms from G to G\\ But if
such an isomorphism / exists, then there are several conclusions we can
make, namely,
1. |V(G)|-|V(G')|
2. \\E(G)\\-\\E(G')\\
Discovering Isomorphisms
of
Theproblem determining whether or not two graphs are isomorphic
is known as the isomorphism problem, and for arbitrary graphs,the only
450 Chapter 5: Graphs
be the case that graphs G and G' are isomorphic under some other
function.
The next question is this: can we do to help locate a potential
Wh&t
Example 5.2.1. The graphs G and G' of Figure 5-5 are isomorphic.
Firstwe observe that if G and G' are isomorphic, then the vertices 6, d,
and e must be mappedtotheverticesb\\d\\ and e' respectively since these
Section5.2 Isomorphisms and Subgraphs 451
Figure 5-5.
0 1110
10 10 0
110 10
10 111
0.0010
It is routine to check that the map /' which maps a to a', b to b', c to c', d to
d\\ and e to e' is also an isomorphism.
property that isomorphic graphs must share, but which the two graphs G
and G' do not share. Thus, for example, if G and G' have different
numbers of vertices, then the graphs are not isomorphic. Likewise, if they
have different degreesequences,they are not isomorphic.
452 Chapter 5: Graphs
have to conclude that the graphs are not isomorphic. For example, if we
classify into a singleclassthe verticesof degree two in each graph, these
classes form a graph in their own right and we could ask if these
subgraphs are isomorphic. To clarify what we mean we need to discuss
the concept of subgraph.
The graph G\"\" shown in (e) is not a subgraph of G because the edge
{l>! ,v5 } was not in E(G).
v4#
(b)
e7 vi
\342\200\242
v,#\342\200\224\342\200\224 \342\200\242
v.
*5 \\ *4
v4#- \342\226\240\342\200\242
v\302\253 v4#
Example 5.2.3. We show that the two graphs in Figure 5-7 are not
isomorphic.
These two graphs have 10 verticesand 15edges, and all vertices are of
degree 3. The first graph has a subgraph of 3 adjacent vertices(the
triangle a-b-j-a, for example), but the second containsno cycles of
length 3.
then match g to d\\ b to e', and c to b'. Now there remain only two
unmatched vertices in each graph:d and e, and c' and /'. Vertex g is
adjacentto e not but d, whereas d' (matched with g) is adjacent to c' but
not to /'. Hence we must match e to c' and d to /'. We conclude that if
there is an isomorphismbetweenthesegraphs then the matching we have
obtained,
a -\302\273a'
b \342\200\224*
e'
c \342\200\224
6'
d -/'
e \342\200\224\342\226\272
c'
-
f \342\200\224\342\200\242*'
\342\200\224
d'
g
v5#C
1 ^#v2 v5# \\ v2
\302\273
and whose edge set is E(G) D E(G').Similarly, the union of G and G' is
the graph with vertex set V(G) U V(G') and edgesetE(G) U E(G').
Special Graphs
Example 5.2.7. Graphs of classes K5, C5, W5, P5, and N5 are shown
in Figure 5-13(a) through (e), respectively.Note that Nb is the
complement of Kb.
'
\342\200\242 \342\200\242
\342\200\242 \342\200\242 \302\273 \342\200\242 \342\200\242
(where we normally order m and n such that m < n). Any graph that is
Khn is called a star graph.
Example5.2.8. Graphs that are K3t3, K2t4 and Khb are shown in (a),
(b), and (c) of Figure5-14,respectively.
The next figure, Figure 5-15, shows five other especially interesting
graphs, the graphs of the edges of the five platonic solids: tetrahedron,
octahedron,cube, icosahedron, and dodecahedron.
\\ \302\273 *\302\273
<1 ,1
\\
Tetrahedron
Octahedron Cube
/I/VA|\\
Icosahedron Dodecahedron
Figure 5-15.
Section5.2 isomorphisms and Subgraphs 459
b'
c
\342\200\242
(a)
a'%
(b)
c'e
(c)
(d)
Figure 5-16.
460 Chapter 5: Graphs
(e) g\302\273
(f)
a b'
-
\342\200\242
(g)
(h)
(i) c
\342\200\242
\342\200\242d'
am
(j)
c
\342\200\242 >\342\200\242/>'
(k)
(1)
(m)
(n)
J>fc<L
(o)
c
\342\200\242
( \\
\342\226\240
(P) c
\342\200\242 \342\200\242r
gf
*y\"*y Vs >y
r
(q) \302\243\342\200\242 *^ \342\200\242
e'
(r)
a',..., j' in such a way that the map f{x)=x' for each letter x in
{a,6,c,d,e,/,g,/i,ij} is an isomorphism. Also label the vertices of the
third graph as a\",6\",..., j\" in such a way that the map g(x) = x\" is
an isomorphism. The graph is known as the Petersen graph.
(a) (b)
Figure 5-17
464 Chapter5: Graphs
\342\200\242 \342\200\242 \342\200\242 \342\200\242 \342\200\242 *
G2
>
\342\200\242 \342\200\224
\342\200\242 \342\200\242 \342\200\242 \342\200\242 \342\200\242
Figure 5-18
(2,2,2,2,2,2,2,2). Verify that they are not isomorphic. Isit true that
every graph G with 8 vertices and 8 edges and degree sequence
(2,2,2,2,2,2,2,2)to has be isomorphic to one of Gx and G2? Explain.
7. Give an example of 2 nonisomorphic graphs of order 6 and size6
with degree sequence (2,2,2,2,2,2).
8. Let G be a simplegraph all of whose vertices have degree 3 and
-
|\302\243| 21 V\\ -3. What said about G?
can be
9. Prove that a graph G is isomorphic to a graph H if there is an
is a multiple of 3.
(b) Showthat thereis only one equivalence class for namely
\302\2474,
\342\200\242c \342\200\242
23. If {vltv2,...,vn) = V(G) and {elye2y.. .,em} = E(G), then define the
[0 B]
[B1 o]
where Bl means the transpose of the matrix B and 0 is a matrix
whoseonly entries are zero.
25. Determine the graph G with adjacency matrix A such that
4 1 1 4 1 1 4 9 9 4 9 9]
1 3 2 1 2 2 9 4 5 9 4 4
=
1 2 3 1 2 2 A*
9 5 4 9 4 4
A2
4 1 1 4 1 1 and
4 9 9 4 9 9
1 2 1 3 2 2 9 4 4 9 4 5
1 2 2 1 2 3 9 4 4 9 5 4J
26. Prove that if > 3, where
d(G) ([(G) is the diameterof the simple
graph G, then d (G) < 3, whereG is the complement of G. Then if G
is isomorphic to Gfd(G) = 2 or 3.
27. A tripartite graph is a graph where the set of vertices may be
partitioned into three subsets so that no edge has incident vertices
in the same subset.
(a) Give an example of a tripartite graph.
In general,a graph G is k-partite if it is possible to partition
the set of
vertex G into k disjoint subsets VlyV2i.. ,Vk such
that each edge has one endpointin one subset V,- and the other
adjacent or nonadjacent.
8. Note that 1^1 = 6:Concludethat G is isomorphic to X33 or the
graph
13. (a)
P(7,2)
P(7,3)
<?i G2 a
\342\200\242
-
b% \342\200\242 %d b*^ #c
\342\200\224 ^%d
\342\200\242\342\226\272\342\200\242
t t
e
\342\200\242 \342\200\224
if g
\342\200\242
t I t
f \342\200\242 \342\200\242/ hm \342\200\242
i
j
root, and we shall designate it as the root. The level ofa vertex v in a
rooted tree is the lengthof the path to v from the root. A tree T with only
one vertex is calleda trivial tree; otherwise T is a nontrivial tree.
Note that the first part of this definition applies to nondirectedgraphs
as well as to digraphs. A tree may be either a digraph or a nondirected
graph.Note that in a tree any vertex may be designated asa root.
Example5.3.1. Two trees, Gx and G2, are shown in Figure 5-19.
Gx
- (V,EX) and G2 ='(V,E2), where
V= {afb,cfd,efffgfhfij}f
Ex J}}, and
= {{a,c},{6,c},{c,d},{c,\342\202\254},{e,^},{/,^},{^,i},{h,i},{i
E2 = {(c,a),(c,6),(c,d),(c,/),(/,e),(/,0,(^,d),(/i,e),0\302\273}.
product; the root can represent the finished product, and tasks that can
be done concurrentlyappearon the same level, whereas if task A must'be
completed before task B can start, then A would have to lie on a higher
levelthan B.
Figure 5-21
If b werethe expression
(c x d) we may write
a + (c x d)
Figure 5-22
Section 5.3 Trees and Spanning Trees 471
Figure 5-23
If we now read the verticesof this tree once each starting from the top
and proceedingcounterclockwise, we write
/
a
\\\302\251 \302\251.^ ~
\\ \" A.
/ \302\251 \302\251/'\\ \302\251 \302\251>
/
>\302\251
/
\302\251\342\200\236
X + a5/+ X3bc + d2
Figure 5-24
a<* ^b
\342\200\242
c
i k
em \342\200\242 %g # \342\200\242
are i and g and j and k, but i and k are not connected.Moreover, c is a cut
vertex of the first component.
of degree 1.
(We are excludingthe trivial tree with only one vertex.)
Proof. Start at any vertex vx. If deg (vx) =\302\243 1, move along any edge to
a vertex v2 incident with vx. If deg(i>2) ^ 1, continuetoa vertex u3 along a
different edge. We can continuethis processto producea path vx
- v2 -
u3
\342\200\224
u4..., (Here we mean that there is an edgefrom vx to v2, one from v2
to i>3 and so on.) None of the v's is repeatedin this path since then we
would have a circuit\342\200\224which a tree may not have. Since the number of
vertices in the graph is finite, this path must endsomewhere. Where it
ends must be a vertex of degree 1 since we can enter this vertex but
cannot leave it. D
Assume, then, for n > 1 that all trees with n vertices have exactly n - 1
474 Chapter 5: Graphs
\342\200\242^./* . v./-
/ V
\\
Figure 5-26
unique simple path from a to b in T. Moreover, this path has not been
affected by the removal of the vertex v and the edge e. Likewise, there are
no cycles in T\" since there were none in T. Thus, T\" is a tree and the
inductive hypothesis impliesthat T\" has n \342\200\224 1 edges. But then T must
have n edges as T has one more edgethan T\". \342\226\241
degdu)
\302\243
- 2|E| - 2(n - 1) - (2n
-
2).
n n
and X! deg(i>t)
= 1 + X! <*eg(i\\) > 1 + 2n - 2 \302\253
2n - 1.
i' = l i-2
But then
2n 2 >
\342\200\224 2n - 1 or -2 > -1, a contradiction.\342\226\241
Section 5.3 Trees and Spanning Trees 475
# # # #v P \342\200\242
\\
I
i v i
this point.
-^
\342\200\242\342\200\224\342\200\242\342\200\224\342\200\242
Figure 5-28
476 Chapter 5: Graphs
(b) 3
(c) 4
(d) 5
2. (a) Prove that if G is a tree, then the sum of degrees equals 21 V \\ \342\200\224
2.
14. (a) Show that a vertex v in a tree T is a cut vertexof T iff deg(y) >
1.
C(G)+\\E(G)\\.
25. Draw all pairwise nonisomorphicforests with
(a) 2 or components and 5 verticesin all.
more connected
(b) 3 or 4 connected componentsand | V \\ = 6.
26. (a) Suppose that G is a forest with k components and | V | = 17 and
| E | = 8.Determine k. Hint: See Exercise 9.
(b) If G is a forest with 7 connected components and | V \\ = 33, find
\\E\\.
27. Show that a graph with no vertices of odd degree and no verticesof
degree0 must contain a circuit.
k.
15. (a) Recall that for a tree |E \\
=
| V\\
\342\200\224
1 and by the sum of degrees
formula
Nv
- 2 = N3 + 2N4 + 3iV5 + ... + (* - 2)Nk.
17.
0
A A A
P 0 \302\251 0 \302\251 \302\251
-XX +abc+de-fXgh
^>f fu\\
22. Label the componentsGX,G2,.. .,0^. Fix roots vt in each G,. Join
one edge between vx and v2, one between y2 and v3, etc. There are
k \342\200\224
1 such adjunctions. Also we could apply Exercise9.
Chapter 5: Graphs
SPANNING TREES
First observe that cycles are not necessary, sincecycles give two ways
in which stations can communicate and all that is needed is one way to
communicate. the cycle d-c-e-d gives two ways for d and e
For example,
to communicate.Namely, along the path d-c-e or directly from d to e. If
the edge {d,e}is deleted,d and e can still communicate via c. Likewise,
oneedgeof each cycle in G can be deleted. The edgesleft are the fewest
necessary to maintain communicationbetweenall stations.One way of
accomplishing this is shown in Figure 5-31(b).The resultis a spanning
tree for the graph of Figure 5-31(a). Of course, by deleting another
Figure 5-29
Section5.4 Spanning Trees 481
*%d
circuit rank of G.
The idea illustrated in the above example is the essenceof the
following theorem.
f
a% J*J
bm- \302\251\302\243
(a) (b)
Figure 5-31
482 Chapter5: Graphs
We the ordering
select of the vertices abcdefghijk.Thenwe select a as
the first vertex chosenin the spanning tree T and designate it as the root
of T. Thus, at this stage, T consistsof the single vertex a. Add to T all
edges {a>x}, as x runs in order from b to k, that do not producea cycle in T.
Thus, we add {a,b}and {a,d}. Theseedges are now called tree edges for the
breadth-first searchtree.
Now repeat the process for all vertices on level one from the root by
examining each vertex in the designatedorder.Thus, since b and d are at
level one, we first examine b.
For by we include the edge {b,c}as a tree edge.Then for d, we reject the
edge {d,c}sinceits inclusion would produce a cycle in T. But we include
{d,e}.
Next, we consider the vertices at level two. Reject the edge {c,e};
include {e,/} and {e,g}.
Then repeat the procedure again for vertices on level three. Reject
{f,g], but include{f9h). At gy reject {fyg] and {g,h}.
On levelfour, include {hfi}> {h,j\\, and {h,k}.
Next, we attempt to apply the procedure on level five at i, j> and k, but
no edge can be added at thesevertices so the procedure ends. The
spanning tree T therefore includes the vertices afb,cfdfefffg>hyij, and k,
and the edges{a,6}, {a,d}, {6,c}, {d,e}, {e,/}, {e,g}, {f,h}> \\h,i}, {hj}y and
ML
The edges that wererejectedin the breadth-first search are called cross
edges. Clearly, breadth-first search partitions the edges of the graph G
into the two sets of tree edgesand crossedges.
Now let us give a formal description of breadth-first search.
V where the edges {xyv} were added in Step 2. Go back and repeat
Step2 for the new set V.
Next, we select the edge {a,x} where x is the first label in the designated
order that doesnot form a cycle with those edges already chosenin T.In
this case, we add the edge {a,6}.The edge{afb} is now said to be examined
and becomesa treeedge.In this context, a is the parent of b and b is the
child of a.
In general,while we are at some vertex x, two situations arise:
Method:
constructing a link between cities vt and vjt we can assign the weight ci;to
the edge{vifVj}. The problem, then, is to design such a network so as to
minimize the total cost of construction.IfMisthe graph of a network of
minimal cost, it is essentialthat M be connected for all of the citiesareto
be connected by it is also necessary that there be no
links. Moreover,
circuits in graph M,
the for otherwise we can remove an edge from a
circuit and thereby reduce the total cost by the cost of construction of
that edge. Hence, a graph of minimal costmust bea spanning tree of the
graph of the n vertices.
Thus,the problemof building a network at minimal cost can now be
stated in general terms. Let G be the graph of all possible links between
the cities with the nonnegative cost of construction C(e) assignedto each
edgee in G. Then if H is any subgraph of G with edges eb.. .,em the total
costof constructingthe network H is C(H) = %Zi C(et). A spanning tree
T where C(T) is minimal is calleda minimalspanning tree of G.
It should be clearat this point that finding a solution to the connector
is
problem equivalent finding to a minimal spanning tree for a connected
graph G where each edge of G is labelled with a nonnegative cost.
Now let us describean algorithmthat will, in fact, construct a minimal
spanning tree. The algorithm is known as KruskaVs Algorithm (after the
mathematicianJ. B, Kruskal, Jr.).
1. Selectany of minimal
edge value that is not a loop.Thisisthe first
edge (If there is more than one edgeof minimal
of T. value,
make the optimal choicefrom the available data at each stage of the
Proof. As before, for each edge e of G, let C(e) denote the value
assigned to the edge by the labelling.
If G has n vertices, an economytree T must have n - 1 edges. Let the
edgeselfe2f...,e\342\200\236_i be chosen as in KruskaPs Algorithm. Then C(T) =
C(et).
2\302\243ll Let T0 be a minimal spanning treeof G.We show that C(T0) =
C(T), and thus conclude that T is also minimal spanning tree.
If T and T0 are not the same let et be the first edge of T not in T0. Add
the edgee(to T0 to obtain the graph G0. Suppose e, = {a,b}. Then a path P
from a to b existsin T0 and so P together with et produces a circuit C in G0
by Theorem 5.3.4.SinceT contains no circuits, there must be an edge e0
in C that is not in T. The graph Tx = G0 - e0 is alsoa spanningtree of G
since Tx has n \342\200\224
1 edges. Moreover,
However, we know that C(T0) < C(TX) since T0 was a minimal spanning
tree of G.Thus,
C(TX)
- C(T0) - C(c,-)- C(e0) * 0
implies that
C(e,-)* C(e0).
Figure 5-32
with one more edge in common with T than was in common between 7\\
andT.
Edge Cost
| \\b.c] 3
{d,f} 4
{a,g} 5 j
led] 5
fee} 5 |
{aM 15 J
{a,d} 15
\\f,h\\ 15
\\g,h} 15
M 15
if.g} 18
1. Choose the edges {6,c}, {d,f}, {a,g}, {c,d},{c,e}.
2. Then we have options: we may choose only oneof {a>b\\ and {a,d}for
the selection of both createsa circuit. Suppose that we choose
{a,b}-
3. Likewise we may choose only one of {g,h} and {/,/*}- Suppose we
choose{/,M.
Section 5.4 Spanning Trees 489
d
g^ -
\342\200\242
*\342\200\242
\342\200\242/
Figure 5-33
ExercisesforSection
5.4
1. Consider the graph G in Figure 5-34. Which of the graphs a-f in
Figure 5-35 are spanning treesof G and why?
Figure 5-34
d e%- -\342\200\242d
Figure 5-35
5: Graphs
*\342\200\242-
(e)
(o
e
\342\200\242
(a) (b)
Figure 5-36
Figure 5-37
a \342\200\242 8 a \342\200\242
(b)
Figure 5-38
13. Find a minimal spanning tree for each of the graphs in Figure
5-39.
a 20 42 31 28 29 33
b 0 26 35 29 24 31
c 0 41 33 22 38
d 0 34 36 40
0 41 32
0 26
0
Spanning Trees 493
(a) Explain why this process gives a spanning tree for any
{
connected graph G.
(b) Modify the proof of Theorem 5.4.2to show that this process
produces a minimal spanning tree.
(c) Find a minimal spanning tree for the graph in Figure5-40using
the process described in (a).
Figure 5-40
v,
\342\200\242
(d) Obtain the Prufer code for each of the following trees:
v4\302\273 \342\200\242V2
v5#- -\342\200\242
v3
v*i
v6< v8
v7 %' ^# \342\200\242
v8 i; v,
V7( \342\200\242
v9
vI2
\342\200\242
(a) (b)
(e) Observe that the edges of T arejust the edges {v8i, vt.} where
sl9s29.\342\200\242
-Ai-2 are the indices of the verticesremovedand t{ is the
index of the neighbor of v8i.
(f) Observe that st = min {k | 1 < k < n and k does not occur in
(tut2,...,^-2)}, =
\302\2532 min {k\\k$ {sl9t29.. .^\302\273-iIK and in general
S; can be defined recursively by s,
= min {k\\k 0.
{slys2,...,Si_l9ti9ti+l9.. .,tn_i}}. Thus a Prufer code (^,t2,.. .9tn_x)
v3 v4 v5 v6
rw
c\302\273\342\226\240 -* p
(g) Given the following sequences, use the process described in (f)
to determine the indicesofthe removed vertices. Then obtain
the tree for which the given sequence is its Prufer code,
(i) (1,4,4,5,6)
(ii) (1,4,4,6,6)
(iii) (1,4,4,5,6,5,7,7,10)
(h) The number of sequences (tut2t.. where
.,\302\243\342\200\236_i) 1 < ^ < n and
tn_i
= n is
obviously nn~2. Each of these is the Prufer code of a
spanning tree of Kn. Moreover,there is a one-to-one
correspondence between such sequences and spanning trees of Kn.
Thus, we obtain another proof of Cayley'sformula that there
are nn~2 spanning trees of Kn.
|V(G,)|then
Yl (mi
~ n>i + 1) circuit rank of G
= m_ n + C(G)
-|tf(G)|-|V(G)|+C(G).
(e)
Chapter 5: Graphs
17. (c) {dye}, {d,f}, {b,e}t{a,c}y and one of {a,/}, {e,/}, and {a,e}.
Delete
20. Useinduction on the number of edges. The result is obvious for a
DIRECTED TREES
The question now arises: Under what conditions does a digraph have a
(b)
Figure 5-41
Section 5.5 Directed Trees 499
In the graph of Figure 5-41 (a) the vertex e is specialin the sense that
there is a directed path from e to every other vertex. By no meansis this
accidentalas shown by the following theorem.
1. G is quasi-strongly connected.
2. There is a vertex r in G such that there is a directed path from r to
1. G is a directed tree.
2. There is a vertex r in G such that there is a unique directedpath
from r to every other vertex of G.
3. G is quasi-strongly connected and G - e is not quasi-strongly
connected for each edge e of G.
4. G is quasi-strongly connected and contains a vertex r suchthat the
Proof. (1 \342\200\224*
2) The root r in G satisfies the property.
3)
(2\342\200\224* By Theorem 5.5.1, G is quasi-stronglyconnected.Suppose
quasi-strong connectivity i, not destroyed when some edge (ufv) is
500 Chapter 5: Graphs
removed. Then thereisa vertex w such that there are two directed paths,
oneto u and one to v, neither of which uses the edge(u,v). Thus, in G
there are two distinct directedpaths from w to v and hence two distinct
directed paths from the root r of G to v. This contradicts (2).
We leave the proof of (3 \342\200\224\342\226\272
4) to the reader.
(4 \342\200\224*
5) The sum of the in-degrees is equal to n - 1. Therefore, by
Theorem 5.1.1, G has n - 1 edges. Clearly, the underlying nondirected
*
graph G is connected. Therefore, Theorem 5.3.5 implies that G is a tree *
The level ofa vertexv in a forest is the length of the path to v from the
root of the tree to which it belongs. A directed tree T is said to have
Tx = ({a,6,cUi), where Ex
=
{(a,6),(a,c)}
T2 = ({d},0), and
^3 - ({eyfygyhyiyjyk}yE3)y where
-
\302\2433 {(eyf)y(eyg)y(gyh)y(h9i)y(hyj)y(hyk)l
only vertex at level 2. 7\\ has degree 2, T2 has degree 0, and T3 has degree
3.
Level 0 *A \342\200\242d e
\342\200\242
X
K
T X
Level 1 b\302\273 \\7^7 \342\200\242\302\243
> Height = 3
1
\302\273
Level:
/ \\ \\
> ^
1
/
. *
\\
Level 3 - IA
\\*|
L(0,k) = l,forall/2.
For fi > 0, each vertex at level fi is the child of a vertex of level fi - 1. There
are up to L(fi -
l,k) vertices at level fi - 1, and each of them has up to k
children. It follows that
L(fi,fe) - L(fi
-
1,*) \342\200\242
*.
The solution to this recurrence relationis L(fi,fc) = fce, which can be easily
verified by induction: k\302\260 k = k*. This
= 1; fc8-1 \342\200\242
reasoning proves a
theorem, which we shall now state.
h h Lh + 1 _ -I
R \342\200\224
\302\261
8-0 8=0
kh+1 - 1
Theorem 5.5.5. There are between h + k and \342\200\224\342\200\224\342\200\224
~~
vertices
\"compact.\" That is, they are no taller than they need to be. Because of
this, it is possibleto get a tighter lower bound on the number of vertices,
in termsofthe height and the degree of a tree.
Section5.5 Directed Trees 503
k - 2 - 1
andJ
kh + kh+1
A-i nrrr
vertices in a complete directed tree of degree k and heighth.
feh+1 - 1
k-1
l + ^Ltf^-i + Efe'-i +
^r-^^r2- D
8-0 g-0
\342\200\224
\302\253 1 \342\200\224
\302\253 1
A
\342\200\242
A A /l\\ A
\342\200\242 \342\200\242
\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242
//\\\\ A /l\\
\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\
(a) (b)
l.(a) Draw a directed tree of height 4 with exactly one vertex at level
one, exactly two vertices at level 2, exactly three verticesat level
3, and exactly four vertices at level 4.
(b) How many directed trees are there that fit the description
above, up to isomorphism (that is, count isomorphictreesas
being the same).
2. Prove that every vertex in a directed tree different from the root
has a unique parent.
3. Deriveformulaefor the minimum and maximum possible heights
of a directed tree of degree k with n vertices.
and T2:
The tree Tx is full in the sensethat each level has the maximum
number of vertices.The treeT2 is thin in the sense that eachlevel
has the minimum number of internal vertices (either 0 or 1).
Note that any full regular tree of degree k is a completetree of
degree k, but the converse need not be true.
(a) Draw a thin regular tree of degree 3 and height4. Note that
there must be 9 leaves.
(b) Draw a regular tree of degree 4, height 4, and having 13
leaves.
(c) Draw a full regular tree of degree 2 and height 3.
(d) Show that for a regular tree T of degreek, if i is the number of
internal verticesand \302\243
is the number of leaves, then (k - l)i =
-1.
\302\243 In particular, i regular of degree2.
= - 1 if T is
\302\243
problem as a tree.
(f) How many matches must be played to determine a tennis
champion if a single elemination tournament is played with 64
players?
(g) Suppose that a certain computerhas an instruction which
computes the sum of 3 numbers. How many times will the
instruction have to be executedto find the sum of 27
numbers?
n0 = 1,
=
nx 2,
ki = i + -
\302\243 1 or (k - l)i -8-1.
all. That each vertex has a unique parent (if any) follows from the
definition of tree, whereit is requiredthat there be a unique path from
the rootto eachvertex. (If any vertex v were to have two parents there
would be a path to each of them from the root, and extending these paths
to v would yield two paths to v.) That eachvertexhas a unique left child
and a uniqueright child (if any) follows from the labeling of the edgesof
the treewith 0's and l's. (At most one edge from the parent can have a 0
label and at most one edgecan have a 1.) It is also implicit in the
definition that every vertex other than the root has a parent.Thisis so
because every vertex v in a tree must have a path to it from the root. The
last vertex before v on such a path must bethe parentof v.
The left-right orientation on the verticesof a binary tree requires that
we view as distinct binary trees those that would otherwise be the sameas
directedtrees of degree at most 2. (See Figure 5-45for an illustration.)
Example 5.6.1 Details such as edge labelsand the direction of
edges are usually represented only implicitly in drawings of binary trees.
The conventionis that for each vertex v the root of i/s left subtreelies
below v and to its left on the page,whereas the root of i/s right subtree
lies belowv and to its right on the page.Figure5-46shows an example of a
binary tree drawn with and without edge labels and directed edges.
There are a few special kinds of binary trees that are important in
computerapplications; one of these is the complete binary tree.
\342\200\242XX O XX X
Figure 5-46. Conventions for drawing binary trees.
Section 5.6 Binary Trees 509
Note that the index of a child is obtainedby doubling the index of its
parent and adding the labelon the edge that goes from the parent to the
child.Another way of looking at this vertex numbering schemeis based
on the fact that each vertex corresponds to a unique string w in {0,1}*,
determined by the sequence of labelson the path to it from the root. The
index of the vertexcorresponding to w is the integer represented by lw,
Example 5.6.3. Of the two binary trees shown in Figure 5-48, only
(a) is complete.In particular,(b) has ten vertices but has no vertex with
index 10.
(a)
where
<j>
= and 1 - 0 = '
\342\200\224^\342\200\224 \342\200\224g\342\200\224
512 Chapter 5: Graphs
V(h) = -U (<t>)h+3
-
-7T (1
- <t>)M
- 1
= Fh+2
\342\200\224
1, where Fn is the 71th Fibonacci number.
5 + 2V5
___ 1
_5-2V5 -1
= ^
_^ ^(1-0)
we see that these two apparently different solutionsarethe same.
It is interesting to compare this bound with the lower bound of 2h
and 1.61804
-lso that
^i(l-0)h+3>
(i) For each vertex u in the left subtree of a vertexv, l(u) < l(v)
(ii) For each vertex u in the right subtreeofa vertex v, l(u) > l(v).
Next use the label9. Again 9 must be the label of a vertex in the left
subtree of the root since 9 < 17.Moreover, 9 is greater than 4, so 9 must be
a label in the right subtree of 4. Likewise 9 > 7,so9isa l$bel for the right
child of 7. Next,19is greater than 17, so 19 will label some vertex in the
right subtree of 17; but 19is less than 23, the right child of 17, so labelthe
left child of 23 with the label 19.Nextconsider 45; 45 > 17 so 45 is a label
for a vertex in the right subtree of 17;45 > 23, so label the right child of 23
with 45. Continuing as above, we see that 6 must bethe labelfor the left
child of the vertex 7, 2 is theleftchildof 4, 37 and 99 are respectively the
left and right children of 45. Thus, we have the following binary tree:
17
\342\200\242
./\\ .1 19 #/ \\45
Figure 5-49
One nice feature of the binary search tree is that now we can perform
an inorder traversal of the tree (see Exercise 7 in this section),and this
traversal will give a rearrangement of the original sequence into its
properorder.
Also, if T\" is a subtree of the binary search tree T with root u, then the
minimum and maximum labels on the vertices of T\" are easily located. To
find the minimum label, start at the root u and visit successivelyleft
children until a leaf is reached. The labelon this leaf is the minimum
label on the subtreeT\". Likewise, we can find the maximum label on the
verticesof T\" by successively visiting right children until we arrive at a
leaf.
But that is not all. Binary have a dynamic feature as well;
search trees
additional numbers original sequence can be
appended to the
incorporated into the binary search tree just as if these had been in the sequence
all along. For instance,if 1,5,11,39,84,87 are appended to the original
sequence,then 1becomes a left child of 2,5 is a left child of 6,11 is a right
child of 9,39 is a right childof37,84isa left child of 99, and 87 becomesa
right childof 84.
514 Chapter 5: Graphs
{1,2,4,5,8,10,11,20}.
2. Show that if H(n) maximum possible heightof a complete
is the
binary tree with then H is in O(log(n)).
n vertices
3. Show that if H(n) is the maximum possible heightof a height-
balanced binary tree with n vertices then it is in O(log(n)).
4. Another kind of balanced binary tree is called an a-balanced
binary tree. Let T be a binary tree and \302\243
and r be the number of
vertices in T\"s left and right subtrees, respectively. Define the
balanceof Ttobethe ratio (1 + 9)1(2 + 8 + r), and say that T is
a-balanced if the balance of T is betweena and 1 \342\200\224
a. Derive a
lower bound on the numberof verticesin an a-balanced binary
tree of height h.
5. Draw a height balanced binary tree of height 4 with the minimum
possible number of vertices.
6. The terminology for binary trees borrows heavily from human
kinship relations.Are the parent-child relationships between
human beings really binary trees? Justify your answer.
7. (Tree Traversal Algorithms.)A traversal of a tree is a processthat
enumerateseachof the vertices in the tree exactly once. When a
root.
Figure 5-50
2. InorderTraversal(abbreviated LNR).
b%' ^#c bj
y\\ v
yy /.(
/ / i
n% o#
p\\
516 Chapter 5: Graphs
(a) (b)
%c bm( cm md
me em '\342\200\242/
(c) (d)
dm em \342\200\242/
d*
mh
(a) 7 vertices.
(b) 10 vertices and height4.
Explain how to view a binary tree as an ordered tree.
14. Determine the height of the binary tree whoselargestlevel-order
indexis
(a) 24
(b) 2s + 17
(c) 26 + 31
(d) 26 + 33
(e) 4s + 7
(f) 2* for k a positiveinteger
(g) n for n a positive integer.
15. Given the level-order index of a vertex v in a binary tree, determine
the level-orderindexof v 's left child, right child, and parent if the
level-order index of v is
(a) 29
(b) 410
(c) n, where n is a positive integer.
16. Design an algorithm to delete a vertex from a binary search tree so
that the resultisstilla binary search tree. Hint: consider the three
caseswherev is a leaf, has one child, or 2 children.
17. Determine the conditions that will cause each internal vertex of a
1.
,2
Figure 5-51
518 Chapter 5: Graphs
Figure 5-52
Father Mother
Figure 5-53
7. (a) Preorder:a-b-d-e-g-c-f-h-i-j
Inorder:d-b-g-e-a-f-i-h-j-c
Postorder:d-g-e-b-i-j-h-f-c-a
Section 5.6 Binary Trees 519
1. For the graph below find the spanning tree (draw the tree and label
each vertex with an integer from 1 to 8 to indicate the orderof
visitation) obtained by:
(a) BFS
(b) DFS
(c) KruskaPs algorithm.
(In each problem use the vertex orderingabcdefgh.)
(b) Postorder:
(c) Inorder:
520 Chapter 5: Graphs
dm e% /\342\200\242 \302\243\342\200\242
\342\200\242,
mm
Section 5.6 Binary Trees 521
7. Prove or disprove.
(a) The following two graphs are isomorphic.
tree.
\342\200\242-\302\253-
Section 5.7 Planar Graphs 523
e \342\200\242
(a) (b)
Figure 5-54
524 Chapter5: Graphs
Figure 5-55
1. If we have drawn a cycle in the plane, then any edge not on the cycle
must be eitherinsidethe cycle, outside the cycle, or the edge must
cross over one of the edges of the cycle.
2. The roles of being inside or outside the cycleare symmetric that is,
the graph can be redrawn so that edges and vertices formerly
outside the cycleare now inside the cycle and vice versa.
Figure 5-56
Section 5.7 Planar Graphs 525
a b c d t \342\200\242
\342\200\242 \342\200\242 # cw i
I
z
*\342\200\242
(a) (b)
Figure 5-57
526 Chapter 5: Graphs
Thus, the reader should review the earlier definitions. The primary
technical fact that we need is that the \"FirstTheoremof Graph Theory\"
holds for multigraphs as well as for graphs.
N
N-
f
1 /,| \342\200\242
t/ .......
\342\200\224.\342\200\224 ~~-s
\\ N. i
/'\\
\\ \\ I \342\200\242
/'-A *^ A
\\
yiQA \\
\\
-\342\200\242-
c d I
Figure 5-58
Let | JET* |, | fi* |, | V* |, and | E\\, \\R |, | V\\ denote the number of edges,
regions, and vertices of G* and G respectively. The the following
i)\\E*\\-\\E\\
ii) =
\\V*\\ \\R\\,and
Section 5.7 Planar Graphs 527
Proof. Let us use the notation 2r\302\243/?(G)degree(r) for the sum of the
degrees of all the regions determined by G. Then if G* is the dual of G, let
2r*ev(G*)degree(r*) denote the sum of the degrees of the vertices of G*.
Then
]T
r<ER(G)
degree(r)
=
]T
r*EV(G*)
degree(r*)
by (iv) above. But we already know that the sum of the degrees of all
verticesin any graph is twice the number of edges.In particular,we know
that
]T degree(r*)' = 2|E*|.
r*EV(G*)
Figure 5-59
528 Chapter 5: Graphs
# #
1/ \\>
Figure 5-60
a a
8i
*#C /7WO**
me
\342\200\242 #
e d
e; c
\342\200\242
c
(d) (e) (f)
Figure 5-61
Section 5.7 Planar Graphs 529
(a)
\342\200\242
(c) \342\200\242, (d)
Figure 5-62
n = 2 n = 3 n =4 n = 5
O A .A fa
Figure 5-63
\\E\\ + \\R\\
=
| V1]
- IE1]+ \\RX[ By the inductive hypothesis, (V1! - l^1!+
ji?1! = 2. Therefore, |V| - \\E\\ + \\R\\
= 2 and the theorem is proved by
mathematical induction. \342\226\241
Section 5.8 EuLer's Formula 531
The above theorem allows the graph to have loops (though the
following corollary does not). We recall that the degreeof a region is the
number of edges in the closedpath that forms the boundary. Then the
above theorem actually holds for graphs where regions may have degree
1: However, we shall assume throughout this section that the graph is
simple and |E| > 1; thus we are assumingthat the degree of eachregion is
greater than or equalto 3.We call a connected plane graph polyhedral
if degree (r) > 3 for each regionr E i? (G); and if, in addition, degree (v) >
3 for each vertex v El V(G). In particular, we observe the following fact:
In a plane graph G, if the deree of each region is > k, then |Jf?| < 2 |JB|. In
particular, we have 3 |Jf?| < 2 \\E\\. The proof of this fact is easy\342\200\224just
observe that 2rG/e(G) degree (r) = 2 \\E\\ > k \\R\\ since degree (r) > k for each
regionr G R(G).
Corollary5.8.1. In a connected plane (simple) graph G, with \\E\\>
1,
(1) |E|<3|V|-6and
(2) there is a vertex v of G such that degree (v) < 5.
The simple fact in (2) is very useful in connection with the four-color
problem,which we will discuss in the Section 5.12.
only to show that Kn is nonplanar if n > 5, and for this it suffices to show
that K5 is nonplanar. We prove this by an indirect argument.If K5 were
planar, then |fl|\302\253|JE|-|V| + 2-10-5 + 2 = 7. But since Kn is simple
and loop free, we would also have 31R \\ < 21E \\ which in this case would
imply that 3 =
\342\200\242
7 21 < 2 =
\342\200\242
10 20, an obvious contradiction. (Note we
could have obtained a contradiction also by appealingto the inequality
|JS|<3|V|-6.) \342\226\241
Proof. It is easy to see that Kmtn is planar if m < 2 or n < 2. Now let
m > 3 and n > 3. To prove that Xmn is nonplanar it suffices to prove that
X3>3
is nonplanar. (We did this in section 5.7,but let us give another proof
based on Euler's Formula.)
SinceK3t3 has six vertices and nine edges, if X33 were planar, Euler's
formula would give that | R | = |\302\243 | -|V| + 2 = 9-6 + 2 = 5.SinceX33 is
bipartite there can be no cycles of odd length. Hence each cycle has
length >4 and thus the degreeof each region would have to be greater
than or equal to 4. But then we would have to have 41R | < 21E| or
20 = 4 - 5 < 2 \342\200\242
9 = 18, a contradiction. \342\226\241
Euler's formula and the method of proofby contradiction will solve the
following problem.
If there were sucha polyhedral graph with |E | = 7, then 31R| < 21E| =
14 since each >3. Moreover, eachvertexhas degree>3,
region has degree
sothat 31 V\\ < 21E | = 14. Thus, |R \\ < 4 and | V\\ < 4. By Euler's formula,
|i?| + \\V\\ = \\E\\ + 2 = 9 and then 8 > \\R\\ + | V\\ = \\E\\ + 2 - 9, a
contradiction.We conclude that a polyhedral graph with 7 edges does not
exist.
31 V\\ < 2\\E\\ prove that | V\\ > 4, |JR| > 4, and \\E\\
> 6 for any
polyhedral graph.
4. (a) If G is a polyhedral graph with 12 vertices and 30 edges, prove
that the degreeof eachregion is 3.
18. Show that if G is a simpleplanar graph with | V\\ >,11, then the
complementof G is nonplanar.
19.N Let G be a plane graph such that eachvertex has degree 3. Prove
that a dual of G will lhave an odd number of regionsof finite area.
534 Chapter 5: Graphs
|J5|<[r/(r-2)](|V|-2).
21. The crossing numberc (G)ofa graph G is the minimum number of
pairs of crossingedgesamong all the depictions of G in the plane.
Forexample, G if is planar, (G) = 0.
then c
(a) Determine c (G) for the following graphs:
(1) K^.
(2) K5.
(b) c (K6) = 3. (Hint. Introducenew vertices
Determine that at
and use the corollary
each cross-over to Euler's formula.)
22. Show that if a plane graph is self-dual (see Exercise1ofSection 5.7
2. (a) \\V\\
= 2 + (|jB|-|i?|)>2 + |i?i/2since|\302\243|>:3/2|fi|implies
that|E|-|rt|;>|fl|/2.
6. Suppose degree (r) > 5 for each region r. Then 2|2?|>5|i?| or
5/2\\R\\^\\E\\,2\\E\\z>3\\V\\ or |V|<2/3|\302\243| and -1 V|=> -2/3|JB|.
\\V\\
-
|JE|> 2or6|V| - 2|JS|> 12.Write 6|V| = 6n, + 6n2 +
6n3 4- \342\200\242
\342\200\242
\342\200\242
-21JB |
= -
\342\200\224n, 2n2
- 3n3... and sum.
Section 5.9 Multigraphs and Euter Circuits 535
11. (a) Observe that if theexterior region is not countedthen for each
( a* 7 v
*d
)
0 2 2 1
2 0 0 1
2 0 0 1
1110
#\342\200\242
Proof, multigraph
(only if) G have an Euler path. It isclear
Let that
Figure 5-68 (a) can be drawn in this fashion with each edge being traced
exactly once,while the directed multigraph in Figure 5-68 (b) cannot.
(a) (b)
Figure 5-68
Ps in each row and check whether the sum is even. For eachrow, this
takes O(n) steps, and since there are n rows the whole process can be
performedin 0(n2)steps.Tocheck that G is connected, we can compute
the transitive reflexive closure A* of A, which takes 0(n3) steps using
WarshalPs algorithm. (This can be done in 0(n2) stepsby methods that
are not covered in this book.)
Application to ComputerScience
De Bruijn Sequences. Let 2 = {0,1,.. ,,n - 1} be an alphabet of n
symbols. Clearly there are nk different sequences of length k over these
symbols.A de Bruijn sequence, known also as a maximum-lengthshift
register sequence, is a circular array a0ax... aL_l over 2 such that for
- OL,
ajaj+i fly+A-i
graph with 2k~l vertices which are labeled with the 2k~1 (fe-l)-digit
binary numbers. From the vertex bxb2
bk_x is an edge to the
\342\200\242
\342\200\242
\342\200\242 there
For example, consider the directed Euler circuit of G2>4( V,E) consisting
of the sequence of edgeswith the following labels:
Section 5.9 Multigraphs and Euler Circuits 541
0000101001111011,
where the circular arrangement is obtainedby closing the two ends of the
sequence.
One applicationof this concept is in the generation of unique codes.
For example, the 16 binary digits in the above sequencegeneratedby use
of the Euler circuit on G2A( V,E) create 16 unique code words that differ
by only one digit. This means that the sequenceof 16 binary digits given
above, when implementedon a rotatingdrum, will generate 16 different
positions of the drum and by that produce 16 distinct codes. In generalit
is possibleto arrange 2n binary digits in a circular array such that 2n
sequences of n consecutive digits in the arrangement areall distinct.
5.9
ExercisesforSection
1. Show that a directed graph that contains an Euler circuit is
strongly connected.
2. Prove a connected
that graph has a Euler circuit iff it can be
decomposed to a set of elementary cycles that have no edge in
common.
3. Find an Euler circuitin Figure 5-70.
CIXD LM\\./J
(a) (b)
Figure 5-70 /
is called a \"bridge.\
542 Chapter 5: Graphs
6. Give an example of a graph with ten edges that has a bridge as well
as an Euler path.
7. In the definition of Euler circuit discuss the requirement that the
Eulercircuitintersects with every vertex at least once.
8. Is it possible a knight to for move on an 8 x 8 chessboard sothat it
makes every move exactly once? A move
possible between two
squares on the chessboardis completewhen it is made in either
direction.
9. Builda 27-digitcircular ternary (0,1, or 2) sequence in which every
10. Let L (G) of a graph G be another graph which has a vertex for each
edge in G and two of these vertices are adjacent iff the
edges
corresponding in G have a common end vertex.Show that L(G) has an
Euler circuit if G has an Euler circuit.
11. Find a graph G which has no Euler circuit but for which L(G) has
one.
12. Prove that if a connected graph has 2n vertices of odd degree then
(a) n Euler paths are requiredto contain each edge exactly once.
(b) There existsa set of n such paths.
13. Prove that for positive integers 5+1 and k there existsa de Bruijn
sequence.
Figure 5-71
possible for him to schedulea round trip by car enabling him to visit each
specifiedcity exactly once?
We can represent the salient featuresof this problem by a graph G
whoseverticescorrespond to the cities in the salesman's territory, and
such that two vertices are joined by an edge iff there is a road directly
connecting the two cities (that is, the road does not pass through any
other city in the territory). The solution of this problem depends on
whether G has a cycle containing every vertex of G.
Thus, we see that this problem suggeststhe concept of Hamiltonian
graphs. A graph G is said to be Hamiltonian if there exists a cycle
containing every vertex of G. Sucha cycle is referred to as a
Hamiltonian cycle. Thus, a Hamiltonian graph is a graph containing a
Hamiltonian cycle. We define a Hamiltonian path as a simple path that
contains all vertices of G but wherethe end points may be distinct. Since
a graph is Hamiltonianiff its underlying simple graph is Hamiltonian
we limit our discussionto simplegraphs.
Whereas the Euler circuit is a circuit that traverseseachedgeexactly
once and, therefore, traverses each vertex at least once,a Hamiltonian
cycle traverses each vertex exactly once (and hencemay miss some edges
altogether.) Thus, there is a striking similarity between the concepts of
Eulerian graph and Hamiltoniangraph, and therefore one might expect
an elegant characterizationof Hamiltonian graphs as in the case of
Eulerian graphs.Such is not the case, and, in fact, the developmentof
sucha characterization
isa major unsolved problem in graph theory,
sure, a Hamiltonian cycle
To be always provides a Hamiltonian path,
upon deletionof any edge. On the other hand, a Hamiltonian path may
not lead to a Hamiltonian cycle (it depends on whether or not the end
points of the path happen to be joined by an edge in the graph).
The name \"Hamiltonian\" is derived from the Irish mathematician Sir
William Rowan Hamilton, who invented a game in 1857consisting of a
solid regular dodecahedron, twenty pegs, one inserted at each corner o f
\342\200\242
v*
-\342\200\242
v5
Figure 5-72
Section 5.10 Hamiltonian Graphs 545
Example 5.10.2. Likewise the graph G2 (in Figure 5-73) has neither
a Hamiltonian path nor a cycle for the following reason. Note that the
vertex / has degree5 so that at least three edges incident on / cannot be
included in any Hamiltonian path. The same is true for the vertices h and
j. There are 13verticesof degree3 and, in particular, b, d, f, and n are
suchthat at leastoneofthe threeedges incident on each of these vertices
cannot be included in a Hamiltonian path. Thus, at least9 + 4 = 13 of the
27 edges of G2 cannot be included in any Hamiltonian path. Hencethere
are not enough edges to form a Hamiltonianpath on the 16vertices of G2.
The appealto the symmetry of the graph often saves some effort. See
Figure 5-74.
Gx G2
d a
Figure 5-73
546 Chapter 5: Graphs
<?3
nm dm
Figure 5-74
Figure 5-75
548 Chapter5: Graphs
{t>4,t>9}, ta,^}, and {v7,v9}y are diagonals in the interior of C, while {vuv4\\ is a
Figure 5-76
Section5.10 Hamiltonian Graphs 549
to this cycle C,
(i
\302\243
-
2)(r, - rj) - 0.
i-3
ri
\302\243
= d + 1 and d - ]T rt\342\226\240
- 1.
t-3 i'-3
Let N denote the sum of the degrees of the regions interiorto C.Then
N = 2JJL3 However,
\302\243rt. N counts each diagonal twice (sinceeachdiagonal
bounds two of the regions interior to C) and eachedgeof C once (since
each bounds only one regioninteriorto C).Thus,
n
N =Y1ir*
- 2d + n.
\302\273-3
21 in = 2 21 ^ - 2+ n
t-3 i-3
so that
21 (i - 2) r,- - n - 2.
t-3
-
By considering the exterior of C we concludein a similarfashion that
(i
\302\243
- 2) rj - n- 2.
t-3
(i
\302\243
- 2)(r, - rj) = 0. \342\226\241
i-3
Figure 5-77
Therefore, the assumption th#t there was a Hamiltonian cycle for G6 led to a
contradiction, and G6 has no Hamiltonian cycle.
Example 5.10.7. The graph G7 (in Figure 5-78) does possess HamiU
tonian cycles.Show,however, that any such cycle containing one of the
edgese, e\\ must avoid the other.
There are five regions of degree 4 and two regions of degree5.Thus, for
a'
. \\/TV/
# \342\200\242
Figure 5-78
Section 5.10 Hamiltonian Graphs 551
cycle then there would be at least two regions of degree 4 on the inside
and at leasttwo on the outside. This makes impossible the four-onesplit
guaranteed by Grinberg's theorem.
(a) (b)
(g) (h)
Figure 5-79
552 Chapter 5: Graphs
</\342\200\242- b
\342\200\242
o \\n
(d) (e)
<\342\200\242#. d
\342\200\242
a.
g* \342\200\242
i
(g)
Figure 5-80
Section 5.10 Hamiltonian Graphs 553
by^ g k
71 X
c?e- \"
VKl
mm' 'e \302\243
(h) (i)
'\342\200\242^x//1^
^.^
cm
(j)
a
m
h \\ b c
<A m >
e
/
(c)
Figure 5-81
554 Chapter 5: Graphs
4.(a) Show that any Hamiltonian cycle in the graph Hx in Fig. 5-82
which contains the edge{c,d} must also contain the edge \\g,h}.
(b) Show that any Hamiltonian cycle in the graph H2 must contain
exactly two of the edges {afh},{c,d},{ij}. Show that any
Hamiltonian cycle that contains both edges {dye} and {e J} cannot also
contain {a,h}.
(c) Using the results of Example 5.10.7., show that no Hamiltonian
cycle in H3 can contain both the edges {a,/}and {/i,n}.
(d) Using (c), show that every Hamiltonian cycle in graph H4 must
contain the edgee.
(e) Show pentagon P must lie outsideany
that the Hamiltonian
**4 \"5
Figure 5-82
(a) (b)
Figure 5-83
knight to tour the chessboard, visiting every square once and only
once, and then returnto its original square?
(a) The question has an affirmative answer. Can you find such a
tour?
(b) Formulatethe question in terms of graphs.
(c) Investigate the Knight'sTourPuzzlefor a 4 x 4 chessboard.
(d) Investigatethe Knight's Tour Puzzle for a 4 x 5 chessboard.
9. Supposethat a classroom has 25 students seated in desks in a
square 5x5 array. The teacher wants to alter the seating by
having every student move to an adjacent seat (just ahead, just
behind, or on the left, or on the right).Show by a parity (even or
odd) argument that sucha move is impossible.
10. Suppose a set lofk verticesin a graph G is chosen so that no pair of
vertices in / are adjacent. Then for each v in /, degree (v) - 2ofthe
edges incident on v will not be used in a Hamiltonian cycle.
Summingover all vertices in /, we have E1 = 2ue/[degree (u)
-
2] =
556 Chapter5: Graphs
(c) With a suitably chosen set /, use part (a) to show that the
following graphs have no Hamiltonian cycles:
(1) the graph in Exercise2(i).
(2) the graph G2 in Example 5.10.2.
(3) the graph G4 in Example 5.10.4.
11. Prove that a directed Hamiltoniancycle of G6+lk(V,E)
corresponds to Euler cycle of G^^.^V,!?). Is it true that
a directed
m \342\200\224
n - o - f. Then observethat we must eliminate at least
one of the edges from each of the outer and inner pentagons,
giving a total of at least 12 edgeseliminated.
4. (a) Suppose not used but {e,d}is used.Then
{gyh} is edges {a,h\\,
{b,h}, {g,f} and {e,g}must be included in a Hamiltonian cycle.
But then {a,b}and {e,/}must be deleted lest a triangle subcycle
be formed.Thus, {6,c} and {c,/} must be included. But then
there are three edges of the cycle incident on c.
Contradiction.
{a,h}, {c,d}, and {ij} must be used. However, all three cannot be
used, for in that case, (^) if {dj} is used, then {d,e}and {ej}are
not used, meaning two of the three edges at e are not used;
(e) The Grinberg theorem gives 2(r4 - r\\) + 3(r5 - r\\) = 0; r4 and
r\\ cannot since r4 + r\\ = 5. Thus, r4 - r\\ J* 0 and r6 -
be equal
r\\ / 0. Since r5 + r\\
= 2,
r5
- r\\ = \302\2612.Thus, both pentagons
must lie on the same sideof any Hamiltonian cycle. The
infinite region lies on the exteriorof any Hamiltonian cycle, so
then does P. Therefore,rb - r\\= -2, giving 2(r4
- r\\)
- 6 = 0
If
\302\2611. r4
- r\\
=
1, then 3(r5 - =
r\302\243) -1 and 3 will divide 1.
Contradiction. If r4 - r\\ = -1, then 3(r5 - r\\) - 3 implies r5
-
=
r\302\2471, but this fact and r6 4- r\302\247
= 3
gives that r5 = 2, no
contradiction. Thus Grinberg's Theorem gives no conclusion.
558 Chapter 5: Graphs
(c) 2(r4 - r}) + 4(r6 - t\\) = 0 implies 2 divides r4 - rj. But since
the external regionhas degree 6, r^ - r} = -1 and r4 - r\\ = 2.
But then r4 + r\\ = 3 implies r4 = 5/2, a contradiction.
7. (n - l)!/2
9. The number of students moving to the left = the number moving
to the right; so the total number of students moving to the left or
right is even. Similarly the total moving forward or backwardis
even.Hence, the total number of students must be even, but the
total is 25.
10. (a) At most E - El edgescanbeusedin a Hamiltonian cycle, but
a Hamiltonian cyclehas V edges.
(b) The sum E1 counts some edges twice if / is not a set of
nonadjacentvertices, and hence El would not be the correct
bound on the number of edges that cannot be used.
(c) (1) Let/ = {ayefgyi,c}
(2) / = {b4,UJ,h,nl
(3) /= {ayc,efgfifl\\.
to
corresponding committees with a common member. But then we need to
introduce a new graph theoretic concept.
By a vertex coloring of a graph G, we mean the assignment of colors
(which are simply the elements of some set) to the verticesof G,onecolor
to each vertex, so that adjacent vertices are assigned different colors.
Figure 5-84
assigned a color different from the colorsfor a and c, color d the color 2.
But then e must be assigned a colordifferent from 2 since e is adjacent to
d. Likewisee must be assigned a color different from 1 or 3 becausee is
adjacentto a and to c. Hence a fourth color must be assignedto e.Thus,
the 4-coloring exhibited indicates x(G) ^ 4. But, at the sametime, we
have argued that x(G) cannot be lessthan 4. Hence x(G) = 4.
We now return to our scheduling problemand the resulting graph G0.
am-
Figure 5-85
560 Chapter 5: Graphs
x(G
- v) < x(G) for each vertex v of G. It is easy to see that a ^-chromatic
graph has a k-criticalsubgraph.
The following properties of fc-critical graphs were proven by G. A.
Dirac.
(i) G is connected,
(ii) The degree of each vertex of G is at leastk - 1, that is, d(G) > k -
1.
(iii) G cannot be expressed in the form Gx U Gx and G2 are
G2, where
graphs which intersect in a complete graph. In particular, G
contains no cut vertices.
x(G
- v) > k, contradicting t he fact that G is /z-critical.
(iiX Since G is fc-critical, we have x(G - v) < k - 1 for eachvertex v of
G. If degree (v) < k \342\200\224 1, then the neighbors of v will be colored with at
most k \342\200\224
2 colors. But then it follows that any (k - 1)-coloring of G - v
can be extended to a (k \342\200\224 1)-coloring of G by coloring v by the color
different from the colorson the neighbors of v, contradicting the fact that
X(G)= k. !
(iii) If G = Gx U G2 and Gv O G2 = Kn then X(G\\) ^ k - 1 and x(G2)<
fe -
1, since Gx and G2 are subgraphs of G, and G is fe-critical. But by
relabeling the colors,we can color the vertices of Gx D G2 the same way in
both graphs. These two colorings can then be combined to give a (k -
Thisrule follows easily from the observation that for any vertex v there
are at least d(G) neighbors of v that are colored some color different from
that of v. Hence there are at most | V\\ - d(G) vertices colored the same
coloras v. If we place vertices in the same class iff they are colored the
same color, there will be x(G) classes, and each class will contain at most
| V\\
- 5(G) vertices. Thus, [ | V| - 5(G)]x(G) > | V|since
every vertex is in
some class.
d c
Figure 5-86
Section 5.11 Chromatic Numbers 563
b
/\342\200\242; /\342\200\242
/\342\200\242-^A^s
V-M
'I
d d
(a) (b) (c)
/\\
a b
\342\200\242 \342\200\242
-#c
\342\200\242 \342\200\242
/ d
a
(a)
d*<- 9C
Figure 5-88
(b) K3.3
(c) The Petersen Graph
(d) Kn
7. Show that the graphs of Exercise 4(f) and 4(g) are fc-critical for
some integer k.
8. Give a proof for Rule 9.
9. We give an algorithm by D. J. A. Welsh and M. B. Powell to color a
graph G. Firstorder the vertices according to decreasing degrees
dx
>
d2 > \342\200\242
> dk. (Such
\342\200\242
\342\200\242 an ordering may not be unique.)Then
use the first color to color the first vertex and to color, in sequential
order, each vertexwhich is not adjacent to a previously colored
vertex.Repeatthe process using the second color and the
unpainted
remaining vertices. Continue the process with the third color,
and so on until all verticesarecolored. For example, in the graph in
Figure 5-89, we order theverticesaccording to decreasing degrees:
e,c, g,a,6,d,/,/i. Use the first color to color e and a. Use the second
color on verticesc, of, and h. Use the third color to colorverticesg,
bf and/. Thus, G is 3-colorable. Note that G is not 2-colorable since
thereis a triangle subgraph. Hence x(G) = 3. Use the Welsh-
Figure 5-89
566 Chapter 5: Graphs
Of*
^<i /
(a)
a\302\273
AT \\l
(c)
Figure 5-90
this coloring may (and usually does) use many more colors than
necessary. Figure 5-91 shows a bipartite (hence,
2-colorable) graph for which the greedy algorithm wastes4 colors.
(a) Given a graph G, showthat its verticescan ordered
be in such a
way that the greedy algorithm uses x(G) colors. (Thus,
exactly
it is not surprisingthat it pays to investigate the number of
colors needed by the greedy algorithm in various orders of the
vertices.)
(b) For each k > 3, find a bipartite graph with vertices vi9v29.. .9vn
Figure 5-91
(c) 2
(d) 4
(e) 3
(f) 4
(g) 4
(h) 4
(i) 2
6. (a) 3
(b) 3
(c) 4
8. (i) \342\200\224\342\226\272
(ii). Suppose G is 2-colorable. Let M and N bethe set of
that
vertices first colorand secondcolorrespectively.
colored the
(ii)
\342\200\224*
(iii). Suppose G is bipartite and suppose M and N form a
(c) X(G) = 4.
(d) X(G)
= 4.
met with failure. The most famous failure occurredin when 1879 A. B.
ys:
Figure 5-92
'7,Ni H(a,y)
{^3j H(a,y)
Let the line graph L(G) of a graph G have a vertex for each edge of
G and suppose that two of these vertices are adjacent iff the
graph G can be edge colored with k colors iff the vertices of L(G)
can be colored with k colors.
5. Take the dual of G. Apply Rule 9 to G*. Interpret this result for
G.
Kl7.
(c) If 17 mathematics professors dine togetherat a circular
table duringa conference and if each night each professor
sits nextto a pair of different professors, how many days
can the conferencelast? Explainhow to model this
problem as a problem about graphs.
(d) Showthat if n is an odd integer, then the edgesof Kn can
be partitioned into {lk){n \342\200\224
1) edge-disjoint Hamiltonian
cycles.
13. (a) Showthat a group ofn > 3 peoplecanbeseated around a table
such that everyone will have two of his friends at his two sides
if everyone knows at least half of the people in the group,
(b) Show that the completebipartite graph Xmm has a
Hamiltonian cycle if m > 1.
14. Suppose that G is a planar graph with n vertices each of which has
degreeat most 5 and at leastonevertexof degree4.Use induction
Boolean Algebras
6.1 INTRODUCTION
BOOLEAN ALGEBRAS
2. V a,b G B,
(a) a 4- b G B,
(b) a \342\200\242
b G B.
3. V a,b G B,
(a) a + b =b + a, I
I commutativity laws
(b) a b = b
\342\200\242 \342\200\242
a. j
for all a,6,c G 23 can be derived from the above postulates. (See
Theorem6.2.9.)
Section 6.2 Boolean Algebras 579
a + (6 \342\200\242
c) = (a + b) \342\200\242
(a + c)
1+1=1.1=1+0=0+1=1
0+0=0-0=1.0=0.1=0
1=0
6-1.
Clearly, all of the axioms of a Booleanalgebraaresatisfied.
It is easy to verify that the set of postulatesdefining the Boolean
algebra above is consistent and independent. That is, none of the
postulates in the set may contradict any other postulate in the set, and
noneof the postulatescan be proved from the other postulates in the
set.
Somecommentshould be made
concerning our notation and
terminology.We have adopted notation frequently used by computer
the
designers. The binary operation + in our definition of Booleanalgebra
satisfiesthe properties:
0+0 =
0, and 0+1 = 1 + 0 = 1+ 1 = 1
Normally, computer designers use the symbol \302\251to denote this latter
binary operation of addition modulo2, sothat for them, 1 \302\2511 - 0, and,
in general, xx \302\251 x2
= xxx2 + xxx2 for each xx, x2 G B.
x <y iff x =
\342\200\242
y x and x + y = y.
While in fact the entire system\342\200\224the set J3, called the domain of the
Booleanalgebra, the operations +, and
\342\200\242, -, and the zero and unit\342\200\224
It is easy to see, from the above axioms, that they are arranged in pairs
and that eitheraxiomcan be obtained from the other by interchanging
the operations of +'s and -'s, and the elements 0 and 1. This is the
principleof duality. For example,
a + (b \342\200\242
c) - (a + b) - (a + c)
i 1 i
a \342\200\242
(b + c) = (a - b) + (a \342\200\242
c).
Every theorem that can be provedfor Boolean algebra has a dual which is
alsotrue.
We sh^ll now prove some theorems necessary for the convenient
manipulation of Boolean algebra. The basic tool of proof of these
theorems is the use of the axioms as well as principles of substitution and
duality.
Proof.
a + a = (a -f a) \342\200\242
1 Axiom 4(b)
= (a + a) \342\200\242
(a + a) Axiom 6(a)
= a+ aa Axiom 5(a)
=a + 0 Axiom 6(b)
=a Axiom 4(a). \342\226\241
As shown here, the complete proof is obtainedby the use of the dual
axioms to those usedin the proof of Theorem 6.2.1and
6.2.1. Theorems
6.2.2are known as the idempotent laws for Boolean algebra.
Proof. Suppose that there are two zero elements, Ox and 02. For each
fl^EB and a2 E B we have, by Axiom 4(a)
ax 4- 0! = ax and a2 4- 02
= a2.
Let ax = 02 and a2
=
0X. Thus,
02 + 0! = 02 and 0! + 02 = (V
Proof.
a + 1 = (a + 1) \342\200\242
1 Axiom 4(b)
= (a + 1) \342\200\242
(a + a) Axiom 6(a)
= a4-l-a Axiom 5(a)
a 0 =
\342\200\242 0 Principle of duality. \342\226\241
a 1 =
\342\200\242a Axiom 4(b)
and
a 0 =
\342\200\2420 Theorem 6.2.4.
and
Hence,
ai = 1 \342\200\242
ai Axioms 2(b) and 4(b)
= (a + a2) ' ai Axiom 6(a)
= 1 \342\200\242
a\"2 Axiom 6(a)
=
a2 Axiom 4(b). D
a -+- a 6 = a
\342\200\242 and a \342\200\242
(a + b) = a.
Section6.2 Boolean Algebras 583
Proof.
a + a = 1 and aa = 0.
a + (b + c) = (a + b) + c
and a (b c) =
\342\200\242
\342\200\242
(a \342\200\242
b) \342\200\242
c.
Proof. Let
a = [(a + 6) + c] \342\200\242
[a + (b + c)]
- [(a + b) + c] \342\200\242
a + [(a + 6) + c] - (6 + c)
= [(a + 6) \342\200\242
a + c \342\200\242
a] + [(a + 6) + c] . (6 + c)
- a + [(a + b) + c] \342\200\242
(b + c)
- a + {[(a+ 6) + c] \342\200\242
6 + [(a + b) + e] - c}
- a + (6 + c).
But also
Thus a + (6 + c) = (a + 6) + c.
Similarly, a \342\200\242
(6 c) =
\342\200\242
(a \342\200\242
b) \342\200\242
c
(a + b) + ab =1 and (a + 6) ab - 0.
\342\200\242
-1-1
= 1.
(a + b)
= a(o6)
\342\200\242
a 6 4- 6(6 a)
= (aa)6 + (66)a
=0 + 0 (6.2.2)
= 0.
Clearly a 6 =
\342\200\242a + 6 by the principleof duality.
Theorem 6.2.11. Va,6 \302\24323,a + a6 = a + 6 and a(a + 6)
- a6.
Proof, a + ab - (a + a) (a + 6) = 1 \342\200\242
(a + 6) = a + 6.
a (a + 6) = ab
by the principle of duality. \342\226\241
(2) h(a b) =
\342\200\242
h(a) A h(b)
(3) h{a)=h{a)
and
h:<P(U)->B%
where
with
1 if^GS
bi =
0 otherwise
6.2
ExercisesforSection
1. Let lx and l2 be elements in a poset L. Provethat if lt and l2 have a
gib (lub) then this gib (lub) is unique.
2. Show that if a poset L has a least element (greatestelement),then
this least (greatest) element is unique.
3. Let V = {1,2,3,4,6,8,12,24}
be a poset with respect to the partial
ordering| (\"is a divisor of\.") Determine the gib and lub of every
pair of elements. Does the poset have a least element? A greatest
element?
4. Provethat (M; 1cm, gcd) is a lattice under /, wheretherelation/ on
a set of positive integers N represents that njn2 iff nx is a divisor of
n2. (1cm = least commonmultiple;gcd = greatestcommon
divisor).
(lx V l2 = lx)
~ (lx A l2 = l2) ~ (l2
< lx).
11. Show that in any Boolean algebra the following four equations are
mutually equivalent:
a - b = a, a + b= b, 5 + 6 = l,a-6 = 0.
16. Show that in any Boolean algebra23, the following hold for a,b,c G
B:
(a) a_+
b = a 6 \302\251
\302\251 ab,
BOOLEAN FUNCTIONS
x a = a
\342\200\242
or x a = 0.
\342\200\242
<P(fl)fU,n/>
X X + 0 1 \342\200\242 0 1
0 1 0 0 1 0 0 0
1 0 1 1 1 1 0 1
the form
/:Bn \342\200\224B
canonical form such that two Boolean expressions represent the same
Booleanfunction if and only if their canonical forms are identical.
Furthermore, given any two Boolean functions fx and f2 over the same
n-tuple 3c E B, new Boolean functions can be determinedthrough the use
of the following three Booleanoperations.
590 Chapter 6: Boolean Algebras
g(xl9...,xn) = 71(x1,...,*\342\200\236),
h,(Xi,. . .,Xn) = f\\\\Xu. . ;Xn) + l2\\x\\y \342\200\242
\342\200\242>^n)>
where
(0 if xf
= x{
where
I 0 if xf = Xi
[
1 if xf = xi9 for i = 1,2,.. .,n.
11...1
f(xl9.. ,,xn) = 21 afemfe (disjunctive normal form),
fc=00...0
11. 1
f(xi9.. .,:cn) = IX (Pk + Mfe) (conjunctive normal form),
k=00...0
ai,..i.ssft-,...y.-/0,ivJB).
Proof. Using the definitions of mjlmmjn
and M;i .>7n,
it is clear that
mji-.Jn = ^ and Mjl..jn= 0 iff jct
= 7t Vi,i = 1,2,.. .,n. Hence
= \342\200\242
/(*!,...,*\342\200\236) <*>,...;\342\200\236
\"*,,..,\342\200\236
if xxx2 \342\200\242
\342\200\242 =
\342\200\242
xn 7x72 \342\200\242
\342\200\242
\342\200\242
Jn> and 0 otherwise; also
if jcjjc2
\342\200\242
\342\200\242
xn
=
\342\200\242
y^'2 \342\200\242
\342\200\242
\342\200\242
Jn> and 1 otherwise. \342\226\241
Itis left as an exercise to the readerto show that the expanded normal
forms of Theorem 6.3.1areunique.
Based on the previous discussion, we may conclude that two Boolean
expressions represent the sameBoolean function iff they have the same
canonical forms.
The form
disjunctive is a sum of minterms and each minterm is a
f(xux2) = (0 xt
\342\200\242
\342\200\242
x2)+ (1 \342\200\242
x1
\342\200\242
x2) + (1 xx
\342\200\242
\342\231\246
x2) + (0 \342\200\242
Xj
\342\200\242
x2)
= X\\X2 -j\" XjX2\302\253
*i x2 *3 f
0 0 0 0
0. 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
f(xlyX2yXs)
= 0 \342\200\242
(*i\302\2432*3) + 1 *
(^2*3) + 0 \342\200\242
(XiX2*3) + 0 \342\200\242
(XiX&s)
+ 1 \342\200\242
(*iX2*3) + 1 \342\200\242
(* 1^2*3) + 1 *
(* 1*2*3)
= +
f(xuX2yXs) (Xj +X2 X3){XY + X2 + XgMXj + X2 + *3).
X i I X i \342\200\224
X ^X i \342\200\224
Xj
and
/(Xi,X2)
=
Xj \\ X2
= Xi 4- X2
and
by
f(x,y) = (aAx~Ay)V(l3AxAy)V(0AxAy)V{lAxAy).
(c) xxx2 4- xs
(d) xx + [(x2 4- F3)(x2x3)] (*i 4- x2J3)
axa2 0, then
\302\245= ax = a2.
15. Prove that if ax 4- a2 4- \342\200\242
an >
\342\200\242
\342\200\242
4- 6, where b,aua2>...,an are all
atoms of a Boolean algebra B, then at = b for some i.
Section 6.4 Switching Mechanisms 595
16. Prove that in every finite Boolean algebra, the sum of all atoms
isl.
17. Suppose that b is a nonzero element of a finite Boolean algebra B.
Suppose that a is an atom ofJ3.Thenpreciselyoneof the following
hold:
a < b or a < b.
d> ifx-0
h(x) = 1,
[{aGJ?|a<:c} if jc ^ 0.
= + ^1^2^3
Xi^^ ~f~ XiX2X^ 4\" \302\243;\302\2432#3 \"I\" #l#2^3
outputs. Each input and output is \"binary\" in the sense that it is capable
of assuming only two distinct values, which are designated 0 and 1 for
convenience. More formally, a switching mechanism with n inputs and m
outputs is a realization of a function f:B2\342\200\224*B2 where if
(zuz2,.. .,zm) = f(xux2,. . .,\302\243*)>then xux2,.. .,xn are the n inputs and
Zi,z2,. \342\200\242
'*zm are the m outputs. The function / is called a switching
function, and usually / (and, hence, the switching mechanismrealizing /)
is specified by a truth table where each row of the table lists the output
(zlyz2y.. .,2m) for one of the T inputs (xlyx2,.. .,xn).Two switching
mechanisms are said to be equivalent if they h^ve the sametruth table, that is,
if they are the realizations of the same switching function. A gate is a
switching mechanism with only one output; thus, a gate realizes a
Boolean function f:B2\342\200\224^B2.
the problem into either logic equation or truth table form. As a specific
example consider a common output device used to display decimal
numbers. This device is known as the seven-segment display (SSD)
shown in Figure 6-1(a). The seven segmentsare labeled with standard
letters from a through g. The 10displays, representing decimal digits 0
through 9, are shown in Figure 6-1(b).
Let us examine the problemof designing a logic system that will turn
on the correct segments in response to binary coded decimal(BCD)
input. The four input wires indicate the number to be displayed by the
binary pattern of l's and 0's on them. The seven outputs of the logic
system must turn on in the properpattern to display the desired digit.
From the word description and the pictured displays in Figure 6-1(b)
we can tabulate the desired outputs for each valid combination of inputs.
Each row on the tablerepresents a different number displayed, and each
column represents an input or output signal.Sincethe input codes are
BCD representations of the digit displayed, the four input columns are
generated by writing in the BCD codes for each of the decimal digits. The
output columns are then filled in by inspecting the displays and filling in
Section 6.4 Switching Mechanisms 697
LJ]
l\\ / / \\ri\\ /
I A Input 0
codes
(a) (b)
a
A b w
Binary B c Seven
coded Logic network d segment
decimal C to be designed
\302\273\302\273 e display
input D r device
\342\200\224\342\226\272
\302\273\302\273
g
(c)
0 0 0 0 0 1 1 11110
1 0 0 0 1 0 1 10 0 0 0
2 0 0 1 0 1 1 0 110 1
3 0 0 1 1 1 1 110 0 1
4 0 1 0 0 0 1 10 0 1 1
5 0 1 0 1 1 0 110 11
6 0 1 1 0 0 0 11111
7 0 1 1 1 1 1 10 0 0 0
8 1 0 0 0 1 1 11111
9 1 0 0 1 1 1 10 0 11
(d)
Figure 6-1. (a) Segment identification, (b) desired displays, (c) logicproblem, (d)
truth table.
598 Chapter 6: Boolean Algebras
out the entire table from the word and picture description of the
problem.
We have thus translated the problem statement into the concise,
standardized language of the truth table from the generalized
requirement of driving a seven-segment display.
Actually the truth tableof Figure 6-1 is incomplete. Since there are 16
possible combinations of four inputs, we could have a more complete
truth table by generating all 16 rows and writing X's in the output
columns in the last six rows to indicate that we \"don't care\" what the
d-0 + 2 + 3 + 5 + 6 + 8.
Thisis an
equation in terms of the displayed digit, but we really want an
equation in terms of the input variables,A, B, C, and D. The input code
for 0 is \"not-A and not-J5 and not-Cand not-D\";we can therefore write an
equation:
digit 0 = A \342\200\242
B \342\200\242
C \342\200\242
D.
Likewise
digit 2 = A \342\200\242
B \342\200\242
C \342\200\242
Z),
digit 3 = A C .
B \342\200\242
\342\200\242
D,
digit 5 = A C .
B \342\200\242
\342\200\242
Dy
digit 6 = A C .
\342\200\242
B \342\200\242
Z),
Section 6.4 Switching Mechanisms 599
and
digit 8 - A . B C . D.
\342\200\242
We can now substitute these expressions for the digits in terms of inputs
into the originalequation for d as follows:
+ A.B.C-5 + A.B.C.Z).
We thus have a logic equation for output d as a function of the inputs
A9 B, C, and D. We can write similar equations for each of the other
outputs as follows:
+ A- \342\200\242
jB. \342\226\240
C- D + A \342\200\242
B. C \342\200\242
D + A B. C
\342\200\242 \342\200\242
D
+ \342\200\242
B-
!\342\226\240 c. D
c = A c- \342\200\242
\342\200\242
B- \342\226\240
D + A .
\342\200\242
B~. c. \342\200\242
D + A B. C
\342\200\242 \342\200\242
D + A C
\342\200\242
B- \342\226\240
D
+ A. \342\200\242
B- c. D + A \342\226\240
C \342\226\240
\342\200\242B. D + A B- C
\342\200\242 \342\200\242
D
+ A. \342\226\240 D + A
5- \342\226\240
c. \342\200\242 c \342\226\240
\342\200\242
B. \342\226\240
\342\200\242
D
e-A B- \342\226\240
c \342\200\242
\342\226\240 D + A \342\200\242
5. . c. \342\226\240
D + A B. \342\200\242
C \342\200\242
\342\200\242 D + A \342\200\242
B. \342\226\240
C \342\200\242
D
/-A. c
\342\200\242
B- D + A \342\200\242
B- c. \342\200\242
D + A B. c.
\342\200\242 \342\200\242
D + A \342\200\242
B. C \342\200\242
D
+ c
A^<\342\200\242
B< D +
\342\226\240 A B. C
\342\226\240 D
g=A c .5 + 3.
\342\200\242
B> \342\200\242
B- c- D + A c
\342\200\242B. \342\200\242
D + A B. C
\342\200\242 \342\200\242
D
+ A.\342\200\242
B< c. D + A >B- .c D.
For example:
m0 - A B \342\200\242
\342\200\242
C \342\200\242
Dy
ml - A B . C
\342\200\242 . A
m2 - A \342\200\242
B \342\200\242
C \342\200\242
Dy
m5 - A \342\200\242
\342\200\242
\302\243 C \342\200\242
D,
m14 - A J3 \342\200\242
C \342\200\242
\342\200\242
Z>,
m16 - A C \342\200\242
\342\200\242
fi \342\200\242
D.
600 Chapter 6: Boolean Algebras
a = m0 + m2 + m3 + m5 + m7 + mB + m9
= Sm (0,2,3,5,7,8,9).
M0
= A + B + C+ D,
Mx -A + B + C+ D,
M15
- A + B + C + D.
Clearly, each maxterm is true for all but onecombination of the variables,
package.
2. A MSI (medium scale integration)device has a complexity of 10 to
100gates.Theseare ICs that provide elementary logic functions such as
registers,counters, and decoders.
Input Output
A B F
0 0
\342\200\242 \342\200\242
A B A B
=o =Q- 0 I 0
1 0 0
1 1 I
Input Output
A B F
0 0 0
B
=0- =E-< 0 1 I
1 0 1
1 I I
Input Output
A B F
A + B
0 0 1
0 1 1
A-B = A+B 1 0 1
=E>
1 1 0
Input Output
A + B= A \342\200\242B
/I B F
0 0 I
0 1 0
A + B= A
\342\200\242
\302\243 I 0 0
=EJ-
1 1 0
Input Output
A F
1
J^>o-/i /!-] |o-/ 0 1
I 0
Input Output
A B F
0 0 0
^\302\243)-A\302\256B
AbZ^7]~aQb 0 I 1
I 0 I
I 1 0
Figure 6-2 represents the AND function. The AND output is high iff all
the inputs are high (1).
The symbol shown in Figure 6-3 represents the INCLUSIVE OR
function. The OR output is low (0) iff all inputs are low.
The NAND symbolcharacterizes a function whose output is low (0) iff
all inputs are high (1) (Figure 6-4).
The NOR symbol shown in Figure 6-5 characterizes a function whose
recognizer.
Though all the gates are shown with two inputs, they can have as many
inputs as desired. Package pin limitations make it fairly standard to
package together four two-input gates, three three-inputgates,two
four-input gates, or one eight-input gate per package.
The one-to-one relationship between the gate structure and the logic
equationmakesit easy to see why logic equations are so useful in gating
design.
h- xTx + yT2.
2-bit number. Assume that the variables A and B are such that
binary patterns that differ in one bit position only is called a Gray
code. A truth table for a 3-bit Gray-code to binary-codeconverteris
shown.
Inputs Outputs
a b c A h h
0 0 0 0 0 0
0 0 1 0 0 1
0 1 1 0 1 0
0 1 0 0 1 1
1 1 0 1 0 0
1 1 1 1 0 1
1 0 1 1 1 0
1 0 0 1 1 1
0 0 0 0
0 0 1 0
0 1 0 0
0 1 I 1
1 0 0 0
1 0 1 1
1 1 0 1
1 I 1 1
bxbj\\ 00 01 11 10
00 1 0 0 0
01 1 1 0 0
11 0 1 1 1
10 1 1 0 1
\342\200\224
fmin ffiffo + bibo + aob\\ + a\\bo + a\\bi
where x means 0 or 1.
Section 6.5 Minimization of Boolean Functions 605
is no other such expression with the same number of terms and with
X\\X2X\302\2474\" XiX2X$
==
^1^3x^2 ^2/
~
\342\226\240 Xi%3\302\273
Similarly, the combination of the second and the third terms yields
XiX2X$ -f XiX2X$
=
#2*3(^1 4- *i)
= *2*3>
/ (Xi,X2,X^)
=
XjX3 4- X2X% 4- X1X3.
f \\Xlyx2yX3)
=
X1X3 4- XiX2 4- ^1^3,
A
A
r *
_
>/-\342\200\224
f = A-B'C.D + A-B-C-D.
Universal set A A A A
four-variable map: the grouping of two cells eliminates one variable, the
grouping of four cells eliminates two variables, and the groupingof eight
cells eliminates three variables.
Any given grouping of l's in the Karnaugh map is identified by a
product term. That is, the single 6-ll(a) cell in Figure is defined as
ABCD. The grouping of twocells, as in Figure 6-ll(b), is identified by
ABD. Minimization involves the gathering of the various groups in the
most where the variables
efficient manner, are arranged in a \"ring\"
pattern of symmetry,these squares so that
would be adjacent if the map
were inscribed on a torus (a doughnut-shaped form). If you have
difficulty visualizing the map on a torus,just remember that squares in
the same row or column, but on oppositeedgesof the map, may be
combined.
AB AB
CD\\ 00 01 11 10 CD\\ 00 01 11 10
00||o 4 12 8 0 4 12 8 ooj
01 1 5 13 9 1 5 13 9 01
1
>D
11 3 7 15 11 3 7 15 11 11
10 2 6 14 10 2 6 14 10 10
-*
B
(a) (b)
01 01
11 11
m
10 10
(71
(a) (b)
A ACD A BD
C\\B 00 01 II 10 C^\\ 00 01 11 10
00 111 ll 00 ll 1 i
01 01
11 11
10 10
[Tj [7]
(c) (d)
A BD A AD
C\\B 00 01 11 10 C\\B 00 01 11 10
DN D>
00 11 11 00
01 01 1
* ll
11 11 ll 11
10 11 11 10
(e) (f)
A AB A
C\\B
DN 00 01 11 10 C\\B
DN
00 01 11
00 171 00
01 l 01
11 i 11 1
* 1 1
11
10 ill
10 11
1 1
11
(g) (h)
A
C \\B
p\\ 00 01 11 10
11 i|
hi i i 1 ITJI
11 11
Figure 6-12.
/ = 2 m(2,3,4,7,10,ll,12,15)
BCD = + BC + CD.
maps, e.g., 4 and 20, are also logically adjacent. Similar arguments apply
to the six-variablemap.
x xl x| x 11
1
\302\243<
X i X 1
|llJ ]_jlJ ~|7|* rrfl
V \342\200\242
0 = /I + D +
\302\243\342\200\242 C- D + \342\200\242
\302\243D b= C \342\200\242
D + C- D + \302\243
A /4
r \"
X 1 X
|x 11
B
Mx] (TT
fl<
c=
||x X 1 in
|x1
X d
>D d = YD
1 M
X 1 1
1 lx ll
i| X 11 111 |x 11 i|
*-- \342\200\224\342\226\240 L
*
A A
\"'
e
X 1) xl l
|X [fxf PI
B
X X x| X 1
l
>/> f = >\302\243>
X 1 X
e = B - D+ C- D f=C D + B-C + A + B- D
1
[fxT \"^ Tfjl
#<
x| X 11
)D
1 lx 1
1
1
lx 1
1
g= B- D + B-C+ B
\342\200\242A
C+
.BC A = 0 A = 1 BC
DE\\ 00 01 II 10 00 01 11 10 /DE
001 0 4 12 8
| 16 20 28 24 00
01 1 5 13 9 17 21 29 25 01
11 3 7 15 11 19 23 31 27 11
10 2 6 14 10 18 22 30 26 10
t *^ \\
0 4 12 8 16 20 28 24
1 5 13 9 17 21 29 25
\\F
3 7 15 11 19 23 31 27
E(
'
2 6 14 10 18 22 30 26
32 36 44 40 48 52 60 56
33 37 45 41 49 53 61 57
A< )F
35 39 47 43 51 55 63 59
E{
34 38 46 42 50 54 62 58
D D
3. (c) C\\ 00 01 11 10
0
1
6. (c) wzX 00 01 11 10
00 1 1 1
01 1
11
10 1
Anin
- xyz + ww + xwz
or Anin
- xyz + xyw + y wz
by subscript numbers from 1 (low order bit) to Figure 6-16 shows the m.
block diagram of an ALUstagek.
The carries are connected in a chain through the ALU stages, where
Ck_i is the input carry to stagek and Ck is the output carry of stage k.The
function selection lines are identical to all stages of the ALU and are
Bk Ak Function selector
1' 1'
Stage k
i'
Fk
one IC package must be connectedto the input carry of the package with
micro-operations.
specify two output variables because the sumof 1 -f 1 is binary 10, which
has two digits. We assign symbols At and J3, to the two input variables,
and Ft (for the sum function) and C,- (for carry) to the two output
variables. The truth table for the half-adderis shown in Fig. 6-17(a). The
Ci output is 0 unlessboth inputs are 1.
The Fi output represents the leastsignificant bit of the sum. The
Section6.6 Applications to Digital Computer Design 615
A i Bi Ci Ft
Br
0 0 0 0
0 1 0 1
I 0 0 1
1 1 1 0
Boolean functions for the two outputs can be obtained directly from
Ft
- Aft + Aft - Ai 0 Bh
Ct - Aft.
two binary digits. The two outputs are designated by the symbols Ft (for
sum) and C, (for carry). The binary variable C, gives the output carry.
The truth tableofthe full-adder is shown in Table 6-2. The eight rows
under input variables designate all possible
the combinationsof l's and
O's that these variables may have. The and O's for the output l's variables
are determined from the arithmetic sum of the input bits. When all input
bits are O's the output is 0.TheFt output is equal to 1 when only one input
is equal to 1. The C, output has a carry of 1 if two or three inputs areequal
tol.
Thus the two functions for the full-adder are
Fi-Ai\302\256Bi\302\256Ci.1
and
Inputs Outputs
W,.i CfF;
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 10
1 0 0 0 1
1 0 1 10
1 1 0 10
1 1 1 1 1
technology used.
Since today full-adders are realized as IC,as pointed out before, the
forms of interest arethosesuitablefor medium scale integration (MSI)
form.
Two of these realizations are shown below in Figures 6-19and 6-20.
Although the realization of Figure 6-20 appears to be moreexpensive,
this form is better suited for IC realization and is used in full-adder chips
such as SN7480and SN7482.
A popular realization of a full-adder is by utilizing two half-adders.
Using this design we will also add control bits so that the circuitwill
perform more operations than just addition. The circuitof the full-adder
with the three control bits S0,Si, and S2, as well as the mode bit M is
shown in Figure 6-21.
Control line S0 controls input At. Lines Sx and S2 control input Bh The
modelineMcontrolsthe input carry C,-_i. When S0 Sx S2 = 101and M =
1, the terminalsmarked jc, y, and z have the values of Ah Bi9 and Cif
respectively.
Control lines S2 Sx S0 may have eight possible bit combinations and
each combinationprovides a different function for Ft and Ct, The mode
=r>
Q-, =o o
Br
c,-r
Cm
^BO
o
SO
AJ
B>
BO
FO
c,
B>t\342\202\254>^=!D o
to
M>
o
Figure 6-19. Full-adder realization with 8 gates and 19 inputs.
Ci-x
>\342\226\240
Bi~+
o-
=D-
A,-
rf>
On
^O
^
pD l~
)E>*
CM
t=Q
618
Section 6.6 Applications to Digital Computer Design 619
So X s1 s2 y M z
0 0 0 0 0 0 0
1 A, 0 1 B, 1 c,.,
1 0 B,
1 1 1
l=i
0 0 0 0 0 0 0 C/., 0
0 0 1 0 B, B, B, B, \302\256
C,., B/C/_1
0 1 0 0 Bt B, CQ B, \302\256
Cf_i BjCj.i
0 1 1 0 1 1 1 c\342\200\236 c,_,
10 0 A, 0 A, A a,\302\256c\342\200\236 AC/-i
10 1 A, B, A,\302\256B, A\302\256 B, A,\302\256B,\302\256 C,., A,B, + AC/-1+ BtC,^
1 1 0 A, B, A,\302\256B, A,\302\256B, A, \302\256
B, \302\256
C,_i A,B, + AC/_, + S/C,.,
1 1 1 A, 1 A, A, A,\302\256C/_1 A, + C/-i
620 Chapter 6: BooleanAlgebras
Note that there are 16possible micro-operations for two logic operands
and only 8 of them are available in the ALU. the two important
In fact,
logic operations AND and OR are not generated in this ALU. By
providing a fourth control line it is possibleto includethesefunctions.
The arithmetic operations are derived from Table 6-3and the
conditions of Table 6-4.
In each case, a parallel binary adder composed of full-adder circuits is
used, but someof the input lines are either missing or complemented.
Thus, in row 001, input A is missing because all the x inputs of the
full-adders change to zero by selection line S0.The output function for
this condition is F = B when Cx
= 0 and F = B + 1 when C0
= 1. In row
010, input A is changed to zero and all B inputs are complemented soF =
B when C0 = =
0 and F B + 1 when C0 1. In row 110,all bits of input B
=
so
are complemented that F generates the arithmetic operation of A plus
the l's complement Boolean of J3. The
for row 111 represents function
1 0 0 1 1 F-B+1 Increment B
1 0 10 1 F=\302\243+ 1 2's complement B
1 10 0 1 F = y\302\273+i Increment A
1 10 1 0 F-A + B Add A and B
1 1 1 0 0 F=A + B A plus 1's complement of B
1 1 1 0 1 F = yi + B+i A plus 2's complement of B
1 1 1 1 0 F= A - 1 Decrement A
Multiplexers
A multiplexer is a digital system that receivesbinary information from
2n lines and transmits information on a single output line. The one input
line being selected is determined from the bit combinationof n selection
lines. It is analogous to a mechanicalor electricalswitch, such as the
selector switch of a stereo araplifer,which selects the input that will drive
the speakers. The input can come from either phono, tape, AM, FM, or
AUX linesworked by the position of the switch. An example of a 4 x 1
multiplexeris shown in Figure 6-22. The four input lines are applied to
the circuit but only one input line has a path to the output at any given
time.
The selection lines Wx and W2 determine which input is selectedto
have a direct path to the output. A multiplexer is also known as a data
selector sinceit selectsone of multiple input data lines and steers the
information to the output line. The size of the multiplexer is specified by
the number of its inputs, 2n. It is also impliedthat it has n selection lines
and one output line.
Clearly the function of the multiplexer is in gating of data that may
4XI
fO i
\342\200\242
Inputs MUX Ouiput
2
/.\342\200\224*-
3
O-i FK, ^2
m>~ Select
/,\342\200\224*-
wx w2 F
\342\202\254>
0 0 /o
0 1 A
A
1 0 /2
1 1
/3
2\"-l
t-0
F- ro</,
\302\243
- Wx W2 W3/0 + Wt W2 W3/1 + Wx W2W3/2
'+ ^1^2^3/7.
*1 x2 x3 F *1 x2 F
0 0 0
\302\260) 0 0 0
0 0 1
o]
0 1 0
\302\260) 0 1 *3
0 1 I ij
1 0 0
') 1 0 1
\\ 0 1
l]
1 1 0
'] 1 1 *3
1 1 1
o)
MUX
A k
F - xx x2 + xx x3 + x2
\302\243i x3
624 Chapter 6: BooleanAlgebras
which implies a network of three AND gates and oneOR gate. Thus parts
of more than one IC areneeded for this implementation. In general, the
multiplexer approachis moreattractive for functions that do not yield
simplesum-of-products expressions. Of course, the relative merits of the
two approaches should be judged by the number of ICs neededto
implementa given function.
Minterm X\\ *2 *3 F
0 0 0 0 0
1 0 0 1 1
2 0 1 0 0
3 0 1 1 I
4 I 0 0 0
5 1 0 1 1
6 1 1 0 1
7 1 1 1 0
\342\226\272F
k>
ten
Function table
\\e
w Output F
1 X all O's
0 0 select /
0 1 selectJ
(enable)
(Original output)
(Modified output)
Figure 6-27.
=
Ck Gk + PkC0
where
Gk
=
Gk_x + Pk-iGk-2 + \342\200\242
\342\200\242
\342\200\242
+ Pk-iPk-2 *
\342\200\242
\342\200\242
P2G1
Pk = Pk-lPk-2 * * \342\200\242
P2P1'
technique.
(a) Show that the technique reducesthe carry propagation time.
(b) Show that P, in a full-adder can be expressed by the Boolean
function A, + J5t.
7. Draw the logic diagram of a 4-bit adderwith look-ahead carry. List
628 Chapter 6: Boolean Algebras
the Boolean functions and draw the logic diagram for outputs G5
and P5.
8. Realize the following two functions using multiplexers
and as little
external gating as possible.
(a) fi(xy*,w) = 2^(2,4,6,10,12,15)
(b) f2(x,y,z,w)
= 2ro(3,5,9,H,13,14,15).
1. F =
xy + xz + yz is identicalto the carry.Hence,
o
MAJ -carry
s3 s2 Si So Fi Ft + AiBi Gi
*1 x2 *3 u h f* u
0 0 0 0 0 1
0 0 1 0 0 1
0 1 0 0 0 0
0 1 1 0 0 0
1 0 0 0 1 1
1 0 1 0 1 1
1 1 0 0 1 0
1 1 1 0 1 0
algebra:
(a) xy 4 xy
(b) (x + y)(x + y)
(c) xz + xyz
(d) (TVy) + J5c + y)
(e) x + xy + xy
/\342\226\240
3. Prove the following using the lawsof Booleanalgebra:
(a) xy
= x
+^xy
(b) (x + y) (x + y) - x
(c) x(x +y) =xy_
(d) xy2 + xy + xyz = y
(e) y +
(w\302\243 a;2) + xy - y(a; + jc)
= z
(f) 3cyz 4- 3cyz 4- xyz 4- xy2
1 1 0 0
X 1 X 0
1 X 0 0
630 Chapter6: Boolean Algebras
10. Using full-adders only design a circuitthat will output the sum of
the switching variablesxux2,x3,and x4.
11. (a) Show that the set {F,G}is functionally complete where
F(x,y) = x\342\200\224*
y
= 3c + y is the implication function and G(x) =
x is the negationfunction,
(b) Showthat {HyK} is not functionally complete where H(x,y) -
x *-* y is the function that outputs 1 iff x and y have the same
value and K(xyy) = x +y\\s the inclusiveOR function.
Network Flows
terminates.
The structural information conveyed by a graph is basically
information indicating which vertices are adjacent and which vertices are
connected by directed paths. Two models of physical systems may be
(a) (b)
Figure 7-1.
Figure 7-2.
Section 7.1 Graphs as Modelsof Flow of Commodities 635
network.
4. Suppose there are 5 girls
Gl9 G2> ..., Gb and 5 boysBu J32, ..., J35.
Suppose, further, that Gx dates Bl9 J32, and J34; G2 dates B2and J33; G3
dates B2; G4 dates J33 and J35; and G5 dates J33, J34, and J35.
(a) Represent this information in a transport network.
(b) Is it possiblefor all 5 girls to go to a party with a boy she usually
dates?
5. Suppose5 personsA, J3, C, D, E belong to 4 committeesClf C2, C3, C4
where Cx - {J3,C},C2
- {A,C,Z>}, C3 - {C,D^B}, and C4 = {A,D}.
(a) Represent this information in a transport network.
(b) Isit possibletoselect4 chairpersons for the committees where
no person chairsmorethan one committee?
Figure 7-3.
7.2 FLOWS
demands of marketsg,h, and i are met? The total amount of oil available
to a is 20,000 barrels per week. (Thisis indicatedin the graph of Figure
7-l(b) that a has only one incoming edge (B(a) = {S})and the capacity of
this edge is 20.) Since A (a) = {c,/}, c and /are the only recipients of a's oil.
Thus, a could sendall 20,000 barrels to c and 0 barrels to /, exceptfor the
fact that the edge (a,c) has a 12,000 barrelcapacity. Thus, a can send a
maximum of 12,000barrelsto c.Butlikewise a can send a maximum of
16,000barrelsto/. Hence, a could send 16,000 barrels to/and 4,000to c;
or 8,000to/ and 12,000 to c; or 10,000 to / and 10,000to c;and so on.
Although we have not begun to considerhow b could distribute its oil,
we alreadyseea largenumber of potential plans. Let us begin to organize
our thoughts concerning this problem, and as we proceed we will beginto
seethe basic of the ideas concept of flow.
Let us labeledges with two numbers, first the capacity of the edgeand
second the amount of flow through that edge.We will make two rules:
(1) The amount of oil transported along any edge cannot exceed the
capacity of that edge.
Section 7.2 Flows 637
(2) Except at the sourceS and the sink D, the amount of oil flowing
into v must be equal to the amountofoil flowing
a vertex out of the
at an intermediatevertex.)
vertex. (Thus, no oil gets \"stored\"
edges (c,e) and (c,d) are 10 and 7 respectively, we c can send out a
see that
maximum of 17,000barrels.Thus, since no be stored at c, c can
oil can
receiveat most 17,000 Since c has barrels. been chosen to receive4,000
barrels a, c can receive at most 13,000barrels
from b. Let us make from
developed:
a% 06,16)^/08.16^
(12,0)/ (17, 0)y
(20, 16)
h (30,
1^(10, 10), ttXd5, 10)r 10)^
(20, 20)
-\342\226\272\342\200\242 *\342\226\240\342\200\242
,
<
(13, 13) d (30, 20)
Figure 7-4.
638 Chapter 7: Network Flows
the sink D.
Thus, 2yEMx)F(x9y) is the flow out of x and 2zE~B{x)F(z,x) is the flow into
x. Moreover, the net flow out of a vertex x is defined to be
2yeA(x)F(jc,y)
- net flow into x is, of course,
2zEBix)F(z,x), while the
2zeb(x)F(z>x)
~
2yeA(x)F(jc,y). Thus, conditions (ii) and (ii')assurethat
for an intermediate vertex x the net flow out of x equals the net flow into
x, and this common value is zero.In otherwords, no flow is either created
or destroyedat an intermediatevertex.
Frequently, condition (ii) or (ii') is referred to as the conversation
equation.
Condition (iii) insures that the flow moves from sourceS to sink D and
not in the reverse direction.
Note that every transport network has at least one flow, namely, the
zero flow, where F(e) = 0 for each edge e E E(G). Another exampleof a
flow is depicted in Figure 7-5. We still follow the convention of labeling
each edge e as (k(e),F(e))where k(e) is the capacity of e and F(e) is the
flow along e.
Note the zeroflow into the source S along the edge (6,S).While it is
true that for each intermediate vertex x> the flow into x equals the flow
out of x, we only illustrate this fact for the vertex e. The flow into e is
Section 7.2 Flows 639
Figure 7-5.
F(a,e) + F(cye)
= 2 + 2 = 4, while the flow out of e is F(eyD) + F(eyd)=
2 + 2 = 4.
The flow along edges (S,a) and (aye) is actually equal to the capacity.
Such edges are said to be saturated; all other edgesof Figure 7-5 are
unsaturated. If an edge e is unsaturated, then we define the slack of e
in a flow F to be s(e) = k(e) - F(e).Therefore, the slack of edge (eyD) in
Figure 7-5is 8 while the slack of edge (d,D) is 2.
Note further that in this example the flow out of the sourceS is equal
to F(S,a) + F(SyC) = 4 + 2 = 6, and this, in turn, is equal to the flow into
the sink D. That this is always the case will be proved later, but first we
g(X,Y) = 6.
640 Chapter 7: Network Flows
g(V(G),X)
= 2xeJrf(V(G),x) = 2xEXg(B(x),x). Thus, if g is a flow
function, then g(V(G),x) is the flow into x arid g(:t, V(G)) is the flow out
of x.
In general if X, Y, and Z are subsets of V(G), then g(X,Y U Z) =
(7.2.2)
- \302\243 F(V(G),x)
x\302\243V(G)
\\F\\
- F^aJ + F(S,a2) + \342\200\242
\342\200\242
\342\200\242
+ F(S,am)
-F(S,V(G))
= F(bl9D) + F(62,D) + \342\200\242
\342\200\242
\342\200\242
+ F(btfD)
= F(V(G),D)
The flow in Figure 7-5 has value 6, while the flow in Figure 7-4 has
value 46.
(2, 1)
Figure 7-6.
642 Chapter 7: Network Flows
ifx = S
\\F\\
(c) a
>D
Figure 7-7.
(5,2)
\342\200\242
D
(a) (b)
>D '\342\200\242D
(e)
\342\200\242D
(2,2)
(3,3)
(d)
(3,3) (4,3)
Section7.3 Maximal Flows and Minimal Cuts 645
(4,3) (5,4)
(b) S^J^
(5, )
Label the planes Plf P2> P& P* and P5 whose capacities are 9,8,6,4,
and 3 respectively.Thennotethat no plane can have more than 7
units of equipmentsinceno 2 units of the same kind are to be in
the same plane. Therefore even though Px 9 and 8
and P2 can carry
units, the maximum they can carry, is 7 units.
in fact, Thus,the 5
planes can carry at most 7 + 7 + 6 + 4 + 3 = 27 units of
equipment. Sincethere are a total of 4 x 7 = 28 units, no such
loading is possible.
(a) 0
(b) 8, maximal flow
We saw in Sections 7.1 and 7.2 that the solution of many practical
problems requires finding a maximal flow for a network. Sometimes, as in
Example 7.2.2,a maximal flow can be found quite easily by inspection.
Other problemsaremore difficult.
a% \342\200\224 \342\200\224\342\226\272
b
m W-W (I
\342\200\224S
<7'5)\\ \302\273
yC(>,5)
b%
5 (5,5) \342\200\242d
(a)
Figure 7-9.
in Figure 7-9(a),
Tx = k(S,a) + k(S,b)
- 8+ 7 - 15
T2-*(c,D) +AW,D)
-7 + 6-13.
Isis patent that the value of any flow cannot exceedthe smallerofthese
two values. Thus, |F| < 13 for any flow F. There are, however, other
limitations on the values of a.flow. For example, it may be that some
edgesare unreliable, and if \"enough\" of these edges fail, then we will not
be able to transmit the desiredflow. Consider, for example, the edges
(a,c) and (b,d) in Figure 7-9. If these edges were removed from the
The flow out of the source and the flow into the sink are nowhere near
capacity. Nevertheless,the \"bottleneck'' edge (c,d) is saturated, and
therefore the flow illustrated is a maximal flow. Of course,the examples
of flows shown in Figure 7-11 are also maximal flows in the same
transport network.
Section7.3 Maximal Flows and Minimal Cuts 647
(7, 1)
D
(20, 1). b (4, 1) c (2,2) d (5, 1)
Figure 7-10.
but^D X,
(\302\243 Let X denote the complement of X in V(G). Then the set
(XyX) of all edges from a vertex in X to a vertex in X is calledan S-D
cut.
k(C) Z k(e).
e\302\243C
e
(7,0)
\342\226\272
\342\200\242D +\302\273*D
(20, 2) b (4, 2) c (2, 2) d (5, 2) (20, 0) b (4, 0) c (2, 2) d (5, 0)
(a) (b)'
Figure 7-11.
Chapter 7: Network Flows
caution that there may be_edgesfrom X to X but they do not enter into
the computation of k(X,X).
Specifically, the cuts with smallest capacities are critical. Thus, we call
an S-Dcut (X,X) a minimal cut if there is no S-D cut (YtY) such that
k(Y,Y)<k(X,X).
In the following example of a transportnetwork, there are 4 vertices
other^ than the source and sink. Therefore, there are 24 = 16 S-Dcuts
(X9X) since any subset of {a,6,c,d} together with S forms a possible
choice for X.
{S,a,bfd\\ {c,D} 14
{S.a.c.d} \\b,D\\ 22
{S,btctd\\ \\a,D] 13
{S,a,b,c,d} \\D\\ 10
Figure 7-12.
Section7.3 Maximal Flows and Minimal Cuts 649
F(X,V(G))
- F(V(G),X) - Y. F(x,V(G))- F(V(G),x\\
xEX
- F(S,V(G)) - F(V(G),S)
+ J2 F(x,V(G))- F(V(G),x)
x\302\243X\\S
Butforx${SJ)}
F(x,V(G))-F(V(G),x)=0
F(S,V(G))-F(V(G),S)=\\F\\.
Thm,F(X,V(G))-F(V(G),X)=\\F\\._ _
Moreover, F(X,V(G)) - F(X,X U X) =_F(X,X) + F(X,X)jiiice
Xf1X = 0. SimilarlyF(V(G),X) - F(X U X,X) = FiXJC) + F(X,X).
Therefore, F(X,V(G)) - F(V(G),X) simplifies to F(X,X) - F(X,X).
If_we
define the net flow across the cut (XJC) as F(X,X) -
F(X,X), then we see that the value of any flow is_equal to the net flow
across any S-D cut (X,X). We may think of F{X,X)asthe flow out of X
andF(X,X) astheflowintoX. _
Now|F| - F(X,X)
-
F(X,X) < F(X,X) sinceF(y,x) > Ofor anyy G
650 Chapter 7: Network Flows
cut. \342\226\241
In truth, methods (1) and (2)arenothing but special cases of_(3), for in
(1) the total flow out of S equals the net flow across the cut (X,X), where
X ==JS}. Moreover,thetotal flow into D equals the net flow across the cut
(Y, Y), where Y ={!>}.
From this theorem we can readily see that if F* is a maximal flow and
F(X,X) = 0).
-
\302\243 F(e)- \302\243 *(e)
e\302\243(X,X\") e\302\243(X,X~)
-A(X,X)
since F(e) < fe(e) for each edge of (X,X). But then subtracting k(X,X)
from the above inequality gives 0 > 2Ve{x~,x) F(e'). But sinceF(e') > 0 for
each edgee' by definition of a flow, we conclude that
2^e(x;X) F(e') - 0
and F(e') = 0 for each edge e'E (X,X).But then
fe(X,X)_= Sc\302\243(x^F(e)
=
2cG(X^ k (e) implies F(e) = k (e)for each edge e E (X,X). D
Figure 7-13.
This flow is maximal since for X = {S,a,fe}, the cut (X,X) satisfiesthe
conditions of Corollary 7.3.2.
652 Chapter 7: Network Flows
Figure 7-14.
Figure 7-15.
\342\200\242
D
Figure 7-16.
jobs\342\200\224jj j*2 J3> and./V Allen has the skillto perform jobs j itj2t
andy3. Baker can do jobsjx andj2.Case can do jobs j2 and j3,
while Dunn can only do job j4. We wish to either assign the
peopleto the
jobs so that all jobs can be donesimultaneously
or state the assignment is impossible.It is assumed
that that
maximal flow,
(b) Suppose that 4 people, 2 carpenters,a plumber, and one
person who is qualified as a carpenter
and as a plumber, apply
for 4 job openings,onein carpentry and three in plumbing.
(1) Explain why the 4 jobs will not allbe filled.
(2) Formulate this as a flow problem as in (a) and find a
maximal flow.
>D
Figure 7-17.
654 Chapter 7: Network Flows
Figure 7-18.
.(c) The verticesin Figure 7-18 represent teachers tiyt2ftZytAy and t5,
and students Si,s2,s3,s4>and s5 at an academy.The edge(tifsj)
indicates that the student s; would liketo be taught by teacher
\342\226\272
\342\200\242D
Figure 7-19.
than the minimum over a subset of that set. Prove that, in fact,
\342\200\224
rrti m2.
a (2, 0) a c (4, 0)
\342\200\242 \342\226\272\342\200\242D
(8,6)
Figure 7-20.
Figure 7-21.
14. (&) Let ici and ir2 be two partitions of a set with n elements, both of
which contain exactly r disjoint nonempty subsets. State a
necessary and sufficient conditionfor the possibility of
selectingr of the n elements such that the r disjoint subsetsin irx as
well as the r disjoint subsets of tt2 are represented,
(b) The integers 2,3,.. .,20,21are partitioned into 4 disjoint
subsets according to their remainders upon division by 4. They are
also partitioned into 4 disjoint subsets according to the
number of prime factors they contain (counting multiplicity),
namely {{2,3,5,7,11,13,17,19}, {4,6,9,10,14,15,21}, {8,12,18,20},
{16}}. Is it possible to select 4 integers such that there is a
representative for each possible remainder modulo 4 and a
representativefor each possible number of prime factors?
15. A company advertises for a carpenter, a mechanic,a plumber,and
an electrician*The company interviews four applicants. The first
is a plumber and a carpenter,the seconda mechanic and an
electrician, the third a mechanic,and the fourth a carpenter and an
electrician. Can the jobsbefilled by these four applicants?
16. At a party, there are 6 girls and 6 boys. Girl Gx know boys BuB2,Be;
girl G2 knows B2 and B5; girl G3 knows B2fB3,B4;girl G4 knows
BUB3,B5; while girls G5 and G6 know Bl9B6 and B2yB3yB4yB5
respectively. During a single dance, can each girl dance with a boy she
knows?
17. Let E bea setand AlfA2y.. .,An are n subsets of \302\243
(these sets need
not be disjoint). If we can choosen distinct elements cii,a2t.. .,a\342\200\236
where at \302\243
At for each i> then we say that we have a system of
distinct representatives. For instance, the sets At may be
different clubs,and it may be that all of the members want to send
a system.
(c) Ax =
{a,d}, A2 = {a,6,c,d,e}, A3 = {d}, A4 - {a,d}
(d) Ax =
{a,6,c}, A2 - [bfd>e},A3 - {a,c}, A4 - {6,c}, A5
= {c}
(e) Ax = {6,d,e},A2 - {a,e}, A3 = {c,d},A4 = {cyd\\
(4,3)
Figure 7-22.
6. First, remove all edgesof C to obtain a graph if. Then define a set
X of vertices v of G such that there is a directed path from S to v in
if. The complement X of X is all verticesof G that cannot be
reached via a directed path from S in if. Thus^D E X sinceCis an
S-D disconnecting set^The
set of edges (X9X) is_ therefore a cut.
Now observe that (X9X)C C.For if (x9y) E (X,X) and (*,y) \302\243 C,
then in if, there is a directed path from S to y. This directed path is
(X,X) is a
disconnecting set C, then C contains another cut
(i) A set A of numbers with an upper bound has a least upper boundL
and this numberL is the limiting value of a sequence {an} of
If these facts are not familiar, the reader must take for granted the
existenceofa maximal flow and proceed to the proof of (3).
Here will sketch thewe (2). Since the value of all flows is less
proof of
than or equal to the capacity any cut in G, the set 7 of all values
of of
flows in (G,k) is bounded above.Let Vhe the least upper bound of 7. Let
FlyF2y^ \342\200\242 be a sequence
./n>\302\253\342\200\242
\342\200\242 of flows so that the limit of the values | Fn \\
isV.
We indicate how to construct a flow with value V. For each edge (x,y)
considerthe flows Fn(x,y) for all possible n. The sequence of numbers
There are two basic ways to increase the value of flows, that is, two
basic ways to move more of a commodity toward the sink.
(i) If an edge is not being used to capacity,we could try to send more
of the commodity through it.
(ii) If an edge is working against us by sending some of the commodity
back toward the source, we could try to reduce the flow along this
edge and redirect in a more practicaldirection.
k(a,d) - F(ayd)
= 6-0 = 6
and
k(dyD) -F(d,D)=6-3 = 3,
a (3, 3) c
\342\200\242 \342\226\272
\342\200\242
b (3, 3) d
Figure 7-23.
662 Chapter 7: Network Flows
(3, 3) c
Figure 7-24.
k(c9D) - =
FfaD) 6-3 = 3
Figure 7-25.
Section7.4 The Max Flow-Min Cut Theorem 663
Repeated application of
this \"greedy\" method produced a maximal
flow in But unfortunately this technique doesnot always
Example 7.4.1.
produce a maximal flow, as indicated in the following example. In fact, in
the next example,thereareno S-D paths made up of unsaturated edges,
soin this case,we take an alternative approach at increasing the value of
the flow by actually decreasing the flows along certain edges that may be
working against thetotal flow.
Figure 7-26.
664 Chapter 7: Network Flows
F{S,b)+ F(a,6) =
F(b,D) and
to avoid decreasing F(b,D) and F(S,a). Hence, the value of the flow can
be increased by increasing F(S,b) by t, decreasing F(afb) by tt and
so (S,6) and (a9D) can be increasedby the minimum of {2,3}. Hence, t < 2.
Moreover,sinceF(a,b) a flow cannot take on negative values,
= 1 and
Figure 7-27.
Section7.4 The Max Flow-Min Cut Theorem 665
Figure 7-28.
(c,6), and the slack of (c,D), sowe increase the flow along (S9b) and (c,D)
by 2 units and decrease the flow along_(c,fe)by 2 units to obtain the flow
F2 (Figure 7-30). Now| F21 = 9 = k(X,X),where X = {S,a,M so that F2 is a
maximal flow.
Figure 7-29.
666 Chapter 7: Network Flows
(5,5)
>D
Figure 7-30.
With associate
P, the number e(P) = min \342\202\254t(P). Then note that e(P) is
always a nonnegative number. In particular, the path P is an
F-augmenting path iff e(P) > 0.
For example, if F is the first flow of Example 7.4.1, then the path P^
S-a-c-Dis not F-augmenting because = 0 since
\342\202\254(Pj) the edge (ayc) is
saturated.But,on the other hand, the path P2: S-b-c-Dis F-augmenting
becausee(P2) = 1 (here each edge was an unsaturated forward edge of
p2).
Section 7.4 The Max Flow-Min Cut Theorem 667
= min {s(Syb),F(ayb)ys(ayD)}
= min {2,1,3}= 1.
The S-a-c-D,
path in Example
P: 7.4.3 was F-augmenting because
e(P)
=
path Px: S-b-c-D is Fraugmentingbecause
1. The = 2.
\342\202\254(PX)
Now we have the machinery and terminology to state and prove the
following lemma.
+ ifx = S
f |F| \342\202\254(P)
0 ifx^SorD.
that (a) holds,note that F(e,-) 4- e(P) < /e(et) for each forward
To see
edge P since by definition e(P) < s(et) = fe(ej)
ei of
-
P(ei). Likewise,
F(ei) - e(P)> 0 for each backward edge et since e(P) < P(et).
To prove (b), observe that we need only check for vertices x on P
because for all other verticesF and F are equal. Furthermore, if x = vt is
668 Chapter 7: Network Flows
on P, recall that only on the two edges e, and ei+x touching vt do we change
the flow. If the edgeeM = (viyvi+1) is a forward edge of P, then F(ei+1)=
F(ei+l) + e(P). On the other hand, if ei+l
- (^+1,1;,) is a backward
edge of
decreasing the net flow out of v( by c(P). Thus, the net flow out of v{ is 0 +
e(P) - e(P), which is zero, if i ^ 0 or n; the net flow out of u0 = S is | F\\ +
e(P) and out of un = D is
- \\F\\ - e(P). Thus, F is a flow and its value is
ifi + \342\202\254(p).n
some x E Xk_x and such that y has not already been chosen in
^o>^i>- \342\200\242
->Xk-i*
This process of construction must terminate becausethe number of
vertices is finite. Either we will find D belongs to Xn for some positive
integer n or we will not.
an F-augmenting path.
Section 7.4 The Max Flow-Min Cut Theorem 669
Now we have all the machinery to make the proofof assertion (3) of the
max flow-min cut theoremof Fordand Fulkerson easy.
Suppose F is a maximal flow. By Lemma 7.4.1, F admits no_augmenting
path, so by_Lemma 7.4.2, the network contains^ cut (X,X) such that
=
|F| k(X,X), which means, of course, that (X,X) a minimalcut.This
is
concludesthe proof of assertion (3), and the proof of the theoremis
complete. D
In the of proving
course Theorem 7.4.1 we proved two lemmas that
flow we need only look for improvements of the two restricted kinds
mentioned earlierin the section or in the definition of an augmenting
path. The combination of Theorem 7.4.1and Corollary 7.3.2 gives a
useful characterization of minimal cuts.
670 Chapter 7: Network Flows
Figure 7-31.
Figure 7-32.
Section 7.4 The Max Flow-Min Cut Theorem 671
cuts:
(i) ({S,a,fa,c,d},{D})and
(ii) ({S},{a,fa,c,d,L>})..
Algorithm 7.4.1.
\\Fh\\<\\Fk\\+l*\\FM\\-\\Fk\\ + e(P)*k(XJ[)
for any cut (X,X) and k(X,X) < 2ee\302\243(G)&(e), we can find at most
2e<=E{G)k(e) neW floWS. \342\226\241
Figure 7-33.
Section 7.4 The Max Flow-Min Cut Theorem 673
c (7,6) . d
Figure 7-34.
(7, 7) d
Figure 7-35.
674 Chapter7: Network Flows
Figure 7-36.
c (7. 7) d
Figure 7-37.
saturated and both edges out of c are saturated. Thus, the last indicated
flow is maximal. Of course,we could also argue that this flow is maximal
by observing_that the value of this final flow is 29 and that the capacity of
the cut (X,X)f where X = {S,c} is also 29.
Infact,let us determine all minimal cuts as we did in Example7.4.6. If
(XyX) is a minimal cut, thenjione of the edges(a,/), (e,-D), (bj), (6,e),
(b,d)AS,c) are in (XJf) U (X,X)i. In fact, sinceD G X, it follows that
e G_X, b G_X, / G X, and a G X. Moreover, since S E X and (S,c) $
(X,X) U (X,X), it follows that c <E X. Thus, if X = {S,c},then (X,X) is
the minimal
only cut.
A Labeling Algorithm*
*The discussion from here to the end of the section may be omitted.
Section7.4 The Max Flow-Min Cut Theorem 675
Backward Labeling: If, on the other hand, e = (y,x) and F(e) > 0
(sothat (y,x) is a backward edge), then y receivesa label.
In either case, assign y the label x, the name of the previously labeled
vertex to which y is adjacent.(Other information could be included in the
label for y such as an indicator signifying whether e is a forward or a
backward edge, but we shall becontentwith the simpler label.)
The information this labelingsucceeds in conveying is this: since x has
been labeledthereisa F-augmenting path from S to x, and the labelx on
the vertex y indicates that a flow-augmenting path from S to y can be
constructedby first using the flow-augmenting path from S to x and then
using the edge e between x and y as a forward or a backward edge
whatever the case may be. In other words, x is a predecessorof y on a
flow-augmenting path from S to y. We use the notation Pred(y) = x to
indicatethat y has been labeled with the label x and a flow-augmenting
path exists from S to y
By referring through x.
back to the proof of
Lemma7.4.2,we x is labeled, x belongsto somesetXk_x for
see that since
some k and then the possibilityof labeling y means that y G Xk.
As in the proofof Lemma7.4.2 two cases present themselves: either the
sink D receivesa labelor not. If D receives a label, then a flow-
augmentingpath from S to D is possible and the labelon D indicates the
predecessor of D on sucha path.A flow-augmenting path can be found by
using the vertices W0
= D,
Wly - Pred(D), W2 =
Pred(Wi) - Pred
(Pred(D)), and soon until eventually we find Wk = S = Pred( W*_i) as the
predecessor of some vertex Wk_x in the sequence. Of course, should we
discovera flow-augmenting path P we can easily determine the amount
e(P) by which we augment the flow F to producea flow of larger value.
If, on to give
the other hand, it is impossible D a label, then the present
flow F is maximal and the set X of all labeledverticesis such that (X,X)
is a minimal cut.
676 Chapter 7: Network Flows
1. Label source the S with <t> (to indicate that S has no predecessor).
2. If the D is sink labeled, go to Step 5.
3. (Choosea vertex to vertices have been
be examined.) If no
examined, choose the choose the vertex vt of smallest
source v0; otherwise,
index i Seti\\ = x and go to Step 4. If
which has not been examined.
no unexaminedverticesareavailable, stop.
4. (Examination of a vertex.) For j = 1 to n, do the following:
If Vj
is labeled, continue. But if Uj
is not labeled and can be, label vj
with the label jc. Set Pred(u;) = x. Return to Step 2.
5. If Pred(D) = u, let W0 = D, Wx
- v, W2 - Pred(u). Continue
until Wk
= S for some k. Then a flow-augmenting path is S =
WkfWk-l9...fWuW0-D.
a (4, 2) b
\342\200\242 \342\226\272
o.
Figure 7-38.
(a)
678 Chapter 7: Network Flows
(b)
(3,0) \\D
(4. 0) /
(c)
>D
(d)
\342\200\242D
(e)
<D
*-\342\200\242
b d.O) d
Section 7.4 The Max Flow-Min Cut Theorem 679
(f) (g)
*->D
V (5,0) D
\342\200\242
(4, 0) /
(h)
Figure 7-39.
680 Chapter7: Network Flows
Figure 7-40.
Figure 7-41.
Y={Syayc},Z={S,a\\.
(b) a (4, 4) c
(c)
(a) If Ft and F2 are flowsjn (G,k) such that Fx(e) = F2(e)for each
edge e in (XfX) U (X,X), then F1and F2 are maximal flows.
Section7.4 The Max Flow-Min Cut Theorem 683
Figure 7-42.
(b) If Fx and F2 are maximal flows, then Fx (e) = F2(e) for each
edgee\302\243(X,X) U (X,X).
12. Suppose that (Gyk) is a transport network with integer edge
capacities. Suppose further that ex
=
(iV->i)> ^2 = (vi9v2)9 \342\200\242 =
\342\200\242
^k
cut.
a (6, 4) c
Figure 7-43.
(d) Augment the flow by 2 units along S-c-e-D and then by 1 unit
3. Not possible, a maximal flow has value 50. For example, use paths
S-a-d-f-i-Dy S-a-d-g-i-Dy S-a-d-e-g-i-D, S-b-e-h-j-D, S-c-e-h-j-Dy
S-b-a-d-e-h-j-D.
Figure 7-44.
686 Chapter 7: Network Flows
other case.
9. See Ford and Fulkerson's book, Flows in Networks [48] page 13.
10. Introduce a source and a sink; make the capacity of each edge 1.
Find a maximal flow. A = {aua3,a6,a9} is such a set.
conditions can all the girls be married provided no girl is married to a boy
she doesnot know?
All of these problems can be dressedup in many different costumes,
but there are certaincommon elements in all of them. Let us attempt to
of
get at the essence the problems with the following definitions.
(i) for each vertex a E A0 there is exactly one vertex 6EB0 suchthat
the edge (a,6) E M. Moreover,
(ii) for eachvertex b E B0, there is exactly onevertexa E A0 such that
(a,b) E M.
Figure 7-45.
Section 7.5 Applications: Matching and Hall's Marriage Theorem 689
F(S,a) = 1,or in other words, the flow into a is 1.Moreover, since the flow
out of a is 1 and F(a,b)
= 1, (a,b) is the only edge of the form (a,x) for
which F(afx) = 1. Similarly the only edge of the form (x,b) such that
F(x,b) = 1isthe edge(a,6).Thus, if M = {edges (a,6) where a E A and b
(E B and F(a>b) = l}, thenthe edges of M have no vertices in common and
M is a matchingfor G.
Parts (b) and (c) follow immediatelyfrom the fact that the number of
verticesof A matched with vertices of B is the value of the flow F.
Of course, sincea maximalflow produces a maximal matching, we can
apply the flow-augmenting path algorithm to the matching network and
determinea maximal matching. \342\226\241
Complete Matchings
and
Cut(X, X) _^
/ edges
of type II
m-5 edges
of type I
edges of
type III
Figure 7-46.
Section 7.5 Applications: Matching and Hall's Marriage Theorem 691
R(C) Pi {bt+l9.. .,fej. The number of edges of type III is just | W2 |. Note
\\W1\\^tand\\W1\\ + \\ W2\\
= \\R(C) | > s implies| W2\\ > s - t. Therefore,
k(XyX)> m sincethe sum of the number of edges of types I, II,and III is
greater than or equal to (m - s) + t + (s - t) = m. \342\226\241
\\C\\. \342\226\241
Thus, committee
in problem, if each committee has at least k
the
members individual
and is permitted to belong to more than
no k
3. Applicant A is qualified for jobs Jl9 J2, and J6; B is qualified for
jobs J3, J4, </5, and J6; C is qualified for jobsJx and qualified J5;Dis
for Jl9 </3, and J6; E is qualified for Jl9 J29 </4, J6> and J7; F is
qualified for J4 and J6; and G is qualified for J3, Jb9 and J7.
11. If every girl in school has k boyfriends and every boy in school has
k girlfriends,is it possiblefor each girl to go to the schooldance
with one of her boyfriends and for each boy to go to the dance with
bub2,.. of B
.,6\342\200\236 corresponding to the columns of M. Inthe graph G,
let there be an edge from a, to 6; iff the entry in the ith row and jth
column of M is nonzero.
(a) Interpret what a matching means in this context.
(b) Expand to a matchingnetwork (G*,k) and interpret the
meaning of a minimal cut in (G *,&).
(c) Prove the Konig-Egervary Theorem: In any matrix, the
maximum number of nonzero entries such that no two are in the
same row or column is equal to the minimum number of rows
and columns that between contain all them
the nonzero
entries.
|C|-|/?(C)|<l/5|C|<2since|C|<10.Sinced(G) = max{|C|-
\\R(C)\\},d(G)*2.
19. SeeLiu [26] p. 289.
21. See Bondy and Murty [4] pp. 203-204.
(a) m _
(b) F(X9X) and k(X,X)for X = {S9a}9 and
A to B: 15 minutes
A to C: 30 minutes
B to D: 15minutes
C to D: 15 minutes
A to B: 1000 vehicles
A to C: 2000 vehicles
B to D: 3000vehicles
C to D: 2000 vehicles
**\342\200\242\302\243>
Figure 7-47.
Section 7.5 Applications: Matching and Hail's Marriage Theorem 697
(15,15)
Figure 7-48.
Representation and
Manipulation of
Imprecision
699
700 Chapter8: Representation and Manipulation of Imprecision
F = mF(wi)/t/i + \342\200\242
\342\200\242
\342\200\242
+ mF(un)/un
lubmF(u)
= 1.
uEU
A C B \302\253-
mA{u)
< mB(u), u E U. (8.1.4)
S(u;a,b,c)
= 0 for u < a
for a <u<b
\\c
- a]
(8.1.5)
for b < u < c
\342\200\224(H)1
= 1 for w > c
where the parameters a and c are the lower and upper fuzzy subset
interval bounds, respectively,and the parameterb = (a + c)/2 is the
crossover point, that is,the value of u at which S(u; aybyc) = 0.5.
Using the S-function, the fuzzy subset WARM can be subjectively
characterized by the membershipfunction mAl(u)
= S(u; 60,70,80) or
mA2(w)
= S(u;
45,60,75) where mAl(u) was given by a person from Florida
whereas a person from Maine expressed the concept of \"warm\" by
mA2(u). Figure 8-1 shows the graphs of membership functions mAl(u) and
mA2(u).
Notice that mAl(70) = 0.5 whereas
mAa(70) = 0.9 with the interpretation
that the degree of agreement with the statement \"70\302\260F is warm\" would
be 0.5 for the personfrom Florida as compared to 0.9 for the personfrom
Maine.
The crossover points for mAl(u)
and mA2(u) are 70 and 60,
respectively.
wwurm(w)
mB(u)
= 1 - S(u; 30,45,60)
mB(u) = 1 for u < 30
mc(u)
= exp (~((u - t)/b)2) for all real u. (8.1.6)
=
exp (-((u - 74)/6)2) and
mCl(u)
=
mC2(u) exp(-(U/-68)/12)2).
It can be observed from Figure 8-3 that the Floridian not only likes
Wcold(w)
Wpleasan\302\253(w)
1.0
u Ma(u)
a \342\200\2423
b .6
c .9
d .5
mA(u)
=
]T 1 + (8.1.7)
fcfjr/*
Here the support is the interval [ayc]. mA(u) is a monotonically
function
decreasing with mA(a) = 1, linv.^mA(c) = 0, and the crossover point
being 6.
Letting a = 0, c = oo and b = 10 yields the following definition of the
704 Chapter 8: Representation and Manipulation of Imprecision
SMALL= +
E[l (^)2]\"7\302\273'
u 0 1 3 5 7 10 12 15
SMALL 1 .99 .91 .80 .67 .50 .41 .31
(8.1.8)
(BUT/-
-*<\302\273>-/\342\200\242[>\342\231\246
= 6 <b
(8.1.9)
if a
and
Among the basic operations that can be performedon fuzzy sets are the
following:
~A =
fu [1
- mA(u)]/u. (8.1.11)
A + B= [
Ju [mA(u) # mB(u)]/u. (8.1.12)
The union corresponds to the connective OR. Thus, if A and B are labels
of fuzzy sets, then A OR B is expressedas A + B.
Comment. It should be pointed out that # and & are not the only
operators used as interpretationsofthe union and intersection,
respectively. In particular, when AND is identified with & (i.e., min), it
represents a \"hard\" AND in the sense that no trade-off is allowed
between its operands. By contrast, an AND that is interpretedin terms of
the arithmetic operands,acts a
product of the as \"soft\" AND. Which of
these or other possibleinterpretationsis more appropriate depends on
the applications in which OR and AND are used.
AB= [ mA(u)
\342\200\242
mB(u)/u. (8.1.14)
706 Chapter 8: Representationand Manipulation of Imprecision
- -
wA [ w mA(u)/u. (8.1.16)
Ju
CON(A)=A2. (8.1.17)
The concentration is an interpretation of VERY. Thus, if A is a label of a
fuzzy set, then VERY A corresponds to CON(A).
The operationof dilationis denoted by DIL(A) and is expressed by
DIL(A)=A05. (8.1.18)
If A is a label of a fuzzy set, then APPROXIMATELY A is interpreted as
DIL(A).
C/-1 + 2+...+8,
and fuzzy subsets
then
A H B = .7/3 + .5/6
\" -56/3 + -3/6
ABa (8.1.20)'
A3 = .512/3 + 1/5 + .216/6
.65 - .42/3 .6/4 + + .3/6
respectively, Cartesian
the product of Alv. .,An is denoted by
Ax x \342\200\242 x An and
\342\200\242
\342\200\242 is defined as a fuzzy subset of UXy.. whose
.,\302\243/\342\200\236
x \342\200\242
\342\200\242
\342\200\242
x mAn(ul9.. .,iO = roAl(wi)
& ... & mAn(un). (8.1.21)
mAl
Thus Al x An can
\342\200\242
\342\200\242
\342\200\242
x be written as
\342\200\242
\342\200\242
\342\200\242
f \\mAx(ui)
& & mAn(un)]/(uly.. .,un) (8.1.22)
Ax
= .5/1 + 1./2 + .6/3 and A2
= l./l + .6/2,
then
= + \342\200\242
\342\200\242
\342\200\242
+ (8.1.24)
mA wxmAl wnmAn
is
combination useful in the representation of linguistichedgessuch as
typically,
essentially* etc., which modify the weights associated with components
of a fuzzy set. The weights can alsobe interpreted as coefficients of
importance of the components of a fuzzy set A \"built\" from fuzzy sets
Alv . .,An.
with mHEAVY(70)
= 0.5. Let U2 = \\u2: 50 < u2 < 220} with u2 as height in
centimeters. A fuzzy set A2 labeled TALL may be definedas
<\302\253\342\226\240\302\2
\342\204\242L-rhN^n~7-
with raTALL(170) - 0.5. Then a fuzzy set A labeled BIG may be definedas
a convexcombinationof fuzzy sets HEAVY and TALL, that is, A1 and
A2:
the membership function of the fuzzy set BIG than variations in height.
This is due to greater \"importance\" of the component HEAVY in
determining the fuzzy set BIG using the convex combination of HEAVY
and TALL.
resolution identity
A- fltAt (8.1.29)
Fuzzy Sets 709
or
A - ]T tAt (8.1.30)
t
where tAt is the product of a scalart with the set At [in the sense of
(8.1.16)], and /J (or 2,) is the unionof the At of the At sets, with t ranging
from 0 to 1.
Since (8.1.1)or (8.1.2) may be interpreted as a representation of a fuzzy
set as a union of its constituent fuzzy singletons {mjui), it follows from
the definition of the union (8.1.12)that if in the representation of A we
have Ui = ujf
then we can make the substitution expressedby
Or conversely,
For example,
or
A.! = a + 6 +c+ d + e
A3 = 6+c+ d + e
A5 = c + d + e
A 9
= d 4- e
= e.
Ax
=
K(u) F(l/u;K). (8.1.34)
U=a+b+c+d
A = .8/a + .6/6 .
tf(l)-l/a+..4/6
K(2) = 1/6 + Ala + .4/c.
Then
< Old
More or less old
Age
Table 8-1.
R 1 2 3 4
1 0 0.3 0.8 1
2 0 0 0 0.8
3 0 ,0 0 0.3
4 0 0 0 0
IS CLOSE TO = f e \342\200\224\342\200\224-
(u,v),
R\302\260S=
[ #v[mR(u,v)&ms(vyw)]/(u,w) (8.1.36)
> mR(u,u')
@-transitive iff m^(w,w\") @ mR(u',u\
w ' o a u (8.1.40)
V u,u , u tz U
R+ =R + #2+ \342\200\242
\342\200\242
\342\200\242
+ Rm + . . \342\226\240
,where Rm = R\"1\"1
R\302\260 (8.1.41)
8.1.12)
(Example are weaker than similarity relations.
714 Chapter 8: Representation and Manipulation of Imprecision
Fuzzy set theory has gained its importance as a tool for vagueness
Hence,
{X = u\\
= 1 for 0 <u <5
JPoss
[Poss {X \302\253=
u} = 0 for u < 0 or u >5
where Poss {X = u] stands for \"The possibility that X may assume the
value of u.\"
Now, \"fuzzify\" the proposition p:
pF = X is a small integer
integers as
Poss {X - 2} - .9
Poss {X
= 3} = .7
Poss {X = 4} = .5
Poss {X = 5} = .2
Poss {X
= u) = 0 for u < 0 or u > 5.
q = XisF (8.2.1)
inducesa possibilitydistributionII x which is equal to F, that is,
nx = F (8.2.2)
implying that
Poss {X - u\\
=
mF(u) for all u G U. (8.2.3)
In essence, the possibility distribution of X engenders a fuzzy set
that is,
Px - mP. (8.2.4)
Thus, PxMy the possibility that X = u, is postulatedto be equal to
mF(u).
Equation (8.2.2) is referred to as a possibility assignment
equation because it signifiesthat the proposition \"Xis F\"translatesinto the
g = XisF\342\200\224 nx = F (8.2.5)
where \342\200\224*
stands for \"translates into.\"
More generally, the possibility assignment equation corresponding to a
proposition of the form
\"ATisF\" (8.2.6)
IW) =F (8.2.7)
or,more simply,
nx = F.
q = Tom is old.
X = u:mF(u) (8.2.8)
u 1 2 3 4 5 6 7
Poss{X= u) 1 1 1 .8 .4 .1 0
Prob{X- u] .3 .4 .2 .1 0 0 0
u 10 20 25 30 35 40 50 60
nA{x){u) 0 .2 .3 .5 .8 .9 1 1
concept. Let us adopt the definition that any age over or equal to 60 is
\"old.\"Then,the probabilities
assume the values as shown in Table 8-4.
u 40 50 60 70 80 90 100
ProbA{x)(u) 0 0 .2 .2 .2 .2 .2
720 Chapter 8: Representation and Manipulation of imprecision
The media blitz is on, and hype, is comingfrom all sides. Artificial
intelligence (AI)\342\200\224especially in the form of Knowledge-Based Expert
Systems\342\200\224is now a practical systems (ES) are the
reality, and expert
hottest glamour item in today's high-tech boom. A new programming
technology has been created, based upon\"productionrules\"and
\"knowledgerepresentation.\" The result is a new class of enormously powerful
I Domain Expert 1
] \\ 1
1r 1
f Knowledge
V Engineer
J)
i i
i
j
Domain Inference
Knowledge Engine
Base
h*
X
User
( )
form of statements that are usually, but not always, true. Such a
statement canbetermed a disposition. A disposition contains an implicit
fuzzy quantifier, such as \"most,\" \"almost always,\"\"usually,\" and so on.
In fuzzy logic, fuzzy quantifiers are treated as fuzzy numbers that
represent, imprecisely, the absolute or relative count of elements in a
fuzzy set. Thus the proposition\"Most As are J3s\" means that the
proportion of these elementsis represented by the fuzzy quantifier
\"most\" (see Figure 8-6).
Oncethe fuzzy quantifiers are made explicit, various syllogisms in
fuzzy logic can be employed in order to arrive at a conclusion. For
example, from the statements,\"Most students are undergraduates\" and
\"Most undergraduates are young,\" one could deduce that \"most2
students are young.\" In this case, \"most2\" represents the product of the
fuzzy quantifier \"most\"with itself. As should be expected, the quantifier
\"most2\" in the conclusion is less specific than the quantifier \"most\" in
Section 8.3 Application of Fuzzy Set Theory to Expert Systems 723
Mosr
(5
\302\243
(L)
s Most
\342\226\240^-
Prr\302\273r\\r\302\273rtir\302\273n
0
finding the degree to which a proportion fits into \"most\" and then finding
the degree to which that degree fits into \"most.\" Thus, the value of
\"most\" for a given proportion will be equal to the value of \"most\" for the
Since \"has duodenal ulcer\" is a fuzzy predicate, so that Jim may have it to
a degree,the meaning of the certainty factor becomes ambiguous. More
specifically, does CF = 0.8 mean (a) that Jim has duodenalulcerto the
degree 0.8; or (b) that the probability of the fuzzy event \"Jim has
duodenal ulcer\" is 0.8?Note that in orderto makethe latter
interpretation
meaningful, it is necessary to be able to define the probability of a
fuzzy event. This can be done in fuzzy logic, but not in classical
probability theory.
The computation of certainty factors in nonfuzzy ES is carriedout
when two or more rules are combinedthrough conjunction, disjunction,
1. Representation of impreciseinformation.
2. Derivation of possibility/certainty measures of acceptance.
3. Linguisticapproximations
of fuzzy terms in the query language.
4. Development of fuzzy relational operators (IS,AS... AS,
GREATER,...).
5. Processingof queries with fuzzy connectors and truth quantifiers.
6. Null value handling using the concept of the possibilistic
expected
value.
user.
types:
Reflexivity: s(x,x) = 1
Symmetry: s(x,y)
= s(yyx)
*
p(x,y) >: max {p(x,y) p(yfz)l
y&Di
nonreflexive:g(:c,Jt) =0
e-reflexive:g(x,x) = ey e > 0
reflexive: g(x,x) = 1
1. Fuzzy modifiers.
2. Fuzzy relational operators.
3. Composition.
4. Qualified propositions.
the rule), all of those edges (and their predecessors) are part of the
hyperedge that must be evaluated.Depending on the numerical
formalism (calculus of evidence) used to propagate truth values along the
hypergraph, at an OR-VERTEX some or all of the edgescorresponding
to propositions that are connected by the logical connectiveOR (and
their predecessors) might also require inclusion in the hyperedge,
(((PROPOSITION)(TRUTH-VAL))SUPPORT-PLAUSIBILITY).
The PROPOSITION is any statement in the base rule domain (i.e., a
assign^ the interval [0.6,0.8] to the degree of membership of Jim to the set
of people much olderthan 30.The proposition
((Jimis much older than 30) (age-factor Jim-age))
on the other hand, computes the interval as a function of Jim's age. The
SUPPORT-PLAUSIBILITY term, which has the same format as
asserts that the evidence in the base domain (facts and rules) indicates
that possible truth values for the proposition \" Jim is much older than 30\"
may range from a lowest value of 0.5 to a highest (nearcertainty) value of
0.9.
The INFERENCE-FUNCTION requires as input the AND-VERTEX
representing the clauses in the antecedent of a rule and the interval truth
both A and J3,\" which is also equivalent to \"If D is any fuzzy set
which contains both A and J5, then it also contains the union of A
and J3.\" Prove the above statement.
(b) A H 0 =0
(c)AU(/=(/
(d) A H (7 = A
(e) A U A = U
(f) AH A =
0.
TheNormal Distribution
=
1 ~(x-u)\\ co < X < oo
Wx)
(2^eXP 2a2 )\342\226\240
Section 8.3 Application of Fuzzy Set Theory to Expert Systems 733
The GammaDistribution
fyto
- -jlTT^exp(-^),0<,
0 elsewhere
{(a + ff + 1)!
\342\200\224 - *)*, 0<x
\342\200\236
<1
a! p !
xa(l
[0 elsewhere
fcto \342\200\224
oo < X < oo
7T 1 + C(2(X
- Uf
Appleton-Century-Crofts, 1964.
12. Eisen, M., Elementary CombinatorialAnalysis, New York,
Gordon and Breach, 1969.
13. Even, S., Algorithmic Combinatorics, New York, Macmillan,
1973.
14. Gill, A., Applied Algebrafor the ComputerSciences.
Englewood
735
18. Horowitz, E. and S. Sahni, Fundamentals of Data Structures,
Woodland Hills, Calif.,ComputerScience Press,1976.
19. Horowitz, E. and S. Sahni, Fundamentals of Computer
Algorithms, Woodland Hills, Calif., Computer Science Press, 1978.
20. Honsberger,
R., Mathematical Gems, The American
Association
Mathematical of America, 1973.
21. Kenelly, John W., Informal Logic, Boston, Allyn and Bacon,
1967.
22. Korfhage, R. R., Discrete Computational Structures, New York,
Academic Press, 1974.
23. Knuth, D. E., The Art of Computer Programming, Vol. I:
Fundamental Algorithms, Reading, Mass., Addison-Wesley, 1968 (2nd
ed. 1973).
24. Levy, H. and F. Lessman, Finite Difference Equations, New York,
Macmillan, 1961.
25. Liu, C. L., Elements of Discrete Mathematics, New York:
McGraw-Hill, 1977.
26. Liu, C. L., Introductionto CombinatorialMathematics,
New
Sons, 1962.
35. Reingold, E., J. Nievergelt,and N. Deo, Combinatorial
Algorithms, Englewood Cliffs, New Jersey, Prentice-Hall, 1977.
36. Riordan,J., Combinatorial
Identities,New York, John Wiley and
Sons, 1968.
37. Stanat, D. F. and D. F. McAllister, Discrete Mathematics in
Computer Science,EnglewoodCliffs, New Jersey, Prentice-Hall,
1977.
Bibliography 737
Directed graphs (Contd.) Double negation, law of, 40 Education stage of development,
isomorphic, 334-335 Dual graph 21
labeling, 632-633, 636 of a plane graph, 526-527 Efficiency of algorithms, 404-407
loop-free, 333 vertices of, 569 Egervary, 689
Menger's Theorem,695 Dualofaposet, 370 EKB, see Explanatory knowledge
networks, see Networks base
nontrivial path, 388-389 Elements (Euclid's), 20
paths, see. Paths in graphs Elements
reflexive, 339, 340 Economy tree, 486 of an argument, 19-20
simple, 333 Edge cut-set, 654-655 of a set, 1
simple path, 388 Edge labeling of a graph, 444 Empty set, 4
strongly connected vertices, Edge-disjoint paths, 442 Endpoints of a path, 388
391-392 Edges of graphs Enumeration
symmetric, 339, 340, 438 adjacent to, 333 ordering of strings, 375
transitive, 339-340 backward, 666 of sets, 367-368
transport networks, see between vertices, 437 topological, 428-432
Networks bridge, 472, 541 (-reflexive general fuzzy relation,
unilaterally connected vertices, capacity constraint, 638 726
391-392 capacity of, 633-634,647-648 Equality
vertices, see Vertices of graphs circuit, 388 ^of generating functions, 240
viewed as nondirected graphs, complete matching, 687, 689- of sets, 4
438-439 691 Equivalence class, 350-351
weakly connected vertices, 391- contracted, 494 canonical representative, 356
392 conversation equation, 638 for integers, 354-358
seealso Graphs cross,483 Equivalence relations, 340
Directed multigraph, 333 crossovers,523 defined, 350
Directed path, 388 cube,458 equivalence class, 350-351
Directed spanning tree, 480 cut edge, 472 on integers, 354-358
Directedtrees,468-470,
498-504 cut-set, 654-655 on sets, 11
full, 506 cycle, 388 Equivalences of expressions, 85-86
ordered, 517 defined, 332 Equivalent propositional
regular, 505 - a diagonal, 548 functions, 38
^
thin, 506 disconnecting set, 654 Equivalent switching mechanisms,
Disconnecting set of edges,654 dodecahedron, 458 596
Discovery, aspects of, 21-22 edge cut-set, 654-655 Equivocation, fallacy of, 28
Disjoint sets, 5, 211 endpoints, 388 Eratosthenes (Sieveof), 224-225
Disjunction flow across, see Flows in ES,seeExpert systems
in Boolean algebras, 591-592 Networks Euclid, 20
in expert systems, 724 forward, 666 Euclidean algorithm, 78,117
of propositions, 34 hyperedges, 728-731 Euclidean plane, 15
Disjunctive counting, 126-132 icosahedron, 458 Euclidean prime, 118
Disjunctive normal form for incident from, on, to 333, 439 Euclid's Elements, 20
Boolean expressions, 591-592 joining vertices, 437 Euclid's Lemma, 360
Disjunctive syllogism,49 labeling, 632-633, 636 Euler, Leonhard, 535
Disposition, 722 left, in binary tree, 507 Eulerian circuit, multigraph, path,
Distinct representatives, system loop, 333, 437 537\342\200\224539
of, 657, 686 matching, 687, 688-689 Euler's formula, 530-532
Distinctive-shape logic symbols, maximal matching, 687 Euler's 0-function, 225-226
601-602 minimal cut, 645-652 EXCLUSIVE-OR function, 602,
Distribution, possibility, 715-720 multiple, 333 603
Distributive laws for sets, 5 multiplicities, 535-536 Existence proofs, 87-88
Divide-and-conquer relations, 285, nondirected path, 388 Existential generalization, 99
321-322 octahedron,458 Existential quantifier, 83-87, 89-
Divisibility tests, 359-360 platonic solids, 458 91
The Division Algorithm, 64 reverse, 666 Existential specification, 98
Division of formal power series, right, in binary tree, 507 Experimentation stage of
247-251 saturated, 639 21
development,
Dodecahedron
S-D cut, 647-651 Expert systems (ES), 720,722,
edge graph of, 458 self-loop, 437 723-724
Hamilton's game, 543 simple path, 388 diagram, 721
slack of, 639 see also \"Soft\" expert systems
Domain
of relation on a set, 10-11 tetrahedron, 458 Explanatory knowledge base
in the FRKB, 725
tree, 483 (EKB), 725-727
unsaturated, 639 The Extension Principle, 714
\"Don't care\" conditions, 609 vertex covering of, 695 Exterior region of a plane graph,
\"Double hashing\" algorithms, 357- Edison, Thomas A., 18 525
358 Edmonds, 671 \"Extraordinary\" sets, 9
Index 743
Generating functions (Contd.) Havel-Hakimi result, 447 \"Greedy\" method for increasing
equivalent expressions for, 290 hypergraphs, 728-731 flow, 663
linearity of, 257 icosahedron, 458 Grinberg's theorem, 548-551
models, 241-244 intersection, 456-457 Grounds for an argument, 19
multiplication by a scalar, 240 invariant, 334
fraction decomposition, isomorphic, 334,449-457
partial
252-257 ^-chromatic, 559,561 Haken, W., 569
Half-adder, 614-615
product of, 240-241 fc-critical, 561
689
Hall, P.,
shifting properties of, 285-290 fc-partite, 467
Hall's 689-691
Theorem,
solutions to recurrence relations, fc-regular, 439 Marriage
Hamilton, Sir William 543
290-296 labelings, 444 Rowan,
437 The Hamiltonian Cycle Problem,
sum of, 240 loop-free, 1
406
table of, 289 multigraphs, 333,437,438
see alsoRecurrence Hamiltonian graphs
relations of edges, 535-536
Generating rule, 110
multiplicities
536-537 defined, 543
Geometricseries,110,116,
249-251
multiplicity
ra-colorable, 558
matrix,
Dirac'stheorem, 551
Girth of a graph, 465 nondirected 333 Grinberg's theorem, 548-551
graphs,
gib, see Greatest lower bound nondirected path, 388 Hamiltonian circuit, cycle. 543-
Goals of an 19 449-457
551
argument, nonisomorphic,
Goldbach conjecture, 119 Hamiltonian path, 543-548
nonplanar, 523,524-525 Hamilton's dodecahedron game,
Good'sdiagrams, 540 nonsimple, 438 543
Grade of membership, 699-704 nontrivial path, 388-389
\"hard\" AND for fuzzy set
Graph Theory With Applications, null, 457
551 operations,705
octahedron, 458
sequences, 444 open path, 442 Hashing algorithms, 357-358
Graphic
Graphs order of, 437
Hassediagrams, see Poset
adjacency matrix, 396-402, 450 organic molecules as, 446-447 diagrams
IEEE Standard No. 91 for logic Inhomogeneous recurrence fc-chromaticgraph, 56, 559
symbols, 601 relations (IHR) (Contd.) ^-critical graph, 561
IHR, see Inhomogeneous example solutions, 306-311 fc-partite graph, 467
recurrence relations summary of particular solutions, fc-regular graph, 439
Images of set elements, 13 318 fc-way B-tree, 503-504
Implication, 35 undetermined coefficients, Karnaugh, M., 607
law of, 40 method of, 311-319 Karnaugh map, 607-609, 610-611
logical, 45-46 see also homogeneous Karp, 671
proof of, see Proof, methods of recurrence relations; Recurrence Kempe, A. B., 569, 571
Incident from, on, to edge, 333, 439 relations Kempe-chain argument, 569-571
Inclusion-exclusion, principle of Initial condition, 110, 268 Kernel of a fuzzifier, 710-711
derangements, 226-228 Initial term of a series, 110 Kirkman, Thomas P., 543
Euler's 0-function, 225-226 Initial vertex, 442 The Knight's Tour Puzzle, 555
formulation and statement of, Inner product of operators, 397 Knowledge-Based Consultant
218-219 Inorder traversal (LNR) 515,518 (Expert) Systems, see Expert
proofs, 220-222 Integers systems
Sieve of Eratosthenes, 224-225 divisibility of, 359-360 Konig, 689
for three sets, 213-218 modulo m, 354-358 Konig-Egervary Theorem, 695
for two sets, 212-213 prime, see Primes Konig's Theorem, 695
INCLUSIVE-OR function, 601, relatively prime, 356 The Konigsberg Bridges, 535-538
603 Integrality of Flows Theorem, 672 Kruskal, J. B. Jr., 486
Incubation stage of development, Integrated circuit (IC), 600 Kruskal's algorithm, 486-489
\"21-22 Integration: small, medium, large,
In-degree of a vertex, 333, 439 and very large scale, 600
Independent postulates, 579 Interchange sort algorithm, 418- Labeling
Indirect counting, 132-133 423 algorithm, 674-675
Indirect proof, 61, 65-66 Intermediate vertex, 634 backward, 675
Induction Internal vertex, 482 edge, 632-633, 636
mathematical, 103-108 International Electrotechnical forward, 675
strong mathematical; 111-115 Commission (IEC) graph, 444
Induction and Analogy in 117-15
Publication for logic symbols, vertex, 674-675
Mathematics, 18 601 Lagrange's interpolation formula,
Inductive hypothesis, 103 Intersection 88
see alsoStrong inductive of fuzzy sets, 705, 731-732 The Lancaster Equations of
hypothesis of graphs, 456-457 Combat,275
Inductive reasoning, 22-24 of relations, 379 Large scale integration (LSI), 600
Inductive step, 103,111 of sets, 5 Latin rectangle, 693
Inefficient algorithms, 406 Into function for sets, 14 Latin square, 96-97,693
Inference Invariant assertion, 426 Lattice,368,578
faulty, 46 Invariant of graphs, 334 Law of contradiction, 34
valid, 46-47 Inverse Law of contrapositive, 40, 49, 50
multiplicative, 247-251 Law of double negation, 40
Inference, rules of
of a proposition, 41 Law of hypothetical syllogism, 48,
addition, 49
of a relation, 381-382 49
conjunction, 49 of a set 14 Law of implication, 40
constructive dilemma, 49
INVERTER function, 602, 603 Law of the Excluded Middle, 34
contraposition, 49, 50 \"An of the Laws of Leaf of a tree, 482
45 Investigation
defined,
577 Leastelement of a set, 364
DeMorgan's Laws, 6, 40-41,49, Involution
Thought.\"
law for Boolean Least upper bound (lub), 364
50,61,86 algebras, 583 Left child, edge, subtree, 507
destructive dilemma, 49
Irreducible form of a Boolean Length of a path, 388, 391
detachment, 47-48, 49 605 LeonardoofPisa (Fibonacci), 269
49 expression,
disjunctive syllogism, Irredundant form of Boolean Level of a vertex, 469, 501
existential generalization, 99 Level-orderindex of binary tree
expression, 605
existential specification, 98
Irreflexivity of a binary relation, vertex, 509
hypothetical syllogism,48, 49 339,340 Lexicographic ordering of strings,
modus ponens, 47-48, 49 Isolatedvertex, 439 373-375
modus tollens, 49 Linear 148-151
49 Isomorphisms permutation,
simplification,
Boolean, 585 Linear recurrence relation, 266
transitive rule, 48, 49
universal generalization, 98 graph,334,406,449-457 Linearity of generating functions,
universal specification, 97-98 Iteration, 281-285 257
see
seealso Reasoning; Proof,
Linguistic approximations,
Fuzzy relations; Fuzzy set
of
methods
Join operations; \"Soft\" expert
Inference engine, 720, 721,727-731 of elements, 368 systems
Inhomogeneous recurrence of relations, 380 Link (general fuzzy relation), 726-
relations (IHR), 266 Join-semilattice, 368 727
746 Index
Literal for a Boolean variable, 590 The Marriage Problem, 687, 689- MSI, see Medium scale integration
Literal variable, 605 691 Multigraphs, 333, 437,438
LNR, see Inorder traversal Matching directed, 538
Logic, first order complete, 687, 689-691 Eulerian paths and circuits in,
defined,80 condition, 689 537-539
equivalences, 85-86 maximal, 687 The Konigsberg Bridges, 535-
existence proofs, 87-88 network, 688-689 538
existential quantifier, 83-87, 89- Mathematical Discovery, 18 nondirected, 537-538
91 Mathematical induction, 103-108 of plane graphs, 526-527
multiple quantifiers, 89-91 see alsoStrong mathematical traversable, 537
open propositions, 81-86 induction Multinomial, 205
proof by counterexample, 87, 89 Matrix Multinomial coefficients,205-207
proof by example, 87 adjacency, 396-402, 450 seealso Binomial coefficients
proof by exhaustion, 87, 89 Boolean, 396-402 The Multinomial theorem, 205-
quantifiers, defined, 82-83 multiplicity, 536-537 \342\200\242207
subject-predicate analysis, 80- Maximal flows in networks, 641, see also The Binomial theorem
81 645-652 Multiple edges, 333
universal quantifier, 83-87, 89- construction of, 671-677 Multiple quantifiers, 89-91
91 The Max Flow-Min Cut Multiplexers, 621-626
universe of discourse, 81-82 Theorem,659-660, 667-669 Multiplication of generating
Logic, fundamentals of Maximal matching, 687 functionby a scalar, 240
abbreviated truth table, 38-39 Maximal planar graph, 534 Multiplicative inverse, of formal
five basic connectives, 34-38 Maximal spanning tree, 493 power series, 247-251
propositional functions of two Maximum-length shift register Multiplicities of graph edges, 535-
variables, 39-42 sequence, 539-541 536
valid inferences and Maxterm Boolean expressions, Multiplicity matrix of a graph,
33-34
propositions, 590-592 536-537
Logic, predicate, in expert Medical diagnosis expert system, Mutually exclusive events, 127
systems, 723-724 722 MUX, see Multiplexers
Logic gates Medium scale integration (MSI), MYCIN expert system, 722
AND, 601,603 600
EXCLUSIVE-OR, 602,603 Meetof elements, 368
INCLUSIVE-OR,601,603 Meet-semilattice, 368 n-ary fuzzy relation, 711-713
INVERTER, 602, 603 Members of a set, 1 n-colorable graph, 558
minimization of, 600-601 Membership function, 699-704 NAND function, 602, 603
NAND, 602, 603 Menger, 689 Negation of a proposition, 34
NOR, 602, 603 Menger's Theorem,695 Neighbor vertices, 439
Logic micro-operations in an ALU, Merge sort algorithm, 282-284, Net flow across a cut, 649
619-621 425-426 Net flow into, out of a vertex, 638,
Logic symbols, 601-603 Merging sorted lists, 282-284 640
Logical connectives, 34-38 Merging sorted sequences, 423-424 Networks
Logical implication, 45-46 Mersenne primes, 120 capacity function, 633
Logical inferences Method of characteristic roots, completematching, 687, 689-
fallacies, see Fallacies 300-304 691
faulty inference, 46 Method of undetermined cuts in, see Cuts
logical consequence, 46 coefficients, see Undetermined defined,633 _
logical implication, 45-46 coefficients, method of edge capacity, 633-634
rules of inference, see Inference, Methods of Proof, see Proof, edge labeling, 632-633, 636
rules of methods of flows in, see Flows in networks
valid inference, 46-47 Micro-operations in an ALU, 619- intermediate vertex, 634
Logically equivalent propositional 621 matching, 687, 688-689
functions, 38 Mineral deposit expert system, 722 maximal matching, 687
Loop, 333, 437 Minimal cuts in networks,-645-652 sink, source vertex, 633, 638, 640
Loop-freedigraph, 333 Minimal spanning trees, 494 Newton's identity for binomial
Loop-free graph, 437 Minimization of Boolean coefficients, 191-192
Lower bound of a set, 364 functions, see Boolean functions, NLR, see Preorder traversal
LRN, see Postorder traversal minimization of Non sequitur fallacy, 51
LSI, see Largescaleintegration Minterm Boolean expressions, Noncomputable functions, 377-
lub, see Least upper bound 590-592 378
Lucas sequence, 278 Modular arithmetic, 354-358 Nonconstructive existence proof,
Lukasiewicz, Jan, 471 Modular law for Boolean algebras, 87,88
587 Nondeterministic algorithms, 419
Modus ponens, 47-48, 4S, 724 Nondirected graphs, 333
Magic Square, 96 Modus tollens, 49 Nondirected multigraphs, 333
Many-to-one function for sets, 14 Monotone increasing functions, Nondirected path, 388
Mapping, see Functions 346 Nondirected trees, 469
Index 747
TheKnight's Tour Puzzle, 555 Priifer code of a tree, 495-497 Reflexive general fuzzy relation,
The Konigsberg Bridges, 535- Pythagorean triple, 77 726
538 Reflexive relation on a set, 11
The Problem, 687,
Marriage
Quadruple primes, 76 Reflexivity
689-691 97-100 of a binary relation, 339, 340
NP-complete, 406-407 Quantified
Quantifiers
propositions, of a similarity relation, 726
ThePlanar Subgraph Problem,
existential, 83-87,89-91 Regions
406 89-91
of a planar graph, 569
multiple,
The Scheduling Problem, 558- of a plane, 525
universal, 83-87, 89-91
560
connected vertices, Regular directed tree, 505
Quasi-strongly
The Subgraph Isomorphism
498-500 Relations
Problem, 406 binary, see Binary relations
Query language, 725
System of Distinct Quotient, 64
closure property, 383-384
Representatives
Problem, 657, 686, 691 complement, 379
The Towers of Hanoi, 282 composition, 382-383
Problem-solving strategies, see Range of relation on a set,,10-11 difference, 379
Reasoning Rational roots theorem,-89 equivalence, see Equivalence
Product Reasoning relations
of fuzzy sets, 705-706 \"analysis-synthesis,\" 24-26 fuzzy, see Fuzzy relations
of generating functions, 240-241 approach,17-19 general fuzzy, 726-727
Product rule, 128-132 aspects of discovery, 21-22 intersection, 379
Product-of-sums form, 591, 612 circular, 29-30 inverse, 381-382
Progression elements of an argument, 19-20 join, 380
arithmetic, 110,115 fallacies, see Fallacies meet, 368
geometric, 110,116, 249-251 inductive, 22-24 ordering, see Ordering relations
Projection of a relation, 379-380 working backward, 26-27 P-closure of a set, 384
Proof, methods of working forward, 20-21 partial ordering, see Partial
conditional proof, 62-63,72 see also Inference, rules of; ordering relations
diagonal argument, 377-378 Proof, methods of projection, 379-380
Index 749
2-valued Boolean function, 134- Value of a flow, 640 Vertices of graphs (Contd.)
136 Vandermonde's identity, 204-205 neighbors, 439
2's complement form, 620-621 Veitch, E. W.. 606 net flow into, out of, 638, 640
Veitch diagram, 606 nondirected path, 388
Venn, John, 6 number of, in directed tree, 502-
Uncountable sets, 367 Venn diagrams, 6, 212, 214 503
Undetermined coefficients, Vertex coloring of a graph, 558, OR-VERTEX, 729-731
method of 567 out-degree, 333, 439
defined, 311 Vertex labeling of a graph, 444 parent, 482, 507
trial solution for exponentials, Vertex-disjoint paths, 442 quasi-strongly connected, 498-
312-315 Vertices of graphs 500
trial solutions for polynomials, adjacent, 439 right child, 507
319 ancestor, 482 root, 482
trial solutions for products of AND-VERTEX, 729-731 simple path, 388
polynomials and exponentials, child, 482, 507 sink, source, 633,638, 640
315-317 circuit, 388 strongly connected, 391-392
Uniform probability density coloring, 558, 567 terminal, 442
function, 732 connected, 388, 472 traverse, 389
Uniform-shape logic symbols, 601- conversation equation, 638 unilaterally connected, 391-392
602 covering of edges,695 weakly connected, 391-392
Unilaterally connected vertices, cut vertex, 472 Very large scaleintegration
\"
391-392 cycle, 388 (VLSI), 600
Union defined, 332 \"Vicious circle\" fallacy, 29
of fuzzy sets, 705, 731 degree, 439 VKB, see Value knowledge base
of graphs, 457 descendant, 482 VLSI, see Very large scale
of relations, 379 dual graph, 569 integration
of sets, 4-5 edges between, joining, 437
Universal generalization, 98 endpoints, 388 Warrants of an argument, 19-20
Universal quantifier, 83-87, 89-91 flow into, out of, 638, 640
Warshall, S., 402, 407
Universal set, 2-3 greedy algorithm for coloring, Warshall's algorithm, 407-412,539
Universal specification, 97-98 567
M. E., 464
Watkins,
Universe (of discourse), 2-3, 81-82 height of, in directed forest,
Weakly connected vertices, 391-
Unordered partition of a set, 181- 500-501 392
184 \"hub,\" 457
Well-defined function for sets, 13
Unordered selection of objects, 143 in-degree, 333, 439 Well-ordered property of integers,
Unsaturated edge, 639 initial, 442
105
Unwarranted assumptions, fallacy intermediate, 634 Well-ordered sets, 366-367
of, 29-30 internal, 482 Welsh, D. J. A., 565
Upper bound of a set, 364 isolated, 439
Welsh-Power algorithm, 565-566
labeling of, 674-675 Wheel graph, 457, 562-563
left child, 507
Working backward, 26-27
61 level of, in rooted tree, 469
Working forward, 20-21
Vacuous proof,
Valid inference, 46-47 level of, in forest, 501
Value knowledge base (VKB), level-order index, in binary tree,
725-727 509 Zadeh, L. A., 699