Digital Dice

Digital Dice: Computational Solutions to Practical Probability Problems

Paul J. Nahin
Copyright Date: 2008
Pages: 276
  • Cite this Item
  • Book Info
    Digital Dice
    Book Description:

    Some probability problems are so difficult that they stump the smartest mathematicians. But even the hardest of these problems can often be solved with a computer and a Monte Carlo simulation, in which a random-number generator simulates a physical process, such as a million rolls of a pair of dice. This is whatDigital Diceis all about: how to get numerical answers to difficult probability problems without having to solve complicated mathematical equations.

    Popular-math writer Paul Nahin challenges readers to solve twenty-one difficult but fun problems, from determining the odds of coin-flipping games to figuring out the behavior of elevators. Problems build from relatively easy (deciding whether a dishwasher who breaks most of the dishes at a restaurant during a given week is clumsy or just the victim of randomness) to the very difficult (tackling branching processes of the kind that had to be solved by Manhattan Project mathematician Stanislaw Ulam). In his characteristic style, Nahin brings the problems to life with interesting and odd historical anecdotes. Readers learn, for example, not just how to determine the optimal stopping point in any selection process but that astronomer Johannes Kepler selected his second wife by interviewing eleven women.

    The book shows readers how to write elementary computer codes using any common programming language, and provides solutions and line-by-line walk-throughs of a MATLAB code for each problem.

    Digital Dicewill appeal to anyone who enjoys popular math or computer science.

    eISBN: 978-1-4008-3929-2
    Subjects: Mathematics, Technology, Statistics

