Recitation, CIS-2033, Feb 5, David's Note (TA)
Contents
Newton-Pepys Problem (1693)
Pepys had a gambling question he couldn't solve and wrote to Newton to ask for help. This was Pepy's problem:
Which of the following 3 possibilities is most likely?
- Event A: at least one '6' occurs when 6 fair dice are tossed
- Event B: at least two '6's occur when 12 fair dice are tossed
- Event C: at least three '6's occur when 18 fair dice are tossed
Newton famously wrote back and gave the correct answer with wrong justification. (Stigler [ref: wikipedia]: there was nothing in Newton's argument that relied on the fact that the dice were fair. The correct answer is that A is the most likely event, as we'll see in a minute, contrary to many people's intuition, including Pepy's. It is possible to come up with an example where the dice are unfair and A is not the most likely outcome. Thus, Newton gave an intuitive explanation for his answer that couldn't possibly have been correct.)
First, let's compute P(A), the probability of at least one 6 occuring when you roll a fair die 6 times. (As an aside, I confess that when I see a phrase like at least one, I think: union of events. Then, no 6's occuring, which is the complement of this union, makes me think: intersection of events. This may be helpful sometimes when solving homework questions.) Now, the probability of no 6 occuring on a throw of a die is 5/6. Thus, by independence:
P_A = 1 - (5/6)^6
P_A = 0.6651
Similarly, compute the probability of B: at least 2 6's in 12 throws. This is 1 minus the probability of no 6's, minus the probability of exactly one 6:
P_B = 1 - (5/6)^12 - 12*(1/6)*(5/6)^11
P_B = 0.6187
Think why this must be true. (We will have more practice with this when we cover the binomial distribution.) As an exercise, compute P(C). This is only slightly more complicated than computing P(B). For now, let me just give the answer:
P_C = 1 - nchoosek(18,0)*(1/6)^0*(5/6)^18 - nchoosek(18,1)*(1/6)*(5/6)^17 - nchoosek(18,2)*(1/6)^2*(5/6)^16
P_C = 0.5973
(there are shorter ways of asking MATLAB to compute this, but let's do it this way for now.)
Now compare the results. You see that event A is more likely than either event B or event C.
It is said that Pepys reneged on his wagers after receiving Newton's reply. (Check out wikipedia if you're curious about the details).
Note that this was considered to be a hard problem in the 17-th century, but for you, now that you are taking CIS-2033 and learning MATLAB, problems like these will soon become a cinch.
Once we've covered the binomial distribution, it may be worthwile to return to this problem and consider the following code that does the above computations in one gulp:
p = 1/6; % prob of 'success': landing a '6' on a single toss s = 1:3; % we toss the die 6*s (6*1, 6*2, 6*3) times for i = s x = 0; n = 6*i; for k = 0:(i-1) x = x + binopdf(k, n, p); end fprintf('Probability of at least %d six in %d fair dice is %f\n', i, n, 1 - x) end
Probability of at least 1 six in 6 fair dice is 0.665102 Probability of at least 2 six in 12 fair dice is 0.618667 Probability of at least 3 six in 18 fair dice is 0.597346
Bonus! (i.e. Exercise): Try increasing the number of elements in the s vector in the code above. What happens to the probability of rolling at least one 6? Plot 1-x against s. Are the results expected?