# 3.3: Simulation and Experimental Probability

**At Grade**Created by: Bruce DeWItt

**License**: CC BY-NC 3.0

### Learning Objectives

- Understand how to generate random numbers using a random digit table or a calculator
- Be able to properly assign digits to simulate a random situation
- Be able to interpret results from a simulation and understand the connection to the Law of Large Numbers

For many of the problems we have addressed, putting together a theoretical model is very reasonable for us to do. A **theoretical model** gives a picture of what *should* happen in the long run for any situation involving probability. It will give us a very clear idea of what to expect out of a particular situation. If you have been dealt an ace, you can quickly figure out the probability that the next card will be a face card. That probability is a theoretical probability.

However, the truth is that in many situations it is beyond the scope of the mathematics of this course to calculate theoretical probabilities. In these situations, we can estimate probabilities by performing a **simulation** through the use of an experimental model. Some of our simulations can be done quite easily using actual probability tools like dice or spinners. Some situations, though, will require us to use a **random number generator** or a **table of random digits**. Does your calculator have a random number generator?

You can see a table of random digits at the end of this book in Appendix A, Part 1. A table of random digits contains a random mix of digits from 0 through 9. These digits can be used to simulate virtually any situation involving chance behavior from rolling dice to drawing cards. It is important that you are detailed in your explanation of how you will assign digits so that others may model your simulation procedure exactly. The 6 steps for using a table of random digits for a simulation are shown below.

1)Assign the same number of digits to each of the different possible outcomes.

2)Choose a line number (often given) from the random digit table.

3)State how many digits you will select at a time. If your largest value is less than 10, you will be able to select one digit at a time. If it is less than 100 you will have to use two digits at a time. If it is less than 1000, you will have to use 3 digits at a time and so on.

4)State what values you will ignore. These typically are values that are larger than your biggest value and number combinations like 000.

5)Know when to stop. Pay attention to the number of trials you must complete.

6)Select your digits and summarize your results.

#### Example 1

Use the line of random digits below to randomly select three days from the month of October.

3 5 4 7 6 5 5 9 7 2 3 9 4 2 1 6 5 8 5 0 0 4 2 6 6 3 5 4 3 5 4 3 7 4 2 1 1 9 3 7

#### Solution

October has 31 days in it so we must identify 31 different outcomes. Our largest value is 31 so I will have to select two digits at a time. I will ignore 32 through 99 and 00. Assign two digits per day, so for example, 01 = the first of October.

3 5 4 7 6 5 5 9 7 2 3 9 4 2 1 6 5 8 5 0 0 4 2 6 6 3 5 4 3 5 4 3 7 4 2 1 1 9 3 7

Notice that we crossed out 35, 47, etc... because these were all beyond our largest value of 31. Our three days are the 16th, 4th, and 26th of October.

#### Example 2

Suppose you wish to roll two dice a total of 5 times and keep track of the totals. You don't have any dice, but you do have access to the line of random digits below. Explain how you could simulate the rolls of two dice using the random digits and then perform the simulation.

19223 95034 05756 28713 96409 12531 42544 82813

#### Solution

We will have to roll two dice. Each die will have a value from 1 through 6 on each roll. We will ignore digits 7, 8, 9, and 0 as a die can never come up with those values. The first three digits in the line of random digits are 1,9,2. The first die will be a 1. We ignore the 9. The second die will be a 2. This gives a total of 3. Our second roll picks up right where we left off and we get a 2 and a 3 for a total of 5. Using the same procedure, our next three totals will be 8, 9, and 11. Our five results were 3, 5, 8, 9, and 11.

Remember that it is unwise to make assumptions after only a very small set of rolls. For example, it would be incorrect to say that a total of 7 is unlikely to happen since it did not come up on our simulation. We only simulated the rolls 5 times which is not nearly enough to make a conclusion. The **Law of Large Numbers** states that as we increase the number of trials we should get closer and closer to the theoretical probability. Theoretically, there is a chance that the total is 7. If we did our simulation for thousands of rolls, we would expect that our simulation would show that a total of 7 comes up about of the time.

#### Example 3

At the start of this season, Major League Baseball fans were asked which American League Central team would be most likely to win the division this year. The table below gives the results of the poll.

Team | Chicago | Cleveland | Detroit | Kansas City | Minnesota |

Probability | 0.14 | 0.23 | 0.33 | 0.02 | 0.28 |

Using the line of random digits supplied, simulate the results when asking 10 fans who they think will win the AL Central.

73676 47150 99400 01927 27754 42648 82425 36290

**License**: CC BY-NC 3.0

#### Solution

Notice that the probability adds up to 100%. Selecting two digits at a time works well in situations like this. Since 14% or 14 out of 100 fans support Chicago, assign 01-14 as Chicago fans. Assign 15-37 as fans who think Cleveland will win. A good trick to remember is to add the 23% for Cleveland to the ending percent for Chicago which was 24%. This will give you the end of the interval for Cleveland. Likewise, Detroit will be 38-70, Kansas City will be 71-72, and Minnesota will be 73-99 and 00. Notice that Minnesota can't use 100 as that is three digits and we are only selecting two at a time. The digit combination '00' can be used to represent 100.

