l3_induction1

Upload: edson-f-okuda

Post on 03-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 l3_induction1

    1/9

    6.042/18.062JMathematicsforComputerScience February8,2005SriniDevadasandEricLehman LectureNotes

    InductionI1 InductionAprofessorbringstoclassabottomlessbagofassortedminiaturecandybars.Sheofferstoshareinaccordancewithtworules. First,shenumbersthestudents0,1,2,3,andsoforthforconvenientreference.Nowherearethetworules:

    1. Student0getscandy.2. Foralln N,ifstudentn getscandy,thenstudentn + 1 alsogetscandy.

    Youcanthinkofthesecondruleasacompactwayofwritingawholesequenceofstate-ments,oneforeachnaturalvalueofn:

    Ifstudent0getscandy,thenstudent1alsogetscandy. Ifstudent1getscandy,thenstudent2alsogetscandy. Ifstudent2getscandy,thenstudent3alsogetscandy,andsoforth.Nowsupposeyouarestudent17.Bytheserules,areyouentitledtoaminiaturecandy

    bar? Well,student0getscandybythefirstrule. Therefore,bythesecondrule,student1alsogetscandy,whichmeansstudent2getscandyaswell,whichmeansstudent3getcandy,andsoon.Sotheprofessorstworulesactuallyguaranteecandyforeverystudent,nomatterhowlargetheclass.Youwin!

    Thisreasoninggeneralizestoaprinciplecalledinduction:

    PrincipleofInduction.LetP(n) beapredicate.If P(0) istrue,and foralln N,P(n) impliesP(n + 1),thenP(n) istrueforalln N.

  • 7/29/2019 l3_induction1

    2/9

    2 InductionIHeresthecorrespondencebetweentheinductionprincipleandsharingcandybars.

    SupposethatP(n) isthepredicate,studentn getscandy.ThentheprofessorsfirstruleassertsthatP(0) istrue,andhersecondruleisthatforalln N,P(n) impliesP(n + 1).Giventhesefacts, theinductionprinciplesaysthatP(n) istrueforalln N. Inotherwords,

    everyone

    gets

    candy.

    Theintuitivejustificationforthegeneralinductionprincipleisthesameasforevery-

    onegettingacandybarundertheprofessorstworules. Mathematiciansfindthisintu-itionsocompellingthatinductionisalwayseithertakenasanaxiomorelseprovedfrommoreprimitiveaxioms,whicharethemselvesspecificallydesignedsothatinductionisprovable.Inanycase,theinductionprincipleisacoreprincipleofmathematics.

    2 UsingInductionInductionisbyfarthemostimportantprooftechniqueincomputerscience. Generally,inductionisusedtoprovethatsomestatementholdsforallnaturalvaluesofavariable.Forexample,hereisaclassicformula:Theorem1. Foralln N:

    n(n + 1)1 + 2 + 3 + . . . + n =

    2

    Theleftsideoftheequationrepresentsthesumofallthenumbersfrom1ton.Youresupposedtoguessthepatternandmentallyreplacethe. . . withtheotherterms.Wecouldeliminatetheneedforguessingbyrewritingtheleftsidewithsummationnotation:

    n

    i or i or ii=1 1in i{1,...,n}

    Eachof theseexpressionsdenotes thesumofallvalues takenonby theexpression totherightofthesigmaasthevariablei rangesfrom1ton. ThemeaningofthesuminTheorem1isnotsoobviousinacouplespecialcases:

    Ifn = 1,thenthereisonlyoneterminthesummation,andso1+2+3+ . . .+n = 1.Dontbemisledbytheappearanceof2and3andthesuggestionthat1 andn aredistinctterms!

    Ifn 0,thentherearenotermsatallinthesummation,andso1+2+3+. . .+n = 0.The. . . notationisconvenient,butwatchoutforthesespecialcaseswherethenotationismisleading!

    Now letsuse the inductionprinciple toproveTheorem1. Suppose thatwedefinepredicateP(n) tobe1 + 2 + 3 + . . . + n = n(n + 1)/2.Recastintermsofthispredicate,thetheoremclaimsthatP(n) istrueforalln N. Thisisgreat,becausetheinductionprincipleletsusreachpreciselythatconclusion,providedweestablishtwosimplerfacts:

  • 7/29/2019 l3_induction1

    3/9

    InductionI 3 P(0) istrue. Foralln N,P(n) impliesP(n + 1).Sonowourjobisreducedtoprovingthesetwostatements. Thefirstistruebecause

    P(0) assertsthatasumofzerotermsisequalto0(0 + 1)/2 = 0.Thesecondstatement ismorecomplicated. But remember thebasicplan forprov-

    ingthevalidityofanyimplication: assumethestatementontheleftandthenprovethestatementontheright.Inthiscase,weassumeP(n):

    n(n + 1)1 + 2 + 3 + . . . + n =

    2

    inordertoproveP(n + 1):(n + 1)(n + 2)

    1 + 2 + 3 + . . . + n + (n + 1) =2

    These twoequationsarequitesimilar; infact,adding(n + 1) tobothsidesof thefirstequationandsimplifyingtherightsidegivesthesecondequation:

    n(n + 1)1 + 2 + 3 + . . . + n + (n + 1) = + (n + 1)

    2(n + 2)(n + 1)

    =2

    Thus,ifP(n) istrue,thensoisP(n + 1).Thisargumentisvalidforeverynaturalnumbern,sothisestablishesthesecondfactrequiredbytheinductionprinciple. Ineffect,wevejustprovedthatP(0) impliesP(1),P(1) impliesP(2),P(2) impliesP(3),etc. allinonefellswoop.

    Withthesetwofactsinhand, theinductionprinciplesaysthatthepredicateP(n) istrueforallnaturaln.Andsothetheoremisproved!

    2.1 ATemplateforInductionProofsTheproofofTheorem1wasrelativelysimple,buteventhemostcomplicatedinductionprooffollowsexactlythesametemplate.Therearefivecomponents:

    1. Statethattheproofusesinduction.Thisimmediatelyconveystheoverallstructureoftheproof,whichhelpsthereaderunderstandyourargument.

    2. DefineanappropriatepredicateP(n). Theeventualconclusionof the inductionargumentwillbe thatP(n) is trueforallnaturaln. Thus,youshoulddefine thepredicateP(n) sothatyourtheoremisequivalentto(orfollowsfrom)thisconclu-sion. Often thepredicatecanbe liftedstraightfrom theclaim,as in theexampleabove.ThepredicateP(n) iscalledtheinductionhypothesis.

  • 7/29/2019 l3_induction1

    4/9

    4 InductionI3. ProvethatP(0) istrue. Thisisusuallyeasy,asintheexampleabove. Thispartof

    theproofiscalledthebasecaseorbasisstep.4. ProvethatP(n) impliesP(n + 1) foreverynaturalnumbern. Thisiscalledthe

    inductivesteporinductionstep. Thebasicplanisalwaysthesame: assumethatP(n) istrueandthenusethisassumptiontoprovethatP(n + 1) istrue.Thesetwo statements shouldbe fairly similar,butbridging thegapmay require someingenuity.Whateverargumentyougivemustbevalidforeverynaturalnumbern,sincethegoalistoprovetheimplicationsP(0) P(1),P(1) P(2),P(2) P(3),etc.allatonce.

    5. Invokeinduction.Giventhesefacts,theinductionprincipleallowsyoutoconcludethatP(n) istrueforallnaturaln.Thisisthelogicalcapstonetothewholeargument,butmanywritersleavethisstepimplicit.

    Explicitlylabelingthebasecaseandinductivestepmaymakeyourproofsmoreclear.2.2 ACleanWriteupTheproofofTheorem1givenaboveisperfectlyvalid;however,itcontainsalotofextra-neousexplanationthatyouwontusuallyseeininductionproofs. Thewriteupbelowisclosertowhatyoumightseeinprintandshouldbepreparedtoproduceyourself.Proof. Weuseinduction.LetP(n) bethepredicate:

    n(n + 1)1 + 2 + 3 + . . . + n =

    2

    Basecase:P(0) istrue,becausebothsidesoftheequationarezero.Inductivestep:AssumethatP(n) istrue,wheren isanynaturalnumber.ThenP(n + 1) isalsotrue,because:

    n(n + 1)1 + 2 + 3 + . . . + n + (n + 1) = + (n + 1)

    2(n + 1)(n + 2)

    = 2

    ThefirststepusestheassumptionP(n),andthesecondfollowsbysimplification.There-fore,P(n) istrueforallnaturaln byinduction.

    Inductionwashelpfulforprovingthecorrectnessofthissummationformula,butnothelpful fordiscovering the formula in thefirstplace. Therearesome tricks forfindingsuchformulas,whichwellshowyouinafewweeks.

  • 7/29/2019 l3_induction1

    5/9

  • 7/29/2019 l3_induction1

    6/9

    6 InductionIInductivestep:AssumethatP(n) istrue,wheren isanynaturalnumber.Then:

    23 (n3 n) 3 (n3 n) + 3(n + n)| |3 n3 + 3n2 + 3n + 1 n 1|3 (n + 1)3 (n + 1)|

    Thefirst implication relieson the fact that3(n2 + n) isdivisibleby3. The remainingimplications involveonly rewriting theexpressionon the right. The last statement isP(n + 1),soweveprovedthatP(n) impliesP(n + 1) foralln N.

    Bytheprincipleofinduction,P(n) istrueforalln N,whichprovestheclaim.Thisproofwouldlookquitemysterioustoanyonenotprivytothescratchworkwedid

    beforehand.Inparticular,onemightaskhowwehadtheforesighttointroducethemagicterm3(n2 +n).Ofcourse,thiswasnotforesightatall;wejustworkedbackwardinitially!

    4 AFaultyInductionProofSometimeswewanttoprovethatastatementistruefor,say,allintegersn 1 ratherthanallintegersn 0. Inthiscircumstance,wecanuseaslightvariationoninduction:proveP(1) inthebasecaseandthenprovethatP(n) impliesP(n + 1) foralln 1 intheinductivestep. Thisisaperfectlyvalidvariantofinductionandisnottheproblemwiththeproofbelow.False

    Theorem

    3.

    All

    horses

    are

    the

    same

    color.

    Proof. Theproofisbyinduction.LetP(n) bethepropositionthatineverysetofn horses,allarethesamecolor.Basecase:P(1) istrue,becauseallhorsesinasetof1mustbethesamecolor.Inductivestep:AssumethatP(n) istrue,wheren isapositiveinteger;thatis,assumethatineverysetofn horses,allarethesamecolor.Nowconsiderasetofn + 1 horses:

    h1, h2, . . . , hn, hn+1

    Byourassumption,thefirstn horsesarethesamecolor:h1, h2, . . . , hn, hn+1

    samecolorAlsobyourassumption,thelastn horsesarethesamecolor:

    h1, h2, . . . , hn, hn+1

    samecolor

  • 7/29/2019 l3_induction1

    7/9

    7InductionITherefore,horsesh1, h2, . . . , hn+1 mustallbethesamecolor,andsoP(n+1) istrue.Thus,P(n) impliesP(n + 1).

    Bytheprincipleofinduction,P(n) istrueforalln 1. Thetheoremisaspecialcasewheren isequaltothenumberofhorsesintheworld.

    Weveprovedsomethingfalse!Ismathbroken?Shouldweallbecomepoets?Theerrorinthisargumentisinthesentencethatbegins,Therefore,horsesh1,h2,. . .,

    hn,hn+1 mustallbethesamecolor. The. . .notationcreatestheimpressionthatthesetsh1, h2, . . . , hn andh2, . . . , hn, hn+1 overlap. However,thisisnottruewhenn = 1. Inthatcase,thefirstsetisjusth1 andthesecondish2,andthesedonotoverlapatall!

    Thismistakeknocksacriticallinkoutofourinductionargument.WeprovedP(1) andweprovedP(2) P(3),P(3) P(4),etc. ButwefailedtoproveP(1) P(2),andsoeverythingfallsapart:wecannotconcludethatP(3),P(4),etc.aretrue.And,ofcourse,thesepropositionsareallfalse;therearehorsesofadifferentcolor.

    5 CourtyardTilingInductionservedpurelyasaprooftechniqueintheprecedingexamples. Butinductionsometimescanserveasamoregeneralreasoningtool.

    MITrecentlyconstructedanewcomputersciencebuilding.Astheprojectwentfurtherand furtheroverbudget, thereweresomeradical fundraising ideas. Oneplanwas toinstallabigcourtyardwithdimensions2n 2n:

    2n

    2n

    Oneofthecentralsquareswouldbeoccupiedbyastatueofawealthypotentialdonor.Lets

    call

    him

    Bill.

    (In

    the

    special

    case

    n = 0,

    the

    whole

    courtyard

    consists

    of

    asingle

    centralsquare;otherwise, therearefourcentralsquares.) Acomplicationwasthat thebuildingsunconventionalarchitect,FrankGehry,insistedthatonlyspecialL-shapedtilesbeused:

  • 7/29/2019 l3_induction1

    8/9

    8 InductionIAcourtyardmeetingtheseconstraintsexsists,atleastforn = 2:

    B

    Forlargervaluesofn,isthereawaytotilea2n 2n courtyardwithL-shapedtilesandastatueinthecenter?Letstrytoprovethatthisisso.Theorem4.Foralln 0 thereexistsatilingofa2n 2n courtyardwithBillinacentralsquare.Proof.

    (doomed

    attempt)

    The

    proof

    is

    by

    induction.

    Let

    P(n) be

    the

    proposition

    that

    there

    existsatilingofa2n 2n courtyardwithBillinthecenter.Basecase:P(0) istruebecauseBillfillsthewholecourtyard.Inductivestep:Assumethatthereisatilingofa2n 2n courtyardwithBillinthecenterforsomen 0.Wemustprovethatthereisawaytotilea2n+1 2n+1 courtyardwithBillinthecenter...

    Nowwereintrouble!TheabilitytotileasmallercourtyardwithBillinthecenterdoesnothelptilealargercourtyardwithBillinthecenter.WecannotbridgethegapbetweenP(n) andP(n + 1).Theusualrecipeforfindinganinductiveproofwillnotwork!

    Whenthishappens,yourfirstfallbackshouldbetolookforastrongerinductionhy-pothesis; that is,onewhich impliesyourprevioushypothesis. Forexample,wecouldmakeP(n) thepropositionthatforeverylocationofBillina2n 2n courtyard,thereexistsatilingoftheremainder.

    Thisadvicemaysoundbizzare:Ifyoucantprovesomething,trytoprovesomethingmoregrand!Butforinductionarguments,thismakessense.Intheinductivestep,whereyouhavetoproveP(n) P(n + 1),youreinbettershapebecauseyoucanassumeP(n),whichisnowamoregeneral,moreusefulstatement. Letsseehowthisplaysoutinthecaseofcourtyardtiling.Proof.

    (successful

    attempt)

    The

    proof

    is

    by

    induction.

    Let

    P(n) be

    the

    proposition

    that

    for

    everylocationofBillina2n 2n courtyard,thereexistsatilingoftheremainder.Basecase:P(0) istruebecauseBillfillsthewholecourtyard.Inductivestep:AsumethatP(n) istrueforsomen 0;thatis,foreverylocationofBillina2n 2n courtyard,thereexistsatilingoftheremainder.Dividethe2n+12n+1 courtyardintofourquadrants,each2n 2n. OnequadrantcontainsBill(Binthediagrambelow).PlaceatemporaryBill(Xinthediagram)ineachofthethreecentralsquareslyingoutsidethisquadrant:

  • 7/29/2019 l3_induction1

    9/9

    9InductionI

    XX X

    B

    2n

    2n

    2n 2n

    Nowwecantileeachofthefourquadrantsbytheinductionassumption.ReplacingthethreetemporaryBillswithasingleL-shapedtilecompletesthejob.ThisprovesthatP(n)impliesP(n + 1) foralln 0.Thetheoremfollowsasaspecialcase.

    Thisproofhastwoniceproperties. First,notonlydoestheargumentguaranteethatatilingexists,butalsoitgivesanalgorithmforfindingsuchatiling. Second,wehaveastronger result: ifBillwantedastatueon theedgeof thecourtyard, away from thepigeons,wecouldaccommodatehim!

    Strengtheningtheinductionhypothesisisoftenagoodmovewhenaninductionproofwontgo through. Butkeep inmind that thestrongerassertionmustactuallybe true;otherwise,thereisntmuchhopeofconstructingavalidproof!Sometimesfindingjusttherightinductionhypothesisrequirestrial,error,andinsight.Forexample,mathematiciansspentalmosttwentyyearstryingtoproveordisprovetheconjecturethatEveryplanargraphis5-choosable1.Then,in1994,CarstenThomassengaveaninductionproofsimpleenough toexplainonanapkin. Thekey turnedout tobefindinganextremelycleverinductionhypothesis;withthatinhand,completingtheargumentiseasy!

    15-choosability isaslightgeneralizationof5-colorability. Althougheveryplanargraph is4-colorableand therefore5-colorable,noteveryplanargraph is4-choosable. If thisallsounds likenonsense,dontpanic.Welldiscussgraphs,planarity,andcoloringintwoweeks.