EXAMPLE 1 Doing a simulation

Toss a coin 10 times. What is the probability of a run of at least three consecutive heads or three consecutive tails?

Step 1. Give a probability model. Our model for coin tossing has two parts:

  • Each toss has probabilities 0.5 for a head and 0.5 for a tail.

  • Tosses are independent of each other. That is, knowing the outcome of one toss does not change the probabilities for the outcomes of any other toss.

Step 2. Assign digits to represent outcomes. Digits in Table A of random digits will stand for the outcomes, in a way that matches the probabilities from Step 1. We know that each digit in Table A has probability 0.1 of being any one of 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9 and that successive digits in the table are independent. Here is one assignment of digits for coin tossing:

  • One digit simulates one toss of the coin.

  • Odd digits represent heads; even digits represent tails.

image Really random digits For purists, the RAND Corporation long ago published a book titled One Million Random Digits. The book lists 1,000,000 digits that were produced by a very elaborate physical randomization and really are random. An employee of RAND once told one of us that this is not the most boring book that RAND has ever published . . .

This works because the five odd digits give probability 5/10 to heads (but any other assignment where half the digits represent heads is equally good). Successive digits in the table simulate independent tosses.

Step 3. Simulate many repetitions. Ten digits simulate 10 tosses, so looking at 10 consecutive digits in Table A simulates one repetition. Read many groups of 10 digits from the table to simulate many repetitions. Be sure to keep track of whether or not the event we want (a run of three heads or three tails) occurs on each repetition.

448

Here are the first three repetitions, starting at line 101 in Table A. We have underlined all runs of three or more heads or tails.

Repetition 1 Repetition 2 Repetition 3
Digits 1 9 2 2 3 9 5 0 3 4 0 5 7 5 6 2 8 7 1 3 9 6 4 0 9 1 2 5 3 1
Heads/tails H H T T H H H T H T T H H H T T T H H H H T T T H H T H H H
Run of 3? YES YES YES

Continuing in Table A, we did 25 repetitions; 23 of them did have a run of three or more heads or tails. So we estimate the probability of a run by the proportion

estimated probability

Of course, 25 repetitions are not enough to be confident that our estimate is accurate. Now that we understand how to do the simulation, we can tell a computer to do many thousands of repetitions. A long simulation (or hard mathematics) finds that the true probability is about 0.826. Most people think runs are somewhat unlikely, so even our short simulation challenges our intuition by showing that runs of three occur most of the time in 10 tosses.