Yale Lecture Notes Ebook free download

  Dis rete Mathemati s Le ture Notes, Y ale Univ ersit y , Spring 1999 L. Lo v asz and K. V esztergom bi

  Parts of these le tur e notes ar e b ase d on L. Lo v asz { J. Pelik an { K. Veszter gombi: K ombina torika

  (T ank on yvkiad o, Budap est, 1972);

  Chapter 13 is b ase d on a se tion in L. Lo v asz { M.D. Plummer: Ma t hing theor y (Elsevier, Amsterdam, 1979)

  Con ten ts

  49 7.3 A form ula for the Fib ona i n um b ers . . . . . . . . . . . . . . . . . . . . . . . .

  37

  6 Com binatorial probabilit y 44 6.1 Ev en ts and probabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  44 6.2 Indep enden t rep etition of an exp erimen t . . . . . . . . . . . . . . . . . . . . . .

  45 6.3 The La w of Large Num b ers . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  46

  7 Fib ona i n um b ers 48 7.1 Fib ona i's exer ise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  48 7.2 Lots of iden tities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  51

  5 P as al's T riangle 34 5.1 Iden tities in the P as al T riangle . . . . . . . . . . . . . . . . . . . . . . . . . . .

  8 In tegers, divisors, and primes 53 8.1 Divisibilit y of in tegers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  53 8.2 Primes and their history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  53 8.3 F a torization in to primes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  56 8.4 On the set of primes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  57 8.5 F ermat's \Little" Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  61 8.6 The Eu lidean Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  62 8.7 T esting for primalit y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  34 5.2 A bird's ey e view at the P as al T riangle . . . . . . . . . . . . . . . . . . . . . .

  32

  1 In tro du tion

  3 Indu tion 19 3.1 The sum of o dd n um b ers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  5

  2 Let us oun t! 6 2.1 A part y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  6 2.2 Sets and the lik e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  8 2.3 The n um b er of subsets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  10 2.4 Sequen es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  14 2.5 P erm utations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  16

  19 3.2 Subset oun ting revisited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  31 4.6 Distributing money . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  21 3.3 A few more indu tion pro ofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  22 3.4 Coun ting regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  24

  4 Coun ting subsets 27 4.1 The n um b er of ordered subsets . . . . . . . . . . . . . . . . . . . . . . . . . . .

  27 4.2 The n um b er of subsets of a giv en size . . . . . . . . . . . . . . . . . . . . . . .

  27 4.3 The Binomial Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  28 4.4 Distributing presen ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  30 4.5 Anagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  66

  9 Graphs

  69

  9.1 Ev en and o dd degrees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  69 9.2 P aths, y les, and onne tivit y . . . . . . . . . . . . . . . . . . . . . . . . . . .

  73

  10 T rees 77 10.1 Ho w to gro w a tree? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  78 10.2 Ro oted trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  80 10.3 Ho w man y trees are there? . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  80 10.4 Ho w to store a tree? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  81

  11 Finding the optim um 88 11.1 Finding the b est tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  88 11.2 T ra v eling Salesman . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  91

  12 Mat hings in graphs 93 12.1 A dan ing problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  93 12.2 Another mat hing problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  94 12.3 The main theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  96 12.4 Ho w to nd a p erfe t mat hing? . . . . . . . . . . . . . . . . . . . . . . . . . .

  98

  12.5 Hamiltonian y les . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

  13 A Conne ti ut lass in King Arth ur's ourt 104

  1 In tro du tion F or most studen ts, the rst and often only area of mathemati s in ollege is al ulus. And it is true that al ulus is the single most imp ortan t eld of mathemati s, whose emergen e in the 17th en tury signalled the birth of mo dern mathemati s and w as the k ey to the su essful appli ations of mathemati s in the s ien es.

  But al ulus (or analysis) is also v ery te hni al. It tak es a lot of w ork ev en to in tro du e its fundamen tal notions lik e on tin uit y or deriv ativ es (after all, it to ok 2 en turies just to de ne these notions prop erly). T o get a feeling for the p o w er of its metho ds, sa y b y des ribing one of its imp ortan t appli ations in detail, tak es y ears of study .

  If y ou w an t to b e ome a mathemati ian, omputer s ien tist, or engineer, this in v estmen t is ne essary . But if y our goal is to dev elop a feeling for what mathemati s is all ab out, where is it that mathemati al metho ds an b e helpful, and what kind of questions do mathemati ians w ork on, y ou ma y w an t to lo ok for the answ er in some other elds of mathemati s.

  There are man y su ess stories of applied mathemati s outside al ulus. A re en t hot topi is mathemati al ryptograph y , whi h is based on n um b er theory (the study of p ositiv e in tegers 1; 2; 3; : : : ), and is widely applied, among others, in omputer se urit y and ele troni banking. Other imp ortan t areas in applied mathemati s in lude linear programming, o ding theory , theory of omputing. The mathemati s in these appli ations is olle tiv ely alled dis r ete mathemati s. (\Dis rete" here is used as the opp osite of \ on tin uous"; it is also often used in the more restri tiv e sense of \ nite".)

  The aim of this b o ok is not to o v er \dis rete mathemati s" in depth (it should b e lear from the des ription ab o v e that su h a task w ould b e ill-de ned and imp ossible an yw a y). Rather, w e dis uss a n um b er of sele ted results and metho ds, mostly from the areas of om binatori s, graph theory , and om binatorial geometry , with a little elemen tary n um b er theory .

  A t the same time, it is imp ortan t to realize that mathemati s annot b e done without pr o ofs. Merely stating the fa ts, without sa ying something ab out wh y these fa ts are v alid, w ould b e terribly far from the spirit of mathemati s and w ould mak e it imp ossible to giv e an y idea ab out ho w it w orks. Th us, wherev er p ossible, w e'll giv e the pro ofs of the theorems w e state. Sometimes this is not p ossible; quite simple, elemen tary fa ts an b e extremely diÆ ult to pro v e, and some su h pro ofs ma y tak e adv an ed ourses to go through. In these ases, w e'll state at least that the pro of is highly te hni al and go es b ey ond the s op e of this b o ok. Another imp ortan t ingredien t of mathemati s is pr oblem solving. Y ou w on't b e able to learn an y mathemati s without dirt ying y our hands and trying out the ideas y ou learn ab out in the solution of problems. T o some, this ma y sound frigh tening, but in fa t most p eople pursue this t yp e of a tivit y almost ev ery da y: ev eryb o dy who pla ys a game of hess, or solv es a puzzle, is solving dis rete mathemati al problems. The reader is strongly advised to answ er the questions p osed in the text and to go through the problems at the end of ea h hapter of this b o ok. T reat it as puzzle solving, and if y ou nd some idea that y ou ome up with in the solution to pla y some role later, b e satis ed that y ou are b eginning to get the essen e of ho w mathemati s dev elops.

  W e hop e that w e an illustrate that mathemati s is a building, where results are built on earlier results, often going ba k to the great Greek mathemati ians; that mathemati s is aliv e, with more new ideas and more pressing unsolv ed problems than ev er; and that mathemati s is an art, where the b eaut y of ideas and metho ds is as imp ortan t as their diÆ ult y or appli abilit y .

  2 Let us oun t!

  3

  88

  89

  90

  89 hoi es for the rst t w o n um b ers, and going on similarly , w e get

  90

  Ali e has 90 hoi es, no matter what she ho oses, Bob has 89 hoi es, so there are

  (In the lottery they are talking ab out, 5 n um b ers are sele ted from 90.) \This is lik e the seating" sa ys George, \Supp ose w e ll out the ti k ets so that Ali e marks a n um b er, then she passes the ti k et to Bob, who marks a n um b er and passes it to Carl, : : :

  12 p ossible pairs. After ab out ten da ys, they really need some new ideas to k eep the part y going. F rank has one: \Let's p o ol our resour es and win a lot on the lottery! All w e ha v e to do is to buy enough ti k ets so that no matter what they dra w, w e should ha v e a ti k et with the righ t n um b ers. Ho w man y ti k ets do w e need for this?"

  3 4 =

  e, the ro wd w an ts to dan e (b o ys with girls, remem b er, this is a onserv ativ e europ ean part y). Ho w man y p ossible pairs an b e formed? OK, this is easy: there are 3 girls, and ea h an ho ose one of 4 guys, this mak es

  2.1 Ho w man y w a ys an these p eople b e seated at the table, if Ali e to o an sit an ywhere? After the ak

  2 1 = 720. If they hange seats ev ery half an hour, it tak es 360 hours, that is, 15 da ys to go through all seating orders. Quite a part y , at least as the duration go es!

  4

  2.1 A part y Ali e in vites six guests to her birthda y part y: Bob, Carl, Diane, Ev e, F rank and George. When they arriv

  5

  6

  4 w a ys to ll the rst three hairs. Going on similarly , w e nd that the n um b er of w a ys to seat the guests is

  5

  6

  30. Similarly , no matter ho w w e ll the rst t w o hairs, w e ha v e 4 hoi es for the third hair, whi h giv es

  6 5 =

  5 + 5 + 5 + 5 + 5 + 5 =

  6 guests. No w lo ok at the se ond hair. If Bob sits on the rst hair, w e an put here an y of the remaining 5 guests; if Carl sits there, w e again ha v e 5 hoi es, et . So the n um b er of w a ys to ll the rst t w o hairs is

  When they go to the table, Ali e suggests: \Let's hange the seating ev ery half an hour, un til w e get ev ery seeting." \But y ou sta y at the head of the table" sa ys George, \sin e y ou ha v e y our birthda y ." Ho w long is this part y going to last? Ho w man y di eren t seatings are there (with Ali e's pla e xed)? Let us ll the seats one b y one, starting with the hair on Ali e's righ t. W e an put here an y of the

  7 6 = 42 handshak es" v en tures Carl. \This seems to o man y" sa ys Diane. \The same logi giv es 2 handshak es if t w o p ersons meet, whi h is learly wrong." \This is exa tly the p oin t: ev ery handshak e w as oun ted t wi e. W e ha v e to divide 42 b y 2, to get the righ t n um b er: 21." settles Ev e the issue.

  e, they shak e hands with ea h other (strange europ ean ostum). This group is strange an yw a y , b e ause one of them asks: \Ho w man y handshak es do es this mean?" \I sho ok 6 hands altogether" sa ys Bob, \and I guess, so did ev eryb o dy else." \Sin e there are sev en of us, this should mean

  87 86 p ossible hoi es for the v e n um b ers." \A tually , I think this is more lik e the handshak e question" sa ys Ali e. \If w e ll out the ti k ets the w a y y ou suggested, w e get the same ti k et more then on e. F or example, there will b e a ti k et where I mark

  7 and Bob marks 23, and another one where I mark

  23 and Bob marks 7."

  Carl jump ed up: \W ell, let's imagine a ti k et, sa y , with n um b ers 7; 23; 31; 34 and

  55. Ho w man y w a ys do w e get it? Ali e ould ha v e mark ed an y of them; no matter whi h one it w as that she mark ed, Bob ould ha v e mark ed an y of the remaining four. No w this is really lik e the seating problem. W e get ev ery ti k et

  5

  4

  3

  2 1 times." \So" on ludes Diane, \if w e ll out the ti k ets the w a y George prop osed, then among the

  90

  89

  88

  87 86 ti k ets w e get, ev ery 5-tuple o urs not only on e, but

  5

  4

  3

  2 1 times. So the n um b er of di er ent ti k ets is only

  90

  89

  88

  87

  86 :

  5

  4

  3

  2

  1 W e only need to buy this n um b er of ti k ets." Someb o dy with a go o d p o k et al ulator omputed this v alue in a glan e; it w as 43,949,268. So they had to de ide (remem b er, this happ ens in a p o or europ ean oun try) that they don't ha v e enough money to buy so man y ti k ets. (Besides, they w ould win m u h less. And to ll out so man y ti k ets w ould sp oil the part y: : : )

  So they de ide to pla y ards instead. Ali e, Bob, Carl and Diane pla y bridge. Lo oking at his ards, Carl sa ys: \I think I had the same hand last time." \This is v ery unlik ely" sa ys Diane.

  How unlik ely is it? In other w ords, ho w man y di eren t hands an y ou ha v e in bridge? (The de k has 52 ards, ea h pla y er gets 13.) I hop e y ou ha v e noti ed it: this is essen tially the same question as the lottery . Imagine that Carl pi ks up his ards one b y one. The rst ard an b e an y one of the 52 ards; whatev er he pi k ed up rst, there are 51 p ossibilities for the se ond ard, so there are

  52 51 p ossibilities for the rst t w o ards. Arguing similarly , w e see that there are

  52

  51 50 : : : 40 p ossibilities for the 13 ards. But no w ev ery hand w as oun ted man y times. In fa t, if Ev e omes to quibbiz and lo oks in to Carl's ards after he arranged them, and tries to guess (I don't no w wh y) the order in whi h he pi k ed them up, she ould think: \He ould ha v e pi k ed up an y of the 13 ards rst; he ould ha v e pi k ed up an y of the remaining

  12 ards se ond; an y of the remaining 11 ards third;: : : Aha, this is again lik e the seating: there are 13 12 : : :

  2 1 orders in whi h he ould ha v e pi k ed up his ards." But this means that the n um b er of di er ent hands in bridge is

  52

  51 50 : : :

  40 = 635; 013; 559; 600 :

  13 12 : : :

  2

  1 So the han e that Carl had the same hand t wi e in a ro w is one in 635,013,559,600 , v ery small indeed.

  Finally , the six guests de ide to pla y hess. Ali e, who just w an ts to w at h them, sets up 3 b oards. \Ho w man y w a ys an y ou guys b e mat hed with ea h other?" she w onders. \This is learly the same problem as seating y ou on six hairs; it do es not matter whether the hairs are around the dinner table of at the three b oards. So the answ er is 720 as b efore."

  \I think y ou should not oun t it as a di eren t mat hing if t w o p eople at the same b oard swit h pla es" sa ys Bob, \and it should not matter whi h pair sits at whi h table."

  \Y es, I think w e ha v e to agree on what the question really means" adds Carl. \If w e in lude in it who pla ys white on ea h b oard, then if a pair swit hes pla es w e do get a di eren t mat hing. But Bob is righ t that it do es not matter whi h pair uses whi h b oard."

  \What do y ou mean it do es not matter? Y ou sit at the rst table, whi h is losest to the p ean uts, and I sit at the last, whi h is farthest" sa ys Diane. \Let's just sti k to Bob's v ersion of the question" suggests Ev e. \It is not hard, a tually . It is lik e with handshak es: Ali e's gure of 720 oun ts ev ery mat hing sev eral times. W e ould rearrange the tables in

  6 di eren t w a ys, without hanging the mat hing." \And ea h pair ma y or ma y not swit h sides" adds F rank. \This means

  2

  2 2 = 8 w a ys to rearrange p eople without hanging the mat hing. So in fa t there are 6 8 = 48 w a ys to sit whi h all mean the same mat hing. The 720 seatings ome in groups of 48, and so the n um b er of mat hings is 720=48 = 15."

  \I think there is another w a y to get this" sa ys Ali e after a little time. \Bob is y oungest, so let him ho ose a partner rst. He an ho ose his partner in 5 w a ys. Who ev er is y oungest among the rest, an ho ose his or her partner in

  3 w a ys, and this settles the mat hing. So the n um b er of mat hings is 5 3 = 15." \W ell, it is ni e to see that w e arriv ed at the same gure b y t w o really di eren t argumen ts.

  A t the least, it is reassuring" sa ys Bob, and on this happ y note w e lea v e the part y .

  2.2 What is the n um b er of \mat hings" in Carl's sense (when it matters who sits on whi h side of the b oard, but the b oards are all alik e), and in Diane's sense (when it is the other w a y around)?

  2.2 Sets and the lik e W e w an t to formalize assertions lik e \the problem of oun ting the n um b er of hands in bridge is essen tially the same as the problem of oun ting ti k ets in the lottery". The usual to ol in mathemati s to do so is the notion of a set. An y olle tion of things, alled elements, is a set. The de k of ards is a set, whose elemen ts are the ards. The parti ipan ts of the part y form a set, whose elemen ts are Ali e, Bob, Carl, Diane, Ev e, F rank and George (let us denote this set b y P ). Ev ery lottery ti k et on tains a set of

  5 n um b ers. F or mathemati s, v arious sets of n um b ers are imp ortan t: the set of real n um b ers, denoted b y

  I R; the set of rational n um b ers, denoted b y Q; the set of in tegers, denote b y Z Z ; the set of non-negativ e in tegers, denoted b y Z Z ; the set of p ositiv e in tegers, denoted b y

  I N . The empty

  • set, the set with no elemen ts is another imp ortan t (although not v ery in teresting) set; it is denoted b y ;.

  If A is a set and b is an elemen t of

  A, w e write b

  2 A. The n um b er of elemen ts of a set A (also alled the ar dinality of

  A) is denoted b y jAj. Th us jP j = 7; j;j = 0; and jZ Zj =

  1

  1 (in nit y). W e ma y sp e ify a set b y listing its elemen ts b et w een bra es; so

  P = fAli e, Bob, Carl, Diane, Ev

  e, F rank, George g is the set of parti ipan ts of Ali e's birthda y part y , or f12; 23; 27; 33; 67g

  1 In mathemati s, one an distinguish v arious lev els of \in nit y"; for example, one an distinguish b et w een the ardinalities of Z Z and

  I R. This is the sub je t matter of set the ory and do es not on ern us here.

  • b efore), and fx

  • Z Z Q
  • ; Z Z ; Q;

  2.8 Is an \elemen t of a set" a sp e ial ase of a \subset of a set"?

  I R?

  I N; Z Z

  I R is also true. Ho w man y su h relations an y ou nd b et w een the sets ;;

  2.7 W e ha v e not written up all subset relations b et w een v arious sets of n um b ers; for example, Z Z

  2.6 What are the elemen ts of the follo wing (admittedly p e uliar) set: fAli e ; f1gg?

  2.5 Name sets ha ving ardinalit y (a) 52, (b) 13, ( ) 32, (d) 100, (e) 90, (f ) 2,000,000.

  2.4 What are the elemen ts of the follo wing sets: (a) arm y , (b) mankind, ( ) library , (d) the animal kingdom?

  2.3 Name sets whose elemen ts are (a) buildings, (b) p eople, ( ) studen ts, (d) trees, (e) n um b ers, (f ) p oin ts.

  G \ D = fAl i eg. Tw o sets whose in terse tion is the empt y set (in other w ords, ha v e no elemen t in ommon) are alled disjoint.

  I R The interse tion of t w o sets is the set onsisting of those elemen ts that elemen ts of b oth sets. The in terse tion of t w o sets A and B is denoted b y A \ B . F or example, w e ha v e

  I N Z Z

  e, G P and D P . Among the sets of n um b ers, w e ha v e a long hain: ;

  A B : F or example, among the v arious sets of p eople onsidered ab o v

  2 P : x is o v er 21 g = fAli e, Carl, F rank g (w e denote this set b y D ). A set A is alled a subset of a set B , if ev ery elemen t of A is also an elemen t of B . In other w ords, A onsists of ertain elemen ts of B . W e allo w that A onsists of all elemen ts of B (in whi h ase A = B ), or none of them (in whi h ase A = ;). So the empt y set is a subset of ev ery set. The relation that A is a subset of B is denoted b y

  G). Let me also tell y ou that D = fx

  2 P : x is a girl g = fAli e, Diane, Ev e g (w e denote this set b y

  2 Z Z : x 0g is the set of non-negativ e in tegers (whi h w e ha v e alled Z Z

  is the set of n um b ers on m y un le's lottery ti k et. Sometimes w e repla e the list b y a v erbal des ription, lik e fAli e and her guestsg: Often w e sp e ify a set b y a prop ert y that singles out the elemen ts from a large univ erse lik e real n um b ers. W e then write this prop ert y inside the bra es, but after a olon. Th us fx

  2.9 List all subsets of f0; 1; 3g. Ho w man y do y ou get? 2.10 De ne at least three sets, of whi h fAli e, Diane, Ev e g is a subset.

  2.11 List all subsets of fa; b; ; d; eg, on taining a but not on taining b.

  2.12 De ne a set, of whi h b oth f1; 3; 4g and f0; 3; 5g are subsets. Find su h a set with a smallest p ossible n um b er of elemen ts. 2.13 (a) Whi h set w ould y ou all the union of fa; b;

  g, fa; b; dg and fb; ; d; eg? (b) Find the union of the rst t w o sets, and then the union of this with the third. Also, nd the union of the last t w o sets, and then the union of this with the rst set. T ry to form ulate what y ou observ ed. ( ) Giv e a de nition of the union of more than t w o sets.

  2.14 Explain the onne tion b ew een the notion of the union of sets and exer ise 2.2.

  2.15 W e form the union of a set with 5 elemen ts and a set with 9 elemen ts. Whi h of the follo wing n um b ers an w e get as the ardinalit y of the union: 4, 6, 9, 10, 14, 20?

  2.16 W e form the union of t w o sets. W e kno w that one of them has n elemen ts and the other has m elemen ts. What an w e infer for the ardinalit y of the union?

  2.17 What is the in terse tion of (a) the sets f0; 1; 3g and f1; 2; 3g; (b) the set of girls in this lass and the set of b o ys in this lass; ( ) the set of prime n um b ers and the set of ev en n um b ers?

  2.18 W e form the in terse tion of t w o sets. W e kno w that one of them has n elemen ts and the other has m elemen ts. What an w e infer for the ardinalit y of the in terse tion?

  2.19 Pro + v e that jA [ B j jA \ + B j = jAj jB j.

  2.20 The symmetri di er en e of t w o sets A and B is the set of elemen ts that b elong to exe tly one of A and B . (a) What is the symmetri di eren e of the set Z Z of non-negativ e in tegers and the set

  • E of ev en in tegers (E =

  f: : : 4; 2; 0; 2; 4; : : : on tains b oth negativ e and p ositiv e ev en in tegers). (b) F orm the symmetri di eren e of A ad B , to get a set C . F orm the symmetri di eren e of A and C . What did y ou get? Giv e a pro of of the answ er.

  2.3 The n um b er of subsets No w that w e ha v e in tro du ed the notion of subsets, w e an form ulate our rst general om bi- natorial problem: what is the n um b er of all subsets of a set with n elemen ts?

  W e start with trying out small n um b ers. It pla ys no role what the elemen ts of the set are; w e all them a; b; et . The empt y set has only one subset (namely , itself ). A set with a single elemen t, sa y fag, has t w o subsets: the set fag itself and the empt y set ;. A set with t w o elemen ts, sa y fa; bg has four subsets: ;; fag; fbg and fa; bg. It tak es a little more e ort to list all the subsets of a set fa; b; g with 3 elemen ts:

  ;; fag; fbg; f g; fa; bg; fb; g; fa; g; fa; b; g : (1) W e an mak e a little table from these data:

  No. of elemen ts

  1

  2

  3 No. of subsets

  1

  2

  4

  8

  

a S

ε

  

Y N

b S b S

  

ε ε

Y N Y N

c S c S c S c S

  

ε ε ε ε

Y N Y N Y N Y N

abc

  • - ab ac a bc b c

  Figure 1: A de ision tree for sele ting a subset of fa; b; g. Lo oking at these v alues, w e observ e that the n um b er of subsets is a p o w er of 2: if the set has n n elemen ts, the result is 2 , at least on these small examples.

  It is not diÆ ult to see that this is alw a ys the answ er. Supp ose y ou ha v e to sele t a subset of a set A with n elemen ts; let us all these elemen ts a ; a ; : : : ; a . Then w e ma y or ma y 1 2 n not w an t to in lude a , in other w ords, w e an mak e t w o p ossible de isions at this p oin t. No

  1 matter ho w w e de ided ab out a , w e ma y or ma y not w an t to in lude a in the subset; this

  1

  2 means t w o p ossible de isions, and so the n um b er of w a ys w e an de ide ab out a and a is

  1

  2

  2 2 =

  4. No w no matter ho w w e de ide ab out a and a , w e ha v e to de ide ab out a , and w e

  1

  2

  3 an again de ide in t w o w a ys. Ea h of these w a ys an b e om bined with ea h of the 4 de isions w e ould ha v e made ab out a and a , whi h mak es

  4 2 = 8 p ossibilities to de ide ab out a ; a

  1

  2

  1

  2 and a .

  3 W e an go on similarly: no matter ho w w e de ide ab out the rst k elemen ts, w e ha v e t w o p ossible de isions ab out the next, and so the n um b er of p ossibilities doubles whenev er w e tak e n a new elemen t. F or de iding ab out all the n elemen ts of the set, w e ha v e ha v e

  2 p ossibilities. Th us w e ha v e pro v ed the follo wing theorem. n

  Theorem

  2.1 A set with n elements has 2 subsets. W e an illustrate the argumen t in the pro of b y the pi ture in Figure 1. W e read this gure as follo ws. W e w an t to sele t a subset alled S . W e start from the ir le on the top ( alled a no de). The no de on tains a question: is a an elemen t of S ? The

  1 t w o arro ws going out of this no de are lab elled with the t w o p ossible answ ers to this question (Y es and No). W e mak e a de ision and follo w the appropriate arro w (also alled an e dge) to the the no de at the other end. This no de on tains the next question: is a an elemen t of S ?

  2 F ollo w the arro w orresp onding to y our answ er to the next no de, whi h on tains the third (and in this ase last) question y ou ha v e to answ er to determine the subset: is a an elemen t

  3 of S ? Giving an answ er and follo wing the appropriate arro w w e get to a no de, whi h on tains a listing of the elemen ts of S .

  Th us to sele t a subset orresp onds to w alking do wn this diagram from the top to the b ottom. There are just as man y subsets of our set as there are no des on the last lev el. Sin e

  3 the n um b er of no des doubles from lev el to lev el as w e go do wn, the last lev el on tains

  2 =

  8 n no des (and if w e had an n-elemen t set, it w ould on tain

  2 no des). Remark. A pi ture lik e this is alled a tr e

  e. (This is not a mathemati al de nition, whi h w e'll see later.) If y ou w an t to kno w wh y is the tree gro wing upside do wn, ask the omputer s ien tists who in tro du ed it, not us.

  W e an giv e another pro of of theorem

  2.1. Again, the answ er will b e made lear b y asking a question ab out subsets. But no w w e don't w an t to sele t a subset; what w e w an t is to enumer ate subsets, whi h means that w e w an t to lab el them with n um b ers 0; 1; 2; : : : so that w e an sp eak, sa y , ab out subset No. 23 of the set. In other w ords, w e w an t to arrange the subsets of the set in a list and the sp eak ab out the 23rd subset on the list.

  (W e a tually w an t to all the rst subset of the list No. 0, the se ond subset on the list No. 1 et . This is a little strange but this time it is the logi ians who are to blame. In fa t, y ou will nd this quite natural and handy after a while.) There are man y w a ys to order the subsets of a set to form a list. A fairly natural thing to do is to start with ;, then list all subsets with

  1 elemen ts, then list all subsets with 2 elemen ts, et . This is the w a y the list (1) is put together. W e ould order the subsets as in a phone b o ok. This metho d will b e more transparen t if w e write the subsets without bra es and ommas. F or the subsets of fa; b; g, w e get the list

  ;; a; ab; ab ; a ; b; b ; : These are indeed useful and natural w a ys of listing all subsets. They ha v e one short oming though. Imagine the list of the subsets of v e elemen ts, and ask y ourself to name the 23rd subset on the list, without a tually writing do wn the whole list. This will b e diÆ ult! Is there a w a y to mak e this easier?

  Let us start with another w a y of denoting subsets (another en o ding in the mathemati al jargon). W e illustrate it on the subsets of fa; b; g. W e lo ok at the elemen ts one b y one, and write do wn a

  1 if the elemen t o urs in the subset and a if it do es not. Th us for the subset fa; g, w e write do wn 101, sin e a is in the subset, b is not, and is in it again. This w a y ev ery subset in \en o ded" b y a string of length 3, onsisting of 0's and 1's. If w e sp e ify an y su h string, w e an easily read o the subset it orresp onds to. F or example, the string 010 orresp onds to the subset fbg, sin e the rst tells us that a is not in the subset, the

  1 that follo ws tells us that b is in there, and the last tells us that is not there. No w su h strings onsisting of 0's and 1's remind us of the binary r epr esentation of in tegers

  (in other w ords, represen tations in base 2). Let us re all the binary form of non-negativ e in tegers up to 10: =

  2 1 =

  1

  2 2 =

  10

  2 3 = 2 1 =

  • 11

  2 4 = 100 2 5 =

  4 1 = 101

  • 2

  4 2 = 110

  • 6 =

  2 7 + + =

  4

  2 1 = 111

  2

  8 = 1000

  2 9 =

  8 1 = 1001

  • 2 10 + =

  8 2 = 1010

  2 (W e put the subs ript 2 there to remind ourselv es that w e are w orking in base 2, not 10.)

  No w the binary forms of in tegers 0; 1; : : : ; 7 lo ok almost as the \ o des" of subsets; the di eren e is that the binary form of an in teger alw a ys starts with a 1, and the rst 4 of these in tegers ha v e binary forms shorter than 3, while all o des of subsets onsist of exa tly

  3 digits. W e an mak e this di eren e disapp ear if w e app end 0's to the binary forms at their b eginning, to mak e them all ha v e the same length. This w a y w e get the follo wing orresp onden e:

  , , 000 , ;

  2 1 , 1 , 001 , f g

  2 2 , 10 , 010 , fbg

  2 3 , 11 , 011 , fb; g

  2 4 , 100 , 100 , fag 2 5 , 101 , 101 , fa; g 2 6 , 110 , 110 , fa; bg 2 7 , 111 , 111 , fa; b; g

  2 So w e see that the subsets of fa; b; g orresp ond to the n um b ers 0; 1; : : : ; 7. What happ ens if w e onsider, more generally , subsets of a set with n elemen ts? W e an argue just lik e ab o v e, to get that the subsets of an n-elemen t set orresp ond to in tegers, starting with 0, and ending with the largest in teger that has only n digits in its binary represen tation

  (digits in the binary represen tation are usually alled bits). No w the smallest n um b er with n n n

  1 bits is + 2 , so the subsets orresp ond to n um b ers 0; 1; 2; : : : ;

  2

  1. It is lear that the n n n um b er of these n um b ers in 2 , hen e the n um b er of subsets is 2 .

  Commen ts. W e ha v e giv en t w o pro ofs of theorem

  2.1. Y ou ma y w onder wh y w e needed t w o pro ofs. Certainly not b e ause a single pro of w ould not ha v e giv en enough on den e in the truth of the statemen t! Unlik e in a legal pro edure, a mathemati al pro of either giv es absolute ertain t y or else it is useless. No matter ho w man y in omplete pro ofs w e giv e, they don't add up to a single omplete pro of. F or that matter, w e ould ask y ou to tak e our w ord for it, and not giv e an y pro of. Later in some ases this will b e ne essary , when w e will state theorems whose pro of is to o long or to o in v olv ed to b e in luded in these notes.

  So wh y did w e b other to giv e an y pro of, let alone t w o pro ofs of the same statemen t? The answ er is that ev ery pro of rev eals m u h more than just the bare fa t stated in the theorem, and this plus ma y b e ev en more v aluable. F or example, the rst pro of giv en ab o v e in tro- du ed the idea of breaking do wn the sele tion of a subset in to indep enden t de isions, and the represen tation of this idea b y a tree.

  The se ond pro of in tro du ed the idea of en umerating these subsets (lab elling them with in tegers 0; 1; 2; : : : ). W e also sa w an imp ortan t metho d of oun ting: w e established a orre- sp onden e b et w een the ob je ts w e w an ted to oun t (the subsets) and some other kinds of n ob je ts that w e an oun t easily (the n um b ers 0; 1; : : : ; 2 1). In this orresp onden e

  | for ev ery subset, w e had exa tly one orresp onding n um b er, and | for ev ery n um b er, w e had exa tly one orresp onding subset.

  A orresp onden e with these prop erties is alled a one-to-one orr esp onden e (or bije tion). If w e an mak e a one-to-one orresp onden e b et w een the elemen ts of t w o sets, then they ha v e the same n um b er of elemen ts.

  100 So w e kno w that the n um b er of subsets of a 100-elemen t set is 2 . This is a large n um b er, but ho w large? It w ould b e go o d to kno w, at least, ho w man y digits it will ha v e in the usual de imal form. Using omputers, it w ould not b e to o hard to nd the de imal form of this n um b er, but let's try to estimate at least the order of magnitude of it.

  3

  99 33 100

  33

  33 W e kno w that 2 = 8 < 10, and hen e 2 < 10 . Therefore, 2 <

  2 10 . No w

  2

  10 100 is a

  2 follo w ed b y 33 zero es; it has 34 digits, and therefore 2 has at most 34 digits.

  10

  3 2 100 30 100 W e also kno w that 2 = 1024 > 1000 = 10 . Hen e 2 > 10 , whi h means that

  2 has at least 30 digits.

  100 This giv es us a reasonably go o d idea of the size of 2 . With a little more high s ho ol math, w e an get the n um b er of digits exa tly . What do es it mean that a n um b er has exa tly k 1 k k digits? It means that it is b et w een

  10 and 10 (the lo w er b ound is allo w ed, the upp er is not). W e w an t to nd the v alue of k for whi h k 1 100 k

  10 2 < 10 : 100 x No w w e an write 2 in the form 10 , only x will not b e an in teger: the appropriate v alue of

  100 x is x = lg 2 = 100 lg

  2. W e ha v e then k 1 x < k ; whi h means that k

  1 is the largest in teger not ex eeding x. Mathemati ians ha v e a name for this: it is the inte ger p art or o or of x, and it is denoted b y bx . W e an also sa y that w e obtain k b y rounding x do wn to the next in teger. There is also a name for the n um b er obtained b y rounding x up to the next in teger: it is alled the eiling of x, and denoted b y dxe.

  Using an y s ien ti al ulator (or table of logarithms), w e see that lg 2 0:30103, th us 100 100 lg

  2 30:103, and rounding this do wn w e get that k 1 =

  30. Th us 2 has 31 digits.

  2.21 Under the orresp onden e b et w een n um b ers and subsets des rib ed ab o v

  e, whi h n um- b er orresp ond to subsets with 1 elemen t?

  2.22 What is the n um b er of subsets of a set with n elemen ts, on taining a giv en elemen t?

  2.23 What is the n um b er of in tegers with (a) at most n (de imal) digits; (b) exa tly n digits? 100

  2.24 Ho w man y bits (binary digits) do es 2 ha v e if written in base 2? n

  2.25 Find a form ula for the n um b er of digits of 2 .

  2.4 Sequen es Motiv ated b y the \en o ding" of subsets as strings of 0's and 1's, w e ma y w an t to determine the n um b er of strings of length n omp osed of some other set of sym b ols, for example, a, b and

  2

  10

  3 The fa t that 2 is so lose to 10 is used | or rather misused | in the name \kilob yte", whi h means 1024 b ytes, although it should mean 1000 b ytes, just lik e a \kilogram" means 1000 grams. Similarly , \megab yte" 20 means

  2 b ytes, whi h is lose to 1 million b ytes, but not exa tly the same.

  . The argumen t w e ga v e for the ase of 0's and 1's an b e arried o v er to this ase without an y essen tial hange. W e an observ e that for the rst elemen t of the string, w e an ho ose an y of a, b and , that is, w e ha v e 3 hoi es. No matter what w e ho ose, there are 3 hoi es

  2 for the se ond of the string, so the n um b er of w a ys to ho ose the rst t w o elemen ts is 3 = 9.

  Going on in a similar manner, w e get that the n um b er of w a ys to ho ose the whole string is n 3 .

  In fa t, the n um b er 3 has no sp e ial role here; the same argumen t pro v es the follo wing theorem: n

  Theorem 2.2 The numb er of strings of length n omp ose d of k given elements is k .

  The follo wing problem leads to a generalization of this question. Supp ose that a database has 4 elds: the rst, on taining an 8- hara ter abbreviation of an emplo y ee's name; the se ond,

  M or F for sex; the third, the birthda y of the emplo y ee, in the format mm-dd-yy (disregarding the problem of not b eing able to distinguish emply ees b orn in 1880 from emplo y ees b orn in 1980); and the fourth, a job o de whi h an b e one of 13 p ossibilities. Ho w man y di eren t re ords are p ossible?

  The n um b er will ertainly b e large. W e already kno w from theorem 2.2 that the rst eld

  8 ma y on tain 26 > 200; 000; 000; 000 names (most of these will b e v ery diÆ ult to pronoun e, and are not lik ely to o ur, but let's oun t all of them as p ossibilities). The se ond eld has

  2 p ossibile en tries; the third, 36524 p ossible en tries (the n um b er of da ys in a en tury); the last, 13 p ossible en tries.

  No w ho w do w e determine the n um b er of w a ys these an b e om bined? The argumen t w e

  8 des rib ed ab o v e an b e rep eated, just \3 hoi es" has to b e repla ed, in order, b y \26 hoi es",

  8 \2 hoi es", \36524 hoi es" and \13 hoi es". W e get that the answ er is

  26 2 36524 13 = 198307192370919 42 4. W e an form ulate the follo wing generalization of theorem

  2.2 Theorem

  2.3 Supp ose that we want to form strings of length n so that we an use any of a given set of k symb ols as the rst element of the string, any of a given set of k symb ols as

  1 2 the se ond element of the string, et ., any of a given set of k symb ols as the last element of n the string. Then the total numb er of strings we an form is k k : : : k .

  1 2 n As another sp e ial ase, onsider the problem: ho w man y non-negativ e in tegers ha v e ex- a tly n digits (in de imal)? It is lear that the rst digit an b e an y of

  9 n um b ers (1; 2; : : : ; 9), while the se ond, third, et . digits an b e an y of the 10 digits. Th us w e get a sp e ial ase of n

  1 the previous question with k = 9 and k = k = : : : = k =

  10. Th us the answ er is

  9 10 .

  1

  2 3 n ( f. with exer ise 2.3).

  2.26 Dra w a tree illustrating the w a y w e oun ted the n um b er of strings of length 2 formed from the hara ters a; b and , and explain ho w it giv es the answ er. Do the same for the more general problem when n = 3, k = 2, k = 3, k = 2.

  1

  2

  3

  2.27 In a sp ort shop, there are T-shirts of 5 di eren t olors, shorts of 4 di eren t olors, and so ks of 3 di eren t olors. Ho w man y di eren t uniforms an y ou omp ose from these items?

  2.28 On a ti k et for a su er sw eepstak

  e, y ou ha v e to guess 1, 2, or X for ea h of 13 games. Ho w man y di eren t w a ys an y ou ll out the ti k et?

  2.29 W e roll a di e t wi e; ho w man y di eren t out omes an w e ha v e (a 1 follo w ed b y a

  4 is di eren t from a 4 follo w ed b y a 1)?

  2.30 W e ha v e 20 di eren t presen ts that w e w an t to distribute to 12 hildren. It is not required that ev ery hild gets something; it ould ev en happ en that w e giv e all the presen ts to the same hild. In ho w man y w a ys an w e distribute the presen ts?

  2.31 W e ha v e 20 kinds of presen ts; this time, w e ha v e a large supply from ea

  h. W e w an t to giv e presen ts to 12 hildren. Again, it is not required that ev ery hild gets something; but no hild an get t w o opies of the same presen t. In ho w man y w a ys an w e giv e presen ts?

  2.5 P erm utations During the part y , w e ha v e already en oun tered the problem: ho w man y w a ys an w e seat n p eople on n hairs (w ell, w e ha v e en oun tered it for n =

  6 and n = 7, but the question is natural enough for an y n). If w e imagine that the seats are n um b ered, then a nding a seating for these p eople is the same as assigning them to the n um b ers 1; 2; : : : ; n (or 0; 1; : : : ; n 1 if w e w an t to please the logi ians). Y et another w a y of sa ying this is to order the p eople in a single line, or write do wn an (ordered) list of their names.

  If w e ha v e an ordered list of n ob je ts, and w e rearrange them so that they are in another order, this is alled p ermuting them, and the new order is also alled a p ermutation of the ob- je ts. W e also all the rearrangmen t that do es not hange an ything, a p ermutation (somewhat in the spirit of alling the empt y set a set).

  F or example, the set fa; b; g has the follo wing 6 p erm utations: ab ; a b; ba ; b a; ab; ba: So the question is to determine the n um b er of w a ys n ob je ts an b e ordered, i.e., the n um b er of p ermutations of n ob je ts. The solution found b y the p eople at the part y w orks in general: w e an put an y of the n p eople on the rst pla e; no matter whom w e ho ose, w e ha v e n

  1 hoi es for the se ond. So the n um b er of w a ys to ll the rst t w o p ositions is n(n 1). No matter ho w w e ha v e lled the rst and se ond p ositions, there are n 2 hoi es for the third p osition, so the n um b er of w a ys to ll the rst three p ositions is n(n 1)(n 2).

  It is lear that this argumen t go es on lik e this un til all p ositions are lled. The last but one p osition an b e lled in t w o w a ys; the p erson put in the last p osition is determined, if the other p ositions are lled. Th us the n um b er of w a ys to ll all p ositions is n (n 1) (n 2) : : :

  2 1. This pro du t is so imp ortan t that w e ha v e a notation for it: n! (read n fa torial). In other w ords, n! is the n um b er of w a ys to order n ob je ts. With this notation, w e an state our se ond theorem.

  Theorem 2.4 The numb er of p ermutations of n obje ts in n!.

  Again, w e an illustrate the argumen t ab o v e graphi ally (Figure 2). W e start with the no de on the top, whi h p oses our rst de ision: whom to seat on the rst hair? The 3 arro ws going out orresp ond to the three p ossible answ ers to the question. Making a de ision, w e an follo w one of the arro ws do wn to the next no de. This arries the next de ision problem: whom to put on the se ond hair? The t w o arro ws out of the no de represen t the t w o p ossible hoi es.

  (Note that these hoi es are di eren t for di eren t no des on this lev el; what is imp ortan t is that there are t w o arro ws going out from ea h no de.) If w e mak e a de ision and follo w the

  

No.1?

a b c

  

No.2? No.2? No.2?

b c a c a b

abc acb bac bca cab cba

  Figure 2: A de ision tree for sele ting a subset of fa; b; g. orresp onding arro w to the next no de, w e kno w who sits on the third hair. The no de arries the whole \seating order".