Unit 2 · Topic 2.3 · about 20 minutes

Estimating Probabilities Using Simulation

Design and carry out a simulation of a chance process, then use the relative frequency of an event to estimate its probability.

Predict first

A cereal brand puts one of 5 different toys in each box, and every box is equally likely to hold any of the five. You buy 10 boxes. How likely is it that you end up with all five toys?

The language of chance

A random process generates results that are determined by chance, like flipping a coin or opening a cereal box. One repetition of the process is a trial, and the result of one trial is an outcome. Flipping a coin once is a trial, and "heads" is an outcome. For the toys, the random process is buying 10 boxes, so one trial is opening all 10, and an outcome is the list of 10 toys you got.

An event is a collection of outcomes. "Getting all five toys in 10 boxes" is an event, and so is "getting the same toy at least three times." The probability of an event is its long-run relative frequency: the proportion of trials in which the event happens, over a very large number of trials.

Building a simulation

A simulation imitates a random process so that the simulated outcomes behave like the real ones. Then you run it many times and count. A complete simulation has four parts.

  1. Assign values to outcomes. Every possible outcome gets a value that chance will choose, with the same probability as in the real process. For the toys: the integers 1 to 5, one per toy, each equally likely.
  2. Describe one trial. Generate 10 random integers from 1 to 5, repeats allowed, one per box. Record whether all five values appear.
  3. Repeat many times. Keep the count of trials in which the event happened and the total count of trials.
  4. Estimate. The relative frequency, count divided by total, estimates the probability.
The first five simulated trials: 10 random integers from 1 to 5 in each
TrialToys in the 10 boxesAll five?
12 4 5 2 4 5 2 1 1 4No (no 3)
21 5 4 4 3 3 3 5 4 5No (no 2)
34 1 2 2 2 3 5 5 2 2Yes
44 5 2 1 4 1 5 5 3 3Yes
53 5 4 5 2 5 4 2 1 5Yes

Three successes in five trials is not an estimate worth trusting. Running 1,000 trials with technology gave all five toys in 514 of them, so the estimated probability is 5141000=0.514, close to the true value of about 0.52. Another run of 1,000 trials would give a slightly different count, and the more trials you run, the less the estimate wobbles from one run to the next.

Why the long run settles

The reason a relative frequency can stand in for a probability is the law of large numbers: for independent trials, as the number of trials increases, the relative frequency of an outcome or event gets closer and closer to a single value. That value is the probability.

The chart follows one simulated run of 500 flips of a fair coin and plots the proportion of heads so far.

Proportion of heads after each flip, one run of 500 flips

00.51Proportion of heads so far0100200300400500Number of flips

The first three flips were heads, so the proportion started at 1. After 10 flips it was still 0.9. By 100 flips it was 0.54, and after 500 flips it sat at 0.50, on the line for the true probability.

The short run is wild and the long run is steady. Anything can happen in 10 flips; once you have 500, a few more flips barely move the proportion.

The same idea lets you estimate probabilities from real data, not only from simulations. A basketball player who has made 168 of her 240 free throws this season has a relative frequency of 168240=0.70, which estimates the probability she makes her next free throw. After 240 attempts that estimate deserves far more trust than it would after 10.

Lab

Probability Simulator

Choose an event and predict its probability before you run anything. Then press Run 10, then Run 100, then Run 1,000 a few times, and watch how far the relative frequency strays from the true value as the total grows.

Open the full Probability Simulator lab

Check your understanding

1

A game uses a spinner with 8 equal sections numbered 1 to 8. Which of these is an event made up of more than one outcome?

2

A basketball player makes 72% of her free throws. To simulate one free throw, a student plans to pick a random digit from 0 to 9 and let 0 through 6 stand for a make and 7 through 9 for a miss. What is the problem with this plan?

3

A driver's route to work has 4 traffic lights. A student simulated 500 drives and recorded how many red lights the driver hit: 0 red lights in 41 drives, 1 in 137, 2 in 182, 3 in 109 and 4 in 31. Use the simulation to estimate the probability that the driver hits at most 1 red light. Give a decimal.

4

Two students estimate the probability that a thumbtack lands point up when tossed. Ana tosses it 20 times and Ben tosses it 400 times, and each computes the relative frequency of point up. Which statement is true?

5

A fair coin has landed heads on each of its last 6 flips. What is the probability that the next flip lands heads?

Course alignment, for teachers

AP Statistics topic 2.3, Unit 2: Probability, Random Variables, and Probability Distributions.

  • Skill 3.C: Calculate and estimate expected counts, percentages, probabilities, and intervals.