### Multiple coin toss

Introduction

If you toss 100 fair coins at once, how many do you expect to be heads? How much variation would you expect? This program implements a Monte Carlo simulation of the statistical properties of the outcome of tosses of many coins. The probability that an individual coin is heads is p.

Algorithm

For each coin we generate a random number r uniformly in the interval [0, 1]. A coin is heads if r ≤ p. We simulate the toss of many coins and plot a histogram of the number of heads found for N tosses and compute the average number of heads and the standard deviation.

Questions

1. Run the simulation for p = 1/2 and N = 10, 100, and 1000 coins. Describe the qualitative dependence of the histogram on the number of coins.
2. Estimate the width of the histogram. Make a plot of the estimated width versus N. Compare your estimated values to the standard deviation σ, where σ is given by σ2 = <H2> - <H>2. What is the functional form of this dependence? How do the relative fluctuations σ/<H> depend on N? (The quantity <H> is the mean number of heads in one toss.)
3. Change the probability of obtaining heads in a single toss to p = 0.8. How does the shape of the histogram change?

Java Classes

• MultipleCoinTossApp

Updated 28 December 2009.