Not long, a great many Americans went crazy attempting to buy a chance to win the largest lottery prize ever: the Mega Millions $656 million jackpot. And, despite my usual practice of avoiding such things with amused condescension, I was one of them. There was a pool of people buying tickets where I work, and, after considering the enormity of the prize, I put $5 (the minimum share) in. After considering the idea of actually

*winning*, though, I began to regret my decision. After the initial thrill wore off, what would I

*do* with all the money? Hedge funds? Charities? Investments? More importantly, who all would know that I had won and had just come into a large sum of cash? Family? Friends? Unsavory characters? People who have won the lottery in the past tend to have a record of losing both the money and their friends - sometimes even their lives. I determined the prize was like Radium; you either needed to keep it very well contained or just get rid of it.

Still, such financial quandaries aside, some of you may still be wondering why I bought the tickets in the first place. Don't I know

*math**???* The answer is yes, I do know math. In this case, just enough to hang myself. Before I threw my money into the pot, I calculated the expected value of buying a ticket. Expected value is a simple statistical calculation that can give you a rough idea of how much each investment in some activity will gain you over the long run. If the expected value is positive, the investment is probably worth it; if not, you'll only come out ahead by being lucky. The expected value of gambling is usually negative (though there have been some instances of people cheating the system with math and coming out ahead consistently). To calculate it, you just take the reward at stake, multiply it by the probability of getting that reward, and subtract the cost.

Now, the chances of winning the jackpot were 1 in 175,711,536, the price of a ticket was $1, and, at the time, the jackpot was around $400 million. A quick calculation showed that the expected value for buying a ticket was $1.28; it was actually

**positive**! Now, this didn't mean that I had any greater chance of winning the jackpot, but it did mean that the shear enormity of the reward was enough to outweigh the slim chance of getting it. So I bought 5 tickets.

Well, I didn't win, of course. If I had, this blog would be inexplicably gold-plated. But afterward I found myself somewhat troubled. Not because I hadn't won - I can't say I ever really expected to win - but because it looked like my calculations had somehow been wrong. Overall, Americans spent around $1.6 billion in tickets, with only a $656 million prize in return. How could the expected value have been positive and yet the overall result show a negative return on investment? After thinking about this a while, I realized that my error was that I hadn't taken into account the fact that other people were also buying tickets and that, in the case of multiple winners, the jackpot would be split. This meant that in my expected value formula, the reward would have to be divided by the number of people expected to win, including myself. This made the formula look like so:

(This holds true for either each person buying one ticket or fewer people buy multiple tickets. The only case for which this wouldn't work is if someone were to buy the same ticket twice.)

Running the calculations again with 1.6 billion tickets purchased gave the much more reasonable expected value of -$0.63; buying a ticket wasn't worth it.

The above formula can be worked backwards, too. No prize less that $176 million is worth buying a ticket for, buying a ticket for a $176 million jackpot would only be advisable if no one else were playing (highly unlikely), and a ticket for the recent Mega Millions would have only been worth it if no more than 480 million other tickets had been sold; less than one third the actual amount.

Now, there may still be a way to game the system. If the data were evenly distributed, the math predicts that there should have been nine winners, but there were only three. This is because people tend to pick some numbers more than others: birthdays, lucky numbers, etc. So, since multiple winners was the reason for the reduced expected value, if you were to pick numbers that other people have a lower chance of picking, you

*just might* be able to get a positive expected value again. However, this would require more data-mining than I am capable of, and due to the large responsibilities associated with actually winning, I don't think I'm going to try.