Question 20.27

20.27 A common expected value. Here is a common setting that we simulated in Chapter 19: there are a fixed number of independent trials with the same two outcomes and the same probabilities on each trial. Tossing a coin, shooting basketball free throws, and observing the sex of newborn babies are all examples of this setting. Call the outcomes “hit” and “miss.” We can see what the expected number of hits should be. If Stephen Curry shoots 12 three-point shots and has probability 0.44 of making each one, the expected number of hits is 44% of 12, or 5.28. By the same reasoning, if we have n trials with probability p of a hit on each trial, the expected number of hits is np. This fact can be proved mathematically. Can we verify it by simulation?

Simulate 10 tosses of a fair coin 50 times. (To do this quickly, use the first 10 digits in each of the 50 rows of Table A, with odd digits meaning a head and even digits a tail.) What is the expected number of heads by the np formula? What is the mean number of heads in your 50 repetitions?