Thursday, October 9, 2014

Lottery probablity, part 1

Once, a few years ago, a real honest-to-god doctor diagnosed me with ADHD, with less "hyper active" and more "focus" problems. I can focus too much on a task, which means other tasks and things get ignored. Isn't that cool? Anyways, I spent the morning working on a single task in coding. One task. After a while, it's not "working" on the problem. Just "deliberately breaking the code in as many ways as possible, then googling the error." It's done, and it's quite around here, so on to today's topic. The lottery.


About a month ago when I started reading the book "The Drunkards Walk: How Randomness Rules Our Lives" someone decided to tell me how they used math to almost win the lottery. His story was:

I studied the winning numbers for the previous 6 months, made note of which number came up in which spot, then used those numbers as my guesses. I missed three numbers.
I can't do the story justice, sadly. The story didn't sit right with me, but at the time I only managed a half- assed "But the numbers should be random." Really, when it comes to random numbers in the lottery, if it is a truly random system, then with a large enough data set the probabilities start showing themselves. So, I put the question in my pocket, and decided that it would make for a semi-decent blog post for this month.

I think I'll break this post up into 2 posts, because of the aforementioned ADHD. There's a lot of ground to cover, and my mind goes weird when I focus on math and programming too much.

First things first, the parameters of the problem. According to the website for the powerball, the ticket costs two dollars, and the player picks 6 numbers. 5 numbers are 1 thru 65, and the 6th number is 1 thru 35. Then there are various combos that win money, but no one cares. They want the secret to the jackpot. Also, as I sit here staring at the rules, missed 3 numbers is not impressive at all, since that's about 50%. I wonder what he was playing?

In probability, there is independent events and dependent events. Independent events are events that don't depend on each other. Yup. Tradition states that the example used here is dice. Dice are independent, if a die is rolled, then it's reset before it's rolled again. If a die is rolled 6 times, then each time the probability doesn't depend on the previous roll. Contrast that with cards, where if a card is pulled from a deck of 52, the chance of predicting the card drawn is 1 in 52. On the second draw, it's 1 in 51. That's a dependent event. Independent is much easier to calculate. The chance of rolling a 5 is 1 in 6. To figure out the chance of rolling a 5 twice, multiply the probability. 1/6 * 1/6 is 1/36. 3 times in a row, 1/(63) or 1/216. Simple. This would only really apply to the lottery if they drew the number out of the bin, made a note of it, then put it back into the bin. It would make the calculation easy: 1/(655) for the top line, and 1/35 for the powerball, and you know what? No one talks about that possibility. I'm going to leave that alone for now, and come back in an edit, or tack it on a later post once it gets worked out.

A dependent event is more in line with cards and this powerball thing. Pick the number 4 10 18 32 12. The chance of a 4 on the first draw is 1 in 65. No matter the outcome of the first draw, the chance of a 10 on the second is 1 in 64. The 12 on the 5 draw is 1 in 60. This can be attack the same way as before with conditional probability. The idea that IF a four is pick on the first draw, then we move onto the next one. The calculation becomes 1/65 * 1/64 * 1/63 * 1/62 * 1/61 * 1/35. That gives us the probability.

1 comment: