Professional Documents
Culture Documents
(Download PDF) Essential Discrete Mathematics For Computer Science 1St Edition Harry Lewis Online Ebook All Chapter PDF
(Download PDF) Essential Discrete Mathematics For Computer Science 1St Edition Harry Lewis Online Ebook All Chapter PDF
https://textbookfull.com/product/discrete-mathematics-for-
computer-science-1st-edition-jon-pierre-fortney/
https://textbookfull.com/product/ideas-that-created-the-future-
classic-papers-of-computer-science-1st-edition-harry-r-lewis/
https://textbookfull.com/product/imaginary-mathematics-for-
computer-science-1st-edition-vince/
https://textbookfull.com/product/logic-lecture-notes-for-
philosophy-mathematics-and-computer-science-andrea-iacona/
Discrete Mathematics 8e Richard Johnsonbaugh
https://textbookfull.com/product/discrete-mathematics-8e-richard-
johnsonbaugh/
https://textbookfull.com/product/the-beauty-of-mathematics-in-
computer-science-1st-edition-jun-wu/
https://textbookfull.com/product/journey-into-discrete-
mathematics-1st-edition-owen-byer/
https://textbookfull.com/product/discrete-mathematics-with-ducks-
second-edition-belcastro/
https://textbookfull.com/product/discrete-mathematics-and-
applications-2nd-edition-ferland/
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page i — ©#1Princeton University Press, 2018
i Please do not circulate. i
ESSENTIAL DISCRETE
MATHEMATICS FOR
COMPUTER SCIENCE
−
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page ii — ©#2
Princeton University Press, 2018
i Please do not circulate. i
−1
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page iii —©#3
Princeton University Press, 2018
i Please do not circulate. i
ESSENTIAL DISCRETE
MATHEMATICS FOR
COMPUTER SCIENCE
−
PR I NC ETON U N I V E R SI T Y PR E S S ∼ PR I NC ETON A ND OX FOR D 0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page iv — ©#4
Princeton University Press, 2018
i Please do not circulate. i
Copyright
c 2019 by Harry Lewis and Rachel Zax
press.princeton.edu
LCCN
ISBN 978-0-691-17929-2
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page v — ©#5Princeton University Press, 2018
i Please do not circulate. i
−
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page vi — ©#6
Princeton University Press, 2018
i Please do not circulate. i
−1
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page vii —© #7
Princeton University Press, 2018
i Please do not circulate. i
−
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page viii —© #8
Princeton University Press, 2018
i Please do not circulate. i
−1
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page ix — ©#9
Princeton University Press, 2018
i Please do not circulate. i
CONTENTS
Preface xi
4 Strong Induction 39
5 Sets 49
6 Relations and Functions 59
8 Structural Induction 79
9 Propositional Logic 89
17 Connectivity 173
18 Coloring 179
22 Counting 233
23 Counting Subsets 243 −
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page x — ©#10
Princeton University Press, 2018
i Please do not circulate. i
x contents
24 Series 261
26 Probability 297
Index 381
−1
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:40 — page xi — ©#11
Princeton University Press, 2018
i Please do not circulate. i
PREFACE
This introductory text treats the discrete mathematics that computer scien-
tists should know but generally do not learn in calculus and linear algebra
courses. It aims to achieve breadth rather than depth and to teach reasoning
as well as concepts and skills.
We stress the art of proof in the hope that computer scientists will learn to
think formally and precisely. Almost every formula and theorem is proved
in full. The text teaches the cumulative nature of mathematics; in spite of the
breadth of topics covered, seemingly unrelated results in later chapters rest
on concepts derived early on.
The text requires precalculus and occasionally uses a little bit of calculus.
Chapter 21, on order notation, uses limits, but includes a quick summary of
the needed basic facts. Proofs and exercises that use basic facts about deriva-
tives and integrals, including l’Hôpital’s rule, can be skipped without loss of
continuity.
A fast-paced one-semester course at Harvard covers most of the material
in this book. That course is typically taken by freshmen and sophomores as
a prerequisite for courses on theory of computation (automata, computabil-
ity, and algorithm analysis). The text is also suitable for use in secondary
schools, for students of mathematics or computer science interested in
topics that are mathematically accessible but off the beaten track of the
standard curriculum.
The book is organized as a series of short chapters, each of which might
be the subject of one or two class sessions. Each chapter ends with a brief
summary and about ten problems, which can be used either as homework
or as in-class exercises to be solved collaboratively in small groups.
Instructors who choose not to cover all topics can abridge the book in
several ways. The spine of the book includes Chapters 1–8 on foundational
concepts, Chapters 13–18 on digraphs and graphs, and Chapters 21–25 on
order notation and counting. Four blocks of chapters are optional and can
be included or omitted at the instructor’s discretion and independently of
each other:
• Chapters 9–12 on logic;
−
• Chapters 19–20 on automata and formal languages; 0
1
i i
i i
i i
xii preface
−1
0
1
i i
i i
i i
ESSENTIAL DISCRETE
MATHEMATICS FOR
COMPUTER SCIENCE
−
0
1
i i
i i
i i
−1
0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:41 — page 1 — ©#1Princeton University Press, 2018
i Please do not circulate. i
Chapter 1
How do we know that a computer program produces the right results? How
do we know that a program will run to completion? If we know it will
stop eventually, can we predict whether that will happen in a second, in
an hour, or in a day? Intuition, testing, and “it has worked OK every time
we tried it” should not be accepted as proof of a claim. Proving something
requires formal reasoning, starting with things known to be true and con-
necting them together by incontestable logical inferences. This is a book
about the mathematics that is used to reason about the behavior of computer
programs.
The mathematics of computer science is not some special field. Com-
puter scientists use almost every branch of mathematics, including some
that were never thought to be useful until developments in computer science
created applications for them. So this book includes sections on mathemat-
ical logic, graph theory, counting, number theory, and discrete probability
theory, among other things. From the standpoint of a traditional mathemat-
ics curriculum, this list includes apples and oranges. One common feature
of these topics is that all prove useful in computer science. Moreover, they
are all discrete mathematics, which is to say that they involve quantities that
change in steps, not continuously, or are expressed in symbols and structures
rather than numbers. Of course, calculus is also important in computer sci-
ence, because it assists in reasoning about continuous quantities. But in this
book we will rarely use integrals and derivatives.
.
One of the most important skills of mathematical thinking is the art of
generalization. For example, the proposition
6 is true, but very specific (see Figure 1.1). The sides of lengths 1 and 2 would
Figure 1.1. Can there be a triangle have to join the side of length 6 at its two ends, but the two short sides −
with sides of lengths 1, 2 and 6? together aren’t long enough to meet up at the third corner. 0
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:41 — page 2 — ©#2Princeton University Press, 2018
i Please do not circulate. i
Well, so what? Put two people together and they may or may not have
been born on the same day of the week. Yet there is something going on
here that can be generalized. As long as there are at least eight people, some
two of them must have been born on the same day of the week, since a week
has only seven days. Some statement like (1.1) must be true, perhaps with
a different pair of names and a different day of the week. So here is a more
general proposition.
In any group of eight people, some two of them were born on the
same day of the week.
But even that isn’t really general. The duplication has nothing to do with
properties of people or days of the week, except how many there are of each.
For the same reason, if we put eight cups on seven saucers, some saucer
would have two cups on it. In fact there is nothing magic about “eight” and
“seven,” except that the one is larger than the other. If a hotel has 1000 rooms
and 1001 guests, some room must contain at least two guests. How can we
state a general principle that covers all these cases, without mentioning the
irrelevant specifics of any of them?
First, we need a new concept. A set is a collection of things, or elements.
−1
The elements that belong to the set are called its members. The members of
0
a set must be distinct, which is another way of saying they are all different
1
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:41 — page 3 — ©#3Princeton University Press, 2018
i Please do not circulate. i
from each other. So the people mentioned in (1.1) form a set, and the days
of the week form another set. Sometimes we write out the members of a set
explicitly, as a list within curly braces {}:
When we write out the elements of a set, their order does not matter—in any
order it is still the same set. We write x ∈ X to indicate that the element x is
a member of the set X. For example, Charlie ∈ P and Thursday ∈ D.
We need some basic terminology about numbers in order to talk about
sets. An integer is one of the numbers 0, 1, 2, . . . , or −1, −2, . . . . The real
numbers are all the numbers on the number line, including √ all the integers
and also all the numbers in between integers, such as 12 , − 2, and π . A num-
ber is positive if it is greater than 0, negative if it is less than 0, and nonnegative
if it is greater than or equal to 0.
For the time being, we will be discussing finite sets. A finite set is a set that
can (at least in principle) be listed in full. A finite set has a size or cardinality,
which is a nonnegative integer. The cardinality of a set X is denoted |X|.
For example, in the example of people and the days of the week on which
they were born, |P| = 8 and |D| = 7, since eight people are listed and there
are seven days in a week. A set that is not finite—the set of integers, for
example—is said to be infinite. Infinite sets have sizes too—an interesting
subject to which we will return in our discussion of infinite sets in Chapter 7.
Now, a function from one set to another is a rule that associates each
member of the first set with exactly one member of the second set. If f is
a function from X to Y and x ∈ X, then f (x) is the member of Y that the
function f associates with x. We refer to x as the argument of f and f (x)
as the value of f on that argument. We write f : X → Y to indicate that f is
a function from set X to set Y. For example, we could write b : P → D to
denote the function that associates each of the eight friends with the day of
the week on which he or she was born; if Charlie was born on a Thursday,
then b(Charlie) = Thursday.
A function f : X → Y is sometimes called a mapping from X to Y, and f
is said to map an element x ∈ X to the element f (x) ∈ Y. (In the same way, a
real map associates a point on the surface of the earth with a point on a sheet
of paper.)
Finally, we have a way to state the general principle that underlies the
example of (1.1):
i i
i i
i i
Copyright
“525-76072_ch01_1aP” — 2018/10/6 — 14:42 — page 15 —©#5Princeton University Press, 2018
i Please do not circulate. i
There was no real need to check this particular case, but doing so makes us
more confident that we didn’t make an algebraic mistake somewhere.
In general, a procedure for answering a question or solving a problem is
said to be an algorithm if its description is sufficiently detailed and precise
that it could, in principle, be carried out mechanically—by a machine, or
by a human being mindlessly following instructions. A constructive proof
implicitly describes an algorithm for finding the thing that the proof says
exists. In the case of Theorem 2.4, the proof describes an algorithm that,
given an odd integer 2k + 1, finds integers m and n such that m2 − n2 =
2k + 1.
Not every proof is constructive—sometimes it is possible to show that
something exists without showing how to find it. Such a proof is called
nonconstructive. We will see some interesting examples of nonconstructive
proofs—in fact, the proof of the Pigeonhole Principle will be nonconstruc-
tive, since it cannot identify which pigeonhole has more than one pigeon.
But computer scientists love constructive arguments, because a construc-
tive proof that something exists yields an algorithm to find it—one that a
1 A stronger meaning of the term “con- computer could be programmed to carry out.1
structive” is used in the school of con- One final note about Theorem 2.4. The proof not only is constructive,
structive mathematics, which disallows
any mathematical argument that does but proves more than was asked for. It shows not just that every odd integer
not lead to the construction of the thing is the difference of two squares, but that every odd integer is the difference of
that the argument says exists. In con- the squares of two consecutive integers, as we noted while working through
structive mathematics it is impermissi-
ble to infer from the fact that a statement
the examples. After finishing a proof, it is often worth looking back at it to
is demonstrably false that its negation is see if it yields any interesting information beyond the statement it set out to
necessarily true; the truth of the nega- prove.
tion has to be demonstrated directly.
For example, constructive mathemat- .
ics disallows proofs by contradiction
(explained below) and arguments like A common goal in mathematical proof is to establish that two state-
that of Problem 2.14. Computer scien- ments are equivalent—that one statement is true in all the circumstances
tists prefer arguments that yield algo-
rithms, but generally don’t insist on in which the second statement is true, and vice versa. For example, consider
“constructive proofs” in the strict sense the statement
used by constructive mathematicians.
For us, to show something is true it suf-
The square of an integer is odd if and only if the integer itself is
fices to show that its negation is not true.
odd.
i i
i i
Another random document with
no related content on Scribd:
vault communicating with the shaft. This shaft is continued
downwards to a depth of 10 cm., and forms a retreat for the bees
when engaged in construction. Several advantages are secured by
this method, especially better ventilation, and protection from any
water that may enter the shaft. The larvae that are present in the
brood-chambers at any one moment differ much in their ages, a fact
that throws some doubt on the supposed parthenogenetic
generation. No cocoons are formed by these Halictus, the polished
interior of the cell being a sufficiently refined resting place for
metamorphosis. Verhoeff states that many of the larvae are
destroyed by mouldiness; this indeed, he considers to be the most
deadly of the enemies of Aculeate Hymenoptera. The nest of
Halictus maculatus has also been briefly described by Verhoeff, and
is a very poor construction in comparison with that of H.
quadricinctus.
The most beautiful and remarkable of all the bees are the species of
Euglossa. This genus is peculiar to Tropical America, and derives its
name from the great length of the proboscis, which in some species
surpasses that of the body. The colours in Euglossa proper are
violet, purple, golden, and metallic green, and two of these are
frequently combined in the most harmonious manner; the hind tibia
is greatly developed and forms a plate, the outer surface of which is
highly polished, while the margins are furnished with rigid hairs. Very
little is known as to the habits of these bees; they were formerly
supposed to be social; but this is doubtful, Bates having recorded
that E. surinamensis forms a "solitary nest." Lucas concluded that E.
cordata is social, on the authority of a nest containing "a dozen
individuals." No workers are known. The species of Eulema have a
shorter tongue than Euglossa, and in form and colour a good deal
resemble our species of Bombus and Apathus.
The genus Chalicodoma is not found in our own country, but in the
South of France there exist three or four species. Their habits have
given rise to much discussion, having been described by various
naturalists, among whom are included Réaumur and Fabre. These
Insects are called mason-bees, and construct nests of very solid
masonry. C. muraria is in appearance somewhat intermediate
between a honey-bee and a Bombus; it is densely hairy, and the
sexes are very different in colour. It is solitary in its habits, and
usually chooses a large stone as a solid basis for its habitation. On
this a cell is formed, the material used being a kind of cement made
by the Insect from the mixture of a suitable sort of earth with the
material secreted by its own salivary glands; the amount of cement
used is reduced by the artifice of building small stones into the walls
of the cell; the stones are selected with great care. When a cell
about an inch in depth has been formed in this manner, the bee
commences to fill it with food, consisting of honey and pollen; a little
honey is brought and is discharged into the cell, then some pollen is
added. This bee, like other Dasygastres, carries the pollen by means
of hairs on the under surface of the body; to place this pollen in the
cell the Insect therefore enters backwards, and then with the pair of
hind legs brushes and scrapes the under surface of the body so as
to make the pollen fall off into the cell; it then starts for a fresh cargo;
after a few loads have been placed in the receptacle, the Insect
mixes the honey and pollen into a paste with the mandibles, and
again continues its foraging until it has about half filled the cell; then
an egg is laid, and the apartment is at once closed with cement. This
work is all accomplished, if the weather be favourable, in about two
days, after which the Insect commences the formation of a second
cell, joined to the first, and so on till eight or nine of these
receptacles have been constructed; then comes the final operation
of adding an additional protection in the shape of a thick layer of
mortar placed over the whole; the construction, when thus
completed, forms a sort of dome of cement about the size of half an
orange. In this receptacle the larvae pass many months, exposed to
the extreme heat of summer as well as to the cold of winter. The
larvae, however, are exposed to numerous other perils; and we have
already related (vol. v. p. 540) how Leucospis gigas succeeds in
perforating the masonry and depositing therein an egg, so that a
Leucospis is reared in the cell instead of a Chalicodoma.
The power of the mason-bee to find its nest again when removed to
a distance from it is another point that was tested by Du Hamel and
recounted by Réaumur. As regards this Fabre has also made some
very valuable observations. He marked some specimens of the bee,
and under cover removed them to a distance of four kilometres, and
then liberated them; the result proved that the bees easily found their
way back again, and indeed were so little discomposed by the
removal that they reached their nests laden with pollen as if they had
merely been out on an ordinary journey. On one of these occasions
he observed that a Chalicodoma, on returning, found that another
bee had during her absence taken possession of her partially
completed cell, and was unwilling to relinquish it; whereupon a battle
between the two took place. The account of this is specially
interesting, because it would appear that the two combatants did not
seek to injure one another, but were merely engaged in testing, as it
were, which was the more serious in its claims to the proprietorship
of the cell in dispute. The matter ended by the original constructor
regaining and retaining possession. Fabre says that in the case of
Chalicodoma it is quite a common thing for an uncompleted cell to
be thus appropriated by a stranger during the absence of the rightful
owner, and that after a scene of the kind described above, the latter
of the two claimants always regains possession, thus leading one to
suppose that some sense of rightful ownership exists in these bees;
the usurper expressing, as it were, by its actions the idea—Before I
resign my claims I must require you to go through the exertions that
will prove you to be really the lawful owner.