olympiad combinatorics chapter 8

29
Olympiad Combinatorics Pranav A. Sriram August 2014

Upload: andros

Post on 20-Feb-2016

352 views

Category:

Documents


76 download

DESCRIPTION

Combinatorics, Olympiad, Math, Problem-solving

TRANSCRIPT

OlympiadCombinatorics

PranavA.Sriram

August 2014

Chapter 8: Graph Theory 1

Copyright notices

All USAMO and USA Team Selection Test problems in this chapter

are copyrighted by the Mathematical Association of America’s

American Mathematics Competitions.

© Pranav A. Sriram. This document is copyrighted by Pranav A.

Sriram, and may not be reproduced in whole or part without

express written consent from the author.

About the Author

Pranav Sriram graduated from high school at The International

School Bangalore, India, and is currently pursuing undergraduate

studies at Stanford University.

Chapter 8: Graph Theory 1

8. GRAPH THEORY Introduction Graphs rule our lives: from Google Search to molecularsequencing, flightscheduling toArtificial Intelligence,graphs aretheunderlyingmathematicalabstractionfuelingtheworld’smostadvanced technology. Graphs are also pervasive in models ofspeech, group dynamics, disease outbreaks and even the humanbrain, and as such play a crucial role in the natural and socialsciences. Where does this versatility come from? Problems inseveral of the above-mentioned fields involve, at their core,entities existing in complex relationships with each other:hyperlinks between web pages, subject-object relationshipsbetween words, flights between cities and synapses betweenneurons.Thepowerofgraphtheorystemsfromthesimplicityandelegance with which graphs can model such relationships. Onceyou’vecastaproblem asaproblemongraphs,youhaveatyourdisposal powerful machinery developed by mathematicians overthecenturies.Thisisthepowerofabstraction.

This chapter is by no means an exhaustive reference on thesubject – graph theory deserves its own book. However, we willseeseveralpowerful lemmasandtechniquesthatunderlieavastmajority of Olympiad and classical graph theory problems, andhopefullybuildplentyofgraphtheoretic intuitionalongtheway.

Olympiad Combinatorics 2

Inthefinalsectionofthischapter,wewill leveragethepowerofgraphs mentioned in the first paragraph to solve Olympiadproblemsthatinitiallyappeartohavenothingtodowithgraphs.

Wenowrecallsomeresultswehaveproveninearlierchapters,thatprovetobeextremelyusefulbothinOlympiadproblemsandin classical graph theory problems.We alsoadvise the reader togoovertheirproofsagain,becausetheprooftechniquesfortheseresultsareasimportantastheresultsthemselves.

Some Useful Results (i) InagraphGwithnvertices,supposenovertexhasdegree

greaterthanΔ.ThenonecancolortheverticesusingatmostΔ+1 colors, such that no two neighboring vertices are thesamecolor.[Chapter1,example1]

(ii) In a graph G with V vertices and E edges, there exists an

inducedsubgraphHwitheachvertexhavingdegreeatleastE/V.(Inotherwords,agraphwithaveragedegreedhasaninduced subgraph with minimum degree at least d/2)[Chapter1,example3]

(iii) Given a graph G in which each vertex has degree at least

(n−1),andatreeTwithnvertices,thereisasubgraphofGisomorphictoT.[Chapter2,example3]

(iv) InagraphG,ifallverticeshavedegreeatleastδ,thenthere

existsapathoflengthatleastδ+1.[Chapter4,example6](v) The vertex set V of a graph G on n vertices can be

partitionedintotwosetsV1andV2suchthatanyvertexinV1hasatleastasmanyneighborsinV2asinV1andviceversa.[Chapter4,example8]

Chapter 8: Graph Theory 3

(vi) Atournamentonnverticesisadirectedgraphsuchthatforanytwoverticesuandv,thereiseitheradirectededgefromu tovor fromv tou.A Hamiltonian path isapathpassingthrough all the vertices. Every tournament has aHamiltonianpath.[Chapter4,example10]

More Useful Results and Applications Dominating Sets In a graph G with vertex set V, a subset D of V is set to be adominating set ifeveryvertexviseitherinDorhasaneighborinD. The next lemma tells us thatunder certainsimpleconditions,thereexistsafairlysmalldominatingset.Lemma 8.1:IfGhasnoisolatedvertices,thenithasadominating

setofsizeatmost|�|

�.

Proof:By (v), thereexistsabipartitionV=V1∪V2sothateveryvertex inV1hasat leastasmanyneighbors inV2andviceversa.Since each vertex has degree at least 1, this implies that everyvertex inV1hasat leastoneneighbor inV2andviceversa.Thus

both V1 and V2 are dominating sets. One of them has at most|�|

verticesandwearedone.Remark: In the next chapter we will show that if the minimumdegreeinann-vertexgraphGisd>1,thenGhasadominatingset

containingatmostn����(���)

���vertices.

Spanning Trees Recall that a spanning subgraph of a graph G is a subgraph of Gcontaining all of the vertices of G. A spanning tree in G is aspanningsubgraphthatisatree(thatis,itisacyclic).Notethatif

Olympiad Combinatorics 4

G is not connected, it cannot have a spanning tree (becauseotherwise there would be a path between every pair of verticesalong edges in this tree, contradicting disconnectedness). Do allconnectedgraphshavespanningtrees?

