01 / 21

Estimating Probabilities
Using Simulation

Learn to use random processes and repeated trials to estimate probabilities when theoretical calculations are complex or impossible.

AP Statistics

What Is a Simulation?

A simulation is an imitation of a real-world random process using a model. Instead of performing the actual experiment (which may be costly, dangerous, or impossible), we use tools like random number generators, coins, dice, or cards to mimic the process many times.

Why Simulate Instead of Calculate?

★ Complex Events
Some probabilities involve too many outcomes to enumerate: "What's the chance 3 of 25 students share a birthday?"
★ No Formula Exists
Many real-world scenarios have no neat closed-form probability formula, making simulation the practical approach.
★ Verification Tool
Even when a formula exists, simulation lets you check your theoretical answer independently.

The Law of Large Numbers

The Law of Large Numbers states that as the number of trials \( n \) increases, the empirical (observed) proportion of an event converges to the event's true probability:

\(P\!=\!0.5\)
0 0.5 1.0 0 100 500 1000 2000 Number of Trials (n) Proportion Converges to true P

Key Vocabulary

Trial
A single run of the simulated experiment (e.g., one coin flip, one random number draw).
Component
The part of the model that represents one outcome of interest (e.g., one digit = one free throw).
Response Variable
What you measure in each trial (e.g., "Did the event occur? Yes/No").

Theoretical vs. Empirical Probability

Theoretical Empirical (Simulated)
Definition Based on mathematical reasoning about equally likely outcomes Based on observed results from repeated trials
Formula \(\frac{\text{favorable outcomes}}{\text{total outcomes}}\) \(\frac{\text{occurrences of event}}{n}\)
Requirements All outcomes must be equally likely and countable Only needs a repeatable random process
Accuracy Exact Approximate (improves with more trials)
Example \(P(\text{heads}) = 0.5\) for a fair coin Flip 1000 times, get 507 heads: \(\hat{p} = 0.507\)

How to Design a Simulation

1
Describe the component. Identify what one "piece" of the experiment is and how to model it with a random device (digits, coins, dice, etc.).
2
Assign outcomes. Map random values to real-world outcomes (e.g., digits 1-8 = "make the shot," digits 9, 0 = "miss").
3
Define a trial. Specify how many components make one complete trial (e.g., 5 digits = 5 free throws).
4
State the response variable. Clearly define what you record from each trial (e.g., "Did all 5 free throws go in?").
5
Run many trials and compute \(\hat{p}\). Repeat at least 30-50 trials (more is better), then calculate the proportion of successes.

Example 1: Free Throw Streaks

A basketball player makes 80% of her free throws. What is the probability she makes all 5 free throws in a game?

Trial 1: 3 7 1 5 2 ✓ All made Trial 2: 6 4 9 2 8 ✕ Miss Trial 3: 5 1 3 7 6 ✓ All made After 50 trials: 17 successes
\(\to \text{Estimated } \hat{p} \approx \frac{17}{50} = 0.34\)

Checking with Theory

Since each free throw is independent with \( P(\text{make}) = 0.80 \), the theoretical probability of making all 5 is:

Our simulation estimate of \(\hat{p} = 0.34\) is close to the theoretical value of 0.328. With more trials, the estimates would converge even closer. This validates both the simulation design and the theoretical answer.

Example 2: The Birthday Problem

In a class of 25 students, what is the probability that at least two share the same birthday? This is surprisingly hard to calculate by hand, but easy to simulate.

1
Component: One student's birthday = a random integer from 1 to 365.
2
Trial: Generate 25 random integers (one per student). Check if any repeat.
3
Response: "At least one match?" → Yes or No.
4
Repeat for 1000 trials. Count the proportion with at least one match.

Example 3: Cereal Box Collector

A cereal brand puts one of 6 different toys in each box (equally likely). How many boxes must you buy on average to collect all 6 toys?

6 Toys (equally likely) 1 2 3 4 5 6 Simulation (1000 trials): Average boxes needed ≈ 14.7 boxes

Ten cereal boxes, five collectible prizes, and one changing stopping rule

