Historical Context & Motivation
Some probability questions are easy to answer with a formula. What is the chance of rolling a 6 on a fair die? Simple: 1 out of 6. But what about the probability that a game of Monopoly ends in fewer than 200 turns, or the expected number of shuffles needed to randomly sort a deck of cards? These questions involve so many interacting variables that a neat closed-form solution either doesn't exist or would take pages of combinatorics to derive. For centuries, mathematicians searched for a practical shortcut, and they found one: simulation — running a random experiment many, many times and letting the results speak for themselves.
The central question this lesson addresses is straightforward: When an exact calculation is too complex, how can we use repeated random trials to approximate a probability or expected value? By the end of this lesson, you'll know how to design, run, and interpret simulations that answer questions the formulas can't easily handle.
Core Principles & Definitions
Before you run a single trial, it helps to understand the key ideas that make simulation work. A simulation is a model of a real-world process that uses random numbers to mimic chance. Each complete run of the model is called a trial (or iteration), and the collection of all trials makes up the simulation. The power of the technique rests on a beautiful mathematical fact: as the number of trials grows, the simulated results converge to the true probability or expected value.
Random Number Generator (RNG)
Trial (Iteration)
Law of Large Numbers
Expected Value (E)
Simulated Probability
Visual Explanation — The Law of Large Numbers in Action
The diagram below shows what happens when you simulate a coin flip. The true probability of heads is 0.50. Notice how the simulated proportion bounces wildly at first but gradually settles near the true value as the number of trials grows. This convergence is the Law of Large Numbers in action.
Key observation: at 10 trials the simulated proportion was about 0.30, which is way off. By 100 trials it hovered near 0.50, and by 1,000 trials it was nearly exact. This pattern holds for any simulation. The practical rule of thumb in this course is to use at least several hundred trials — and more is almost always better.
Mathematical Framework
While simulation is about running experiments, a bit of mathematical notation helps you interpret the results. Two key formulas connect your simulation data to the quantities you want to estimate.
Designing a Simulation — Step by Step
Every simulation follows a consistent design process. Whether you're using a graphing calculator, a spreadsheet, or a programming language, the five steps below remain the same. The diagram that follows turns these steps into a visual flowchart you can reference whenever you design your own simulation.
Let's unpack each step. In Step 1, you state the question precisely: "What is the probability that all five friends share a birthday month?" or "What is the expected number of rolls to get three sixes?" In Step 2, you pick a randomizer that matches the real situation. A coin works for 50-50 events; a random integer from 1 to 6 models a die; digits 0–9 from a random number table can model all sorts of outcomes. In Step 3, you spell out what one trial looks like: the sequence of random actions and the specific result you record. In Step 4, you repeat the trial many times (at least 100, ideally 1,000+). Finally, in Step 5, you calculate P̂ or Ê from your collected data and state your conclusion.
Worked Example — The "At Least One Match" Problem
Suppose you buy a bag of 8 colored candies. Each candy is equally likely to be one of 5 colors: red, blue, green, yellow, or orange. What is the probability that you get at least one candy of every color? Counting the exact number of favorable outcomes requires advanced combinatorics (Stirling numbers). A simulation gives us a solid estimate much more easily.
Strengths, Limitations & Choosing the Right Approach
Simulation is incredibly versatile, but it isn't magic. Understanding when to simulate versus when to calculate exactly is an important skill. The table below summarizes the main trade-offs.
| Criterion | Simulation | Exact Calculation |
|---|---|---|
| Accuracy | Approximate; improves with more trials | Exact (if the formula is correct) |
| Ease of setup | Often easy — just model the experiment | Can be very difficult for complex scenarios |
| Speed | Needs many trials; fast on a computer, slow by hand | One calculation gives the answer immediately |
| Flexibility | Works for nearly any scenario, even non-standard ones | Requires a known formula or counting technique |
| Reproducibility | Results vary slightly each time (random) | Always gives the same answer |
Connections to Advanced Topics
The simulation techniques you learn in this course are the foundation for much more powerful tools in college-level statistics, data science, and applied mathematics. Here is a brief comparison showing how the ideas you're mastering now connect to what lies ahead.
| What You Learn Now | Where It Leads |
|---|---|
| Running trials with dice, coins, or RNG | Monte Carlo methods used in physics, finance, and machine learning |
| Approximating P̂ by counting successes | Bayesian inference and Markov Chain Monte Carlo (MCMC) sampling |
| Estimating expected value Ê from averages | Bootstrap resampling for confidence intervals (AP Statistics and beyond) |
| Law of Large Numbers as justification | Central Limit Theorem and convergence theory in probability |
You don't need to master these advanced topics right now. The important point is that simulation is not a shortcut around "real" math — it is a powerful branch of mathematics in its own right. Many professional statisticians and scientists spend their entire careers refining simulation methods to solve problems that no formula can touch.
Practice Problems
Lesson Summary
A simulation uses repeated random trials to approximate a probability or expected value when exact computation is too complex. You design a simulation in five steps: define the question, choose a random device that matches the real situation, define one trial, run many trials, and analyze the data. The simulated probability P̂ = k/n (successes over total trials) and the simulated expected value Ê = (sum of outcomes)/n both converge to their true values as the number of trials increases.
The Law of Large Numbers is the mathematical backbone that guarantees convergence: more trials yield better approximations. Simulation is most valuable when the number of possible outcomes is huge, when multiple random events interact, or when no clean formula exists. Remember that simulation gives an approximate answer — different runs may produce slightly different results — but with enough trials, the approximation becomes remarkably accurate.