Discrete Mathematics Computing A Set of Lectures Malik Magdon-Ismail All Chapters Instant Download
Discrete Mathematics Computing A Set of Lectures Malik Magdon-Ismail All Chapters Instant Download
com
https://textbookfull.com/product/discrete-mathematics-
computing-a-set-of-lectures-malik-magdon-ismail/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/discrete-mathematics-8e-richard-
johnsonbaugh/
textboxfull.com
https://textbookfull.com/product/essentials-of-discrete-mathematics-
third-edition-david-james-hunter/
textboxfull.com
A Journey Through Discrete Mathematics A Tribute to Ji■í
Matoušek Martin Loebl
https://textbookfull.com/product/a-journey-through-discrete-
mathematics-a-tribute-to-jiri-matousek-martin-loebl/
textboxfull.com
https://textbookfull.com/product/discrete-mathematics-an-open-
introduction-oscar-levin/
textboxfull.com
https://textbookfull.com/product/discrete-mathematics-an-open-
introduction-oscar-levin-2/
textboxfull.com
https://textbookfull.com/product/discrete-mathematics-with-ducks-
second-edition-belcastro/
textboxfull.com
https://textbookfull.com/product/discrete-mathematics-and-
applications-2nd-edition-ferland/
textboxfull.com
D is c r e t e
M a t h e m a t ic s
S z
C o m p u t in g
A S et of Lectures
The book website DMC-book. com contains supporting
material for instructors and readers.
(Solutions to pop-quizzes and exercises, slides, . . . )
'Lh(' use in t h i s p u b l i c a t i o n o f t l a d e n a m i 's , t r a d e 'in a r k s , se'iyice m a r k s , a n d s i m il a r t i'r m s , evi'ii if t he>- are' ue>t ielent ilie'el
a s sue h, is ue>t t o be' teike'ii a s a n e'xpre'ssiem e)f e)piuiou a s te> whe'lhe'l' eir ue>t the'\- are' stibje'e t te) p r e ip r i e t a r v r i g h ts .
T h i s bexik w a s ty p e 's e t b y the' em theers emel w a s p r in le 'd anel benm el in the' I'uite-el Sleete's eif .\m e'rie';\.
To m y teachers, and to m y students.
M a th e m a tic s
She is patien t.
She sits,
She w aits in silence.
A tr u th once found,
A tr u th shall be.
In a n tiq u ity and hereafter.
So please, oh please, we beg, we pray.
Go throw your TV set away.
And in its place you can install
A lovely bookshelf on the wall. - Roald Dahl
No wi-fi. Please just talk to each other and get drunk.
- bar on Kollwitzstrasse, Berlin.
I have been a happy man ever since January 1, 1990, when I no
longer had an email address. - Donald E. Knuth
Preface
T h is book is a sto ry w hich s ta r ts w ith d iscrete m a th e m a tic s and ends a t th e th eo ry of com puting. T he end
p o in ts as well as th e jo u rn e y are b eau tifu l. Dtie to physical c o n strain t, our passage th ro u g h th e com plex
lan d scap e is linear, c h a ra c te r by c h a ra c ter, w ord by word. T h e tru e sto ry is neith er linear nor short, so it
goes w ith o u t saying th a t o u r ta le is n o t entire. We striv e to m ake th e sto ry relavent to th e life of a com puter
scien tist, w ho, a fte r all, is th e biggest consum er of discrete m a th em atics in th e m odern era.
Be su re to d istin g u ish th e p ro g ra m m e r from th e co m p u ter scientist. P rogram m ing is b u t one of th e skills
req u ired of a c o m p e te n t c o m p u te r scien tist. T h e o th e r is to solve problems using algorithms. T his trife c ta of
pro b lem solving using a lg o rith m s p ro g ram m ed on one of a m yriad different co m p u tin g platform s is everywhere.
A nd everyw here in th is trife c ta , you will find a role for th e o ry and form al reasoning. It behoves us to solve
th e se c o m p u tin g pro b lem s carefully because, today, th e com m on citizen tru s ts th e ir life to com puting system s.
I t ’s b e st t h a t th o se system s w ork as th e y are su p posed to, provably so. W e are n o t alone in th is observation.
"Too few people recognize that the high technology so celebrated today is a mathematical technology."
"A programmer must demonstrate that their program has the required properties. If this comes as an
afterthought, it is all but certain that they won't be able to meet this obligation. Only if this obligation
influences the design is there hope to meet it. Pure a posteriori verification denies you that wholesome
influence and is therefore putting the cart before the horse. But that is exactly what happens in the
software houses where "programming" and "quality assurance" are done by different groups. Needless to
say, those houses deliver without warranty."
"The required techniques of effective reasoning are pretty formal, but as long as programming is done by
people who don't master them, the software crisis will remain with us and will be considered an incurable
disease. And you know what incurable diseases do: they invite the quacks and charlatans in, who in this
case take the form of Software Engineering Gurus." - Edsger Dijkstra
You m ay use th e b o o k for self-study, b u t th e sp irit o f th e p re sen ta tio n is a set of lectures for a th eo ry course.
W e are old fashioned a n d ad h ere to th e te a ch e r-a p p re n tice philosophy. M axim um value will be reaped w ith
a n in s tru c to r a t th e helm , for one sh o u ld n ’t u n d e re stim a te th e gu id e’s ability to d am pen th e m eanderings of
th e fiedgling-trekker. A course im poses an inflexible b a n d w id th co n stra in t and effort was needed to respect
t h a t c o n stra in t. W e h a d to carefully choose w h a t to include, and m ore im p o rta n tly w h at to exclude.^ It is on
good a u th o rity th a t effort sp e n t identifying only th a t w hich is absolutely necessary is effort well spent:
"I didn't have time to write a short letter, so I wrote a long one instead," - Mark Twain
"This report, by its very length, defends itself against the risk of being read." - Winston Churchill
To c o m p e n sa te for o m itte d to p ics, th e re are 250+ w orked quizzes an d exercises and 1.500+ problem s suitable
for hom ew orks or exam s. M any of th e p roblem s are a sp rin g b o ard into m ore advanced techniques.
T o t h e in s t r u c t o r . E ach lectu re is sh o rt an d m eant to be covered in whole. O nce or twice, we reneg
on t h a t in te n tio n to p resen t to p ics of p a rtic u la r relevance to co m p u ter science (for exam ple th e RSA-
c ry p to sy ste m ). T h e m a te ria l is su ita b le for a fast-paced single-sem ester course. O ne could also teach each
p a r t (p a rt I on d iscrete m a th e m a tic s an d p a rt II on th e th e o ry of com iuiting) as se})arate sem ester courses, in
w hich case all th e d etails could be covered, including som e challenging problem s.
T h e flexibility offered by s ta n d a rd te x ts a d a p ts well to a variety of teaching philosophies. B ut. th a t
flexibility is a t a price. E xperien ce show s th a t stu d e n ts re ac t well to a linear i)ath w ith o u t diversions. \ \ liile
^Suggestions that further shorten the text will receive iny gratitude squared. All other feedback is greatly appreciated too.
Vll
P reface
a lecturer is skilled a t selecting w h at to cover, a stu d en t may not be skilled a t deciding w h a t to focus on as
they read. O ur presentation does not offer a w ealth of options for m eandering. I have picked a p a th . S tu ents
eager to explore can quench th a t th irs t in th e problem s section. In the end, it is n o t th e stu d e n t s p a th b u t
th e passion they develop th a t m atters.
T o t h e s t u d e n t . D on’t be a sp ectato r. You have to do theory, not read ab o u t it. A typical begining stu d e n t
should m ake an effort to work all th e pop-quizzes and a tte m p t all th e exercises. T h e pop-quizzes check if
you are still awake. T he exercises are to stretch th e muscles. T reat th e pop-quizzes and exercises as w orked
exam ples. To reap m axim um benefit you m ust try to solve th em first, before looking to th e solutions. T h e
end-of-chapter problem s give an o p p o rtu n ity to strain th e muscles, and in some cases stra in th e m a lot. An
advanced stu d en t m ay quickly read th e te x t, do th e exercises and focus on th e problem s. You can learn a lot
by m astering all th e problem s.
B la n k e t A c k n o w le d g e m e n t. E verything in this book has been done before. P e rh a p s som e of th e presen
ta tio n is original, b u t even th ere, I can n o t say to w h at ex te n t I was influenced by th e m any beloved te x ts I
grew up on. So, w h at th e n is th e purpose of such a book, which produces n o thing new ? P u rely pedagogical!
To give an analogy, everything is on th e in tern et. So, w h at th en is th e purpose of Google'^"? G oogle’^'” does
not create novel content, ra th e r it plays a search and discovery role. W hen you w ant som ething, Google'^”
finds it and presents it in ju s t th e right order - G oogle’s’^'"' opinion of th e right order. T h e re ’s a w ealth of
m ath em atics o u t there, and you can get it all using Google'^“ . B u t you d o n ’t need it all for a sophom ore-level
theory course. I’ve collected w h at I th in k is needed, and presented it in my own way an d my own order.
Hopefully, my th o u g h ts m atch up w ith som e higher order tr u th , w ho knows. To focus on pedagogy. I gave up
on detailed references in th e te x t. Instead , I pay a blanket trib u te here, to:
Biggs E pp G raham ; K n u th : P a ta sh n ik
G rim rnett; Stirzaker H opcroft; M otwani; U llm an K leinberg: T ardos
Lehm an; Leighton; Meyer Lewis; P ap adim itriou Lovasz; Pelikan: V esztergom bi
Polya Rosen Sipser
Scheinerm an Skiena Stanley
van Lint; W ilson W est Zeitz
l l i e above au th o rs developed ideas in unique ways th a t m ay have affected th e wa>- I present c e rta in topics,
either explicitly or intangibly. W hen th e resem blence is extrem e. I have tried to give credit w ith in th e
local context. In cases where 1 have u n d erestim ated th e resem blence. I apologize in advance, and hope th e
acknow ledgem ent above reduces a little of th e w rongdoing. A sim ilar consideration goes for exercises mid
problem s, which in some cases have been lifted form olym piads, problem -books. etc. W ith age com es th e
ability to forget th e original source of m any a problem , esjiecially those encountered main- years ago.
I give a sjiecial th a n k s to those stu d en ts, colleagues and teaching assistan ts who were th e sandbox for early
drafts of this book, especially M ark K. G oldberg who took on the first draft.
P u m p elstiltsk in is still spinning gold for Z ainab. Zain, Deem Pafi and Sofya who p a tien tly endureil th e
dem ands of w riting a book. W hen th e little ones grow into tlii'ir m ath em atics shoes. 1 hope th ey will read
this book. I t ’s tim e to tu rn on the lights and enter.
Malik .Magdou-lsmail
Irov. .New N'ork
[email protected]
■lulv 2:!. 2D2t).
vm
Contents
P r e fa c e Vll
I D isc re te M a th em a tics 1
0 B a c k g r o u n d a n d P e p T a lk 3
1 A T a s t e o f D is c r e t e M a t h e m a t ic s 7
1.1 M odeling E p i d e m i c s ...................................................................................................................................... 7
1.2 S peed D a t i n g .................................................................................................................................................... 8
1.3 F rien d sh ip N etw orks an d A d s .................................................................................................................... 8
1.4 M odeling C o m p u t e r s ...................................................................................................................................... 9
1.5 P r o o f ...................................................................................................................................................................... 9
1.6 P ro b lem s ............................................................................................................................................................ 11
2 D is c r e te O b je c ts 15
2.1 S e t s ...................................................................................................................................................................... 15
2.2 S e q u e n c e s ........................................................................................................................................................... 17
2.3 G r a p h s ................................................................................................................................................................... 17
2.4 E asin g in to P r o o f s .......................................................................................................................................... 19
2.4.1 A n A xiom : T h e W ell-O rdering P r in c ip le ................................................................................. 20
2.5 P ro b lem s ............................................................................................................................................................ 23
3 M a k in g P r e c is e S t a t e m e n t s 25
3.1 C o m p o u n d P r o p o s i t i o n s ............................................................................................................................... 26
3.2 T r u t h - T a b l e s .................................................................................................................................................... 28
3.2.1 P ro v in g an I m p lic a tio n ..................................................................................................................... *10
3.3 Q uantifiers: S ta te m e n ts A b o u t M any T h i n g s ..................................................................................... 30
3.3.1 P r e d i c a t e s .............................................................................................................................................. 31
3.3.2 N eg atio n .............................................................................................................................................. 33
3.3.3 M ixing Q u a n t i f i e r s ............................................................................................................................ 33
3.3.4 P ro o fs w ith Q u an tifiers ................................................................................................................. 34
3.4 D e d u ctio n V ersus I n d u c t i o n ........................................................................................................................ 34
3.5 P ro b lem s ............................................................................................................................................................
4 P r o o fs
4.1 D irect P r o o f ........................................................................................................................................................
4.1.1 D isproving I m p lic a tio n .....................................................................................................................
4.2 P ro o f by C o n t r a p o s i t i o n ...............................................................................................................................
4.3 E quivalence: If a n d O n ly I f ........................................................................................................................
4.4 P ro o f by C o n tra d ic tio n (R ed u ctio ad A b s u r d u m ) .............................................................................. "10
4.5 P ro o fs a b o u t S e t s .............................................................................................................................................
ix
C ontents
50
4.6 Problem s
55
In d u c tio n : P r o v in g “ f o r al l . . . ”
57
5.1 O rd in ary I n d u c tio n ........................
58
5.1.1 Sum of Powers of Integers
61
5.1.2 In duction Gone W rong . .
63
5.2 Induction and W ell-ordering . . .
64
5.3 Problem s .........................................
71
S tr o n g In d u c tio n
71
6.1 S trengthening th e Induction H ypothesis
74
6.2 Leaping In duction ......................................
75
6.3 S trong I n d u c t i o n .........................................
78
6.4 M any Flavors of I n d u c tio n ........................
6.5 Problem s ....................................................... 80
R e c u r sio n 85
7.1 Recursive Functions ..................................................................................................................................
7.1.1 R e c u rre n c e s ................................................................................................................................ 89
7.1.2 Recursive P r o g r a m s ............................................................................................................... 90
7.2 Recursive S e t s ................................................................................................................................................. 91
7.3 Recursive S tru ctu res - T r e e s ............................................................................................................... 92
7.4 Problem s .......................................................................................................................................................
8 P r o o fs vi^ith R e c u r s iv e O b je c ts
8.1 S tru c tu ra l I n d u c t i o n .................................................................................................................................. 191
8.2 S tru c tu ra l In d u ctio n on N ........................................................................................................................ 193
8.3 P a lin d ro m e s .................................................................................................................................................... 19-1
8.4 W ell-Formed A rith m etic E x p r e s s io n s ................................................................................................... 194
8.5 P ro p erties of R ooted B inary ' f r e e s ....................................................................................................... 195
8.6 Problem s ....................................................................................................................................................... 19 ‘
9 S u m s a n d A s y m p t o t ic s 113
9.1 C om puting S u m s ......................................................................................................................................... HI
9.2 A sym ptotics: B ig -'fh eta, B ig-O h an d R ig - O m e g a ............................................................................. 117
9.3 A pproxim ation via Integration .............................................................................................................. 119
9.4 Problem s ....................................................................................................................................................... 122
10 N u m b e r T h e o r y 129
10.1 G reatest C om m on D iv is o r ........................................................................................................................ 130
10.2 F u n d a m e n ta l'fh e o re m of A r i t h m e t i c .................................................................................................... 132
10.3 M odular A rithm etic and C ry ])t()g rap h y ................................................................................................ 133
10.3.1 .Modular .M ultiplicative I n v e r s e .................................................................................................. 135
10.3.2 RSA Public Key C r y p to g r a p h y .................................................................................................. 136
10.4 Problem s ........................................................................................................................................................ i;ip
11 G r a p h s 145
11.1 1)egree S e ([U ('n e ('.......................................................................................................................................... 145
I 1.1.1 1la n d s h a k in g 'f h e o r c 'm ................................................................................................................... pps;
1 1.2 T r e e s ................................................................................................................................................................... 149
11.3 P lanar G rap h s ............................................................................................................................................. 149
11.1 ( ) ( lu'r I’ypes of G r a p h s ...............................................................................................................
150
1 1. 1.1 D irected G rap h s ( D ig r a p lis ) .......................................................................................
11.5 Problem Solving w ith G r a p h s .................................................................................................
C ontents
12 M a t c h in g a n d C o lo r in g 161
12.1 B ip a rtite G ra p h M atchings ....................................................................................................................... 162
12.1.1 S tab le M arriage: M a th e m a tics of D a t i n g ................................................................................... 164
12.2 C o l o r in g .............................................................................................................................................................. 166
12.3 W h irlw in d T onr of G ra p h P ro b lem s ..................................................................................................... 168
12.4 P ro b lem s .......................................................................................................................................................... 170
1 3 C o u n t in g 179
13.1 C o u n tin g Sequences ..................................................................................................................................... 179
13.2 B u ild -u p C o u n t i n g ......................................................................................................................................... 182
13.3 C o u n tin g O ne Set B y C o u n tin g A nother; B i j e c t i o n ......................................................................... 184
13.3.1 B ijection ............................................................................................................................................ 184
13.3.2 B ijection an d C o u n tin g ................................................................................................................ 185
13.4 P e rm u ta tio n s an d C o m b in atio n s ........................................................................................................... 186
13.5 P ro b lem s ........................................................................................................................................................... 188
14 A d v a n c e d C o u n t in g 197
14.1 In c lu s io n -E x c lu s io n ....................................................................................................................................... 199
14.1.1 U nion of M ore th a n Two S e t s ...................................................................................................... 200
14.2 P igeonhole P r i n c i p l e .................................................................................................................................... 202
14.3 P ro b lem s ......................................................................................................................................................... 206
15 P r o b a b ilit y 211
15.1 C o m p u tin g P r o b a b i l i t ie s ............................................................................................................................. 211
15.1.1 T h e E v en t of In te re st .................................................................................................................... 213
15.2 P ro b a b ility an d S e t s .................................................................................................................................... 216
15.3 U niform P ro b a b ility S p a c e s ...................................................................................................................... 218
15.4 Infin ite P ro b a b ility S p a c e s ......................................................................................................................... 219
15.5 P ro b lem s ......................................................................................................................................................... 221
1 6 C o n d it io n a l P r o b a b ilit y 225
16.1 D e f i n i t i o n ......................................................................................................................................................... 225
16.2 E x a m p l e s ......................................................................................................................................................... 226
16.3 C o n d itio n a l P ro b a b ility T r a p s ................................................................................................................... 229
16.3.1 S am pling B ias .................................................................................................................................. 229
16.3.2 T ran sp o sed C o n d i t i o n a l ................................................................................................................ 230
16.4 Law o f T o ta l P r o b a b i l i ty ............................................................................................................................. 231
16.5 P ro b lem s .......................................................................................................................................................... 234
17 In d e p e n d e n t E v e n ts
17.1 C oincidence: T h e B irth d a y P a r a d o x ...................................................................................................... 246
17.1.1 H a s h i n g ................................................................................................................................................
17.2 R a n d o m W alk a n d G a m b le r’s R u i n ......................................................................................................... 250
17.3 P ro b lem s ...........................................................................................................................................................
259
1 8 R a n d o m V m ia b le s
18.1 P ro b a b ility D istrib u tio n F u n ctio n ( P D F ) .............................................................................................. 26(
18.1.1 J o in t P ro b a b ility D i s tr ib u tio n ...................................................................................................... 262
18.1.2 C u m u lativ e D istrib u tio n F u n ctio n (C D F ) ............................................................................. 264
2G5
18.2 B e r n o u l l i / B i n a r y ............................................................................................................................................
18.3 U n i f o r m ..............................................................................................................................................................
18.4 B in o m ia l..............................................................................................................................................................
xi
C ontents
268
18.5 W aiting T im e to S u c c e s s ............................................................................................................................
18.6 Problem s .......................................................................................................................................................
277
19 E x p e c t e d V a lu e
19.1 E xpected Value of Com m on R andom V a r i a b l e s ..............................................................................
280
19.1.1 B inom ial D i s t r i b u t i o n .................
280
19.1.2 W aiting T im e to S u c c e ss..............
281
19.2 C onditional E x p e c t a t i o n ...........................
284
19.2.1 Law of T otal E x p ectatio n . . . .
287
19.3 Problem s .......................................................
20 E x p e c t e d V a lu e : S u m s a n d O t h e r T o o ls 293
293
20.1 L inearity
20.2 Iterated E x p e c t a ti o n ...................................................................................................................................
20.3 B uild-up E x p ectatio n ................................................................................................................................
20.4 E xpected Value of a P ro d u c t ..................................................................................................................
20.5 Sums of I n d i c a t o r s .......................................................................................................................................
20.6 Problem s ........................................................................................................................................................
21 D e v ia tio n s fro m t h e M e a n
21.1 V a r ia n c e ............................................................................................................................................................
21.1.1 C om puting V a r i a n c e ......................................................................................................................
21.1.2 V ariance is N o n - N e g a tiv e ............................................................................................................ 312
21.2 V ariance of a S u m ....................................................................................................................................... 313
21.3 Law of Large N u m b e r s ................................................................................................................................. 315
21.3.1 W eak Law of Large N u m b e r s ..................................................................................................... 317
21.3.2 S trong Law of Large N um bers .................................................................................................. 317
21.4 Problem s ......................................................................................................................................................... 319
23 L a n g u a g es: W h a t is C o m p u tin g ? 33 9
23.1 Decision P r o b l e m s ........................................................................................................................................ 339
23.2 L a n g u a g e s ......................................................................................................................................................... 341
23.2.1 D escribing a L a n g u a g e '................................................................................................................... 340
23.3 Com plexity of a Coni])nt ing P r o b k 'i n ................................................................................ 343
23.4 Proble: 346
25 C o n te x t F ree G ra m m a rs 365
25.1 P arse 'l Y e e s ....................................................................................................................................................... 369
25.2 P u sh d o w n A u to m a ta ( P D A ) ....................................................................................................................... 371
25.3 P ro v ab ly N ot C o n te x t Fi’ee ....................................................................................................................... 372
25.4 P ro b lem s .......................................................................................................................................................... 374
2 6 T u r in g M a c h in e s 377
26.1 T ra n sd u c e r T u rin g M a c h iu e s ....................................................................................................................... 381
26.2 Infin ite L o o p s ................................................................................................................................................... 383
26.3 E n co din g s o f T u rin g M a c h in e s .................................................................................................................... 384
26.4 P ro b lem s ........................................................................................................................................................... 386
2 7 U n s o lv a b le P r o b le m s 38 7
27.1 S ketching T u rin g M achines ....................................................................................................................... 387
27.2 P ro g ra m m a b le T u rin g M a c h in e s................................................................................................................ 388
27.3 £ tm is U ndecidable: T h e re ’s No M e g a -C o m p ile r................................................................................ 390
27.4 O th e r U nsolvable Problem s: R ed u ctio n ............................................................................................... 391
27.4.1 P o s t’s C o rresp o n d en ce P ro blem ( P C P ) .................................................................................... 393
27.4.2 P ro g ra m V erification: ’‘Hello W orld!’’ ........................................................................................ 394
27.4.3 N on-R ecognizable L a n g u a g e s ...................................................................................................... 395
27.5 P ro b lem s ........................................................................................................................................................... 396
2 8 E ffic ie n c y : T h e C I eiss P 40 3
28.1 T im e C o m p le x ity ............................................................................................................................................. 404
28.2 Efficiently Solvable Problem s: T h e C lass P ........................................................................................ 405
28.3 A D ecidable N on-P o ly n o m ial P r o b l e m .................................................................................................. 409
28.4 B o u n d a ry B etw een Efficient an d Inefficient ........................................................................................ 411
28.5 P ro b lem s ........................................................................................................................................................... 412
2 9 H a r d P r o b le m s : NP 41 3
29.1 V erifiable versus Solvable ........................................................................................................................... 413
29.1.1 NP: Poly n o m ialy V e r i f i a b l e ......................................................................................................... 414
29.1.2 NP an d N o n d e te rm in is m ................................................................................................................ 416
29.2 A H a rd e st P ro b lem in N P ........................................................................................................................... 418
29.2.1 C irc u its an d S a t i s f i a b i l i t y ............................................................................................................. 418
29.2.2 CIRCUTT-SAT is H ard er th a n E very P roblem in N P ........................................................... 418
29.3 O th e r H ard est Problem s: N P - c o m p le tn e s s ........................................................................................... 421
29.4 P ro b lem s ...........................................................................................................................................................
E p ilo g u e
THE END
3 0 S o lu t io n s t o Q u iz e s & E x e r c is e s ^
End Quiz and Exercise S o lu t i o n s sol - 9o
43 3
F u r th e r R e a d in g
437
G lo s s a r y o f N o t a t i o n
T ^ 441
In d ex
xm
N otation
XIV
Part I
Discrete M athematics
Good mathematics is not about how many answers you know. It's about
how you behave when you don't know. - unknown
The only way to learn math is to do math. - Paul Halmos
Don't let anyone work harder than you. - Serena Williams
To make a great dream come true, the first requirement is a great
capacity to dream; the second is persistence. - Cesar Chavez
Chapter 0
1: The basics, the resources and putting yourself in the right mood.
E ven “self-co n tain ed ’’ boo k s s ta r t som ew here an d build. W e c a te r to 2nd-year u n d e rg rad u ates in a m ath e
m a tic a l, engineering or scientific discipline wdio have h ad one year of c o m p u ter science (p ro g ram m in g /d ata-
s tru c tu re s ) an d one y ear of calcuhis. In sh o rt, we assum e high-school m ath e m atic s (num bers, geom etry, alge
b ra , . . . ) , som e p ro g ram m in g a n d som e calculus. Here are som e refresher questions. A nswer th em , perhaps
w ith a little h elp from th e solu tio n s
N u m b e r san d S e ts.
1. W h a t is th e p rim e fa c to riz atio n of 252?
2. W h a t is th e m in im u m elem ent in th e set { 8 ,9 ,3 ,1 0 ,1 9 } ?
3. W h a t is th e u n io n o f th e sets { 8 ,9 ,3 ,1 0 ,1 9 } an d { 3 ,1 0 ,1 , 7}? W h a t is th e intersection?
4. D oes th is set of p o sitiv e n u m b ers have a m inim um elem ent:
{ 2 5 ,9 7 .1 0 7 ,1 0 0 .1 8 ,3 3 ,9 9 ,2 7 ,2 0 1 4 .2 2 0 0 ,2 3 ,...}
L o g a r ith m s a n d E x p o n e n t ia ls .
1. ln(2) w 0.693; ln(3) « 1.098. W h a t is ln(12)?
2. 2^° = 1024 a 1,000. W h a t is 22°?
3. How a re ln ( l x 2 x 3 x • • • x 10) an d (In 1 -T In 2 -T In 3 -T • • ■-T In 10) related?
S u m s an d P r o d u c ts.
1. W h a t are: (a) 1 + 2 + 3 + • • • + 1000 (b) 1 + 2 + 3 + • • • + n (c) 1 + } + ^ + ^ + ^ +
3. ^ is an inv itatio n to add. asks you to add /(?:) for th e whole num bers i w hich satisfy th e
lower bound in th e lower lim it and th e upp er bound in th e u p per lim it,
i<10
£ / ( z ) = / ( 1) + / ( 2) + --- + / ( 10).
i>i
Similarly, f ] is an invitatio n to m ultiply,
i<10
r i / ( d = / ( l ) x / ( 2) x - - - x / ( 10).
i> l
10 10
We often sim plify th e n o ta tio n even m ore and w rite f { i ) and H /(*)■
1=1 1=1
1000 1000 1000
W h at is Y W h at is Y W h a t is Y W h a t is Y
4=1 k=l k=l | i- l|< 5
k n
4. W h a t i s l + 2 + 3 + -- - + A:? W h a t is Y W h a t is Y
4=1 k=l
k k
5. W rite th e next two q u an tities using factorials: Y H *•
4=1 4=1
4<1
6. “E m pty" sum s, e.g. Y T are 0. “E m p ty ” p ro ducts, e.g. 2° and 0!, are 1. H ere's why.
i >3
You want the sum of the numbers in the set {3,10,1,7}. You are lazy, but your two friends are
not. You split the set into two disjoint subsets {3,10} and {1, 7}, give one subset to each friend, and
request the subset-sums. You receive the subset-sums 13 and 8, and add these two numbers to get
the full sum of 21. This simple procedure should work no m atter how you split up your original set.
Suppo.se you gave one friend all the numbers, and the other none of them. For the procedure to work,
your friend with none of the numbers (who computes an empty sum) must return 0.
To get the product instead of the sum, your friends would give you the subset-products 30 and 7.
which you multiply to get 210. If one friend gets all the numbers, and the other none of them, the
procedure still works if the friend with no numbers (who computes an empty product) returns 1.
A lg eb r a .
1. W h at is (1 + 2)''^?
2. W h at is (a + h)'^l W h at a b o u t (« + (i)'^?
3. W h at ar(> th e solutions to — 5.7; - 0 = 0?
4. W h at are th e solutions to - 5c'' - 0 = 0?
5. W h at are ;r and /y when x + ly = 2 and 2.r + 3iy = 7?
C a lc u lu s.
1. hich of the.se sc'i ies converges;
I + 2 + 2- + 2'* + 2 ' + • • ■
l + f + ( f ) “ + ( B " + ( B ' + ---
1- 1+1 1 + 1 H H - 1+ ■..
1t ' + i + ]
4. W h a t is th e lim it as x 0 of th e functions:
- 1 - 1 - 1 6 -^ - 1 c - 1
sin (2x) ’ 1+ X’ siii(x 2 ) ’ X -f x '^ ’
g2x _ 1
_ 1
e ^ - 1
5. W h a t is th e lim it as x oo of th e functions:
:2x _ 1 ’ x 3 q- 2 e ^ ’ x L '
7. W h a t is d x (1 + x '^ ) “ Q
S e ttin g U p E x p ec ta tio n s
T h is b o o k is by no m eans a co m p lete coverage of discrete m a th e m a tic s and com puting. We chose some topics
to cover, an d w 'ithin th o se to p ics we left o u t m any advanced concepts to satisfy th e b a n d w id th co n strain ts of
a course. To co m p en sate, we have given a generous helping of quizzes, exercises and problem s:
• easier pro b lem s te s t y our know ledge an d provide practice w ith th e concepts;
T h e re are several boo k s w hich delve m ore deeply or m ore com pletely into discrete m ath em atics. As for th e
d ee p e r b ooks, we will say m ore in th e epilogue. H ere are som e m ore com plete books a t th is level:
• Introduction to A u t o m a t a Theory, Languages, a nd Computation, by H opcroft. M otw ani, and U llm an.
T h e in te rn e t is an endless resource for en rich m en t. C om bined w ith th e above books which have m any soh-ed
exercises, th e re is no sh o rta g e of p ra c tic e problem s. M a th em a tic s is like any sp o rt. You have to train .
F in a l E x a m . You relaxed all winter and ran the spring Boston Marathon. You got destroyed.
The next year, you put in some intense 5-hour workouts three days before the race. You got
destroyed. The third year you wisened up and got a coach 3 months ahead of the race. You
took notes which helped fine-tune your 5-hour workouts three days before the race. You still
got destroyed. Finally on the 4th attempt you tried something new. You got the coach as
before and incorporated the coach’s teachings into a 3 hour work-out every day. You were
getting fitter. Three days before the race, you ramped up your training. W ow ! You finished in
the top-10% of runners in the race.,4;? Your Boston Marathon is the final exam in the course.
0. B a c k g r o u n d and P ep T alk
Pep Talk
Society w on’t o bject if you say “M ath isn’t for m e,” and yet i t ’s as ridiculous as saying “R unning isn ’t for me,
or "English isn 't for me.” If you move to USA, to get around you learn English. A nyone can do it. If you
wish to precisely m odel “stuff”, you learn m ath . A nyone can do it, enough said. Yes, m a th is h ard . B u t so is
learning English. M ath is for anyone who will p u t in the effort. You must p u t th e effort.
You also can learn to ‘th in k ”, to be creative and solve problem s. Solving a problem s ta rts w ith strateg ic
considerations, th e forem ost being to p repare th e psychology. Two classics on th a t front are
How to Solve It: A New Aspect o f Mathematical Method by G eorge Polya;
The A r t and Craft o f Problem Solving, by Paul Zeitz.
To get into th e right s ta te of m ind, listen well to th e sto ry of P olya’s little mouse.
“A mouse tries to escape from an old fashioned cage. After many futile attempts
bouncing back-and-forth, thumping his body against the cage bars, he finally finds one
place where the bars are slightly wider apart. The mouse, bruised and battered escapes
through this small opening, and to his elation, finds freedom.” - Polya
Try. try and try again. Vary th e trials th a t you m ay find th e rare favorable p a th to a discovery. T h e sto ry of
the m ouse is for everyone. W hen you hit an in teresting problem ju s t outside th e reach of your fam iliar realm ,
d o n 't throw your h ands in th e air out of subm ission because a solution d o esn ’t m agically ap p ear.
The solution to an interesting problem is not obvious.
T h a t is th e law. W hen you d o n ’t see th e solution im m ediately, d o n 't be discouraged. R ealize th a t such
situatio n s are faced by every explorer entering th e unknow n. All th a t C olum bus needed was a curiosity,
perseverance and a little good luck. C olum bus m arched forw ard despite adversity. A m a th e m a tic s problem
can throw much adversity your way. D on’t fret: d o n ’t give up. Be p atien t: persevere. Be th a t m ouse, try in g
this and th a t. E ventually a sm all opening will ap p ear and you m ay th en walk th ro u g h . M ost im p o rtan tly ,
realize th a t these are th e rules for everyone, from th e a m a te u r to th e professional m ath e m a tic ian .
It m ay be tru e th a t th ere is an innateness to m ath em atical creativity, ju st as not everyone is a M ozart.
-Alas, some m ay ap p ear b e tte r at m ath em atics th a n others. T hey m ay be b e tte r tra in e d , or ju s t b e tte r. In all
cases, it doesn't m atter. Leave them to th e ir business, and you focus on yours. To w arm up to th e im p o rtan ce
of perseverance, try not to tu rn an o th er page until you solve th is visual connection puzzle, w hich we have
lifted directly from The Ar t and Craft of Problem Solving.
.Ask this puzzle of your best m ath em atician friends. It will drive home th e fact th a t everyone ha.s to th in k
about a problem . Everyone ha.s to try one or two things th at fail, th e n one or two things th a t p a rtia lly succeed,
riirongh jM'iseverance. these' failures and p a rtia l succes.ses are w hat n ltim ately shine light on th e way out.
O ur prim ary goal is to im part tlu' knowledge and tools of discrete m atlu 'iu aties to you. R u t. you are the
one who mnst use- the.se tools to solve' preible'ins. A nd. te) solve' proble'ins, yeui must prep are yourself m entally
for a tough road. D on't be' afraiel to e'-xjeeriiiK'nt. Don't be afraid to erash your C P U eer e'enrupt your eiperating
system you can always pe'rform a fre'sh install of linux. P ut yemrself in the right fram e of m ind.
[ B e th e m ouse! ]
bet IIS Ix'gin.
Go down deep enough into anything and you will find mathematics.
- Dean Schlicler
If you don't believe mathematics is simple, it is only because you don’t
realize how complicated life is. - John von Neumann
To ask the right question is harder than to answer it. - Georg Cantor
Learning is a treasure that follows its owner. - Chinese Proverb
Chapter 1
D iscrete m a th e m a tic s deals w ith “o b je c ts th a t we co u n t.” W hen you cook your favorite T h a i dish, you perform
“d iscrete” ste p s in a sequence. W e can co u n t th o se steps. W h en delegates sit a t a b an q u et, each “discrete”
d eleg ate sits a t a single “d iscrete” seat. Processes th a t tak e place in well defined steps, involving o b jects th a t
com e in in divisible u n its a re th e focus of d iscrete m a th em atic s. T h e m ost fam ous discrete ob ject is th e digital
c o m p u te r w hich ex ecu tes in stru c tio n s in seq uential step s an d uses a discrete scratc h -p a p er called RAM to
sto re in te rm e d ia te re su lts d u rin g its calcu lations. If th a t is n o t enough reason to stu d y th e su b ject, th en for
b e a u ty ’s sake do it. L et us begin w ith som e exam ples of discrete m a th e m a tics in th e real world.
■ ■ ■ ■ ■ ■ ■
d ay 1 d ay 2 d ay 3 day 4 day 5 dav 6 day 7 day 8
P o p Q u iz 1 .1
Continue to tinker with the epidemic spread above. Does the red square eventually get infected?
T h e epidem ic sp re a d is indeed a d iscrete process. People are e ith e r infected or not. T im e is discretized into
days. W e identified th e a c to rs as people living on a grid an d th e process dynam ics - a t least two of youi
n eig h b o rs m u st be infected to infect you. T hese are m odeling assum ptions. M odeling assum ptions are critical,
a n d you m ay arg u e w ith th e m . People m ay n o t live on a grid. P erh ap s one neighbor being infected suffices to
infect you. A good m odel is m ore likely to give correct conclusions. T h e beginning of a discrete m athem atical
an aly sis is alw ays a m odel of th e p h enom enon you are analyzing. In our case, th e m odel was a 2-contact
1. A T a s t e of D iscrete M a t h e m a t i c s _______________________________________ 1.2. S peed D atin g
threshold for epidem ic spread on a grid. We do not address m odeling, which is very application dependent.
We care ab o u t w h at hap p en s next. You ask questions. Here are a few interesting questions.
1. Given th e in itial infection, who will u ltim ately get infected?
2. W h a t is th e fewest in itial infections needed to ultim ately infect th e whole com m unity?
3. If you had a few vaccines, w ho should you im m unize to m inim ize th e u ltim ate infection?
4. Given th e cu rren t observed sta te of th e epidem ic, can one determ ine th e “points of e n try defined as th e
sm allest set of initially infected people th a t could have produced th e observed infections?
do get answers, one m ust analyze th e m odel, and th a t is w here discrete m ath em atics enters.
E x e r c ise 1.2
Can you infect the entire 7 x 7 grid, starting with an initial infection of just 6 people?
Before we sw itch gears, observe th a t o u r m odel for EBOLA spread can apply to o th e r contexts: virus spread
in a com puter netw ork; com pany-defaults in an econom ic crisis; adoption of a technology in a social netw ork.
® ® © @
® ^ ® © ^® ® ^ ®
© © ® ®
You succeed if you hook uj) m any couples, so you w ant everyone to m eet as m any people as possible du rin g
th e night. T h a t’s th e m odel. Here are some in teresting (piestions.
1. W h a t does “ .. .m eet as m any people as possible . . . " m ean? Do you care a b o u t th e average num ber of
encounters your clients had or th e client who had th e fewest encounters?
2. C an one efficiently configure th e rounds so th a t everyone m eets at least 10 peo[)le?
.3, W h at would hapi)en if you random ly assigned clients to tables in each round?
Tinker a little. C an yon come up w ith good ways to configure th e 4 rounds of sp eed-dating. See if you can
hgure out why I am so confident th a t no m a tte r how much you tinker, no one will m eet m ore th a n 12 people.
1 can also say th a t if you configured th e rounds random ly, everyone would expect to m eet a b o u t !) people, so
random is not th a t bad. You can n o t b e a t 12 for anyoiii', and random gets yt)u to a b o u t 9 for ew ry o n e .
dsdids —
TTojfo pio' w hich gives th e com bined dom ino
1100110
iJ b o o J b i. 1110011
To solve th e dom ino puzzle, find a sequence of dom inos for w hich th e com bined to p and b o tto m strings m atch.
R e p e titio n o f d om inos is allow ed an d you need n o t use all dom inos. In th is case, you can verify th a t d 3 d 2 d 3 d\
solves th e puzzle. T h a t ’s nice, b u t w h a t does a sim ple k id s’ puzzle have to do w ith com puting? C ould you
w rite a p ro g ra m to solve th e dom ino puzzle? Y our p rogram w ould read in a te x t file w here each row of the
file describ es a dom ino, tw o co m m a s e p a ra te d b in ary strin g s. Your program should o u tp u t a sequence of
dom inos w hich solves th e puzzle, or say it c a n ’t be done. Now, does th a t look like a com puting problem to
you, so m eth in g t h a t could be o n a p ro g ram m in g assignm ent?
1.5 P ro o f
It is H u m an to seek proof, to ask why. If your neighbor says ev acuate because of hurricanes, w ouldn t you
seek verificatio n ? If you claim to have a p e rp e tu a l m otion m achine, I w on’t take you a t your word. We each
have different th re sh o ld s to be convinced of som ething. In life, a few tru e instances are often enough - th a t
is in d u ctiv e proof. T h e su n h as risen every m orning. T h a t’s enough for us e arth y beings to conclude th a t
th e su n will alw ays rise. Logically, a few cases of th e sun having risen does not prove “T h e sun rises every
m o rn in g .” I t only m ean s th e s ta te m e n t is n o t obviously false. In m ath em atics, we have th e sam e urge for
v erification, b u t o u r e x p e c ta tio n s are high. W e require ded u ctiv e proof.
In th e s p e e d -d a tin g ritu a l on page 8 , n o b o d y m eets m ore th a n 12 people. Here is a jiroof. In any round a
p e rso n m e e ts a t m o st 3 new people. So, a fte r 4 ro u n d s th e y m eet a t m ost 4 x 3 = 12 new people. A ren t you
u tte rly convinced? T h e b e a u ty of d ed u ctiv e p ro o f is th a t it leaves no room for d o ubt.
1. A T a s te o f D is c r e t e M a th em a tics 1.5. P roof
In m athem atics, if you’re m issing som ething, you’re m issing everything. Work th e te x t, quizzes
and exercises, w ith pencil and p a p e r in hand. You m ust agree w ith th e sm allest detail.
It is w orth showcasing th e recurring workflow an ex p ert uses to solve a problem . M em orize it.
1: M odel th e problem you are try in g to solve using a discrete m a th em a tic al object.
2: T inker w ith easy cases to u n d erstan d th e m odel. T in k e r in g is e s s e n tia l.
3: Based on th e tinkering, form ulate a conjecture a b o u t your problem m odel.
4: Prove th e conjecture and m ake it a theorem . You now know som ething new.
The novice builds th e m odel and stares a t it w ith o u t know ing w h at to prove, because of a failure to tinker.
E x e r c is e 1 .3 [A S isy p h e a n P u z z le to T e e th e On]
Zeus punished King Sisyphus of Corinth to an eternity of rolling a boulder up a hill
only to see it roll down when near the top. Sisyphean tasks are laborious yet futile.
Three boxes start with 100, 200 and 300 boulders, the configuration (100,200,300).
A move places a stone from one box into another. For example, moving a stone
from the box with 200 to the box with 100 gives configuration (101,199,300).
Each move gains or loses gold coins and debt is allowed. The gain is larger for a
move from a box with many stones to a box with few stones. Specifically,
gain = ^ stones left in originating box (after move) — # stones in destination box (before move).
Here is a sequence of moves with the corresponding payments.
start configuration end configuration gain
(100.200.300) (101,199,300) 199 - 100 = +99
(101.199.300) (101,198,301) 198 - 3 0 0 = - 1 0 2
(101.198.301) (102.198,300) 300- 101 =+199
The profit for these three moves is +196 coins (= 99 - 102 + 199). Sisyphus can move stones, but must
return to the start configuration. How much can Sisyphus profit? Can you prove it?
M a t h e m a t i c s a n d ‘" P a r tia l C r e d i t ” . 1 licv doii t mcsli well, lii scIiodI, i>artial r redit is a learuiug-aiile. It s
com forting to know you're close to a solution, and p a rtial credit delivers the m essage. .M athem atics is not so
forgiving. A proof is right or wrong. T h ere's no alm ost |)roven. C o m p u ter program s are m a th e m a tic a l o b jects
I iinning on inathem atical d e\’ices. program works or it doc'sn t. It a builder m akes one w rong join th e whole
stru ctu re can fall. ’\o n don t g(>t .(-crt'dit tor sending soiiK'one to the m oon but forgetting to bring th e m back.
A in-ograin that m ostly works is a cata.strophe w aiting to happen. Check ont Therac-25 on W ikipedia;
"Because of concurrent programming errors, it sometimes gave its patients radiation doses
that were hundreds of times greater than normal, resulting in death or serious injury."
W ho cares if Therac-25 had one bug or 17 bugs'.’ Should we be lenimit because Therac-25 w orked 99 9'T of th e
tim e, only failing in ran- boundary ca.ses'.’ Then- is a fundam ental ditlereiuv lu-tween alg o rith m s th a t alwavs
work an.l henristics which often work, but w ithout g u a ra n t.v . bih- docs not give credit for p a rtia l solutions
C ritical coinpntm- sy.steins from trafli.- control to robotic surgerv to self-driving cars m ust fullv work all
the tiiiK-. otherwi.se people will sulfer. Take th e precaution to proiH yonr program w orks O th e rs relv on it
H)
1. A T a s te o f D is c r e t e M a th em a tics 1 g P r o b ie m s
1.6 Problem s
P r o b le m 1 .1 . The parity of an integer is 0 if it is even and 1 if it is odd. Which operations preserve parity:
(a) Multiplying by an even, (b) Multiplying by an odd. (c) Raising to a positive integer power.
P r o b le m 1 .2 . W hat's wrong with this comparison: Google's nett worth in 2017, about $700 billion, exceeds the
G D P of many countries, e.g. Argentina's 2016-GDP was about $550 billion. (Look up nett worth and GDP.)
P r o b le m 1.5 ( S o c ia l G o lfe r P r o b le m ) . 32 golfers form 8 groups of 4 each week. Eachgroup plays a round of
golf. No two golfers can be in the same group more than once. For how many weeks can this golfingactivity go on?
(a) "Prove" that this golfing activity cannot go on for more than 10 weeks.
(b) Try to create a scheduling of players for as many weeks as you can. (10 is possible.)
(c) How is this problem related to the speed-dating problem?
In general you must schedule g groups of golfers each of size s for w weeks so that no two golfers meet more than once
in the same group. Given (g ,s,w ), can it can be done and what is the schedule? This is a hard problem.
P r o b le m 1.7. Five radio stations (red stars) broadcast to different regions, as shown. The FCC
assigns radio-frequencies to stations. Two radio stations with overlapping broadcast regions must
use different radio-frequencies so that the common listners do not hear garbled nonsense.
W hat is the minimum number of radio-frequencies the government needs?
r Discrete math problems are like childhood puzzles. Parity, symmetry and invariance often yield simple solutions.
P r o b le m 1 .8 . Two players take turns placing identical circular quarters on a circular table. Coins cannot overlap and
must remain on the table. The last person to play wins. Do you want to go first or second? [Hint: symmetry.]
P r o b le m 1 .9 . A chocolate-bar has 50 squares (5 x 10). How many breaks are necessary to break the bar into its 50
individual squares? You may only break a piece along a straight line from one side to the other. No stacking allowed.
[Hint: Define the invariant A = [[pieces — [[breaks. What happens to A with each break?]
P r o b le m 1 .1 0 . A single-elimination tournament has 57 players. Players may receive byes in some rounds. How many
matches are played before a winner is declared? Does it depend on how the tournament is configured? [Hint: Define
the invariant A = [[players remaining + [[matches played. What happens to A after a match?]
P r o b le m 1 .1 1 . Five pirates must share 100 gold coins. The most senior pirate proposes a division of coins and all
pirates vote. If at least half the pirates agree, the coins are divided as proposed. If not, the proposer is killed and the
process continues with the next most senior pirate. A pirates priority is to stay alive, and then to get as much gold as
possible. W hat should the senior pirate propose? [Hint: Sometimes it is better to start with a smaller problem.]
P r o b le m 1 .1 2 . Can you color squares of a 9 x 9 grid blue or red so that every square has one opposite color neighbor
(neighbors are left, right, up or down).
11
1 .6 . P roblems
1. A T a s te o f D is c r e t e M a th em a tics
P r o b le m 1 .1 3 . 57 security guards are positioned so that no two pairs of guards are the same distance apart. Every
guard watches the guard closest to him. Is there an arrangement of the guards so that every guard is being watched?
P r o b le m 1 .1 4 . 10 trucks each have 100 gallons of fuel and use 1 gallon of fuel per mile. How far can you deliver a
chest that fits in one truck? (You can transfer the chest and/or fuel from truck to truck.)
P r o b le m 1 .1 5 . A camel owner wants to sell his 300 bananas at a market 100 miles away. The camel can carry at
most 100 bananas, but eats a banana for every mile travelled. How many bananas can be sold at the market?
P r o b le m 1 .1 6 . Show that fewer than n initial infections cannot infect the whole n x n grid in 2-contact e b o l a .
[Hint: For a square, define 4-outgoing links (N,S,E,W) to its 4 neighbors. Pretend boundary-squares have neighbors.
For an infected square, remove all outgoing links to infected neighbors. Let A, the "wavefront o f the infected area, be
all remaining outgoing links for infected squares. Can A increase? What is A when all squares are infected?]
P r o b le m 1 .1 7 (C h o m p ). In the grid of chocolate, if you eat the top-left square, you lose.
Each player takes turns to eat a square plus all the chocolate below it and to the right. We show
a possible first move and the chocolate that removed in blue. Do you want to go first or second?
■
'/y X/
[Hint: Either eating the bottom right piece wins or not. If not, what should you do?]
P r o b le m 1.18. A man has a boat which can carry him and one other thing. How can the man get a fox, a chicken
and a bag of corn across the river, if, when unattended, the fox eats the chicken and the chicken eats the corn.
P r o b le m 1.19. Tasks involving covering an area using different shaped tiles are a treasure trove of interesting puzzles.
(a) Remove the top left and bottom right squares on an 8 x 8 chess board. Can you tile the remaining 62 squares
with 31 dominos? [Hint: Show that #black squares - ifw hite squares is an invariant when you place a domino?]
(b) On an 8 X 8 chess board, show that if you remove any two squares of different colors, you can
tile the remainder of the board with dominos. [Hint: See illustration on the right. We show
a path starting from the top-left. You can tile the board by placing dominos along this path.
You may assume that the first square removed is white (why?). Show that you can still tile
the remaining board along the path.].
(c) On a 8 X 8 chess board, show that if you remove any corner square, you cannot tile the
remainder of the board with straight triominos ( I I I I). It is possible to tile the board with
triominos after removing one square. Can you identify which squares can be removed (there
are 4)? [Hint: See illustration on the right. We have colored the squares on the chess board
so that a triomino must cover one square o f each color.].
(d) Can you cover a 10 x 10 chessboard with 25 straight tetrominos ( I I I I I). If yes, how?
P r o b le m 1 .2 0 . There are 13 purple, 15 red and 17 green chameleons. When chameleons of different colors meet they
both transform to the third color. Will all 45 chameleons ever be the same color? [Hint: Consider A = ffp u rp le -ifre d .]
P r o b le m 1.21. A building has 1000 floors. You wish to determine the highest floor from which you can drop an
egg without the egg breaking. If you had 1000 identical eggs, you could drop one from each floor and seewhicheggs
survive. How many egg drop trials do you need if you have: (a) One egg. (b) Two identical eggs.
P r o b le m 1.22. Four boys take Imin, 2min, 7min and lOmin to cross a bridge. The bridge only holds two boys at
a time. It is dark and there is only one flashlight, which is needed to cross the bridge. Two boys cross at the speed of
the slower boy who holds the flashlight. All four boys must get across the bridge. If the fastest boy acts as chauffeur
for the other three, all four can cross in 21 min. Can all four get across the bridge faster?
P r o b le m 1.23. Two consecutive positive numbers n and n + 1 are given to you and a friend. One player gets n
and the other gets n. f I, at random. You look at your number and shout out your opponents number if youknow it,
otherwise you pass the turn to your opponent. Will this game ever stop?
P r o b le m 1.24. You have a gold chain with 63 links. You would like to cut some links to obtain a set of links of
different sizes. You goal is to be able to represent any number of links from 1 to 63 as a collection of someof your
pieces in order to trade. What is the minimum number of links you need to cut to be able to do so?
P r o b le m 1.25. Three ants a.h.c are on the vertices .1. Ii.< 'o f a triangle. Each ant randomly picks one of the other
vertices and walks to it. What are the chances that no ants colide on an edge or at a destination vertex)?
What if there are four ants ii.h.c.il on the vertices .1, H.( /) of a tetrahedron?
12
1. A T a s t e o f D i s c r e t e M a t h e m a t i c s ______________________________ ^ 0 P r o b lfm s
P r o b le m 1 .2 6 . Two players alternately pick numbers without replacement from the set {1, 2 , 3 ,..., 9 }. The first
player to obtain three numbers that sum to 15 wins. What is your strategy?
P r o b le m 1 .2 7 . A maharaja has 100 amphoras of wine. A traitor poisons one amphora, gets detected and killed.
The poisoned amphora is not known and the poison kills in exactly one month. The maharaja uses tasters to tell if wine
is safe, depending on whether the taster lives or dies after a month.
(a) The maharaja wants to safely drink wine in a month, what is the minimum number of tasters he needs.
(b) The maharaja wants to use all safe amphoras to throw an orgy in a month. What is the minimum number of
tasters he needs. A simple solution is 100 tasters, one on each amphora. One can do much better though.
P r o b le m 1 .2 8 . Two players take turns picking a coin from either end of a line of 20 coins. In the example below,
if player 1 always takes from the left and player 2 from the right, then player I's coins total 80, and player 2 ’s total is 146.
- © 0 0 ® ® © © © © © © ® ® © ® © ® © © ©
The player with the highest total wins, player 2 in the example. Do you want to play first or second?
P r o b le m 1 .2 9 . To weigh sugar, you have a comparison scale that can compare weights (illustrated).
Give the fewest weights that are needed to measure out 1 . 2 , . . . , 1 2 1 pounds of sugar.
For example, to measure 3 pounds of sugar with 2 and 5 pound weights, place the sugar and 2 pounds
on the one side, and 5 pounds on the other side. The sugar weighs 3 pounds if the scale balances.
P r o b le m 1.30. More than half of 99 processors are good and the rest are bad. You may ask a processor to evaluate
another processor. A good processor always gives the correct answer and a bad one gives the wrong answer. How many
times must you ask some (any) processor to evaluate another before you can identify a good processor?
P r o b le m 1.31. A plane has fuel capacity to fly half way around the world. A plane can refuel from another plane in
mid-air. All planes are at the airport. How many planes and tanks of gas do you need so that you can support a single
plane to fly around the world? All planes must return to the airport.
P r o b le m 1.32 . 25 horses have different speeds. You can race up to 5 horses at a time and observe the order in
which the horses finish. You have no stop-watch. Show that 7 races suffice to determine the fastest 3 horses.
P r o b le m 1.33. 100 prisoners are up for a pardon. Prisoners will be lined in random order with a randomly chosen
red or blue hat on each head. A prisoner sees only those ahead of them in the line. The last in line shouts the color of
his hat. If he gets it right, he is pardoned. Then the second-last prisoner gets a chance and so on until the first in line.
The night before pardoning, the prisoners may strategize. During the pardoning process, the prisoners cannot commu
nicate except to shout out a hat color. If the prisoners optimally strategize the night before, what are the chances that
the first to shout is pardoned, the second to shout, the third to shout and so on up to the final prisoner?
P r o b le m 1.34. At a puzzle-party with 32 guests, the host will shuffle a 52-card deck and paste a card on each guest's
forhead. A guest will see every other guest's card but not their own card. After the cards are pasted on forheads, each
guest, one by one, must shout out a card (e.g. 4<|k). At the end the number of guests who correctly shouted out their
card is multiplied by $1 , 0 0 0 to get a prize amount which is split evenly among all guests.
Intense discussion breaks out among the guests as they arrive. A philosopher suggests breaking into 16 pairs. In each
pair, the first to shout says their partner's card so the partner can guess correctly. This strategy guarantees $16,000. A
FOCS-student claims, "I can guarantee we will share $31,000.” Can you come up with a strategy to guarantee $31,000?
P r o b le m 1.35. Three friends A , B , C each have tokens a , 6 ,c. At every step a random pair of friends is picked
to swap whatever tokens they currently have. If the first pair picked is ( A , B) and then {A, C) then the tokens are
distributed c, a, b after the two swaps. What are the chances each friend has their own token after 2015 swaps?
P r o b le m 1.36. On a table are some red and blue cards. Two players take turns picking two cards. If the two cards
picked are the same color, both cards are replaced by one red card. If the two cards picked are different colors, both
cards are replaced by one blue card. When one card remains, you win if it is blue and your opponent wins if it is red.
(a) Must the game always end, or can it go on forever?
(b) Who wins if there are 8 blue and 11 red cards to start? Does it matter who goes first? [Hint: Parity invariant.]
P r o b le m 1.37. Dad normally picks Sue from school which ends at 3pm. School ended early at 2pm, so Sue started
walking home and dad picked her up on the way, returning home 20min earlier than usual. For how long did Sue walk?
P r o b le m 1.38. Pick any six kids. Show that either 3 of them know each other or 3 of them do not know each other.
13
1. A T a s t e of D iscrete M at h em at ics
1 .6 . P roblems
P r o b le m 1 .3 9 . Fifteen houses are in a row. A thief robs a house. On each subsequent night, the thief robs a
neighbor of the house robbed the previous night. The thief may backtrack and rob the same house. A policeman can
watch any one house per night. Is there a strategy for the policeman to guarantee catching the thief?
P r o b le m 1 .4 0 . 5 of 10 coins are showing heads. You can move coins to form two sets, and you can flip over any
coins you wish. How will you guarantee that both sets have the same number of heads showing, blindfolded?
P r o b le m 1 .4 1 . Baniaz and her twin kids pass a gumball machine with 2 red, 3 blue and 4 green gumballs. Gumballs
cost 1$ each and come out randomly. Baniaz buys gumballs until she can give each of her kids one gumball of the same
color. In the worst case, how much must Baniaz be willing to spend? What if she had quadruplets instead?
P r o b le m 1.42. Two 1 meter fuses (strings) each burn non-uniformly in 60 sec. How can you measure 45 sec?
^ Here come hard problems that take you to the boundaries of mathematics and computing, j
P r o b le m 1 .4 4 (S u b s e t S u m ). Find two different subsets of this set of one hundred 27-digit numbers, with the
requirement that the numbers in each subset
1: 5719825393567961346558155629 35; 8794353172213177612939776215 69 7549684656732941456945632221
2: 5487945882843158696672157984 36: 2989694245827479769152313629 70 2397876675349971994958579984
3: 4767766531754254874224257763 37: 6117454427987751131467589412 71 4675844257857378792991889317
4; 1855924359757732125866239784 38: 2761854485919763568442339436 72 2832515241382937498614676246
5: 4289776424589197647513647977 39: 6884214746997985976433695787 73 8755442772953263299368382378
6: 7967131961768854889594217186 40: 8671829218381757417536862814 74 9833662825734624455736638328
7: 2572967277666133789225764888 41: 9431156837244768326468938597 75 5298671253425423454611152788
8: 1294587141921952639693619381 42: 4788448664674885883585184169 76 9857512879181186421823417538
9: 4764413635323911361699183586 43: 3624757247737414772711372622 77 1471226144331341144787865593
10: 1474343641823476922667154474 44: 9361819764286243182121963365 78 3545439374321661651385735599
11; 2578649763684913163429325833 45: 9893315516156422581529354454 79 6735367616915626462272211264
12: 5161596985226568681977938754 46: 5913625989853975289562158982 80 2141665754145475249654938214
13: 2242632698981685551523361879 47: 8313891548569672814692858479 81 8481747257332513758286947416
14: 7474189614567412367516833398 48: 2265865138518379114874613969 82 9961217236253576952797397966
15: 6211855673345949471748161445 49: 3477184288963424358211752214 83 9941237996445827218665222824
16: 4942716233498772219251848674 50: 6321349612522496241515883378 84 6242177493463484861915865966
17: 5516264359672753836539861178 51: 1796439694824213266958886393 85 4344843511782912875843632652
18: 5854762719618549417768925747 52: 6366252531759955676944496585 86 7568842562748136518615117797
19: 5313691171963952518124735471 53: 8545458545636898974365938274 87 2776621559882146125114473423
20: 6737691754241231469753717635 54 3362291186211522318566852576 88 6174299197447843873145457215
21: 4292388614454146728246198812 55: 8464473866375474967347772855 89 5387584131525787615617563371
22: 4468463715866746258976552344 56: 2892857564355262219965984217 90 5317693353372572284588242963
23: 2638621731822362373162811879 57; 4296693937661266715382241936 91 6612142515552593663955966562
24: 1258922263729296589785418839 58: 8634764617265724716389775433 92 1314928587713292493616625427
25: 4482279727264797827654899397 59: 8415234243182787534123894858 93 2446827667287451685939173534
26: 8749855322285371162986411895 60: 2267353254454872616182242154 94 9786693878731984534924558138
27: 1116599457961971796683936952 61: 4689911847578741473186337883 95 2926718838742634774778713813
28: 3879213273596322735993329751 62: 4428766787964834371794565542 96 3791426274497596641969142899
29: 9212359131574159657168196759 63: 7146295186764167268433238125 97 2831727715176299968774951996
30: 3351223183818712673691977472 64: 2273823813572968577469388278 98 3281287353463725292271916883
31: 8855835322812512868896449976 65: 6686132721336864457635223349 99 9954744594922386766735519674
32: 4332859486871255922555418653 66: 3161518296576488158997146221 100 341433914354532429S85324S718
33: 2428751582371964453381751663 67: 1917611425739928285147758625
34: 6738481866868951787884276161 68: 3516431537343387135357237754
[298]
[Contents]
XV
Beaver Work
Hidden among the larches at the lower end of my pond was a tiny outgoing stream,
which had proved hard to find when first I explored the region, and almost impossible
to follow afterward. Under a fallen log, so weathered and mossy that it seemed part of
the natural shore, a volume of water escaped without ripple or murmur, wandering
away under bending grasses to lose itself in an alder swamp, where innumerable
channels offered it lingering passage. From the swamp it found its way, creepingly,
among brooding cedars to a little brook, which went singing far down through the
woods to Upper Pine Pond; and beyond that on the farther side was a long dead-
water, [299]and then Pine Stream making its tortuous way through an untraveled
region to the Penobscot. The nearest beavers, a colony of four lodges which I
unearthed on a hidden branch of Pine Stream, were twelve or fifteen miles away, as
the water flowed; yet over all that distance an exploring family had made its lonely
way, guided at every turn by the flavor of distant springs, till one after another they
crept under the fallen log and entered my pond, which was solitary enough to satisfy
even their pioneer instincts. They had first picked a site for their new lodge, on a point
overlooking the lower half of the pond, and had then gone back to the outlet to raise
the water.
Their dam was a rare piece of wild engineering; so much I had to confess, even while
I wished that the beavers had chosen some other place to display their craft. Finding
where the water escaped, they stopped the opening beneath the log, and made a
bank of mud and alder-brush above it. This bank was carried out a dozen feet or more
on either side of the stream, the ends being bent forward (toward the pond above) so
as to make a very fine concave arch. On a small or quiet stream like this, beavers
almost invariably build a straight dam; and where swift water calls for a stronger or
curving structure, they present the convex side to the current; but here they had
[300]reversed both rules, for some reason or impulse which I could not fathom,—
except on the improbable assumption that the animals could foresee the end of their
work from the beginning. The finished dam was an amazingly good one, as you shall
see; but whether it resulted from planning or happy experiment or just following the
water, only a certain old beaver could tell.
Since there was no other outlet to my pond, the beavers were obliged to build here;
but the site was a poor one, the land being uniformly low on all sides, and no sooner
did they finish their dam than the rising water flowed around both ends of it. To
remedy this they pushed out a curving wing from either end of their first arch, so that
the line of their dam was now a pretty triple-curve. Again and again the outgoing
water crept around the obstacle; each time the beavers added other curving wings,
now on this side, now on that, bending them steadily forward till the top of their dam
suggested the rim of an enormous scallop-shell. Then, finding the water deep enough
for their needs, they thrust out a straight wing from either end of their dam, resting
their work on the slopes of two hillocks in the woods, some fifty yards apart,—this in a
straight line, or across the hinge of the scallop-shell: if measured on the curves, their
dam was three or four times that length. Their [301]next task was to build a lodge on
the point above; then they dug a canal through the bog to the nearest grove of
hardwood, and cut down a liberal part of the trees for their winter supply of bark. The
branches of these trees had been cut into convenient lengths, floated through the
canal, and stored in a great food-pile in the deep water near the lodge.
When I found the dam, several deer (to judge from the tracks) were already using the
top of it as a runway in passing from the flooded ground on one side of the pond to
the other. From either end a game-trail led upward along the shore, no longer
following immemorial paths over the bog, which was submerged with all its splendor
of color, but making a new and rougher way through the black growth. When I
followed one of these trails it led me completely around the pond, going confidently till
it neared the salt-lick, where it halted, wavered and trickled out in aimless wanderings.
There, where once the ground was trodden smooth by many feet, was now no ground
to be seen. The precious spring, over which a thousand generations of deer had
lingered, had vanished in a dull waste of water. Twice I watched the place from early
morning till owls began to cry the twilight; in that time only a few animals appeared,
singly, at long intervals; and after wandering about as if [302]seeking something and
finding it not, they disappeared in the dusky woods.
And so I went away, looking for the last time sadly on the little pond, as upon a place
one has owned and loved, but which has passed into other hands. Though the wild
ducks still breed or gather there, it is no longer the same. There is no restful spot from
which to watch the waters dance with the wind, or frown at the cloud, or smile at the
sunshine; the little larches are all dead beside their ancestors; the carpet of colored
moss is but a memory. When the beavers go to pioneer a remoter spot, I shall break
their dam and let the water return to its ancient level. Then, if happily I live long
enough for another fringe of larches to grow, and another mossy rug to crimson under
the waning sun, perhaps it will be my pond once more.
THE END
[Contents]
Colophon
Availability
This eBook is for the use of anyone anywhere at no cost and with almost
no restrictions whatsoever. You may copy it, give it away or re-use it under
the terms of the Project Gutenberg License included with this eBook or
online at www.gutenberg.org ↗️.
Metadata
Revision History
2024-02-04 Started.
Corrections
The following 3 corrections have been applied to the text:
Edit
Page Source Correction
distance
98 show-shoes snow-shoes 1
141 ‘ “ 1
161 How how 1
*** END OF THE PROJECT GUTENBERG EBOOK HOW ANIMALS
TALK ***
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must, at
no additional cost, fee or expense to the user, provide a copy, a
means of exporting a copy, or a means of obtaining a copy upon
request, of the work in its original “Plain Vanilla ASCII” or other
form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com