Mathwords logoMathwords

Simulation — Definition & Example

Simulation is a way to estimate a probability by imitating a random process many times, using dice, coins, random digits, or a computer instead of the real thing. You count how often the event happens and use that relative frequency as your estimate. Outside probability class, simulation also means any computer or physical model that imitates a real system, such as a flight simulator or a weather model; this page covers the probability method.

A simulation is a model of a chance process in which each real outcome is assigned to outcomes of a random mechanism with the same probability distribution. Independent repetitions of the model (trials) produce a relative frequency of the event of interest. By the law of large numbers, this relative frequency converges to the true probability as the number of trials grows.

Key Formula

P^(A)=kn\hat{P}(A) = \frac{k}{n}
Where:
  • P^(A)\hat{P}(A) = estimated probability of event A from the simulation
  • kk = number of trials in which event A occurred
  • nn = total number of trials run

How It Works

Simulation is useful when a probability is too hard to calculate directly or when you want to check a calculation. AP Statistics uses a four-step outline. State the question. Plan by assigning random digits (or die faces) to outcomes in the correct proportions and defining what one trial is and what counts as a success. Do many trials and record the results. Conclude by reporting the proportion of successes as your estimate, and note that a different run would give a slightly different answer.

Worked Example

Problem: A basketball player makes 70% of her free throws, and each shot is independent. Use simulation to estimate the probability that she makes at least 2 of her next 3 free throws. Use the random digits 19223 95034 78756 to begin, then assume 50 trials were run in total.
Step 1: Assign digits. Let 0, 1, 2, 3, 4, 5, 6 represent a make and 7, 8, 9 represent a miss. Seven of the ten digits mean a make, which matches her 70% rate.
P(make)=710=0.7P(\text{make}) = \frac{7}{10} = 0.7
Step 2: Define a trial. Read 3 digits for 3 shots and count the makes. The trial is a success if she makes 2 or more.
success  ⟺  makes≥2\text{success} \iff \text{makes} \ge 2
Step 3: Run the first trials. The digits split into 192, 239, 503, 478, 756. The make counts are 2, 2, 3, 1, 2. Only 478 (one make) fails, so 4 of the first 5 trials are successes.
45=0.8\frac{4}{5} = 0.8
Step 4: Continue to 50 trials. Suppose 39 of the 50 trials are successes. Divide successes by trials. For comparison, the exact binomial probability is shown on the right.
P^=3950=0.783(0.7)2(0.3)+(0.7)3=0.784\hat{P} = \frac{39}{50} = 0.78 \qquad 3(0.7)^2(0.3) + (0.7)^3 = 0.784
Answer: The simulation estimates the probability of at least 2 makes as 0.78. This is very close to the exact value of 0.784.

Why It Matters

Simulation is a tested skill in AP Statistics Unit 4. It returns in Units 5 and 6, where simulated sampling distributions show how sample proportions vary. Engineers, actuaries, and epidemiologists use computer simulations, called Monte Carlo methods, to estimate risks such as equipment failure or the spread of disease when exact formulas do not exist.

Common Mistakes

Mistake: Assigning digits in the wrong proportion. For example, assigning digits 0 through 7 to a make for a 70% shooter. That is 8 of the 10 digits, so it actually models an 80% shooter.
Correction: Count the digits you assigned and divide by 10, or by 100 for two-digit groups. The fraction must equal the stated probability. For 70%, use exactly 7 of the 10 digits, such as 0 through 6.
Mistake: Running only a handful of trials and treating the result as the true probability. In the example, the first 5 trials gave 0.8.
Correction: A few trials can be far off by chance. Run many trials and report the result as an estimate. A different set of random digits would give a slightly different answer.

Related Terms