2.3 The number of subsets Nowthatwehave introducedthe notionof subsets,we can formulate our rst general combi-natorialproblem: what isthe numberof all subsetsof aset withn elements?. No
Trang 1Lecture Notes, YaleUniversity, Spring1999
L Lovasz and K Vesztergombi
Parts of these lecture notes are based on
(Tankonyvkiado,Budapest,1972);
Chapter 13 is based on a section in
L Lov
asz { M.D Plummer: Matching theory
(Elsevier, Amsterdam,1979)
Trang 31 Introduction 5
2.1 A party 6
2.2 Sets and thelike 8
2.3 The numberof subsets 10
2.4 Sequences 14
2.5 Permutations 16
3 Induction 19 3.1 The sum ofoddnumbers 19
3.2 Subsetcounting revisited 21
3.3 A fewmore inductionproofs 22
3.4 Counting regions 24
4 Counting subsets 27 4.1 The numberof orderedsubsets 27
4.2 The numberof subsets ofa given size 27
4.3 The BinomialTheorem 28
4.4 Distributingpresents 30
4.5 Anagrams 31
4.6 Distributingmoney 32
5 Pascal's Triangle 34 5.1 IdentitiesinthePascalTriangle 34
5.2 A bird'seye viewat the PascalTriangle 37
6 Combinatorial probability 44 6.1 Events andprobabilities 44
6.2 Independentrepetitionof an experiment 45
6.3 The Lawof LargeNumbers 46
7 Fibonacci numbers 48 7.1 Fibonacci's exercise 48
7.2 Lots of identities 49
7.3 A formulafortheFibonacci numbers 51
8 Integers, divisors, and primes 53 8.1 Divisibilityof integers 53
8.2 Primesand theirhistory 53
8.3 Factorization into primes 56
8.4 Onthe setof primes 57
8.5 Fermat's \Little"Theorem 61
8.6 The EuclideanAlgorithm 62
8.7 Testingforprimality 66
Trang 49.1 Even and odddegrees 69
9.2 Paths,cycles,and connectivity 73
10Trees 77 10.1 How to growa tree? 78
10.2 Rootedtrees 80
10.3 How manytreesare there? 80
10.4 How to storeatree? 81
11Finding the optimum 88 11.1 Findingthebesttree 88
11.2 TravelingSalesman 91
12Matchings in graphs 93 12.1 A dancingproblem 93
12.2 Anothermatching problem 94
12.3 The maintheorem 96
12.4 How to nda perfectmatching? 98
12.5 Hamiltoniancycles 101
Trang 5For moststudents, the rst and often onlyareaof mathematics incollege is calculus Andit
is true that calculus is the single most important eld of mathematics, whose emergence in
the17thcenturysignalledthebirthofmodernmathematicsandwasthekeyto thesuccessful
applicationsof mathematicsinthesciences
Butcalculus(oranalysis)isalso verytechnical Ittakesalotofworkeven tointroduceits
fundamental notionslike continuityor derivatives (after all, ittook 2 centuries just to de ne
these notions properly) To get a feeling forthe power of its methods, say b describing one
of itsimportant applicationsindetail,takes years ofstudy
Ifyouwantto become amathematician,computerscientist, orengineer,thisinvestment is
necessary But ifyourgoal isto develop afeeling forwhat mathematicsisall about,where is
itthat mathematical methodscan behelpful,and what kindofquestions do mathematicians
work on,you maywant to lookfortheanswerinsome other eldsof mathematics
Therearemanysuccessstoriesofappliedmathematicsoutsidecalculus Arecenthottopic
ismathematicalcryptography,whichisbasedonnumbertheory(thestudyofpositiveintegers
1;2;3;: :),andis widelyapplied,among others, incomputersecurityand electronicbanking
Other important areas in applied mathematics include linear programming, coding theory,
theory of computing The mathematics in these applications is collectively called discrete
mathematics (\Discrete" here isusedastheoppositeof \continuous";it isalsooften usedin
themore restrictive senseof\ nite".)
Theaimofthisbookisnottocover\discretemathematics"indepth(itshouldbeclearfrom
the descriptionabove that such a taskwouldbe ill-de nedand impossibleanyway) Rather,
we discussa numberof selected resultsand methods,mostly fromtheareas ofcombinatorics,
graphtheory,and combinatorial geometry, witha littleelementarynumbertheory
At the same time, it is important to realize that mathematics cannot be done without
proofs Merely stating the facts, without saying something about why these facts are valid,
wouldbeterriblyfarfromthespiritofmathematicsandwouldmakeitimpossibletogiveany
idea about how it works Thus, wherever possible, we'll give the proofs of the theorems we
state Sometimesthisisnotpossible;quitesimple,elementaryfactscanbeextremelydiÆcult
toprove,andsomesuch proofsmaytake advancedcoursesto gothrough Inthesecases,we'll
state at leastthat theproof ishighly technicaland goesbeyond thescopeof thisbook
Another important ingredient of mathematics is problem solving You won't be able to
learnanymathematicswithoutdirtyingyourhands and tryingouttheideasyoulearnabout
in the solution of problems To some, this may sound frightening, but in fact most people
pursuethistypeofactivityalmosteveryday: everybodywho playsa gameof chess, orsolves
a puzzle,issolvingdiscretemathematicalproblems Thereaderisstrongly advisedto answer
thequestions posed inthetext and to go throughtheproblemsat theendof each chapter of
thisbook Treat it aspuzzlesolving, and ifyou ndsome ideathat you come upwith inthe
solutionto playsome role later,be satis edthatyouare beginning to getthe essenceof how
mathematicsdevelops
We hopethat we can illustrate that mathematicsis abuilding, whereresults arebuilton
earlierresults,oftengoingbackto thegreatGreek mathematicians;thatmathematicsisalive,
withmorenewideasandmorepressingunsolvedproblemsthanever;andthatmathematicsis
anart,wherethebeautyofideasandmethodsisasimportantastheirdiÆcultyorapplicability
Trang 62.1 A party
Alice invites six guests to her birthday party: Bob, Carl, Diane, Eve, Frank and George
When they arrive,they shake handswith each other (strange european costum) This group
isstrange anyway, because one of them asks: \How manyhandshakesdoesthismean?"
\I shook6 handsaltogether" says Bob, \andIguess,sodid everybodyelse."
\Sincethere areseven of us,thisshouldmean 76=42 handshakes"ventures Carl
\This seems too many" says Diane \The same logic gives 2 handshakes if two persons
meet,whichis clearlywrong."
\This is exactly the point: every handshake was counted twice We have to divide42 b
2,to get therightnumber: 21." settlesEve theissue
When they go to thetable,Alice suggests:
\Let's changetheseating every halfan hour, untilweget every seeting."
\But you stay at theheadof thetable"says George, \sinceyou have yourbirthday."
How long is thisparty going to last? How many dierent seatingsare there (with Alice's
place rst10places?
(c)Showthattheresultabo eforthenumberofpossibleoutcomesforthe rst10places
canbealsoobtainedusing(a)and(b)
There is nothing special about the numbers 100 and 10 in the problem above; we could
carryoutthe same fornathletes withthe rst k placesrecorded
To give a more mathematicalform to theresult,we can replacetheathletes b anysetof
sizen The listof the rst k placesis given b a sequence of k elements of n, whichall have
to be dierent We mayalso view this as selecting a subset of the athletes with k elements,
and thenordering them Thuswe have thefollowing theorem
Theorem 4.1 The number of ordere k-subsets of an n-set is n(n 1): :(n k+1)
(Note thatifwestart withnand count downk numbers,the lastone willbe n k+1.)
4.3Ifyougeneralizethesolutionofexercise4.1,yougettheanswerin theform
n!
(n k)!
Checkthatthisisthesamenumberasgivenin theorem4.1
4.4Explainthesimilarityandthedierencebetweenthecountingquestionsansweredb
theorem4.1andtheorem2.2
4.2 The number of subsets of a given size
From here,we can easilyderiveone of themostimportant counting results
Theorem 4.2 The number of k-subsets of an n-set is
n(n 1): :(n k+1)
k!
=n!
k!(n k)!
Trang 28Theorem 4.1 Of course, if we want to know thenumber of unordere subsets, then we have
overcounted; every subset was counted exactly k! times (with every possible ordering of its
elements) Sowehavetodividethisnumberb k!togetthenumberofsubsetswithkelements
(withoutordering)
The numberofk-subsetsofann-set issuchanimportantquantitythatone hasaseparate
notation forit:
4.5Whichproblemsdiscussedduring thepartywerespecialcasesoftheorem4.2?
4.6Tabulate thevaluesof
n
k
forn;k5
In thefollowingexercises, try to prove theidentitiesb usingtheformulaintheorem 4.2,
and also without computation, b explaining both sides of the equation as the result of a
also have aname,binomial c eÆcients, which comesfroma very important
formulainalgebrainvolvingthem We arenowgoing to discussthistheorem
The issue is to compute powers of thesimple algebraicexpression(x+y) We start with
+3x2
y+3xy
2
+y3
y+6x2
y2
+4xy3
+y4
:
Trang 29n
k Letusmakethisobservationprecise Weillustratetheargument
forthenext valueof n, namely n=5,butit worksingeneral
Thinkof expanding
(x+y) =(x+y)(x+y)(x+y)(x+y)(x+y)
sothatwegetridofallparanthesis Wegeteachtermintheexpansionb selectingoneofthe
two termsineach factor,and multiplyingthem If wechoosex,say,2times thenwe choosey
3 times,andwegetx
2
y3
Howmanytimesdo we getthissame term? Clearlyasmanytimes
as the number of ways to select the two factors that supply x (the remaining factors supply
y) Thuswehave to choosetwo factorsoutof 5,which can bedonein
+5
1
!
xy4
+5
2
!
x2
y3
+5
3
!
x3
y2
+5
4
!
x4
y+5
5
!
x5
:
We can applythisargument ingeneralto obtain
Theorem 4.3 (The Binomial Theorem) The c eÆcient of x
k
yk
n
!
xn
:
This importanttheorem iscalled theBinomialTheorem;thename comesfrom theGreek
wordbinome foranexpressionconsistingof twoterms,inthiscase, x+y The appearenceof
thenumbers
n
k
inthistheorem isthesourceof theirname: binomial c eÆcients
The BinomialTheoremcanbeappliedinmanyways togetidentitiesconcerningbinomial
coeÆcients For example,let ussubstitutex=y =1,thenweget
2 =n
0
!
+n
1
!
+n
n
!
Later on we are going to see trickier applications of this idea For the time being, another
twist onit iscontainedinthenext exercise
4.12GiveaproofoftheBinomialTheoremb inducion,basedonexercise4.2
4.13(a)Provetheidentity
=1,withthelastdependingontheparityofn.)
(b)Thisidentityisobviousifnisodd Why?
4.14Proveidentity4,usingacombinatorialinterpretationofthetwosides(recallexercise
4.2)
Trang 30Suppose we have n dierent presents, which we want to distributeto k children For some
reason, we are told how many presents should each child get; so Adam should get n
Adam
presents, Barbara, n
Barbara
presents etc In a mathematically convenient (though not very
friendly) way, we call the children 1;2;: : k; thus we are given the numbers (non-negative
1+n
2+: :+n
k
= n, else there is no way to
distributethepresents
The questionis,of course, how manyways can these presentsbedistributed?
Wecanorganize thedistributionofpresentsasfollows Welayoutthepresentsinasingle
row of length n The rst child comes and picks up the rst n
1presents, starting from the
left Then thesecond comes, and picks up the next n
Itisclearthatwecandeterminewhogetswhatb choosingtheorderinwhichthepresents
arelaidout Therearen!waystoorderthepresents But,ofcourse,thenumbern!overcounts
thenumberof waysto distributethepresents, sincemanyof theseorderingsleadto thesame
results(that is,every childgetsthe same setof presents) The questionis,how many?
Soletusstartwithagivendistributionofpresents,andlet'saskthechildrentolayoutthe
presentsforus, nicelyinarow, startingwiththe rstchild,thencontinuingwith thesecond,
third, etc Thisway we getback one possibleordering that leadsto thecurrent distribution
The rstchildcanlayouthispresentsinn
1
!possibleorders; nomatterwhichorder hechoses,
thesecondchildcanlayoutherpresentsinn
2
!possibleways,etc Sothenumberof ways the
presentscan belaidout(giventhedistributionofthepresentstothechildren)isaproductof
4.15Wecandescribetheprocedureofdistributingthepresentsasfollows First,weselect
Completethisargumentandshowthat itleadstothesameresultasthepreviousone
4.16Thefollowingspecialcasesshouldbefamiliarfrompreviousproblemsandtheorems
4.17 (a) How manyways can you place n rooks on achessboard so that no twoattack
each other(Figure9)? Weassumethat therooks areidentical, soe.g interchangingtwo
rooksdoesnotcountasaseparateplacement
(b)Howmanywayscanyoudothisifyouhave4blackand4whiterooks?
(c)Howmanywayscanyoudothis ifallthe8rooksaredierent?
Trang 314.5 Anagrams
Quiteprobablyyouhaveplayedwithanagrams Oneselectsaword(say,COMBINATORICS)
and triesto composefrom its lettersmeaningful,oftenfunnywords orexpressions
Howmanyanagramscanyoubuildfromagivenword? Ifyoutrytoanswerthisquestionb
playingaroundwiththeletters,you willrealizethatthequestionisbadlyposed;itisdiÆcult
to draw the line between meaningful and non-meaningful anagrams For example, it could
easilyhappen that A CROCBIT SIMON.Andit may be true thatNapoleon always wanted
aTOMBINCORSICA Itisquestionable,butcertainlygrammaticallycorrect, toassert that
COB ISROMANTIC.Some universitiesmayhave a courseon MAC INROBOTICS
But one would have to write a book to introducean exciting character, ROBIN
COSMI-CAT,who enforcesa COSMICRIOTBAN,whileappealingTOCOSMICBRAIN
Andit wouldbe terriblydiÆcultto explainan anagramlikeMTBIRASCIONOC
To avoid this contraversy, let's accept everything, i.e., we don't require the anagram to
be meaningful (or even pronouncible) Of course, the productionof anagrams becomes then
uninteresting;butat least we can tellhowmanyof them arethere!
4.18HowmanyanagramscanyoumakefromthewordCOMBINATORICS?
4.19Which word givesriseto moreanagrams: COMBINATORICSorCOMBINA
TOR-ICA?(ThelatteristheLatin nameofthesubject.)
4.20Whichwordwith13lettersgivesriseto themostanagrams? Whichwordgivesrise
totheleast?
So let's see the general answer to the question of counting anagrams If you have solved
theproblemsabove,itshouldbeclearthatthenumberof anagramsn-letter worddependson
howmanytimeslettersofthewordarerepeated SosupposethatthewordcontainsletterNo
1 n
1
times,letter No 2n
2times,etc.,letter No kn
ktimes Clearly,n
1+n
2+: :+n
k
=n
Now to form an anagram, we have to selectn
1positionsforletter No 1,n
2positionsfor
letterNo 2,etc.,n
kpositionsfroletterNo 3 Havingformulateditthisway,wecan seethat
thisisnothingbutthequestionof distributingnpresents to k children,whenit isprescribed
howmanypresentseach childgets Thuswe know from theprevioussection that theanswer
Trang 326!=(2!2!) =180) We say that these wordsare \essentiallythe same" (at least as faras
counting anagramsgoes): theyhave twoletters repeated twice and two lettersoccuring
onlyonce
(a)Howmany6-letterwordsarethere? (Asbefore,thewordsdon'thavetobemeaningful
Thealphabet has26letters.)
(b)Howmanywordswith6lettersare\essentiallythesame"asthewordLETTER?
(c)Howmany\essentiallydierent"6-letterwordsarethere?
(d)Tryto ndageneralanswertoquestion(c)(thatis,howmany\essentiallydierent"
wordsare there onnletters?) If youcan't nd it,read thefollowingsectionand return
tothisexerciseafterit
4.6 Distributing money
Instead of distributing presents, let's distribute money Let us formulate the question in
general: we have n pennies that we want to distribute among k kids Each child must get
at least one penny (and, of course, an integer number of pennies) How many ways can we
distributethemoney?
Beforeansweringthisquestion,wemustclarifythedierencebetweendistributingmoney
and distributing presents If you are distributing presents, you have to decidenot only how
manypresentseachchildgets,butalsowhicharethesepresents Ifyouaredistributingmoney,
onlythe quantity matters In other words, thepresents aredistinguishable whilethepennies
arenot (Aquestionlikeinsection 4.4, wherewe specifyinadvence howmanypresentsdoes
a given childget, would be trivialformoney: thereisonlyone wayto distributenpenniesso
thatthe rstchildgets n
1,thesecond childgets n
2,etc.)
Even thoughtheproblemisquite dierentfrom thedistributionof presents, we can solve
it b imagininga similardistribution method We lineup thepennies(it does notmatter in
which order, they are all alike), and then let child No 1 begin to pick them up from left to
right After a whilewe stop him and let the second child pick up pennies, etc (Figure 10)
Thedistribution of the money isdetermined by specifying where to startwith a new child
Nowthere aren 1points(betweenconsecutive pennies)wherewecan letanewchildin,
and we have to select k 1 of them (since the rst child alsways starts at the beginning,we
havenochoicethere) Thuswehavetoselecta(k 1)-elementsubsetfroman(n 1)-element
set The numberof possibilitiesto do sois
n 1
k 1
To sumup,weget
Theorem 4.4 Thenumberofwaystodistributenidenticalpennies tok children,sothat each
child gets at least one, is
n 1
k 1
It is quite surprising that the binomial coeÆcients give the answer here, in a quite
non-trivialandunexpected way
Let's alsodiscussthenatural (though unfair)modi cationofthisquestion, wherewe also
allow distributions in which some children get no money at all; we consider even giving all
themoneytoone child Withthefollowingtrick, wecan reducetheproblemofcountingsuch
distribnutions to the problem we just solved: we borrow 1 penny from each child, and the
distribute the whole amount (i.e., n+k pennies) to the children so that each child gets at
leastone penny Thiswayevery childgetsbackthemoneyweborrowedfrom himorher,and
Trang 33P P P P P P P P P P
Alice
Figure 10: Howto distributenpenniesto k children?
thelucky onesgetsome more The \more"isexactlynpenniesdistributedto k children We
already know that thenumberof ways to distributen+k pennies to k childrensothat each
childgetsat least onepennyis
4.23Wedistributenpenniestokb ysand`girls,sothat(tobereallyunfair)werequire
thateachofthegirlsgetsatleastonepenny Inhowmanywayscanwedothis?
4.24kearlsplaycards Originally,theyallhaveppennies Attheendofthegame,they
count how much money they have They do not borrow from each other, sothat they
cannotloosemorethantheirppennies Howmanypossibleresultsarethere?
Trang 34To study various properties of binomial coeÆcients, the followingpicture is very useful We
arrange all binomialcoeÆcients into a triangularscheme: inthe \zeroeth" row we put
1
!
and2
1
!
; : ;n
n
!
We shift these rows so that their
midpointsmatch; this way we get a pyramid-like scheme, called the Pascal Triangle (named
after theFrench mathematicianand philosopherBlaisePascal, 1623-1662) TheFigure below
shows onlya nitepiece of thePascalTriangle
5.2ProvethateachrowinthePascalTrianglestartsandendswith1
5.1 Identities in the Pascal Triangle
Looking at the Pascal Triangle, it is not hard to notice its most important property: every
numberinit(otherthanthe1'sontheboundary)isthesumofthetwonumbersimmediately
above it This in fact is a property of the binomial coeÆcients you have already met: it
translates into therelation
Trang 35ThispropertyofthePascalTriangle enablesusto generatethetrianglevery fast,building
it up row b row, using (5) It also gives usa tool to prove many properties of the binomial
coeÆcients, aswe shallsee
As a rst application, let us give a new solution of exercise 4.3 There the task was to
prove theidentity
whichisclearly0,sincethesecondtermineachbracketcancelswiththe ... subsets,we can formulate ourrst general
combi-natorialproblem: what isthe numberof all subsetsof aset withn elements?
Westartwithtrying outsmallnumbers It playsno role whattheelementsofthesetare;... (Besides,they would winmuch less Andto ll
outsomanyticketswouldspoil theparty:: )
So they decideto playcards instead Alice,Bob, Carl and Dianeplaybridge Lookingat
his cards,Carlsays:...
doistostartwith;,thenlistallsubsetswith1elements,thenlistallsubsetswith2elements,
etc Thisis thewaythelist(1) isputtogether
We could order the subsets asin aphone book This methodwill bemore