Table of Contents

  1. Front Matter
    (pp. i-viii)
  2. Table of Contents
    (pp. ix-xiv)
  3. Introduction
    (pp. 1-34)

    This book is directed to three distinct audiences that may also enjoy some overlap: teachers of either probability or computer science looking for supplementary material for use in their classes, students in those classes looking for additional study examples, and aficionados of recreational mathematics looking for what I hope are entertaining and educational discussions of intriguing probability problems from “real life.’’ In my first book of probability problems,Duelling Idiots and Other Probability Puzzlers(Princeton University Press, 2000), the problems were mostly of a whimsical nature. Not always, but nearly so. In this book, the first test a problem had...

  4. The Problems
    • 1. The Clumsy Dishwasher Problem
      (pp. 37-37)

      Suppose a restaurant employs five dishwashers. In a one-week interval they break five dishes, with four breakages due to the same individual. His colleagues thereafter call him “clumsy,’’ but he claims it was just bad luck and could have happened to any one of them. The problem here is to see if he has some valid mathematical support for his position. First, see if you can calculate the probability that the same dishwasher breaksat leastfour of the five dishes that are broken (this includes, of course, the event of his breaking all five). It’s an easy combinatorial calculation....

    • 2. Will Lil and Bill Meet at the Malt Shop?
      (pp. 38-39)

      The introduction used some examples of geometric probability from pure mathematics to open this book, and here’s a problem from real life that can also be solved with a geometric probability approach. It can, however, also be easily attacked with a Monte Carlo simulation if the theoretical solution escapes you, and so I think it perfect for inclusion in this collection.

      I used this problem in every undergraduate probability class I taught at the University of New Hampshire, and I originally thought the initial puzzlement I saw on my students’ faces was because the math was strange to them. Then...

    • 3. A Parallel Parking Question
      (pp. 40-41)

      Supposen≥ 2 cars parallel park in a long, straight, narrow lot of lengthL. To make things easy, we’ll imagine that the cars have no extensions but instead can be modeled as simply points distributed along a line segment of lengthL. We’ll measure the parking location orpositionof a car by its distance from the lot entrance at the origin, and so each car is located in the interval (0,L). Now, each car will obviously have anearest neighbor. For example, ifn= 3 and if the positions of car1, car2, and car3 are 0.05,...

    • 4. A Curious Coin-Flipping Game
      (pp. 42-44)

      Unsolved problems in mathematics are fun to play with because if you manage to solve one, you’ll become famous—or at least as famous as mathematicians get to be. When Andrew Wiles (born 1953) finally put Fermat’s Last Theorem to rest in 1995, he became really famous, but that sort of general fame is rare. Frank Cole’s experience is more typical; after his death, the American Mathematical Society named a prize in his honor in 1928, but don’t look for any breathless announcements about the yearly winner on your local newscast. (That important honor is reserved for the up-to-the-minute details...

    • 5. The Gamow-Stern Elevator Puzzle
      (pp. 45-47)

      Elevators are a wonderful source of fascinating probabilistic questions. They are easy to understand—elevators, after all, even though they are built to go straight up (with the exception of the fascinating elevators in the Luxor casino and hotel in Las Vegas)—aren’t rocket science, and yet they present numerous situations in which the analyses are subtle and the results often nonintuitive. One such question that I knew would be in this book the moment I laid eyes on it is due to the mathematician Marvin Stern (1935–1974) and the physicist George Gamow (1904–1968). The problem originally appeared...

    • 6. Steve’s Elevator Problem
      (pp. 48-50)

      In March 2004 I received the following e-mail from a California reader of my first probability book,Duelling Idiots. That reader, Mr. Steve Saiz, wrote to ask for some help with an elevator problem different from the one in the last problem:

      Every day I ride up to the 15th floor in an elevator. This elevator only goes to floors G, 2, 8, 9, 10, 11, 12, 13, 14, 15, 16, and 17. On average, I noticed that I usually make 2 or 3 stops when going from the ground floor, G, to 15, but it really depends on the...

    • 7. The Pipe Smoker’s Discovery
      (pp. 51-52)

      On one of the bookshelves next to my desk I have an old, well-thumbed 1970s textbook on computer programming which has, as one of its homework problems, the following interesting assignment:

      A pipe smoker has two booklets of matches in his pocket, each containing 40 matches initially. Whenever a match is required he picks one of the booklets at random, removing one match. Write a program using random numbers to simulate the situation 100 times and determine the average number of matches that can be removed until one booklet is completely empty.

      I recall that the authors’ answer at the...

    • 8. A Toilet Paper Dilemma
      (pp. 53-58)

      Up to now all the problems in this book have been studied with the aid of Monte Carlo simulations run on a computer. Not all probability problems that a computer is useful on use the Monte Carlo approach, however, and this problem is an example of that. A quarter-century ago Donald Knuth (look back at the Gamow-Stern elevator problem) published a paper in theAmerican Mathematical Monthlythat has achieved minor cult status among mathematicians and computer scientists. It analyzed a problem suggested to him by the architect of a new computer science building at Stanford University, and the paper¹...

    • 9. The Forgetful Burglar Problem
      (pp. 59-60)

      Imagine an old-time medicine-man show, wandering from town to town, selling narcotic-laced bottles of “Doctor Good’’ to the local hicks. Imagine further that the star of the show indulges in his own product just a bit too much for his own good, and so can’t remember where he has already been in his travels. If he should put his tent up in a previously visited town, there may be a painful penalty extracted by enraged former customers who have since discovered the inability of narcotics to cure poor eyesight, arthritis, and thinning hair. A similar concern exists for a burglar...

    • 10. The Umbrella Quandary
      (pp. 61-62)

      Imagine a man who walks every day between his home and his office. Because of the ever-present threat of rain, he likes to keep an umbrella at each location; that way, so goes his reasoning, if it is raining when he is about to leave one location to walk to the other, he won’t get wet. The only flaw in his grand plan is that if it isn’t raining he invariably neglects to take an umbrella with him. If you think about this for about five seconds, you should see that this can easily result in one location eventually having...

    • 11. The Case of the Missing Senators
      (pp. 63-64)

      Imagine that the U.S. Senate is about to vote on an important bill. It is known that there are more for votes than there are against votes, and so if all 100 senators show up, then the bill will pass. Let’s suppose there areAsenators who are against the bill, and thus there are 100 −Asenators who are for it, whereA< 50. IfA= 49, for example, it will be a close 51 to 49 vote to pass the bill—if all the senators vote (and they don’t always do!). Suppose, in fact, thatM...

    • 12. How Many Runners in a Marathon?
      (pp. 65-68)

      In any war, it is always of value to one side to have good intelligence on the weapons resources of the other side.¹ During the Second World War, for example, Allied military planners eagerly searched for ways to accurately estimate the Axis production of tanks, aircraft, and numerous other weapons platforms. In the specific case of German tanks, a very clever way to do that was based on using either the stamped serial numbers or the gearbox markings on captured Mark I or Mark V tanks, respectively.² As a modern writer (my source for the above quotation) explained, however, this...

    • 13. A Police Patrol Problem
      (pp. 69-73)

      Imagine a long, straight stretch of high-speed, two-lane road that is routinely monitored by the state police for accidents.¹ There are many different ways that we can imagine how this monitoring could be implemented. For example:

      (a) A police patrol car sits on a side of the road at the midpoint of the road, waiting for a radio call request for aid at the scene of an accident;

      (b) A police patrol car continuously travels up and down from one end of the road to the other end and back again, listening for a radio request for aid;

      (c) Two...

    • 14. Parrondo’s Paradox
      (pp. 74-76)

      Here’s another gambling problem based on coin flipping. While Problem 4 dated from 1941, this one is of much more recent vintage and is at least as challenging. It is, in fact, downright mystifying! Imagine that we have two games, calledAandB, both based on flipping coins. GameAis quite easy to understand: you flip a so-called biased coin, i.e., a coin with unequal probabilities of showing heads and tails. Let’s say that if the coin shows heads (with probability 1/2 – ϵ, ϵ > 0), you win one dollar, otherwise you lose one dollar. It takes no...

    • 15. How Long Is the Wait to Get the Potato Salad?
      (pp. 77-80)

      Probability theory has been a branch of mathematics for several hundred years, but new subspecialities are added on a fairly regular basis. About a hundred years ago the still active field ofqueueing theorywas founded, which is the mathematical study of waiting. We all know what it is to have to wait for just about any sort of service, and examples of waiting are nearly endless. You have to wait, for example, or at least have to expect the possibility of waiting when you go into a haircutting salon, when you approach a checkout station at a grocery store,...

    • 16. The Appeals Court Paradox
      (pp. 81-82)

      Imagine a criminal appeals court consisting of five judges; let’s call themA, B, C, D, andE. The judges meet regularly to vote (independently, of course) on the fate of prisoners who have petitioned for a review of their convictions. The result of each of the court’s deliberations is determined by a simple majority; for a petitioner to be granted or denied a new trial requires three or more votes. Based on long-term record keeping, it is known thatAvotes correctly 95% of the time; i.e., whenAvotes to either uphold or to reverse the original conviction,...

    • 17. Waiting for Buses
      (pp. 83-84)

      Here’s another sort of waiting problem, one that big-city dwellers probably face all the time. Imagine that you’ve just moved to a large city, and a friendly neighbor has told you about the local public transportation system. There are two independently operated bus lines, both of which stop in front of your apartment building. One stops every hour, on the hour. The other also stops once an hour, but not on the hour. That is, the first bus line arrives at …, 6 a.m., 7 a.m., 8 a.m., etc., and the second bus line arrives at …, (6 + x)...

    • 18. Waiting for Stoplights
      (pp. 85-86)

      This waiting problem first appeared in the early 1980s. With reference to Figure P18.1, imagine a pedestrian starting out on a shopping trip in the Big City,mblocks east andnblocks north of her ultimate destination at (1, 1). That is, she starts at (m+ 1,n+ 1). (In the figure,m=n= 2, and she starts from (3, 3)). She slowly works her way down the streets, shopping and window gazing, letting the traffic lights at each intersection control which way she’ll go next. In other words, as she reaches each intersection she...

    • 19. Electing Emperors and Popes
      (pp. 87-90)

      Imagine there is a group ofNpeople who wish to elect one of themselves as leader of the group. Each member of the group casts a vote, in a sequence of secret ballots, until one of them receives at leastMvotes. Two historically interesting examples of this situation are the so-called Imperial Election problem¹ (N= 7 andM= 4, i.e., a simple majority is required to win) and the election of the pope (Nis the membership of the College of Cardinals andMis the first integer equal to or greater than two-thirds ofN)....

    • 20. An Optimal Stopping Problem
      (pp. 91-95)

      A good example of the above assertion is the cruise missile. A cruise missile is powered by a lightweight, inexpensive jet engine that, by its very nature, has a life expectancy after launch measured in a very small number of hours at most. The whole point of a cruise missile, after all, is to successfully vanish in a stupendous fireball once it arrives on target, and so why use a reliable, long-life, expensive engine? “Good enough” is all you need. When it comes to affairs of the heart, however, our practical engineering dictum loses all its force. When looking for...

    • 21. Chain Reactions, Branching Processes, and Baby Boys
      (pp. 96-100)

      Initially I toyed with the idea of making the previous problem (with its suggestive title) the last problem in the book. But with this problem we’ll end with what comes after (usually) all the dating—babies! But before I formulate the central problem to be posed here, let me start by discussing what might seem to be a totally off-the-wall and unrelated topic—atomic bombs! You’ll soon see the connection.

      One can’t read newspapers or watch television and not be aware that the worldwide fear of nuclear weapons is as strong today as it was in the 1950s, at the...

  5. MATLAB Solutions To The Problems
    • 1. The Clumsy Dishwasher Problem
      (pp. 103-104)

      We can calculate the theoretical probability as follows. There are$4\left( {\begin{array}{*{20}{c}} 5 \\ 4 \\ \end{array} } \right) + \left( {\begin{array}{*{20}{c}} 5 \\ 5 \\ \end{array} } \right)$ways to assign any four, or all five, of the broken dishes to “clumsy.’’ The factor of 4 in the term$4\left( {\begin{array}{*{20}{c}} 5 \\ 4 \\ \end{array} } \right)$is there because, after we have “clumsy’’ breaking four dishes, the remaining fifth broken dish can be assigned to any of the other four dishwashers. There are a total of 5⁵ different ways to assign the broken dishes among all five dishwashers. So, the answer to the question of the probability of “clumsy’’ breaking at least four of the five broken dishesat randomis

      \[\frac{{4\left( {\begin{array}{*{20}{c}} 5 \\ 4 \\ \end{array} } \right) + \left( {\begin{array}{*{20}{c}} 5 \\ 5 \\ \end{array} } \right)}}{{{5^5}}} = \frac{{20 + 1}}{{3,125}} = \frac{{21}}{{3,125}} = 0.00672.\]


    • 2. Will Lil and Bill Meet at the Malt Shop?
      (pp. 105-108)

      Let’s denote the arrival times of Lil and Bill byLandB, respectively, whereLandBare taken as independent and uniformly distributed random variables over the interval 0 to 30 (0 means arriving at 3:30 and 30 means arriving at 4 o’clock). Obviously, ifL<B, then Lil arrives first, and otherwise (L>B) Bill arrives first. So, we can now immediately write

      ifL<B, then Lil and Bill will meetifBL< 5


      ifL>Bthen Lil and Bill will meetifLB< 7.

      Figure S2.1 shows the geometric interpretation of these two inequalities. The 30 × 30...

    • 3. A Parallel Parking Question
      (pp. 109-113)

      This problem originally appeared in 1978, as a challenge question. As stated then,¹

      Four birds land at random positions on a finite length of wire. Upon landing, each bird looks at its nearest neighbor.

      What is the probability that a bird picked at random is looking at another bird that is looking at it?

      What is the probability if there arenbirds, withn> 4?

      The solution appeared the next year.² (I have converted the birds into cars and the wire into a car lot to, I hope, make the problem more “relevant’’.)

      A Monte Carlo simulation for problem...

    • 4. A Curious Coin-Flipping Game
      (pp. 114-119)

      The code broke.m simulates this problem. But first, before getting into its details, let me give you the theoretical answer¹ for the fair coins case. It is amazingly simple: the average number of tosses until one of the men is ruined is$\frac{{4lmn}}{{3(l + m + n - 2)}}$. So, ifl=m=n= 1, the answer is$\frac{{4(1)(1)(1)}}{{3(1 + 1 + 1 - 2)}} = \frac{4}{3}$as given in the problem statement. And forl= 1,m= 2, andn= 3, the answer is$\frac{{4(1)(2)(3)}}{{3(1 + 2 + 3 - 2)}} = \frac{{24}}{{12}} = 2$. Ifl= 2,m= 3, andn= 4, the answer is$\frac{{4(2)(3)(4)}}{{3(2 + 3 + 4 - 2)}} = \frac{{32}}{7} = 4.5714$; ifl=m...

    • 5. The Gamow-Stern Elevator Puzzle
      (pp. 120-123)

      Rather than simulate the two-elevator and the three-elevator problems separately, the code gs.m simulates the generaln-elevator problem for any integern≥ 1. We imagine that the height of the building is scaled so that floor 1 (the bottom stop of an elevator) is at height 0 and floor 7 (the highest stop of an elevator) is at height 1. Thus, Gamow’s elevator stop on the second floor is at height$G = \frac{1}{6}$. We further imagine, as described by Knuth, that all the elevators are, independently, at the moment that Gamow requests elevator service, at random heights, as well...

    • 6. Steve’s Elevator Problem
      (pp. 124-128)

      For thek= 2 analysis (the riders at floorGare Steve and two others), we can write

      there is one stop for Steve if

      a. both of the other riders get off on Steve’s floor (probability =$\frac{1}{{n^2 }}$), or

      b. one of the other riders (either one) gets off on Steve’s floor and the other gets off on a floor above Steve’s (probability =$2 \times \frac{1}{n} \times \frac{2}{n} = \frac{4}{{n^2 }}$), or

      c. both of the other riders get off on a floor above Steve’s (probability =$\frac{2} {n} \times \frac{2}{n} = \frac{4}{{n^2 }}$);

      there are two stops for Steve if

      a. one of the other riders...

    • 7. The Pipe Smoker’s Discovery
      (pp. 129-139)

      The code smoker.m simulates the problem one million times, as controlled by the for/end loop defined by lines 03 and 16. Before beginning those simulations, however, line 01 initializes the variable S to zero, where the value of S will, at the completion of each simulation, be the current total number of matches used (and so, when the program completes the last of the one million simulations, S/1000000, as computed in line 17, will be the answer to the original question, i.e., the average number of matches removed until one booklet is empty). Also, line 02 initially sets all eighty...

    • 8. A Toilet Paper Dilemma
      (pp. 140-143)

      The code rolls.m uses Knuth’s recurrence formulas to directly calculate and plotM₂₀₀(p). This program can be most easily understood by referring to Figure S8.1, which again shows the underlying lattice point structure of the problem. The one complication MATLAB itself, as a programming language, introduces is that it does not allow zero indexing of arrays. If your favorite language does, then rolls.m will still work, but you could, if you wanted, actually rewrite the program with fewer commands. As you can see, however, rolls.m is pretty short anyway.

      Line 01 starts things off by defining M to be a...

    • 9. The Forgetful Burglar Problem
      (pp. 144-147)

      The code of fb.m simulates ten million paths of the burglar, with each path continuing until a previously visited house is revisited. Line 01 defines the row vector duration as having fifty elements, where duration(k) is the number of paths with lengthksteps (each step is a move of length 1 or 2). Lines 02 and 19 define the for/end loop that cycle fb.m through its ten million simulations. Each simulation will continue as long as the variable go is equal to 1, to which it is initially set in line 03. Line 04 initializes the row vector whereyouvebeen...

    • 10. The Umbrella Quandary
      (pp. 148-152)

      The code umbrella.m performs 10,000 simulations of the man’s walks for each of the ninety nine values of rain probability, from 0.01 to 0.99, in steps of 0.01. That is, it performs a total of 990,000 simulated walks. We don’t have to simulate forp= 0 (it never rains) because, obviously, in that case the man never gets wet; i.e., the answer forp= 0 is that he’ll walk an infinite number of times before his first soaking. That’s the answer forp= 1, too (it always rains), but for a far different reason. Forp=...

    • 11. The Case of the Missing Senators
      (pp. 153-156)

      The code missing.m simulates the problem of the absentee senators. Lines 01 and 02 are by now obvious to you. Line 03 initializes the variable defeats to zero; the value of this variable, at the end of the program execution, will be how many times the bill was defeated during one million simulated votes. Lines 04 and 26 define the for/end loop that cycles the code through its one million simulations. Line 05 defines the 100-element row vector votes; votes(k) is the vote during an individual simulation of thekth senator (if that senator actually does vote), where −1 is...

    • 12. How Many Runners in a Marathon?
      (pp. 157-160)

      The code estimate.m simulates this problem. It is probably the most MATLABy of all the codes in this book, with its use of several specialized (but all quite easy to understand), highly useful vector commands. All of these commands could be coded in detail—as I did in Problem 3 with the bubble-sort algorithm, rather than just using MATLAB’s sort command—but that would be tedious. If your favorite language doesn’t have similar commands, I’ll let the tedium be yours! And in estimate.m, since the code is so MATLABy anyway, I’ve made an exception to my earlier decisions not to...

    • 13. A Police Patrol Problem
      (pp. 161-168)

      Figure S13.1 shows a logical flow diagram of the simulation of this problem, and the code patrol.m follows the flow diagram faithfully. The code assumes that all of the patrol cars are randomly patrolling the road; for scenario (a), that of a single patrol car sitting aty= 1/2, only a simple extra line of code is required, which I’ll tell you about in just a bit. To make the code crystal clear, the following comments will almost certainly be helpful. The variables totalgrassdistance and totalconcretedistance are the total travel distances accumulated (in one million simulations) for the two...

    • 14. Parrondo’s Paradox
      (pp. 169-174)

      The code gameb.m simulates gameB. The logic is pretty straightforward, but in a few places the code does take elementary advantage of MATLAB’s vector capabilities. After line 01 establishes the value of ϵ, line 02 creates the row vector Mtotal of length 100, with all of its elements initially equal to zero. Mtotal(k) will be, when gameb.m ends, the total capital of all 10,000 sequences at the end ofkgames, 1 ≤k≤ 100. (Line 26 divides Mtotal by 10,000 at the completion of gameb.m to finish the calculation of the ensemble average.) Line 03 controls the...

    • 15. How Long Is the Wait to Get the Potato Salad?
      (pp. 175-183)

      To simulate the operation of the deli counter, the sequence of decisions that the clerk(s) go through, at each moment of time, is as follows, where, to simulate the flow of time, the code deli.m defines the variable clock whose value at the opening of the deli counter is zero and is 36,000 at closing; i.e., clock advances the code through simulated time in one-second increments:

      (a) continue the service of the customer(s) presently being processed;


      (b) if there is a/are clerk/s available and the queue is not empty, start the service of the person at the front of...

    • 16. The Appeals Court Paradox
      (pp. 184-186)

      The code jury.m simulates our five-judge appeals court. Line 01 sets the value ofp(k)equal to the probability thekth judge makes a correct decision, whereAis judge 1,Bis judge 2, and so on. Line 02 sets the variable mistakes equal to zero; at the end of ten million simulated deliberations its value will be the number of incorrect court decisions. Lines 03 and 16 define the for/end loop that executes the ten million deliberations. At the start of each deliberation line 04 sets the variable majority to zero; majority will be set equal to one...

    • 17. Waiting for Buses
      (pp. 187-190)

      Our randomly arriving bus rider must obviously arrive at the bus stop between some two consecutive hours, and we lose no generality by labeling those two hours as hour 0 and hour 1. The given theoretical value of one-half hour for the average waiting time until a bus arrives, in then= 1 case, immediately follows from the observation that the possible waiting times vary from 0 to 1 (hour), and the average of such a random quantity (with a uniform distribution) is 1/2. We can compute the theoretical value for then= 2 case with only slightly...

    • 18. Waiting for Stoplights
      (pp. 191-196)

      The code walk.m simulates our pedestrian’s walk from (m+ 1,m+ 1) to (1,1) a hundred thousand times, for any given value ofm. Lines 01 and 02 respectively bring in the value ofmto be used and initialize the variable totalwait to zero. When the program terminates, totalwait will be the total number of red lights encountered in 100,000 simulated walks from (m+ 1,m+ 1) to (1,1). Lines 03 and 26 define the for/end loop that simulates a single one of those walks. At the start of a walk, lines 04 and 05...

    • 19. Electing Emperors and Popes
      (pp. 197-203)

      The code election.m gives us estimates for the election probability of a leader for a group withNmembers, of whomnNare the dark horse candidates who receive among themselves allNnotes, with at leastMvotes required for election. The operation of the code hinges on the row vector result, of lengthn; if we number thendark horse candidates from 1 ton, then the value of result(j) will be the number of votes received by candidatej. To start, lines 01 through 05 define the basic variables of N, n, and M,...

    • 20. An Optimal Stopping Problem
      (pp. 204-212)

      The central idea of this problem has been around in the mathematical world since 1875, when the English mathematician Arthur Cayley (1821–1895) proposed something similar in the form of a lottery problem.¹ That problem does not follow the exact same rules that we have in our dating game problem, and so at least one writer has concluded Cayley’s problem doesn’t count as a historical precedent, but I don’t agree. You can make up your own mind.² It is generally agreed, however, that our problem became widely known in 1960 only after it appeared in Martin Gardner’s famous “Mathematical Games”...

    • 21. Chain Reactions, Branching Processes, and Baby Boys
      (pp. 213-220)

      Before getting to the writing of a simulation code to estimate the answers to the questions posed in the original problem statement, let me show you a beautiful theoretical solution. I’ll then use this solution to validate the code. If we have {pi} as the sequence of probabilities that a man will haveisons,i≥ 1 , then define the so-calledgenerating functionof this sequence to be

      \[f(x) = {p_0} + {p_1}x + {p_2}{x^2} + {p_3}{x^3} + \cdots \]

      where there is no physical significance tox. What Hawkins and Ulam showed¹ is that if we calculate the iterated functions$f_n (x) = f\{f_{n - 1} (x)\} $, where$f_1 (x) = f(x) $, then the probability...

  6. Appendix 1. One Way to Guess on a Test
    (pp. 221-222)
  7. Appendix 2. An Example of Variance Reduction in the Monte Carlo Method
    (pp. 223-228)
  8. Appendix 3. Random Harmonic Series
    (pp. 229-230)
  9. Appendix 4. Solving Montmort’s Problem by Recursion
    (pp. 231-236)
  10. Appendix 5. An Illustration of the Inclusion-Exclusion Principle
    (pp. 237-243)
  11. Appendix 6. Solutions to the Spin Game
    (pp. 244-247)
  12. Appendix 7. How to Simulate Kelvin’s Fair Coin with a Biased Coin
    (pp. 248-251)
  13. Appendix 8. How to Simulate an Exponential Random Variable
    (pp. 252-254)
  14. Appendix 9. Author-Created MATLAB m-files and Their Location in the Book
    (pp. 255-256)
  15. Glossary
    (pp. 257-258)
  16. Acknowledgments
    (pp. 259-260)
    Paul J. Nahin
  17. Index
    (pp. 261-264)
  18. Also by Paul J. Nahin
    (pp. 265-265)