Main content

### Course: AP®︎/College Statistics > Unit 7

Lesson 1: Estimating probabilities using simulation- Intro to theoretical probability
- Experimental versus theoretical probability simulation
- Theoretical and experimental probability: Coin flips and die rolls
- Random number list to run experiment
- Random numbers for experimental probability
- Interpret results of simulations

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Random numbers for experimental probability

Using a list of random number to calculate an experimental probability.

## Want to join the conversation?

- How would you do a mathematical calculation of the probability of winning this game?(14 votes)
- Just bit of logic, Maximum roll is 18 minimum roll is 3. This means we have total of 16 outcomes. Rolling below 10 has 7 values (3,4,5,6,7,8,9) and rolling 10 or more has 9 values. (10,11,12,13,14,15,16,17,18).

So you will have 43.75% chance to roll below 10 and 56.25% chance to roll above 10.

Maths

7/16 = 0.4375

9/16 = 0.5625(0 votes)

- Why not run RANDOM numbers from 1 to 6?(8 votes)
- Well he doesn't really control the random number generator, I think he just rang up a website that did a string of numbers a lot.(4 votes)

- Based on 10 000 000 simulations my probability settled at approximately 62%.(6 votes)
- Based on the possible combinations the probability is 135/216 = 62.5%(5 votes)

- those are not random your last tutorial used the same numbers(2 votes)
- The sequence might be the same, but it was presumably constructed randomly.(8 votes)

- how can we calculate the theoretical probability in this and the previous examples?(5 votes)
- As for me, in this particular example it is easier (for those who want to decide whether to participate in the game) to come up with the concept of expected value from theoretical probability.

If the 6-sided die is fair, then every result from 1 to 6 has a 1/6 probability. If in this case we take an expected value ('mean value' / 'average' for probability) of every toss - then we have 3,5 (we find this by multiplying each value (1,2,3,4,5,6) by 1/6 probability and summing them up).

As we have 3 tosses in this game - we multiply 3,5 by 3 and have 10,5. What does this value of 10,5 tell us? It tells that on average we are likely to win this game (remember the necessity of getting 10 as the sum of 3 rolls to win).

Correct me if I am wrong, please.(2 votes)

- I am confused. Why would we calculate experimental probability here when we can theoretically calculate the probability of getting a sum of 10 or more as 62.5%. I thought we use experimental probability only when it is impossible to calculate theoretical probability like the number of points scored in a football game in the previous example.(2 votes)
- You always have both options. Maybe you know how to calculate the theoretical probability here, but there may be others who do not. In cases where it is very difficult or you just do not know how to do it, it is nice to have an alternative to be able to approximate the answer.(3 votes)

- Is there a formula to determine # of experiments per # of variables, or whatever other variables are present, to predict accurately when(# of experiments) one could expect the experimental results to match up to theoretical?(2 votes)
- The Law of Large Numbers says a sample size greater than 30 would suffice, but there is more research where 1000 is the right amount on return. It depends how easy it is to get up to 1000 samples(1 vote)

- Can anyone solve it theoretically(1 vote)
- Using generating functions

(x + x^2 + ... + x^6)^3 = Poly(n) = sum(coef_n * x^n)

plop into your favorite algebra expander

x^3 + 3 x^4 + 6 x^5 + 10 x^6 + 15 x^7 + 21 x^8 + 25 x^9 + 27 x^10 + 27 x^11 + 25 x^12 + 21 x^13 + 15 x^14 + 10 x^15 + 6 x^16 + 3 x^17 + x^18

10 and over = sum(coef_n from n=10 to 18)

= 27 + 27 + 25 + 21 + 15 + 10 + 6 + 3 + 1 = 135

answer = 135 / 216(2 votes)

- Not a question but a suggestion, for a programming solution for the same (Python)
`import itertools as iter`

die=list(range(1,7))

count=0

#We need to create a catesian product, with 3 repetations

for x in list(iter.product(die,repeat=3)):

eof = '\n' if count%10==0 else ','

if sum(x)>=10: print(x, end=eof); count+=1

print('\nPossible combos of 10 or more=',count)

print('Probability=',count/(len(die)**3))(1 vote) - Is there a website that can do that. Instead of a 10 times, 100 times?(1 vote)

## Video transcript

