What is the probability of rolling two six-sided dice and getting a value greater than 7?
In general, I think it’s worth solving this problem via simulation, because solving via enumeration scales much worse. (We could also solve this problem analytically, but that scales even worse than the enumerative solution.) So first I’ll show how to solve via simulation.
# The number of simulations we will do. As this number gets larger, our# simulated probability will approach the theoretical probability.N_rolls <-10000# Simulate the two die rolls. You could do this with one call of sample but# for expository purposes this is easier.die_1 <-sample(1:6, N_rolls, replace =TRUE)die_2 <-sample(1:6, N_rolls, replace =TRUE)# Calculate the proportion of sums that are greater than 7sum <- die_1 + die_2mean(sum >7)
[1] 0.4282
We can also use R to solve this problem by enumeration.
As you can see, our simulated solution is extremely close to the “true” answer that we get by enumerating the sample space. If you prefer the answer as a fraction, we can also just count.
# Number of possible combinations that sum to > 7sum(possible_rolls$sum >7)
[1] 15
# Number of possible combinationsnrow(possible_rolls)
[1] 36
So 15 out of the 36 possible combinations have a sum greater than 7, giving us the observed probability \(0.41\bar{6}.\)
Q2
What is the probability of rolling three six-sided dice and getting a value greater than seven?
We can solve this in the same way. We’ll do it just via enumeration this time, since this book is about probability, not about simulations.
The Yankees are playing the Red Sox. You’re a diehard Sox fan and bet your friend they’ll win the game. You’ll pay your friend $30 if the Sox lose and your friend will have to pay you only $5 if the Sox win. What is the probability you have intuitively assigned to the belief that the Red Sox will win?
To solve this problem, we just use the formula that relates the odds to the probability of an event.