Chapter 11 · Probability

Choosing and Using Simulations for Compound Events

Learn to pick a chance device that matches a situation, then run many trials to estimate the probability of a compound event.

20 min read

You can already find the probability of a compound event (an event with two or more stages, such as two guesses or two draws) by listing its sample space, the list of all possible outcomes. A simulation gives you a second way to find it, as an estimate. You act out the situation with a chance device: an object that gives random outcomes, such as a coin, a number cube or numbered cards. You choose a device whose outcomes have the same chances (probabilities) as the real outcomes.

One complete run of a simulation is called a trial. Because the chances match, over many trials the event happens in about the same fraction of trials as it would in the real situation. So you run many trials, count the trials in which the event happens, and use that count to estimate the probability. This helps when the real situation is too slow or too costly to repeat many times.

A device is not right for a situation just because it is easy to find. In this lesson, one use of the device stands for one stage of the situation. A simulation built this way represents the situation when it passes three checks:

  1. Same chances. Each outcome of a stage is matched to device outcomes with the same probability.
  2. Same number of stages. One trial uses the device once for each stage.
  3. Same link between stages. If the first stage leaves the second stage unchanged, the device must offer the same outcomes on its next use. If the first stage removes an outcome, the device must remove it too.

For check 1, use a fair device, which means that all of its outcomes are equally likely. Then the chance of a group of device outcomes is the number of outcomes in the group (the favourable outcomes) divided by the total number of outcomes. This favourable-over-total rule works only because the outcomes are equally likely.

The table shows three fair devices and a chance that each one can match.

Three fair chance devices
Fair device (one use)Equally likely outcomesChance of each outcomeExample of a match
Flip a coin
heads, tails
12\frac{1}{2}
An outcome with a 12\frac{1}{2} chance: use heads
Roll a number cube
1, 2, 3, 4, 5, 6
16\frac{1}{6}
An outcome with a 13\frac{1}{3} chance: use faces 1 and 2, because 26=13\frac{2}{6} = \frac{1}{3}
Shuffle 10 identical cards numbered 0 to 9 and draw one
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
110\frac{1}{10}
An outcome with a 40%40\% chance: use cards 0, 1, 2 and 3, because 410=0.4=40%\frac{4}{10} = 0.4 = 40\%

Worked example

Choosing a simulation for a quiz

A quiz has 2 questions. Each has 3 choices (A, B, C), and exactly 1 is correct. Ren guesses both answers at random, so each choice is equally likely. Which simulation represents Ren's two guesses? Coin simulation: flip a fair coin twice; heads means correct, tails means wrong. Two-roll simulation: roll a fair number cube twice; 1 or 2 means correct, 3 to 6 means wrong. One-roll simulation: roll a fair number cube once; 1 or 2 means both correct, 3 to 6 means not both correct.

  1. Find the chance at each stage of the real situation. One guess picks 1 of 3 equally likely choices, and only 1 choice is correct. Because the choices are equally likely, favourable over total gives the chance of a correct guess. The other 2 choices give the chance of a wrong guess.

    correct: 13wrong: 23\text{correct: } \frac{1}{3} \qquad \text{wrong: } \frac{2}{3}
  2. Check the coin simulation for the same chances. A fair coin has 2 equally likely sides, so heads has a chance of 1 out of 2. That is greater than 1 out of 3, so correct guesses would happen too often. The coin simulation fails check 1.

    12≠13\frac{1}{2} \ne \frac{1}{3}
  3. Check the two-roll simulation for the same chances. A fair number cube has 6 equally likely faces. Two faces (1 and 2) mean correct, and four faces (3, 4, 5 and 6) mean wrong. Dividing each numerator and denominator by 2 shows that both chances match the quiz, so it passes check 1.

    26=1346=23\frac{2}{6} = \frac{1}{3} \qquad \frac{4}{6} = \frac{2}{3}
  4. Check the stages of the two-roll simulation. The quiz has 2 guesses and the simulation has 2 rolls, one for each guess, so it passes check 2. Guessing on question 1 does not change the choices on question 2, and the first roll does not change the faces on the second roll, so it passes check 3.

  5. Check the one-roll simulation. It uses 1 roll for 2 guesses, so it fails check 2. It also gives the event that both guesses are correct a chance of 2 out of 6, the same as one correct guess. But both guesses are correct only when the first guess is correct and the second is correct too. The second guess can still be wrong, so both correct must be less likely than one correct guess.