- [Instructor] Pascale
Ricketts has invented a game called Three Rolls to 10. You roll a fair six-sided die three times. If the sum of the rolls
is 10 or greater, you win. If it is less than 10, you lose. What is the probability of
winning Three Rolls to 10? So, there is several ways
that you can approach this. The way we're going to
tackle it in this video is we're going to try to come up with an experimental probability. We're going to do many experiments trying to win Three Rolls to 10 and figure out the proportion that we actually win and the more experiments we try, the better, the more
likely that we're gonna get a good approximation of
the actual probability. So, let's do that and to help us I'm
going to have a computer generate a string of random digits from zero to nine. And the way that we're going
to use this is remember, we're rolling a fair six-sided die, so the outcome could be
one, two, three, four, five or six for each roll. In this random number list that the computer has generated, I do get digits from one to six but I also get the digits
seven, eight, nine and zero and so what I'm going to
do for each experiment, I'm going to start at the top left and I'm gonna consider each digit a roll. If it gives me an invalid
result for a six-sided die, so if it's a zero, an
eight, a seven or a nine I will just ignore that, I will just say well,
that wasn't a valid roll. It's like, you roll the die
and it fell off the table or something like that. So, let's do that. Let's do multiple experiments of taking three rolls, sum them up and we'll see how many we can do to figure out an experimental probability of winning Pascale's game. So, let me set up a little table here, so I want space to show the sum, so this is going to be the experiment, experiment, actually let me write the sum and over here we're gonna say did we win? Alright. So, let's start with experiment one. So, our first roll we got a one. Our second roll we got a five. We're doing quite well and then our third roll we got a six. Did we win? Well, one plus five plus six is 12. Yes, we won. Let's do another experiment. This is going to be experiment two. We can just keep going here. These are random digits. So, we have a six in our first roll. We got a two in our second roll, we got a four in our third roll. Did we win? Yes, once again this summed up to 12. So, we won. Alright, let's do another experiment. So, experiment number three. So, this first thing is invalid, so this is our first roll. We got a six, and then this is invalid. Our second roll we get a three, this is invalid, that is invalid, that is invalid and then in our third roll we got a two, so we squeaked by. This adds up to 11. Yes, that looks like a win. Alright, let's do our
fourth experiment here. So, our first roll we got a one. This is invalid. Second roll we got a two. This is invalid. Third roll we get a five. Did we win? One plus two plus five is eight. No, we did not win. So, that was our first non-win. So, let's keep going. This is interesting. Alright, this is invalid, so we're going to have,
so this is trial five, we're going to have four
plus three plus one. Four plus three plus one, adds up to eight. Did we win? No. Let's just keep going here. So, I'm gonna keep going with my table where I have experiment, I'll do five more trials, experiment, sum and do we win? Let me make the table. This is just a continuation
of the table we had before. I don't want to go below the page 'cause I wanna be able to look
at our random numbers here. So, we are onto experiment six. Experiment six, we are getting
a three in the first roll, a three in the second roll, this isn't looking good and then a two in our third roll. Did we win? No, this is less than 10. Now we go to experiment seven. Experiment seven. We get a two in our first roll. This is invalid. We get a three in our
second roll, plus three and we get a one in our
third roll, so plus one. Once again we did not win. Now we go to experiment, we will go to experiment eight. We get a one in our first roll, we get a three in our second row, this is invalid, the
die fell off the table, we could think of it that way and then in our third roll
we get a five, plus five. Did we win? No, this adds up to nine. So, we had a string of wins to begin with but now we're getting
a strong of non-wins. Alright. Now, let's go to experiment nine. So, we get a six in our first roll, we get a four in our second roll and then these are all invalid, and then we got a five in our third roll. Did we win here? Yes, we won over here. This is definitely going
to be greater than 10, this is 15 here. Alright, last experiment or at least for this
video, last experiment. You could keep going. In fact, I encourage you to after this and see if you can get a more accurate, a better approximation of
the theoretical probability of winning by doing more experiments to calculate an experimental probability. So, here experiment 10. First roll we get a five, second roll we get a two, this is invalid, invalid, invalid, then we get a six. Here we definitely won. So, with 10 trials, based on 10 trials or 10 experiments, what is our experimental
probability of winning this game? Well, out of the 10 experiments how many did we win? Well, it looks like we won
one, two, three, four, five. So, based on just these 10 experiments we got a pretty clean 50%. So, do you think the
theoretical probability is actually 50%? Maybe you'd want to continue
running these experiments over and over. Maybe we'd want to do a computer program that could run this experiment
instead of 10 times, maybe 10,000 times to see if we can get closer to the true theoretical probability.