Figure 8.1. A graph G and a spanning tree of G Lemma 8.2: Every (finite) connected graph G = (V, E) has aspanningtree.Proof:DeleteedgesfromGasfollows.Aslongasthereisatleastonecyclepresent,takeonecycleanddeleteoneedgeinthatcycle.Notice that this procedure cannot destroy connectivity, so thegraph obtained at each stage is connected. This process cannotcontinue indefinitely (we are dealing with finite graphs), soeventually we get a connected graph with no cycles. This is therequired spanning tree (note that all the vertices of V are stillpresentsinceweonlydeletededges).

Spanning trees arise very often in the study of graphs,especiallyinoptimizationproblems.Iliketothinkofthemasthe“skeleton” of the graph, since they are in a sense the minimalstructure that is still connected on itsown. Theirmainusage onOlympiadproblemsisthatinsteadoffocusingongeneralgraphsGwhichmayhaveacomplicatedstructure,wecansometimes findwhat we are looking for just by taking a spanning tree. For ourpurposes,allyoureallyneedtoknowaboutspanningtreesis

a) Theyaretreesb) Theyexist(unlessGisn’tconnected).

A

BC

D

EF

C B E

F D A

Chapter 8: Graph Theory 5

We’ll now use our arsenal of lemmas to reduce some ratherchallengingOlympiadproblemstojustafewlines.Example 1 [Based on ELMO Shortlist 2011, C7] LetTbeatreewithtvertices,andletGbeagraphwithnvertices.Show that if G has at least (t−1)n edges, then G has a subgraphisomorphictoT.Answer: By(ii),G hasasubgraphHsuchthatallverticesinHhavedegreeatleastt−1(inH).Applying(iii),HhasasubgraphisomorphictoT.■Remark: This is probably the shortest solution to a problem inthisbook.Notethatitwouldactuallybequiteadifficultproblemifyoudidn’tknowthesuperusefullemmaslistedabove!Example 2 [Based on ELMO Shortlist 2011, C2] LetGbeadirectedgraphwithnverticessuchthateachvertexhasindegreeandoutdegreeequalto2.Showthatwecanpartitiontheverticesof G into three sets such no vertex is in the same set asboththeverticesitpointsto.Answer: Take a partition that maximizes the number of “crossing edges”,thatis,edgesbetweendistinctsets.Ifsomev belongstothesamesetasbothofitsout-neighbors,movingvtooneoftheothertwosets (whichever has fewer in-neighbors of v) willadd 2 crossingedgesbutdestroyatmost1oldone.Thenwegetapartitionwitheven more crossing edges, contradiction. Thus the originalpartitionindeedworks.■Remark:Thisisessentiallythesameideausedtoprove(v).Example 3 [Russia 2001] Acompanywith2n+1peoplehasthefollowingproperty:Foreachgroup of n people, there exists a person amongst the remainingn+1 people who knows everyone in this group. Show that thereexists a person who knows all the people in the company. (As

Olympiad Combinatorics 6

usual,knowingismutual:AknowsBifandonlyifBknowsA).Answer: Assume to the contrary that no one knows everyone else.Construct a graph G with 2n+1 vertices representing the people,andanedgebetweentwoverticesifandonlyifthosetwopeopledo not know each other. Our assumption implies that everyvertexhasdegreeatleast1.Nowapplyinglemma8.1,thereexistsadominatingsetofGcontainingnvertices.Thismeansthateachoftheothern+1verticeshasaneighborinthissetofnvertices.Inother words, no person outside this set of n people knowseveryone in this set, contradicting the problem statement. Thiscontradictionestablishestheresult.■

The Extremal Principle We’vealreadyencounteredtheextremalprincipleseveraltimesinvarious forms. The true power of this technique lies in itsubiquitoususeingraphtheory.Ineachofthenextfiveexamples,thestepinwhichweusetheextremalprincipleismarkedinboldletters.Example 4 [IMO Shortlist 2004, C3] The followingoperation is allowedona finitegraph:chooseanycycle of length 4 (if oneexists), choose an arbitrary edge in thatcycle, and delete this edge from the graph. For a fixed integern≥4, find the least number of edges of a graph that can beobtained by repeated applications of this operation from thecompletegraphonnvertices(whereeachpairofverticesisjoinedbyanedge).Answer: Clearly the answer cannot be less than n−1, since the graphobtainedateachstagewillalwaysbeconnected.Weclaimthatthe

Chapter 8: Graph Theory 7

graphobtainedateachstageisalsononbipartite.Thiswillimplythattheanswer isat leastn (sinceagraphwithn-1vertices isatreewhichisbipartite).

Kn is non-bipartite (it has a triangle), so suppose to thecontrary that at some stage the deletion of an edge makes thegraphbipartite.Considerthefirsttimethishappens.LetedgeABfromthe4cycleABCDbethedeletededge.Sincethegraphisnonbipartite before deleting AB but bipartite afterwards, it followsthatAandBmustlieonthesamesideofthepartition.ButsinceBC,CD,DAareedgesinthenow-bipartitegraph,itfollowsthatCand A are on one side and B and D are on the other side of thebipartition.Contradiction.

Figure 8.2.

