2.3 - Estimating Probabilities Using Simulation
Overview
Probability describes how often things happen by chance. This topic starts with the vocabulary (random process, outcome, event), then defines the probability of an event as its long-run relative frequency. When a probability is hard to calculate directly, you can estimate it with a simulation: imitate the random process many times and count how often the event happens. The law of large numbers explains why that works.
Random processes, outcomes, and events
- A random process generates results that are determined by chance. Flipping a coin, rolling a die, picking a student at random, and a basketball player shooting a free throw are all random processes.
- An outcome is the result of one trial of a random process. Roll a die once and get a 4: the outcome is 4.
- An event is a collection of outcomes. "Roll an even number" is the event made of the outcomes 2, 4, and 6. The event happens if the trial's outcome is any one of them.
Random process | One possible outcome | An event |
Roll a six-sided die | 5 | Roll a number greater than 4: {5, 6} |
Flip a coin 3 times | HTH | Get exactly 2 heads: {HHT, HTH, THH} |
Shoot 5 free throws | make, make, miss, make, miss | Make at least 4 of the 5 |
A single outcome of a random process can't be predicted. What makes probability possible is that random processes show a regular pattern over many repetitions.
Probability as a long-run relative frequency
The probability of an outcome or event is its relative frequency over a very large number of trials, its long-run relative frequency:
Saying a fair coin has a 0.5 probability of heads means that in a very long series of flips, about half are heads. It does not mean that 2 flips always give exactly 1 head, or that 10 flips give exactly 5.
The law of large numbers
The law of large numbers says that 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 event's true probability. (Trials are independent when the result of one trial doesn't change the chances for any other trial.)
The graph follows one run of 1000 fair coin flips. After each flip, it plots the proportion of heads so far.

The first flip was heads, so the proportion started at 1. After 5 flips it was 0.2 (1 head) and after 10 flips it was 0.4 (4 heads). Early on, a single flip moves the proportion a lot. After 1000 flips there were 491 heads, a proportion of 0.491, and the line hugs 0.5.
What the law of large numbers does not say: it does not say short-run results even out. After five tails in a row, the coin is not "due" for heads. The next flip still has a 0.5 chance of heads. The proportion settles down because an early streak gets swamped by hundreds of later flips, not because the coin corrects itself.
Estimating probabilities from data
The relative frequency of an event in real data (empirical data) can be used to estimate its true probability. For example, if an airline's records show that 4128 of its last 5000 flights out of one airport arrived on time, then
We estimate about an 82.6% chance that a flight from that airport arrives on time. By the law of large numbers, an estimate based on many flights is more trustworthy than one based on a few, as long as conditions stay about the same.
Simulation
A simulation models a random process so that the simulated outcomes closely match real-world outcomes. You assign values to all the possible outcomes so that a chance device picks them with the right probabilities, run many trials, and record the count of each simulated outcome along with the total number of trials. AP questions usually want three steps:
- Describe how to model one trial. Name the chance device (a random number generator, a table of random digits, cards, a spinner). Say which values stand for which outcomes, so the probabilities match the real situation. Say what one trial is and what you record.
- Carry out many trials. Repeat the trial many times (often 100 or more) and record the result of each.
- Estimate the probability. Divide the number of trials where the event happened by the total number of trials, and state the answer in context.
Assigning values
- Probabilities in tenths: use single digits 0 to 9. For 70%, let 0 to 6 be a success (7 digits) and 7 to 9 a failure (3 digits).
- Probabilities in hundredths: use pairs of digits 00 to 99. For 23%, let 01 to 23 be a success and 24 to 99 and 00 be a failure.
- Unused values: for three equally likely outcomes, let 1 to 3, 4 to 6, and 7 to 9 stand for them and skip 0.
- Repeats: allow repeated values when trials are independent (like free throws). Skip repeats when you're choosing different people or objects without replacement.
On a TI-84:
randInt(lower, upper, n) (MATH, then PRB, or PROB on newer models) gives random integers from lower to upper. For example, randInt(0, 9, 5) gives five random digits.Example 1: Free throws
A basketball player makes 70% of her free throws, and her shots are independent. In a game she shoots 5 free throws. Use a simulation to estimate the probability that she makes at least 4 of them.
Step 1: Model one trial. Each digit 0 to 9 is equally likely. Let 0 to 6 be a make (7 out of 10 digits, so a 0.7 chance) and 7 to 9 a miss. One trial is 5 digits, one per free throw. Record the number of makes and whether it's at least 4.
Step 2: Carry out trials. Here is a line of random digits, split into groups of 5:
45790 18923 84282 46500 87858Trial | Digits | Makes (0 to 6) | At least 4? |
1 | 4 5 7 9 0 | 3 | No |
2 | 1 8 9 2 3 | 3 | No |
3 | 8 4 2 8 2 | 3 | No |
4 | 4 6 5 0 0 | 5 | Yes |
5 | 8 7 8 5 8 | 1 | No |
Five trials are far too few to estimate anything. A computer continued the same way for a total of 200 trials, and 107 of them had at least 4 makes.
Step 3: Estimate the probability.
We estimate about a 0.535 probability that the player makes at least 4 of her 5 free throws. With the binomial distribution in Topic 2.10, you can calculate the exact value, 0.528, and the simulation came close. More trials would make the estimate even more reliable.
Example 2: Guessing on a quiz (AP-style)
A quiz has 10 multiple-choice questions, each with 4 answer choices and only one correct choice. A student who didn't study guesses on every question.
(a) Describe how to use a random number generator to simulate one student's score.
Use
randInt(1, 4, 10) to generate 10 random integers from 1 to 4, one for each question. Let 1 stand for a correct answer (a 1 in 4 chance) and 2, 3, and 4 stand for wrong answers. The number of 1s is one simulated score. Repeat this many times, recording each score.(b) The dotplot shows the scores of 100 simulated guessing students. Use it to estimate the probability that a student who guesses on every question gets at least 5 correct.

Count the dots at 5 or more: 5 dots at 5, 2 dots at 6, and none higher, for 7 dots.
We estimate about a 0.07 probability that a student who guesses on all 10 questions gets at least 5 correct. (The dots center around 2 or 3 correct, which makes sense, since one fourth of 10 questions is 2.5.)
(c) Ana got 7 correct. Based on the simulation, is it believable that she guessed on every question? Explain.
None of the 100 simulated guessers got 7 or more correct, so the estimated probability of scoring 7 or higher by guessing alone is close to 0. A score of 7 would be very unusual for a student who is only guessing, so the simulation gives convincing evidence that Ana knew at least some of the answers. ("Very unlikely" is not "impossible": the exact probability is about 0.0035.)
Common mistakes
- Assigning values that don't match the probability. Using 0 to 7 for a 70% chance gives 8 out of 10 digits, which is 80%.
- Leaving out parts of the simulation description. Name the device, what each value stands for, what one trial is, and what you count.
- Running too few trials, then treating the estimate as exact.
- Believing in the "law of averages." A coin is never "due" for heads. The law of large numbers is about the long run, not the next trial.
- Mixing up repeats: allow repeated values for independent trials, but skip them when choosing different people without replacement.
- Giving a number with no context. Say what the probability is the probability of.