[null, {"document_url": "http://andreweckford.blogspot.com/2011/03/tim-hortons-school-of-probability.html", "unformatted_src": "https://lh4.googleusercontent.com/-aqKc6HfqAnI/TYduXcRT4yI/AAAAAAAAAHQ/YBZpAeKh-_M/s200/rollup.jpg", "src": "https://lh4.googleusercontent.com/-aqKc6HfqAnI/TYduXcRT4yI/AAAAAAAAAHQ/YBZpAeKh-_M/s200/rollup.jpg", "formatted_filename": "rollup", "rendered_width": 147, "rendered_height": 200}, null, {"document_url": "http://andreweckford.blogspot.com/2011/03/tim-hortons-school-of-probability.html", "unformatted_src": "https://lh3.googleusercontent.com/-jx0S5lo-w4Q/TYd1FZUaleI/AAAAAAAAAHY/mkr7s0hj0qo/s320/gd1.png", "src": "https://lh3.googleusercontent.com/-jx0S5lo-w4Q/TYd1FZUaleI/AAAAAAAAAHY/mkr7s0hj0qo/s320/gd1.png", "formatted_filename": "gd", "rendered_width": 320, "rendered_height": 49}, null, {"document_url": "http://andreweckford.blogspot.com/2011/03/tim-hortons-school-of-probability.html", "unformatted_src": "https://lh5.googleusercontent.com/-06-QfKHGrm0/TYd_hAfZlkI/AAAAAAAAAHc/h5DoZMYj4y8/s200/gd2.png", "src": "https://lh5.googleusercontent.com/-06-QfKHGrm0/TYd_hAfZlkI/AAAAAAAAAHc/h5DoZMYj4y8/s200/gd2.png", "formatted_filename": "gd", "rendered_width": 200, "rendered_height": 74}, null, {"document_url": "http://andreweckford.blogspot.com/2011/03/tim-hortons-school-of-probability.html", "unformatted_src": "https://lh3.googleusercontent.com/-JKu-q2_MvH4/TYeBNH3HjbI/AAAAAAAAAHk/AoIk1ppKyL8/s200/gd3.png", "src": "https://lh3.googleusercontent.com/-JKu-q2_MvH4/TYeBNH3HjbI/AAAAAAAAAHk/AoIk1ppKyL8/s200/gd3.png", "formatted_filename": "gd", "rendered_width": 200, "rendered_height": 180}, null, {"document_url": "http://andreweckford.blogspot.com/2011/03/tim-hortons-school-of-probability.html", "unformatted_src": "https://lh5.googleusercontent.com/-uA3-7Gu_s1k/TYfoIdiMY_I/AAAAAAAAAHo/HA-g-VcVRIE/s320/gd4.png", "src": "https://lh5.googleusercontent.com/-uA3-7Gu_s1k/TYfoIdiMY_I/AAAAAAAAAHo/HA-g-VcVRIE/s320/gd4.png", "formatted_filename": "gd", "rendered_width": 320, "rendered_height": 164}, null, null, null, null, null, null]

The Tim Hortons School of Probability Do you know what this object is? We've just come to the end of that late-winter Canadian ritual when we line up to buy coffee, hoping for the magic words: "Win donut / Gagnez un beigne".

There are a couple of neat posts here and here, using "roll up the rim" to illustrate the binomial distribution. But you can also use it to illustrate the geometric distribution.

The geometric distribution (GD) gives a distribution on the number of trials before the next win. It's like the binomial distribution (BD) for impatient people: The BD asks, "If I buy 20 coffees, how many prizes can I get?" while the GD asks, "How many coffees do I have to buy until I get my next prize?"

More formally, let p represent the probability of receiving a winning cup, and let x represent the number of coffees you buy until you receive your next winning cup. Then since x follows the GD, we have Rather than Pr(x), the probability of winning in exactly x cups, you're probably more interested in the probability of the next win happening in up to and including x cups. This is given by the cumulative distribution function F(x), where Notice that Pr(x) forms a geometric series for x = 1, 2, ..., so using the geometric sum formula, we have As we can see, the good news is that F(x) goes to 1 very quickly as x increases.  This year's contest had published odds of p = 1/6, so using F(x), we have F(5) = 0.598; F(10) = 0.839; F(20) = 0.974; and F(30) = 0.996. That is, if you buy a coffee a day, your chances of winning within a month are over 99%.

The bad news, sort of, is this: say you bought a coffee today, and lost. From the GD, how long do you now have to wait before your next win? Measuring time x from before you bought the first cup, we now know that x > 1, since the first cup is a loser.  Thus, we need to calculate the conditional probability Pr(x | x > 1).  This is given by That's very tidy.  In general, you can show that Pr(x | x > m) = Pr(x - m) for any m > 0.

But now think of it this way: you already bought the losing cup, so how long do you have to wait after that until you win? Well, x is the time from before the first loss, so let y = x-1 be the time from after the first loss. Then from the above, Pr(y | x > 1) = Pr(y), the same as Pr(x). In other words, if you know you lost already, you still have the same waiting probabilities before your next win!

This seems perverse, but it actually makes sense: it's the memoryless property.  Tim Horton (rest his soul) is not watching you buy coffee, and adjusting the order of cups as you win or lose.  Instead, each play is independent and has the same odds.  For the same reason, if you take a coin and happen to flip a million tails in a row, your odds of getting a tail on the next flip are still 1/2; the coin doesn't remember.

Just something else to think about next time you see the dreaded "Please Play Again / Reessayez SVP".

Posted by Andrew Eckford at 8:25 PM 
What happened to the "And Now A Word From Our Sponsors" blog? Sorry to bother you, I'm just curious if someone complained to you or something. I thought it was insightful and you brought up good points.

March 28, 2011 at 6:54 PM 
It will be back in a couple of months. I had to take it down temporarily for reasons I will explain when I re-post it.

March 28, 2011 at 7:22 PM 
Thanks for the link and the kind words, Prof. Eckford. Much appreciated -- keep up the great work!

March 28, 2011 at 8:29 PM 
More stuff by me