To show n can be achieved, let the vertices be V1, V2, …, Vn.RemoveeveryedgeViVjwith3≤i<j<nfromthecycleV2Vi Vj Vn.Thenfor3≤i<ndeleteedgesV2ViandVi VnfromcyclesV1V2Vi VnandV1Vi Vn V2respectively.Thisleavesuswithonlynedges:V1Vifor2≤i≤nandV2Vn.■Remark:Youmayhavebeentemptedtoguessthattheansweris(n−1), since theproblemlooks like thealgorithmforobtainingaspanning tree. While guessing and conjecturing is an importantpartofsolvingproblems,itisimportanttoverifytheseguessesbyexperimentingabitbeforetryingtoprovetheguess.Theprocessofrealizingyourguesswaswrongmaygiveyouaclueastohowtoproceedwiththeproof.Inthisexample,youmayhavenoticedthat the graph you end up with always had an odd cycle, which

C B

D A

Olympiad Combinatorics 8

would lead to thecorrect claim that the graph obtained is neverbipartite.Example 5 [Croatian TST 2011] There are n people at a party among whom some are friends.Amongany4of themthereareeither3whoareall friendswitheachotheror3whoaren’tfriendswitheachother.ProvethatthepeoplecanbeseparatedintotwogroupsAandBsuchthatAisaclique(thatis,everyoneinA isfriendswitheachother)andBisan independent set (no one in B knows anyone else in B).(Friendshipisamutualrelation).Answer ConstructagraphGwithverticesrepresentingpeopleandedgesbetweentwopeopleiftheyarefriends.ThenaturalideaistoletAbe the largest clique in G, and the remaining people as B. Weprovethatthisworks.

IfA=Gor|A|=1wearetriviallydone,soassumethatn>|A|≥2.We only need to show that B is independent, that is, G-A isindependent.Assumetothecontraryv1,v2belongtoG−Aandv1v2isanedge.SinceA is the largestclique, thereexists u1 inA suchthatv1u1isnotanedge(otherwisewecouldaddv1toA,formingabiggerclique).

Figure 8.3.

A

u u1

v2 v

1

Chapter 8: Graph Theory 9

Ifu1v2isnotanedge,thenletubeanyothervertexinA.Sincev1v2anduu1areedges,bytheconditionoftheproblemtheremustbe a triangle amongst these four vertices. The only possibility isuv1v2sinceu1v2andu1v1arenotedges.Thenuv1anduv2areedgesforalluinA,soAU{v1,v2}\{u1}isalargerclique,contradiction.

Similarly, if v2u1 is an edge, then for all u in A either v2u1u orv2v1umustbeatriangle.Ineithercasev2uisanedgeforalluinA.ThusAU{v2}isalargerclique,contradiction.■Example 6 [Degree vectors] A vector v = [d1 d2 … dk] with d1 ≥ d2 ≥ … ≥ dk is said to be agraphicalvectorifthereexistsagraphGwithkverticesx1,x2,…,xkhavingdegreesd1,d2,…,dkrespectively.Notethattherecouldbemultiple graphs G with degree vector v. Let v’ be the vectorobtainedfromvbydeletingd1andsubtracting1fromthenextd1components of v. Let v1 be the non-increasing vector obtainedfromv’byrearrangingcomponentsifnecessary.(Forexample,ifv=[43322211]thenv’=[2 2 1 1211]andv1=[2221111].)Showthatv1isalsoagraphicalvector.Answer: LetSbethesumoftheindicesoftheneighborsofx1(forinstance,ifx1isadjacenttox3,x4andx8,thenS=15).TakethegraphGwithdegreevectorvsuchthattheS is as small as possible.

Nowweclaimthattheredonotexistindicesi<jsuchthatx1xiisnotanedgeandx1xjisanedgeinG.Supposethecontrary.Sincedi≥dj,theremustbesomevertexxtsuchthatxixtisanedgebutxjxtis not an edge. Now in G, delete edges x1xj and xixt and replacethem with edges x1xi and xjxt. Note that all degrees remainunchanged, but the sum of indices of neighbors of v1 hasdecreasedby(j–i),contradictingourassumptiononG.Thisprovesourclaim.

Olympiad Combinatorics 10

Figure 8.4. Illustration of a swap that decreases S

Our claim implies that x1 is adjacent to the next d1 vertices,namelyx2,x3,…,xd1+1.Hencev1isnothingbutthegraphicalvector

ofthegraphobtainedfromGbydeletingx1,sincethenthedegreesofitsneighborsallreducebyone.Hencev1isgraphical.■Remark 1: Howdidwecomeupwithourratherstrangeextremalconditionin the firstparagraph?Theproblem provides ahint: itsayswedeleted1andsubtract1fromthenextd1componentstoobtain v’. Hence we wanted a graphsuch that x1 is connected tothenextd1vertices, since in this casesimplyremovingvertexx1wouldhavepreciselythiseffectonthedegreevector(this isourreasoninginthelastparagraphoftheproof).Nowtoprovesuchagraph exists, we needed a simple extremal property satisfied bysuch a graph. This naturally leads to our definition of S and theextremalconditionthatGminimizesS.Remark 2: This is quite a useful lemma for testing whether agivendegreesequenceisgraphical(seeexercise27).Example 7 [MOP 2008] ProvethatiftheedgesofKn,thecompletegraphonnvertices,arecolored such that no color is assigned to more than n−2 edges,thereexistsatriangleinwhicheachedgeisadistinctcolor.Answer Assumetothecontrarythatthereexistsnosuchtriangle.DefineaC-connected component to be a set of vertices such that for any

x1 xi x

j

xt

x1 x

i xj

xt

Chapter 8: Graph Theory 11

two vertices in that set, there exists a path between them, all ofwhoseedgesareofcolorC.NowletXbethelargest C-connectedcomponentofthegraphforanycolorC,andsaythecolorofX isred.

Suppose there is avertexvnot inX.Consider twoverticesu1andu2thatarejoinedbyarededge.Neitheredgevu1noredgevu2canbered(otherwisevcouldbeaddedtoX).Sovu1andvu2arethesamecolor(otherwisevu1u2wouldhavethreedistinctcolors,contradicting our assumption). It follows that v is joined to allelementsofXbythesamecoloredge,sayblue.ButthenX∪{v}isalargerconnectedcomponent(ofcolorblue),contradiction.

It followsthat therecannotbeanyvertexvoutsideX,soallnverticesareinX.Now,sinceXisred-connectedandhasnvertices,theremustbeatleastn−1rededges,contradiction.■Example 8 [Generalization of USAMO 2007-4] GivenaconnectedgraphGwithVvertices,eachhavingdegreeatmost D, show that G can be partitioned into two connected

subgraphs,eachcontainingatleast���

�vertices.

Answer: WeinductonE, thenumberofedgesofG.WhenE=1,thereareonly two vertices and the partition consists of two isolatedvertices.Fortheinductionstep,notethatifwecandeleteanedgeand G remains connected, we are done by induction. Hence weonlyconsiderthecasewhenGisatree.

Pick the root x such that the size of the largest subtree T is

minimized.Clearly |T|≥���

�, since thereareatmostD subtrees

andV–1verticesamongstthem.Also,|T|≤�

�.Thisisbecauseif|T|

>�

�,theninsteadofrootingthetreeatxwecouldrootthetreeat

the first vertex y of T. This would decrease |T| by 1, but T\{y}wouldstillbethelargestsubtreesinceitwouldstillhaveatleast

Olympiad Combinatorics 12

���

� vertices. This would contradict our assumption on x, as we

wouldhaveasmallerlargestsubtree.

Thus�

�>|T|≥

���

�.TakeT tobeonesubgraphandG–T tobe

theother.Bothhavesizeatleast���

�bytheboundsonTandare

connected,sowehavefoundavalidpartition.■Remark: The “induction” in the first paragraph is really just aformal way of saying “Well, the worst case for us is when G is atree,solet’sjustforgetaboutgeneralgraphsandprovetheresultfortrees:ifit’struefortrees,it’strueforeveryone”.AnotherwayofreducingthefocustojusttreesistotakeaspanningtreeofG.

Hall’s Marriage theorem GivenNsets(notnecessarilydistinct),wesaythatthefamilyofNsets has a system of distinct representatives (SDR) if it ispossibletochooseexactlyoneelementfromeachsetsuchthatallthe chosen elements are distinct. For example, if we have 4 sets{1,2,3},{2,4},{2,3,4}and{1,3}thenthisfamilyhas(1,2,4,3)asasystemofdistinctrepresentatives.Underwhatconditionsdoesafamily have a system of distinct representatives? One obviousnecessaryconditionisthatforanysubfamilyofksets,theunionofthese k sets must have at least k elements. It turns out that thiscondition,knownasthemarriagecondition,isalsosufficient.Example 9 [Hall’s Marriage Theorem]ShowthatthemarriageconditionissufficientfortheexistenceofanSDR.Proof:LetthemarriageconditionholdforthefamilyA1,A2,…,An.KeepdeletingelementsfromthesesetsuntilafamilyF’=A1’,A2’,…,An’ isreachedsuchthatthedeletionofanyelementwillcause

Chapter 8: Graph Theory 13

themarriageconditiontobeviolated.Weclaimthatatthisstageeach set contains exactly one element. This would imply theresult, since these elements would be distinct by the marriagecondition,andwouldhenceformtherequiredSDR.

Suppose our claim is false. Then some set contains at least 2elements. WLOG this set is A1 and let x and y be elements of A1.Deleting x or y would violate the marriage condition by thedefinitionofF’.ThusthereexistssubsetsPandQof{2,3,4,…,n}suchthatX=(A1’–x)∪(⋃ ��′)�є� andY=(A1’–y)∪(⋃ ��′)�є� satisfy

|X|≤|P|and|Y|≤|Q|.Addinggives

|X|+|Y|=|X⋂�|+|X⋃�|≤|P|+|Q|.

Now,X⋃�=A1’∪(⋃ ��′)�є�⋃� andX⋂�=⋃ ��′�є�⋂� .

Thusthemarriageconditionimpliesthat

|X∪Y|≥1+|P∪Q|,and|X⋂�|≥|P⋂�|.

Addinggives

|X⋂�|+|X⋃�|≥1+|P∪Q|+|P⋂�|=|P|+|Q|+1,

contradictingourearlierbound.■Remark:ThekeyideainthisproofwasthefactthatthemarriageconditionholdsforthesetsA1’,A2’,…An’butnotforA1\{x},A2’,…,An’andA1\{y},A2’,…,An’.Thisproofillustratesanimportantidea:it’s useful to exploit conditions given to us, but it’s even moreusefultoexploitsituationswhentheconditionsdon’thold.Hall’smarriagetheoremwasphrasedaboveinthelanguageofsettheory, but we can also interpret it in graph theoretical terms.Consider a bipartite graph G with vertex set V = V1 ∪ V2. Acomplete matchingoftheverticesofV1isasubsetoftheedgesofG

Olympiad Combinatorics 14

suchthat:(i) EveryvertexofV1isincidentonexactlyoneedge(ii) EachvertexofV2isincidentonatmostoneedge

In other words, it is a pairing such that every vertex in V1 ispaired with a vertex in V2 and no two vertices in V1 are pairedwiththesamevertexofV2.Theverticesinapairarejoinedbyanedge.

If the vertices of V1 represent the sets A1, A2, …, An and the

vertices of V2 represent elements in ⋃ ������ , then a complete

matching of V1 gives us a system of distinct representatives(namely the vertices of V2 to which the vertices of V1 arematched).Example 10 [Canada 2006-3] In a rectangular array of nonnegative reals with m rows and ncolumns,eachrowandeachcolumncontainsatleastonepositiveelement. Moreover, if a row and acolumnintersect in a positiveelement,thenthesumsoftheirelementsarethesame.Provethatm=n. Answer: Createabipartitegraph,withtheleftsiderepresentingrowsandtherightsideforcolumns.Placeanedgebetweentwovertices ifand only if the corresponding row and column intersect in apositiveelement.Theideaistoshowthatthereisamatchingfromrowstocolumns,son≥m.Bysymmetrythesameargumentwillgivem≥n,implyingm=n.

Assume to the contrary there is no such matching. Then themarriageconditionmustbeviolated,sothereexistssomesetSofrows having a total set T with |T| < |S| of columns in whichpositiveentriesappear.Letthesumsofthe|S|rowsbes1,…,sk.Bytheproperty,eachofthe|T|columnshassumequaltooneofthesi.SothetotalsumoftheelementsintheSrows,whencalculatedfrom the column point of view (since entries outside are all

Chapter 8: Graph Theory 15

nonnegative) is at mosta sum of asubset of thesi. Yet from therow point of view, it is the full sum. As all si > 0, this is acontradiction.■Remark: This duality between arrays of numbers (i.e. matrices)and graphs (especially bipartite graphs) comes up very often.Keep an eye out for this trick, since it can prove very useful. Infact, analyzing and algebraically manipulating these matricesallows graph theory to be studied from an algebraic viewpoint,and fast algorithms for multiplying matrices form the basis of aclass of algorithms for large graphs known as algebraic graphalgorithms.

Unexpected Applications of Graph Theory

Most problems in previous sections suggested a natural graphtheoretic interpretation. In this section, we will leverage thepower of graphs to model complex relationships in nonobviousways. Carefully constructed graphs can reduce unfamiliar,complexproblemstofamiliargraphtheoreticones.Example 11 [Taiwan 2001] Letn≥3beanintegerandletA1,A2,…,AnbendistinctsubsetsofS={1,2,…,n}.ShowthatthereexistsanelementxєSsuchthatthesubsetsA1\{x},A2\{x},…,An\{x}arealsodistinct.Answer: We construct a graph G with vertices A1, A2, …, An. For eachelementy, ifthereexistdistinctsetsAiandAjsuchthatAi\{y}=Aj\{y},weselectexactly onesuchpair(Ai,Aj)andjointhembyanedge(eveniftherearemultiplesuchpairs,weselectonlyoneforeachy).Supposetothecontrarytheredoesn’texistxasstatedintheproblem.ThenallelementsofScontributeatleastoneedgetothegraph.Moreover,itisimpossiblefortwodifferentelements

Olympiad Combinatorics 16

tocontributethesameedgesinceifAi\y1=Aj\y1andAi\y2=Aj\y2fordistincty1andy2,thiswouldforceAi=Aj.

Thus G has at least n edges, and hence has a cycle, WLOGA1A2…AkA1forsomek≥3.Thenthereexistssomedistinctx1,x2,…,xksuchthatA1\{x1}=A2\{x1};A2\{x2}=A3\{x2},…,Ak\{xk}=A1\xk.Nowx1isinexactlyoneofA1andA2(otherwiseA1=A2).WLOGitisinA2butnotinA1.Butthenx1mustalsobeinA3sinceA2 \ {x2} = A3 \ {x2}, and similarly must be in A4, and so on. Wefinallygetthatx1єA1,acontradiction.■The next problem, like several others in this book, underscores

the usefulness of induction. Problems with around “2n” objects

practically beg you to induct: all you need to do is find anappropriate way to split the set of objects into two parts, andapply the induction hypothesis to the larger or smaller part asapplicable.Buthowdoesthisconnecttographtheory?Example 12 [USA TST 2002]

LetnbeapositiveintegerandletSbeasetof(2n+1)elements.Let

fbeafunctionfromthesetoftwo-elementsubsetsofSto{0,1,…,

(2n-1

−1)}. Assume that for any elements (x, y, z) of S, one off({x,y}),f({y,z})andf({z,x})isequaltothesumoftheothertwo.Showthatthereexista,b,cinSsuchthatf{a,b},f{b,c)andf{c,a}areallequalto0.