We now select our 10 fans. Our 2-digit pairs are 73, 67, 64, 71, 50, 99, 40, 00, 19, and 27. The table at the top of the following page summarizes our results.

License: CC BY-NC 3.0

In our simulation, we found that 4 out of our 10 randomly selected fans felt Detroit was going to win. While it is not exactly the 33% we were given in the original problem, it is fairly close. Once again, if we had done hundreds of trials instead of just 10, our percentages would tend to get very close to the theoretical probability according to the Law of Large Numbers.

#### Example 4

Every person is born on a different day of the month. Some people are born on the 1st and some people are born as late as the 31st. How many people must you go through until you find two that were born on the same day of the month? Simulate this one time using the random digits below. (Ignore the fact that people are not equally likely to be born on all days. It is more likely you were born on the 17th than the 31st since all months have a 17th but not all months have a 31st.)

45467 71709 77558 00095 32863 29485 82226 90056

52711 38889 93074 60227 40011 85848 48767 52273

#### Solution

We will select 2 digits at a time as our largest value, 31, requires two digits. We will use 01, 02, ... 30, 31 and ignore 32-99 and 00.

The numbers we get are 45, 46, 77, 17, 09, 77, 55, 80, 00, 95, 32, 86, 32, 94, 85, 82, 22, 69, 00, 56, 52, 71, 13, 88, 89, 93, 07, 46, 02, 27, 40, 01, 18, 58, 48, 48, 76, 75, 22, and 73. The only 'keepers' are 17, 09, 22, 13, 07, 02, 27, 01, 18, and 22. We did not get a match until we got our second 22. It took us 10 people to find a pair that were born on the same day of the month.

Notice that when you get to the end of one line in a random digit table, you simple continue by moving to the next line below.

### Problem Set 3.3

#### Exercises

1) Suppose that 80% of a school’s student population is in favor of eliminating final exams.

a) Explain how could you assign digits from a random digit table to simulate this situation?

b) Suppose you ask 10 students if they would like to eliminate final exams. Simulate a random selection of 20 students and record how many of the 20 are in support of eliminating final exams. Use line 147 from the random digit table in Appendix A, Part 1.

[Figure5]License: CC BY-NC 3.0

2) Suppose that students at a particular college are asked about their class rank when they were in high school. The table below shows what they said.

Class Rank |
Top 10% |
Top 10% to 25% |
Top 25% to 50% |
Bottom 50% |

Prob. |
0.2 |
0.4 |
0.3 |
??? |

a) What must the probability be for the bottom 50%?

b) Explain how you could assign digits to carry out a simulation for this situation.

c) Using your set up, perform a simulation. Use 20 students in your simulation and record your results. Use line 103 from the random digit table.

3) Suppose the grades for students in your Stats & Prob. course were distributed as shown in the table below.

Grade |
A |
B |
C |
D or F |

Prob. |
0.20 |
0.29 |
0.35 |
0.16 |

a) Explain how you could assign digits to simulate the grades of randomly chosen students.

b) Simulate the grades for 30 students. Use line 106 from the random digit table. Build a tally chart to track your results.

c) How closely did your simulation match the actual distribution?

4) How many five card poker hands must you be dealt in order to get a hand with two cards that have matching values? (For example, the 7 of hearts and 7 of diamonds have matching values.)

a) Explain how you will assign digits for this situation.

b) Perform the simulation one time and state how many five-card hands it took for you to get your first hand with two cards that match. Use line 138 from the random digit table.

[Figure6]License: CC BY-NC 3.0

5) There are some basic concepts that should be clearly understood about a random digit table. Answer the questions below.

a) Is it possible to have four 6's next to each other in a random digit table?

b) What percent of the digits in a random digit table are 9's?

c) What should you do if you come to the end of a line of random digits and you still need more digits?

6) Suppose we have a class of 30 students and you are wondering what the chances are that there is at least one pair of students who have the same birthday. Assume that there are 365 days in a year.

a) Explain how could you assign digits from a random digit table to simulate this situation?

b) Perform this simulation one time and record whether or not there was a match in the class of 30 students. Use line 121 from the random digit table.

#### Review Exercises

7) Suppose you are dealt two cards from a well-shuffled standard deck of 52 cards. What is the probability that your two cards are a king and an ace (in either order)?

8) Consider a set of 15 pool balls. Pool balls numbered 1 - 8 are solid and pool balls numbered 9 - 15 are striped. You pull two pool balls randomly out of a bag without replacement.

a) What is the probability that your second pool ball will be solid if your first pool ball had an even number?

b) What is P(Even|Striped)?

9) A survey of junior boys found that 97 are planning to participate in either a fall sport or in a winter sport or both. Use the Venn Diagram below to answer the questions.

**License**: CC BY-NC 3.0

a) How many junior boys are planning on playing hockey or football (or both)?

b) How many junior boys who are planning on participating in a fall or winter sport are not represented in the Venn Diagram?

c) What is P(Hockey|Football)?

### Image Attributions

**[1]****^**License: CC BY-NC 3.0**[2]****^**License: CC BY-NC 3.0**[3]****^**License: CC BY-NC 3.0**[4]****^**License: CC BY-NC 3.0**[5]****^**License: CC BY-NC 3.0**[6]****^**License: CC BY-NC 3.0**[7]****^**License: CC BY-NC 3.0