Problem 1
A die is rolled three times. Find the probability that the sum of the outcomes is:
Simulations result: 62.4% chance of sum of rolls > 9, with n = 100,000 There are 6 sides, and 6^3 = 216 possible sets of rolls from three rolls.
For generating an exact solution, we know that the number of possible rolls for each value follows the coefficients on the sequence (x + x^2 + x^3 + x^4 + x^5 + x6)k, where the number of rolls is k.
odds: 1 1 1 1 1 1 (sum = 6), i.e. each roll is equally likely.
value: 1 2 3 4 5 6
odds: 1 2 3 4 5 6 5 4 3 2 1 (sum = 36 = 6^2)
odds: 1 3 6 10 15 21 25 27 27 25 21 15 10 6 3 1 (sum = 216 = 6^3)
value: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
The sum of odds for rolls under 10 = 1 + 3 + 6 + 10 + 15 + 21 + 25 = 81
The probability of rolling less than 10 = 81/216 = 37.5%
Probability of rolling 10 or greater: (216 - 81)/216 = 135/216 = 62.5%
Theory: The probability of an odd number: add up the odds for each value that is odd:
1 + 6 + 15 + 25 + 27 + 21 + 10 + 3 = 108, which is exactly half of 216.
# Sample of three rolls
x = sum(sample(1:6, 3, replace = TRUE))
n = 10000
trials = c()
for (i in 1:n) {
trials = c(trials, sum(sample(1:6, 3, replace = TRUE)))
}
hist(trials)
# Probability of an odd sum of rolls = 49.8%:
sum(trials %% 2 == 1) / n
## [1] 0.4931
# Probability of an odd sum of rolls = 49.8%:
sum(trials %% 2 == 1) / n
## [1] 0.4931
The price of a stock on a given trading day changes according to the distribution
Probability of stock changes =
-1 0 1 2
1/4 1/2 1/8 1/8
Find the distribution for the change in stock price after two (independent) trading days.
The distribution can be found by identifying the possible values that would add up to the sum of the changes. For example, after two days, the sum could be -2, which would be the result of only -1 on each day, for a probability of 1/4 on each day, so the probability would be 1/16, or 0.0625.
For the total sum of changes to be 1, the possible sets of changes that would cause that result are {(0,1), (1,0), (2, -1), (-1, 2)}. Multiplying the respective probabilities and summing them obtains a likelihood of 18.75%.
Possible sum values, and the probability of roll combinations leading to those values:
-2 0.0625
-1 0.125 0.125
0 0.25 0.03125 0.03125
1 0.0625 0.0625 0.03125 0.03125
2 0.015625 0.0625 0.0625
3 0.015625 0.015625
4 0.015625
Probability by sum
-2 0.0625
-1 0.25
0 0.3125
1 0.1875
2 0.140625
3 0.03125
4 0.015625