# Coin Tossing Simulation

At first, this page can be used to simulate the experiment in the text on page 288. A coin is tossed 10 times. What is the Likelihood that there will be be three heads or three tails in a row? We can use random digits to simulate many repitions of tossing a coin ten times, and the proportion of times that this occurs will eventually approach the true likelihood.

How many tosses to a trial?

How many times to run the experiment?

# Questions and Challenges

1. First run the simulation with 10 tosses, 25 times, like on page 288-289, where the book used the random digits. The book found 3 or more heads 23/25 times (92%); How does your result compare? Try this several times.

2. The theoretical probability is about 82.6 %. See how many trials you need to get near this result. What is a good number of trials to get near this result?

3. The computer seems slow to calculate these results because it is printing so much information to the scrolling window. You can hide raw results by saving a copy of this web page on your computer and making changes to it.

Once you have your own version of this web page, have the same file open both in Notepad and in your browser (at the same time). Edit the file in Notepad by adding a "//" in front of the line that that looks like

document.sim.results.value += trial+" -- "+cnt+" in a row\n"

Reload (Refresh) the page in the browser, and try the simulation again. It doesn't print as much and it should take less time to run the simulation. How many trials are needed to get a number like 82.6% ?

4. Now try to manipulate the simulation so you are rolling dice. Instead of 0 and 1's, change the simulation so it generates 1 through 6's. You may want to undo the changes you made the previous question. Rolling a die 10 times, what is the probabilty of getting three or more of the same number consecutively?

5. Now try to change the program so that it computes getting 4 coin tosses in a row. What is the probability of this happening in 15 tosses of a fair coin?

6. Now change the program so that you can to estimate the probability of dealing out 52 cards (ordinary fair poker deck) and getting 5 of the same suit in a row.