Answer

The two-roll simulation represents Ren's two guesses: roll a fair number cube twice, where 1 or 2 means a correct guess and 3, 4, 5 or 6 means a wrong guess.

Key concept

A matching simulation estimates a probability

A simulation stands in for a real situation. When one use of the device stands for one stage, the simulation represents the situation if it has the same chances at each stage, the same number of stages in a trial, and the same link between stages (if a stage removes an outcome, the device removes it too).

The relative frequency of an event is the fraction of trials in which the event happens. It approximates (comes close to) the probability only over many trials. Treat it as an estimate: a relative frequency of 0.120.12 suggests about 12 in every 100 trials, which is an approximate expected count and not a guarantee.

estimated probability=number of trials in which the event happenstotal number of trials\text{estimated probability} = \dfrac{\text{number of trials in which the event happens}}{\text{total number of trials}}

To design a simulation, make four decisions before you pick up a device:

  1. Stages and chances. List each stage of the situation and the probability of each of its outcomes.
  2. Device and meaning. Choose a fair device and say exactly which device outcomes stand for which real outcomes.
  3. One trial. Say how many times you use the device in one trial, and whether an outcome can come up again.
  4. The event. Say what a trial must show for the compound event to count as happening.

To use the simulation, run many trials, record every trial, and find the relative frequency of the event.

The table shows the first 10 trials of the two-roll simulation for Ren's quiz. Each trial is 2 rolls of a fair number cube. A 1 or 2 means a correct guess, and a 3, 4, 5 or 6 means a wrong guess.

Two-roll simulation for Ren's quiz: the first 10 trials
TrialFirst rollSecond rollGuesses (question 1, question 2)Both guesses correct?
1
4
2
wrong, correct
No
2
1
6
correct, wrong
No
3
2
1
correct, correct
Yes
4
5
5
wrong, wrong
No
5
3
2
wrong, correct
No
6
6
4
wrong, wrong
No
7
1
3
correct, wrong
No
8
2
2
correct, correct
Yes
9
4
1
wrong, correct
No
10
3
6
wrong, wrong
No

Worked example

Using a simulation to estimate a probability

Use the two-roll simulation to estimate the probability that Ren guesses both quiz answers correctly. The table above shows the first 10 trials. Ren's class runs 200 trials in all, and both guesses are correct in 24 of them.

  1. State the trial and the event, so that every trial is judged in the same way. One trial is 2 rolls, because the quiz has 2 questions. The event happens when both rolls show 1 or 2, because that means both guesses are correct.

  2. Read the first 10 trials. The event happens in trials 3 and 8 only, so the relative frequency so far is 2 out of 10. With only 10 trials, one trial changes this value by 1 out of 10, which is 0.10, so 10 trials are too few to trust.

    210=0.20\frac{2}{10} = 0.20
  3. Use all 200 trials, because relative frequency approximates probability only over many trials. Divide the 24 trials in which the event happens by the 200 trials that were run. Dividing the numerator and denominator by 2 gives an equivalent fraction with denominator 100, which is easy to write as a decimal.

    24200=12100=0.12\frac{24}{200} = \frac{12}{100} = 0.12
  4. Check with the sample space of the quiz. Write the choice for question 1, then the choice for question 2. Keeping that order gives 9 ordered pairs, each listed once: AA, AB, AC, BA, BB, BC, CA, CB, CC. Each choice is equally likely and one guess does not change the other, so the 9 pairs are equally likely and favourable over total applies. Exactly 1 pair has both answers correct.

    favourabletotal=19\frac{\text{favourable}}{\text{total}} = \frac{1}{9}
  5. Compare the two values. As a decimal, 1 out of 9 is 0.111..., which is 0.11 to the nearest hundredth. The estimate 0.12 is close to 0.11 but not equal to it. A simulation gives an approximation, even over many trials, so a small gap like this is normal.

    19=0.111…≈0.11\frac{1}{9} = 0.111\ldots \approx 0.11

Answer