Answer Step 1: The basic strategy

OurideaistofindasubsetS’ofSsuchthat|S’|≥2n-1+1andforall

x,yinS’f({x, y}) is even.Thenifweletg({x,y})=�({�,�})

�forallx,y

inS’,wewouldhaveafunctionfrompairsinS’to{0,1,…,2n-2

–1}satisfying the same conditions as f and we could apply theinduction hypothesis to get the result. It remains to show thatsuchasetS’exists.

Chapter 8: Graph Theory 17

Step 2: Constructing the graph and a new goal

ConstructagraphGwith2n+1verticesrepresentingelementsinSasfollows:thereisanedgebetweenaandbifandonlyiff({a,b})isodd.WenowneedtofindanindependentsetinGofsizeatleast

2n-1+1. Our hope is that G is bipartite: then we can just take thelarger side of the bipartition, which will have size at least

⌈(2� + 1)/2⌉=2n-1+1.Someexperimentationconfirmsourhope–butofcoursewestillneedaproof. Step 3: A key observation Note that for any 3 vertices a, b, c there must be 0 or 2 edgesamongst them, since f({a, b}) + f({b, c}) + f({c, a}) is even (sinceoneofthesetermsisthesumoftheothertwo).Step 4: Proving G is bipartite IfGisnotbipartite,ithasanoddcycle,soconsideritssmallestoddcyclev1v2…v2k+1.Considerverticesv1,v3,v4.Theremustbeanevennumber of edges amongst them. As v3v4 is an edge, v1v3 or v1v4must be an edge. v1v3 is not an edge since otherwise amongstverticesv1,v2andv3therewouldbethreeedges,contradictingourearlierobservation.Hencev1v4isanedge.Butthenv1v4…v2k+1isasmalleroddcycle,contradictingourassumption.■

Figure 8.5. The edge v1v4 creates a smaller odd cycle Remark 1: Instep4weessentiallyprovedthefollowingresult:IfGisagraphinwhichforanythreeverticesthereareeither0or2

v1 v2

v2k+1 v3

v4

Olympiad Combinatorics 18

edgesbetweenthem,Gisbipartite.Thisisaveryhandylemmatokeep in mind, especially since so many Olympiad problems boildowntoprovingthatacertaingraphisbipartite.Remark 2: Theideaoftakingashortestcyclearisesveryoften.Example 13 [IMO Shortlist 2002, C6] Letnbeanevenpositiveinteger.Showthatthereisapermutation(x1,x2,…,xn)of(1,2,…,n)suchthatforeveryiє(1,2,…,n),thenumberxi+1isoneofthenumbers2xi,2xi−1,2xi−n,2xi–n–1.Hereweusethecyclicsubscriptconvention,sothatxn+1meansx1.Answer: Letn=2m.Wedefineadirectedgraphwithvertices1,2,…,mandedgesnumbered1,2,…,2masfollows.Foreachi≤m,vertexihastwo outgoing edges numbered 2i−1 and 2i, and two incomingedgeslabelediandi+m.AllweneedisanEuleriancircuit,becausethensuccessiveedgeswillbeofoneof theforms(i,2i−1),(i,2i),(i+m, 2i) or (i+m, 2i−1). Then we can let x1, x2, …, xn be thesuccessiveedgesencounteredintheEuleriancircuitandtheywillsatisfytheproblem’sconditions.

Figure 8.6.

Now, each vertex’s indegree is equal to its outdegree, so wejustneedtoshowweakconnectivitytoestablishthatthereisanEulerian circuit. We do this by strong induction. There is a pathfrom1tok:sincethereisapathfrom1tojwhere2j=kor2j–1=k, andanedge from j tok, there is apath from 1tok.ThusG isweaklyconnectedandhencehasanEuleriancircuit.■

i i+m

2i 2i–1 i

Chapter 8: Graph Theory 19

Exercises

Hall’s Theorem and Related Problems 1. [Konig’s marriage theorem]

Show that a k-regular bipartite graph G (all vertices havedegreek)hasaperfectmatching(amatchingcoveringall itsvertices).

2. [Konig’s theorem]

A matching in a graph G is a set M of edges such that eachvertexinGisincidenttoatmostoneedgeinM.Avertex coverinGisasetofverticesCsuchthateachedgeisincidenttoat least one vertex in C. Using Hall’s marriage theorem, showthat in a bipartite graph G, the maximum possible size of amatching is equal to the minimum possible size of a vertexcover.

3. [Vietnam TST 2001]

Aclubhas42members.Supposethatforany31membersinthis club, there exists a boy and a girl among these 31members who know each other. Show that we can form 12disjointpairsofpeople,eachpairhavingoneboyandonegirl,suchthatthepeopleineachpairknoweachother.

4. [IMO Shortlist 2006, C6]

Consider an upward equilateral triangle of side length n,

consisting of n2 unit triangles (by upward we mean with

vertexontopandbaseatthebottom).Supposewecutoutnupward unit triangles from this figure, creating n triangularholes.Calltheresultingfigureaholey triangle.Adiamondisa60-120unitrhombus.ShowthataholeytriangleTcanbetiledbydiamonds,withnodiamondsoverlapping,coveringaholeor sticking out of T if and only if the following holds: every