A child examines five distinct collectible designs and repeated prizes among opened cereal packages.Collecting all prize types and waiting for the first designated prize use different stopping rules. Define the response variable before generating trials.

Define completion by ten boxes

A ten-box sequence tracks cumulative distinct prize types from one to five, reaching all five at box seven.Suppose each box independently contains one of five equally likely prize types. In the sequence A, B, A, C, D, B, E, A, C, D, all five types first appear at box 7. This trial succeeds for completion by ten boxes; repeated trials estimate the event’s probability.

Repeated prizes still count as trials

Ten positions reuse five distinct prize designs, with cumulative collection size shown below each position.The ten-box sequence is A, B, A, C, D, B, E, A, C, D. New types increase the collection count; repeated types leave it unchanged. Start a fresh collection for the next trial.

Choosing a Random Device

Probability Random Device Mapping
\(P = 0.50\) Coin flip Heads = success, Tails = fail
\(P = 1/6\) Single die Roll 1 = success, 2-6 = fail
\(P = 0.80\) Digits 0-9 1-8 = success, 9, 0 = fail
\(P = 0.35\) Digits 00-99 01-35 = success, 00 & 36-99 = fail
\(P = 0.417\) Digits 000-999 001-417 = success, 000 & 418-999 = fail

How Many Trials Are Enough?

More trials yield more accurate estimates. But how many is "enough"? The margin of error for an estimated proportion decreases as:

★ 20 trials
Very rough estimate. Margin of error \(\approx 0.22\). Only for quick checks.
★ 100 trials
Reasonable for class exercises. ME \(\approx 0.10\). Good starting point.
★ 1000+ trials
Professional quality. ME \(\approx 0.03\). Use technology for this many.

Using a Random Number Table

On the AP exam, you may be given a table of random digits. Here's how to use it for a simulation where \( P = 0.70 \):

Line 101: 1 9 2 2 8 3 0 5 6 4
= Digits 1-7: Success (\(P = 0.70\))
= Digits 8, 9, 0: Failure (\(P = 0.30\))
This trial: 7 successes out of 10 \(\to\) proportion = 0.70

Common Mistakes to Avoid

✕ Too Few Trials
Running only 5-10 trials and treating the result as reliable. Use at least 30 trials, preferably 100+.
✕ Wrong Digit Mapping
Assigning digits 1-8 for \( P = 0.75 \). Digits 1-8 represents \( P = 0.80 \), not \( 0.75 \). Match the digits to the probability exactly.
✕ Ignoring Independence
Using simulation with replacement when the real scenario is without replacement (e.g., drawing cards from a deck).
✕ Confusing Trial and Component
A "trial" is the full experiment (e.g., 5 free throws). A "component" is one part (e.g., 1 free throw). Don't mix them up.
✕ Claiming Exact Probability
Saying "the probability IS 0.34" instead of "the estimated probability is approximately 0.34." Simulations give estimates, not exact values.

Summary of Simulation Steps

Step Action Example (Free Throws)
1. Component Identify one random element One free throw attempt
2. Assign Map outcomes to random device Digits 1-8 = make, 9,0 = miss
3. Trial Define one full experiment 5 consecutive digits
4. Response What to record Did all 5 digits fall in 1-8?
5. Repeat Run many trials 50+ trials, compute \(\hat{p}\)

Question 1 of 5

A simulation of 200 trials is used to estimate a probability. In 68 of those trials, the event occurred. What is the estimated probability of the event?

Question 2 of 5

A player makes 60% of her penalty kicks. To simulate this, you use single random digits 0-9. Which assignment is correct?

Question 3 of 5

Why does a simulation with 1000 trials generally give a better estimate than one with 50 trials?

Question 4 of 5

To estimate the probability that a couple with 3 children has all boys (assuming \(P(\text{boy}) = 0.5\)), what constitutes one trial in the simulation?

Question 5 of 5

A student runs a simulation and gets \(\hat{p} = 0.42\) based on 500 trials. Using the approximation \(\text{ME} \approx \frac{1}{\sqrt{n}}\), the margin of error is approximately: