the toilet paper problem

Upload: kishore-babu

Post on 03-Apr-2018

258 views

Category:

Documents


11 download

TRANSCRIPT

  • 7/29/2019 The Toilet Paper Problem

    1/7

    The Toilet Paper ProblemAuthor(s): Donald E. KnuthReviewed work(s):Source: The American Mathematical Monthly, Vol. 91, No. 8 (Oct., 1984), pp. 465-470Published by: Mathematical Association of AmericaStable URL: http://www.jstor.org/stable/2322567 .

    Accessed: 16/02/2013 10:04

    Your use of the JSTOR archive indicates your acceptance of the Terms & Conditions of Use, available at .http://www.jstor.org/page/info/about/policies/terms.jsp

    .JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide range of

    content in a trusted digital archive. We use information technology and tools to increase productivity and facilitate new forms

    of scholarship. For more information about JSTOR, please contact [email protected].

    .

    Mathematical Association of America is collaborating with JSTOR to digitize, preserve and extend access to

    The American Mathematical Monthly.

    http://www.jstor.org

    This content downloaded on Sat, 16 Feb 2013 10:04:50 AMAll use subject to JSTOR Terms and Conditions

    http://www.jstor.org/action/showPublisher?publisherCode=maahttp://www.jstor.org/stable/2322567?origin=JSTOR-pdfhttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/stable/2322567?origin=JSTOR-pdfhttp://www.jstor.org/action/showPublisher?publisherCode=maa
  • 7/29/2019 The Toilet Paper Problem

    2/7

  • 7/29/2019 The Toilet Paper Problem

    3/7

    466 DONALDE. KNUTH [OctoberMn(p) = C1PMn-1(P) + C2p2qM-2(P) + * +c, 1pfllq1-2M1(p) + Ln(p)E Ckpkqk lMn-k(P) + Lnfl(P);O

  • 7/29/2019 The Toilet Paper Problem

    4/7

    1984] THE TOILET PAPER PROBLEM 467These ower eriesonvergeor zI< 1/4,becausehe ighthandide s singularnlywhenis nfiniterV1- 4z is singular.t s nterestingo considerhat appens hen = pq, p > 0,q>O,andp+q=1:Wehave1 -4z=(p-q)2, hence

    1-4z = Ip - ql= max(p, q) - min(p, q),andweobtain he nterestingormula

    C(pq) = E (2n -2) pnqn= min(p, q)We have q < 1/4unless = q = 1/2;the ormulaolds lso ntheatterase, yAbel'simittheorem.

    4. Generatingunctions.etusnow etM(z)= , Mn(p)Zn; L(z) = E, Ln(p)zn.n1 n>1

    TherecurrenceelationorM,(p) insectionis equivalentoM(z) - L(z) = q-1C(pqz)M(z),andwealsohaveL(z) = z + 2 q _ 1k(k - 1)pnk(2n k 2)zn

    = E qklk kk-i2k+ k 2)(qZ)j+kk-l~~k k1 2 + k- 2 )Eqk>O lkz jk-E1 pz'

    Bythedentitynsection,the atterum s( l /- 4pqz k-= 2qk1kzk 2pqz

    = Z E kpl-kC(pqz)k-l p Zk 0 (p - C(pqz))2

    Wecan now eliminate(z) and solveforM(z), obtaining"closedform"or hedesiredgeneratingunction:M(z ) = Z - C(pqz) q - C(pqz))

    Such simpleormorM(z) isunexpected;ut nfact, ecando evenmore!Wehave(p - C(pqz))(q - C(pqz)) = pq - C(pqz) + C(pqZ)2 = pq(l - z),because (z) - C(Z)2 = z. Hencethedenominatorf M(z) can be vastly implified:

    M(z)= z q-C(pqz)This is theproduct z + 2Z2+ 3z3 + ***(1-cpz- c2p2qz2 - c3p3q2z3 ** ), so thecoefficientf n canbe written

    This content downloaded on Sat, 16 Feb 2013 10:04:50 AMAll use subject to JSTOR Terms and Conditions

    http://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsp
  • 7/29/2019 The Toilet Paper Problem

    5/7

    468 DONALD E. KNUTH [OctoberWhen formulaurnsut o be sosimple,t must ave simplexplanation.ut he uthorhasn't een ble othinkfanydirect roof.or ome eason,M, p) is not nly he xpectedsize f he emainingollwhenneroll mpties,t salso he xpectedalue f he firsteturnothediagonal,"nthefollowingense: uppose he wo oilet aper olls tartn thefull tate(n, n), and heyreused ybig-choosersnd ittle-choosersntil he mptytate0, ) is reached;and supposethatthe rollsfirst ecome equal in size again at state n - k, n - k). Then theaveragealue fk isMn(p). This ollowsromur ormulaorM (p), because kkqk-l is theprobabilityf first eturn o n - k, n - k) for achk < n, and1 - clp - * pn lq -2is the robabilityhat he iagonals not ncounteredntil tate0, ) is reached.)Is theren easyway o prove hat he ame xpectedalue ccursn both roblems?hedistributionsredifferent,ut hemean alues re he ame.5. The imitingehavior. ow hatM(z) hasbeen ut nto fairlyimpleorm, earereadytodeduce he symptoticalueofMn(p) for ixed as n -- oo.Let's ssumeirsthat #q.Then pq < 1,and he unction(pqz) = 2(1 - 01 - 4pqz) is

    analytic or zl< 1/(4pqz); so it is analyticn a neighborhoodf z = 1. In fact, simplecomputationroveshattsTaylor eriest the oint = 1 involvesheCatalan umbersnceagain:min(,) pqz -1))C(pqz) = min(p, q) + (max(p, q) - i(,)C( ( )2)

    (This ormulaeneralizesur reviousbservationhat (pq) = min(p, ).)Ifq < p, our ormulaorM(z) reducesoMW z q -p pq(z -I)

    (I Z)2 q (p -q) )_ z p ( p2q p3q25(-)=1l-z p q - Z C2 pq)3 + C3 Z - ) +

    - Z P~ ~ ( -q p- )1-zp-q

    where (z) is analyticnthe egionzI 1/(4pq).Thisdetermineshevalue fMn(p) quiteaccurately:THEOREM 1. Letrbeanyvaluegreaterhan pq. Then

    fIPl(P- q) + 0(r n) if < p;((q-p)/q)n + p/(q-p) + O(rn), ifq > p.(Theconstantsmpliedy0 in theseormulasepend np andr, butnot n n.)

    Proof. f q < p, thevalueofMn(p) is the oefficientfzn nM(z), whichs p/(p - q) plusthe coefficientf zn in f(z). But f(z) convergesbsolutelyhen = l/r, hence ts nthcoefficients 0(rn).Ifq > p, the tatedesult ollowsromhe ormulaor < p,using hedentityqMn(p) + pn = pMn(q) + qn

    whichsan mmediateonsequencef he ormulaorMnp) in section. QED.For example,f p = 2/3 and q = 1/3, so thatbig-choosersutnumberittle-choosersy2 to1,the verageizeof the emainingollwill everylose o2,when is large; utwhenp = 1/3 and q = 2/3 the veragewillbe approximatelyn + 1.This grees ith ur ntuition:f ittle-choosersredominate,he ize f he argerollwill end

    This content downloaded on Sat, 16 Feb 2013 10:04:50 AMAll use subject to JSTOR Terms and Conditions

    http://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsp
  • 7/29/2019 The Toilet Paper Problem

    6/7

    1984] THE TOILET PAPER PROBLEM 469to be proportionalo n, when he mallerolls usedup.But fbig-choosersre n themajority,the arger ollwill end obereducedo a boundedize, ndependentf henitializen.

    6. The ransitionoint. utwhat bout he oundaryase,p = q?Does t ead to engthsforder , ororder , or somethingn between?This sactuallyhe implestasetoanalyze,ecause = q = 1/2 sequivalento sayinghateverybodys a random-chooser;he roblemeducesoa fairlyimplerandom alk." nfact,we are essentiallyealing erewith Banach'smatch ox problem"s discussedy Feller 2,IX.3(f)]. ccordingoourgeneralormula,he eneratingunctionn this ase s simply

    M(Z) ~zZ)(1 )3/72so theres a solutionnclosed orm:

    Mn(1)= (-3/2)(_1)n-1 = 2n(2n)By Stirling'spproximationehave he ollowingesult:

    THEoREM 2.Mn(p) = 2 - 4 - + O(n3-3/2'IT 4i rn-

    when = q.Thefunction n(p) is a polynomialn p ofdegreen - 3, forn> 2, and t decreasesmonotonicallyrom down o1 as p increasesrom to1. Theremarkablehingbout hisdecreasesthattchangesn characteratheruddenlyhen passes /2.We can't se the ormulasfTheoremwhen is too close o1/2, ven f n isextremely

    100

    80

    60

    40

    .0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1.0

    This content downloaded on Sat, 16 Feb 2013 10:04:50 AMAll use subject to JSTOR Terms and Conditions

    http://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsp
  • 7/29/2019 The Toilet Paper Problem

    7/7

    470 GEORGEBOOLOS [Octoberlarge.For example,f n = 1010andp = 1 + 10-20, both pproximationsn Theorem give heridiculous stimateMn(p) = I X 1020. Indeed,we knowthatMn1/2) is of orderVn, o theapproximationsan be validonlywhen P -P is of order / n at least.The slopeofMnp) at p = 1/2 can be calculated ydifferentiating(z) with espect opand extractinghe oefficientfzn. The derivativesz d (C(p(1-p)z z(l_z)2 dp 1 - p (1_ z)2

    ( (1- 2p)zC'(p(I -p)z) + C(p(I -p)z)I -P ~(1-_p)2 1andat p = 1/2 this quals -2z(1 _ z)-2 + 2z(l z)-3/2. Hence

    Mn1/2) = -2n + 2Mn(1/2);this s consistent ithMn(p) droppingromn to a smallvalue as p goesfrom to 1/2. Thegraph fMloo(p) is shown n page469.

    Acknowledgements.wish o thankhe rchitectf the omputercience uildingt Stanfordniversityorimplicitlyuggestinghis roblem,nd Richard eigel or hensighthat ed to the losed orm fL(z). AndreiBroder fferedelpfulommentsndcomputedhegraph fMloo(p).My research assupportednpartbyNational cience oundationrantMCS-83-00984.References

    1. DesireAndre,olutionirecteu probkmeesolu arM.Bertrand,omptes endus, cad. Sci.Paris, 05(1887)436-437.2. Williameller, n ntroductionoProbabilityheorynd tsApplications,ol.1,2nd d.,Wiley, ewYork,1957.3. DonaldE. Knuth, heArt fComputerrogramming,ol.1: Fundamentallgorithms,ddison-Wesley,Reading, A, 1968, xii 634 pp.

    THE LOGIC OF PROVABILITYGEORGEBOOLOSDepartmentf inguisticsndPhilosophy,assachusettsnstitutefTechnology,ambridge,A02139

    The ubjectfthis rticlesthewaynwhichnancientranchf ogic, irstnvestigatedyAristotlendknowns modalogic, asrecentlyeen oundo shed ightna branchf ogic fmuchater ate, hemathematicaltudyfmathematicstself,studyegun yDavidHilbertandbroughto fruitionyKurtGodel.The fundamentalonceptstudiedn modal ogic re those fnecessityndpossibility:statementscalled necessary"f t must etrue,nd possible"f tmightetrue. hus, incetheremighte a warn the ear 000, he tatementthere ill e a war n 2000"spossible,utit s notnecessary,sthere ightot e a war hen. nthe therand,he tatementthere ill

    Georgeoolos:AfternundergraduateegreenmathematicstPrinceton,heremy upervisorasRaymondSmullyan,nda graduateegreenphilosophytOxford, became hefirsterson ver o receive Ph.D. inphilosophyromMIT,writing thesis n hierarchyheorynderHilary utnam. taughtor hree ears tColumbiand n 1969returnedo MIT,where amnow professorfphilosophy.n additiono a bookon thetopic fthis rticle,he UnprovabilityfConsistency,nda textbook,omputabilityndLogic co-authoredithRichard effrey),havewrittennumberf articlesn ogic ndphilosophy.

    This content downloaded on Sat, 16 Feb 2013 10:04:50 AMAll bj JSTOR T d C di i

    http://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsphttp://www.jstor.org/page/info/about/policies/terms.jsp