Olympiad Combinatorics 20

upward equilateral of side length k inT has atmost k holes,forall1≤k≤n.

5. [Dilworth’s theorem]

A directed acyclic graph (DAG) is a directed graph with nodirected cycles. An antichain in a DAG (with some abuse ofnotation)isasetofverticessuchthatnotwoverticesinthissethaveadirectedpathbetweenthem.Showthatthesizeofthe maximum antichain of the DAGis equal to the minimumnumber of disjoint paths into which the DAG can bedecomposed.

6. [Romanian TST 2005]

LetSbeasetofn2+1positiveintegerssuchthatinanysubset

X of S with n+1 integers, there exist integers x ≠ y such thatx|y.ShowthatthereexistsasubsetS’ofSwithS’={x1,x2,…,xn+1}suchthatxi|xi+1foreach1≤i≤n.

Coloring Problems 7. [Welsh-Powell theorem] (U*)

Aproper coloringoftheverticesofagraphGisanassignmentof one color to each vertex of a graph G such that no twoadjacent vertices in G have the same color. Let G be a graphwithverticeshavingdegreesd1≥d2≥…≥dn.ShowthatthereexistsapropercoloringofGusingatmostmaxi(min{i,di+1}colors.

8. [Dominating sets and coloring] (U*)

Ifagraphonnverticeshasnodominatingsetofsizelessthank, thenshow that its vertices can be properlycolored in n–kcolors.

9. [IMO 1992, Problem 3]

LetGbethecompletegraphon9vertices.Eachedgeiseithercoloredblueorredorleftuncolored.Findthesmallestvalue

Chapter 8: Graph Theory 21

ofnsuchthatifnedgesarecolored,therenecessarilyexistsamonochromatictriangle.

10. [IMO Shortlist 1990]

TheedgesofaK10arecoloredredandblue.Showthatthereexisttwodisjointmonochromaticoddcycles,bothofthesamecolor.

11. [Szekeres-Wilf theorem] (U*)

ShowthatanygraphGcanbeproperlycoloredusingatmost1+max Δ(G’) colors, where the maximum is taken over allinduced subgraphs G’ of G and Δ(G’) refers to the maximumdegreeofavertexintheinducedsubgraphG’.

12. [Generalization of USA TST 2001]

LetG beadirectedgraphonnvertices,suchthatnovertexhasout-degreegreaterthank.ShowthattheverticesofGcanbecoloredin2k+1colorssuchthatnotwoverticesof thesamecolorhaveadirectededgebetweenthem.

13. [Brook’s theorem] (U*)

We know from (i) that ∆+1 colors are sufficient to properlycolor the vertices of a graph G, where ∆ is the maximumdegreeofanyvertex inG. Showthat ifG isconnectedand isneither a complete graph nor an odd cycle, then actually ∆colorssuffice.[Easy version: prove the result above with the addedconditionthatnotallverticeshavethesamedegree.]

Turan’s theorem and applications 14. [Turan’s theorem] (U*)

TheTuran graphT(n,r) is thegraphonnvertices formedasfollows: partition the set of n vertices into r equal or almostequal(differingby1)parts,andjointwoverticesbyanedgeifandonlyiftheyareindifferentparts.NotethatT(n,r)hasno(r+1)-clique. Show that amongst all graphs having no (r+1)-

Olympiad Combinatorics 22

clique, the Turan graph has the most edges. Hence, deducethat the maximum number of edges in a Kr+1-free graph is(���)��

��. This generalizes the bound of n2/4 edges in triangle-

freegraphsthatweprovedinchapter6.[Hint:firstprovethefollowingclaim:theredonotexistthreeverticesu,v,wsuchthatuvisanedgeinGbutuwandvwarenot. Show this by assuming the contrary and then makingsome adjustments to G to obtain a graph with more edges,contradicting the fact that G has the maximum possiblenumber of edges amongst all Kr+1-free graphs. The claimestablishes that if two vertices u and v have a common non-neighbor, then u and v themselves are non-neighbors. Thisshows that G is k-partite for some k. Now show that themaximum number of edges will occur when k = r and thepartsareequalordifferby1.]Remark: This method of proving that G is multipartite isextremely important, and is sometimes called Zykovsymmetrization.

15. [Poland 1997]

There are n points on a unit circle. Show that at most n2/3

pairsofthesepointsareatdistancegreaterthan√2.16. [IMO Shortlist 1989]

155birdssitonthecircumferenceofacircle.Itispossibleforthere to be more than one bird at the same point. Birds atpointsPandQaremutuallyvisibleifandonlyifanglePOQ≤

10o, where O is the center of the circle. Determine theminimumpossiblenumberofpairsofmutuallyvisiblebirds.

17. [USA TST 2008]

Given two points (x1, y1)and (x2, y2) in thecoordinate plane,theirManhattan distance isdefinedas |x1−x2|+ |y1−y2|.Callapairofpoints (A,B) in theplaneharmonic if1<d(A,B)≤2.

Chapter 8: Graph Theory 23

Given 100 points in the plane, determine the maximumnumberofharmonicpairsamongthem.

More Extremal Graph problems 18. [China TST 2012]

Letnandkbepositiveintegerssuchthatn>2andn/2<k<n.LetGbeagraphonnverticessuchthatGcontainsno(k+1)-clique but the addition of any new edge to G would createa(k+1)-clique.CallavertexinGcentral ifit isconnectedtoall(n−1)othervertices.Determine the leastpossiblenumberofcentralverticesinG.

19. [China TST 2011]

LetGbeagraphon3n2vertices(n>1),withnovertexhavingdegree greater than 4n. Suppose further that there exists avertexofdegreeoneandthatforanytwopoints,thereexistsapath of length at most 3 between them. Show that G has at

least(7n2–3n)/2edges.

20. [Generalization of IMO Shortlist 2013, C6]

InagraphG,foranyvertexv,thereareatmost2kverticesatdistance 3 from it. Show that for any vertex u, there are atmostk(k+1)verticesatdistance4fromit.

21. [IMO Shortlist 2004, C8]

ForafinitegraphG,letf(G)denotethenumberoftrianglesinG and g(G) the number of tetrahedra (K4s). Determine the

smallestconstantcsuchthatg(G)3≤c f(G)4forallgraphsG.22. [IMO Shortlist 2002, C7]

In a group of 120 people, some pairs are friends. A weakquartet is a group of 4 people containing exactly one pair offriends. What is the maximum possible number of weakquartets?

Olympiad Combinatorics 24

Tournaments 23. Show that if a tournament has adirected cycle, then it has a

directedtriangle.24. [Landau’s theorem]

Call a vertex v in a tournament T a champion if for everyvertexuinT,thereisadirectedpathfromvtouinToflengthatmost2.Showthateverytournamenthasachampion.

25. [Moon-Moser theorem]

A directed graph G is called strongly connected if there is adirectedpathfromeachvertexinGtoeveryothervertexinG.A directed graph with n vertices is called vertex-pancyclic ifevery vertex is contained in a cycle of length p, for each3≤p≤n.Showthatastronglyconnectedtournamentisvertexpancyclic.

26. [Based on USA TST 2009]

Letn>m>1beintegersandletGbeatournamentonnverticeswithno(m+1)-cycles.Showthattheverticescanbelabeled1,2,…,Nsuchthatifa≥b+m–1,thereisadirectededgefrombtoa.

Miscellaneous 27. [Generalization of Saint Petersburg 2001]

Foreachpositiveintegern,showthatthereexistsagraphon4nverticeswithexactlytwoverticeshavingdegreed,foreach1≤d≤2n.Remark: The degree vector lemma kills this otherwisedifficultproblem.

28. [Iran 2001]

In an n×n matrix, a generalized diagonal refers to a set of n

Chapter 8: Graph Theory 25

entrieswithoneineachrowandoneineachcolumn.LetMbeann×n0-1matrix,andsupposeMhasexactlyonegeneralizeddiagonalcontainingall1s.Showthatitispossibletopermutethe rows and columns of M to obtain a matrix M’ such that(i,j)entryinM’is0forall1≤j<i≤n.

29. [Generalization of Russia 2001]

LetGbeatreewithexactly2nleaves(verticeswithdegree1).Show that we can add n edges to G such that G becomes2-connected, thatis, thedestructionofanyedgeatthispointwouldstillleaveGconnected.

30. [Russia 1997]

Let m and n be odd integers. An m×n board is tiled withdominoessuchthatexactlyonesquareisleftuncovered.Oneisallowedtoslideverticaldominoesverticallyandhorizontaldominoes horizontally so as to occupy the empty square(therebychangingthepositionoftheemptysquare).Supposethe empty square is initially at the bottom left corner of theboard. Show that by a sequence of moves we can move theemptysquaretoanyoftheothercorners.

31. [Generalization of Japan 1997]

LetGbeagraphonnvertices,wheren≥9.Supposethatforany 5 vertices in G, there exist at least two edges withendpoints amongst these5vertices.ShowthatGhasat leastn(n−1)/8edges.Determineallnforwhichequalitycanoccur.

32. [Japan 1997]

Letnbeapositiveinteger.Eachvertexofa2n-gonislabeled0

or 1. There are 2n sequences obtained by starting at somevertex and reading the first n labels encountered clockwise.

Showthatthereexistsalabellingsuchthatthese2nsequences

arealldistinct.

Olympiad Combinatorics 26

33. [Based on USA TST 2011] InanundirectedgraphG,alledgeshaveweighteither1or2.Foreachvertex,thesumoftheweightsofedgesincidenttoitis odd. Show that it is possible to orient the edges of G suchthat for each vertex, the absolute value of the differencebetween its in-weight and out-weight is 1, where in-weightreferstothesumofweightsofincomingedgesandout-weightreferstothesumofweightsofoutgoingedges.

34. [IMO Shortlist 1990]

Consider the rectangle in the coordinate plane with vertices(0,0),(0,m),(n,0)and(m,n),wheremandnareoddpositiveintegers.Thisrectangleispartitionedintotrianglessuchthateachtriangle in thepartitionhasat leastonesideparallel tooneof thecoordinateaxes,andthealtitudeonanysuchsidehas length 1. Furthermore, any side that is not parallel to acoordinate axis is common to two triangles in the partition.Show that there exist two triangles in the partition eachhavingonesideparallel tothexaxisandonesideparallel totheyaxis.