A die is rolled three times. Find the probability that the sum of the outcomes is (a) greater than 9. (b) an odd number.
1] Simulate three dice role 1000 times and find the sum
time = 1000
sum.dice <- sample(1:6, size = time, replace = TRUE) + sample(1:6, size = time, replace = TRUE) + sample(1:6, size = time, replace = TRUE)
(a) Find probability of sum greater than 9.
p.num.gt.9 = length(sum.dice[sum.dice>9])/length(sum.dice)
print(p.num.gt.9)
## [1] 0.649
(a) Find probability of sum being an odd number.
p.odd = length(sum.dice[sum.dice %% 2 != 0])/length(sum.dice)
print(p.odd)
## [1] 0.472