1. A die is rolled three times. Find the probability that the sum of the outcomes is
a.) greater than 9
The probability that the sum of the outcomes is greater than 9 is equivalent to: \(P(>9) = 1 - P(\leq 9)\). (We must remember that we cannot roll a sum of 0, 1, 2, as the smallest side of the die = 1). In addition, if we calculate the total amount of possible combinations there are, there are \(6^3 = 216\) different combinations that we can throw.
\[P(\leq 9) = P(3) + P(4) + P(5) + P(6) + P(7) + P(8) + P(9)\]
Let’s go back to the chapter and review how to calculate the sum of random variables. Let \(S_3 = X_1 + X_2 + X_3\) be the sum of thhe outcomes, where \(X_1, X_2, and X_3\) are outcomes from a roll of a die. Then, \(X_1, X_2, and X_3\) have the common distribution function:
Let’s start with two dice first.
We can continue this, and find \[P(S_2 = 5) = 4/36, P(S_2 = 6) = 5/36, P(S_2 =7)=6/36,P(S_2 =8)=5/36,P(S_2 =9)=4/36,P(S_2 =10)=3/36, P(S_2 = 11) = 2/36, P(S_2 = 12) = 1/36\]
The distribution function of \(S_3\) would then the convolution of this distribution with itself. Thus,
\[P(S_3 = 3) = P(S_2 = 2)P(X_3 = 1) = 1/36 * 1/6 = 1/216\] \[P(S_3 = 4) = P(S_2 = 3)P(X_3 = 1) + P(S_2 = 2)P(X_3 = 2) = 2/36 * 1/6 + 1/36 * 1/6 = 3/216\]
We can calculate the probability of each P value all the way up to 9.
# Let's set the probability values for the sum of two die thrown as we have found above.
P_S2_2 <- 1/36
P_S2_3 <- 2/36
P_S2_4 <- 3/36
P_S2_5 <- 4/36
P_S2_6 <- 5/36
P_S2_7 <- 6/36
P_S2_8 <- 5/36
#P_X3 for any value X where X is from 1 to 6, its probability will always be 1/6, no matter what the value is
P_X3_1 <- 1/6
P_X3_2 <- 1/6
P_X3_3 <- 1/6
P_X3_4 <- 1/6
P_X3_5 <- 1/6
P_X3_6 <- 1/6
# Let's calculate the probabilities for the sum of 3 dies up to a total sum of 9
P_S3_3 <- P_S2_2 * P_X3_1
P_S3_4 <- P_S2_2 * P_X3_2 + P_S2_3 * P_X3_1
P_S3_5 <- P_S2_2 * P_X3_3 + P_S2_3 * P_X3_2 + P_S2_4 * P_X3_1
P_S3_6 <- P_S2_2 * P_X3_4 + P_S2_3 * P_X3_3 + P_S2_4 * P_X3_2 + P_S2_5 * P_X3_1
P_S3_7 <- P_S2_2 * P_X3_5 + P_S2_3 * P_X3_4 + P_S2_4 * P_X3_3 + P_S2_5 * P_X3_2 + P_S2_6 * P_X3_1
P_S3_8 <- P_S2_2 * P_X3_6 + P_S2_3 * P_X3_5 + P_S2_4 * P_X3_4 + P_S2_5 * P_X3_3 + P_S2_6 * P_X3_2 + P_S2_7 * P_X3_1
P_S3_9 <- P_S2_3 * P_X3_6 + P_S2_4 * P_X3_5 + P_S2_5 * P_X3_4 + P_S2_6 * P_X3_3 + P_S2_7 * P_X3_2 + P_S2_8 * P_X3_1
# Sum of all the P Values from X=3 to X = 9
P_sum_3_9 <- P_S3_3 + P_S3_4 + P_S3_5 + P_S3_6 + P_S3_7 + P_S3_8 + P_S3_9
# However, we need to solve for the probability that the sum will be greater than 9
print(paste0("The probability of the sum of 3 die will be greater than 9 will be: ", 1 - P_sum_3_9))
## [1] "The probability of the sum of 3 die will be greater than 9 will be: 0.625"
b.) an odd number
The range of sum of 3 die goes from 3 to 18.
range_sum <- 3:18
# How many of them are odd?
odd <- 0
for (i in range_sum){
if (i %% 2 == 0){
odd <- odd + 1
}
}
# How many of them are even?
even <- 0
for (i in range_sum){
if (i %% 2 == 1){
even <- even + 1
}
}
# What is the probability that the sum of 3 die is odd?
print(paste0("Probability that the sum of 3 die is odd: ", odd/length(range_sum)))
## [1] "Probability that the sum of 3 die is odd: 0.5"