The simulation estimates the probability that Ren guesses both answers correctly as about 0.120.12, or about 12%12\%. This is close to the sample-space value 19≈0.11\frac{1}{9} \approx 0.11.

In Ren's quiz, the first guess left the second guess unchanged. Some situations work differently. Without replacement means that whatever is picked at the first stage is not put back, so it cannot be picked again. The second stage then has one fewer outcome to choose from, and its chances change.

A simulation of such a situation must lose the same outcome after its first stage. Drawing a card and leaving it out does this. Rolling a number cube twice does not, because the cube can show the same face again.

For example, shuffle 5 identical cards numbered 1 to 5 and draw 2 cards without replacement. Write each result in order, first card then second card, so (1, 2) and (2, 1) are different ordered pairs. Each first card leaves only 4 cards for the second draw, so there are 5×4=205 \times 4 = 20 ordered pairs, not 5×5=255 \times 5 = 25. The table lists every ordered pair once.

Drawing 2 of the cards 1 to 5 without replacement: all 20 ordered pairs
First cardCards left for the second drawOrdered pairs (first card, second card)
1
2, 3, 4, 5
(1, 2), (1, 3), (1, 4), (1, 5)
2
1, 3, 4, 5
(2, 1), (2, 3), (2, 4), (2, 5)
3
1, 2, 4, 5
(3, 1), (3, 2), (3, 4), (3, 5)
4
1, 2, 3, 5
(4, 1), (4, 2), (4, 3), (4, 5)
5
1, 2, 3, 4
(5, 1), (5, 2), (5, 3), (5, 4)

Worked example

Designing a simulation without replacement

A playlist has 5 songs: 2 rock songs and 3 pop songs. On shuffle, the player picks 2 songs, one after the other. Each song that is still available is equally likely to be picked, and a song that has played cannot be picked again. Design and use a simulation to estimate the probability that both songs are rock.

  1. List the stages and chances. Stage 1 picks 1 of 5 equally likely songs, and 2 of them are rock. Stage 2 picks from only 4 songs, because the first song cannot play again. This is a situation without replacement.

    first pick: 5 songssecond pick: 4 songs\text{first pick: 5 songs} \qquad \text{second pick: 4 songs}
  2. Choose a device and say what it means. Use the 5 identical cards numbered 1 to 5 from the table above, shuffled so that each card is equally likely to be drawn. Cards 1 and 2 stand for the rock songs, and cards 3, 4 and 5 stand for the pop songs. Then 2 of the 5 cards are rock cards, which matches 2 rock songs out of 5.

  3. Define one trial and the event. Draw one card, leave it out, and draw a second card from the 4 that remain. Leaving the first card out matches the rule that a song cannot play again. The event happens when both cards are rock cards.

  4. Run many trials and record each one. Drawing 2 then 5 means rock then pop, so the event does not happen. Drawing 2 then 1 means rock then rock, so it does. Suppose you run 300 trials and the event happens in 33 of them. The relative frequency is 33 out of 300, and dividing the numerator and denominator by 3 gives an equivalent fraction with denominator 100.

    33300=11100=0.11\frac{33}{300} = \frac{11}{100} = 0.11
  5. Check with the sample space. The table above lists each of the 20 ordered pairs once, and shuffling makes the pairs equally likely, so favourable over total applies. Only (1, 2) and (2, 1) show two rock cards. Dividing the numerator and denominator by 2 gives 1 out of 10.

    220=110=0.10\frac{2}{20} = \frac{1}{10} = 0.10

Answer

The simulation estimates the probability that both songs are rock as about 0.110.11, or about 11%11\%. This is close to the sample-space value 220=0.10\frac{2}{20} = 0.10.

A simulation is a stand-in experiment that you can repeat as often as you need. When each use of the device stands for one stage, it represents a situation if it has the same chances at each stage, the same number of stages, and the same link between stages. That link includes removing an outcome whenever the situation removes one.

To find the probability of a compound event, design the simulation, run many trials, and divide the number of trials in which the event happens by the total number of trials. The result is an estimate. It approximates the probability only over many trials, and it never guarantees what one set of trials will show.

Next, you will examine solutions about the probability of compound events, find the errors in them, and correct them.