Home > General, Markets > A lottery math problem

A lottery math problem

December 30, 2010

The MegaMillion Lotto Jackpot is now $237 Million. The odds of winning are about 1:175 Million. This means that if Rocky fills out 175 million lottery tickets, he is guaranteed to make a profit. (Assuming that he doesn’t have to share the prize.)


But Rocky doesn’t want to stand at his local Seven-Eleven and fill out 175 Million tickets. (After he enters  Trophy Wife’s birthdate, the dog’s birthdate,  and his lucky number from inside of a Chinese Fortune Cookie, he won’t remember what numbers to pick.)  So instead, he will ask the Seven-Eleven lottery clerk for  175 Million “Quick Pick” tickets.

A “Quick-Pick” is a computer-generated random number lottery entry. The computer picks the numbers, so Rocky doesn’t have to think that hard.

Alas, this won’t work either. Because even if Rocky buys 175 million Quick-Pick, there is some chance that he will receive duplicate Quick-Pick entries … and there is some chance that he won’t receive the winning combination.

The chance of getting a duplicate Quick-Pick should be the same as the chance of winning the lottery. But in Rocky’s case, achieving this result is an illustration of really bad luck.

So Rocky poses the following math question: What is the OPTIMAL number of Quick-Pick tickets to buy? (The optimal number should maximize the chance of getting the winning combination, and minimize the chance of getting a duplicate combination.)

As always, the reader with the best submission will receive a unique prize of dubious monetary value.

  1. December 30, 2010 at 5:40 pm

    Fakename has absolutely no idea, since the day they were handing out the math genes, Fakename had the flu. But she will say this: the time to play the lottery is not when it’s at $237 million because more people play then, thereby lowering her chances of winning further. (At least she thinks so.)

  2. December 31, 2010 at 2:05 am

    I forwarded your post to Stu Savory, who likes this kind of stuff, and he replied:

    I would have thought 1/e which is about 37% of the 175 Million. BTW, how is he going to finance the purchase? Not even a bankster is going to lend him the money for the tickets,

    • December 31, 2010 at 1:33 pm

      Fakename: in the words of the New York State Lottery advertisement: “Hey, you never know!”

      Pergie: That’s rather unSavory.

  3. Sandy
    December 31, 2010 at 1:16 pm

    The math types might say that a non repetitive permutation such as n! / (n-r)! might increase your chances exponentially (sic! pun intended).

    But I personally would be more inclined to fill iron filings in the balls on magnetized surface and rig the balls to a number chosen between yourself and the state official in charge and then a plush getaway to an unknown island for the both of you (with some plastic surgery)

    Or, you could be really devious and follow the eventual winner and “persuade” him/her to part with their ill gotten gains. Method of “persuasion” – up to you (nudge nudge wink wink)

  4. December 31, 2010 at 1:31 pm

    Sandy: Welcome to the blog and thank you for commenting. You are obviously a sagacious person of mathematical substance. Nonetheless, Rocky will wait for the lottery results to be posted after midnight tonight before he discloses his solution (which will be undoubtedly be a diluted solution after the “solutions” that he will imbibe during the evening.)

  5. December 31, 2010 at 2:05 pm

    In keeping with Sandy’s suggestions, Fakename wonders what the odds are of a close relative winning? (How many close relatives does the average person have?) If a husband or wife, you could at least expect half. Parents, you could wait to inherit. Although these options could also involve persuasion. Whatever the eventual solution, Fakename will take your word for it. She is still trying to unscramble her brain from thinking about the Three Door Problem.

  6. big al
    January 3, 2011 at 12:07 pm

    Interesting problem to think through. So here goes, with no destination in mind.

    “The chance of getting a duplicate Quick-Pick should be the same as the chance of winning the lottery.”

    Rocky is being sly here, of course, because this is true only for the second QP ticket purchased. If we’re standing at the counter with a no-limit debit card, buying QP tickets, then the first ticket, qp[1] has zero chance of being a dupe, or, to make it look like math: P(dupe(qp[1])) = 0. The second ticket, qp[2] has a 1:175M chance of being a dupe, or the same as winning the lottery, because it has that chance of being the same as qp[1]. The third ticket’s chance of being a dupe would be the chance of duping qp[1] or qp[2], minus the chance that qp[2] = qp[1]. P(dupe(qp[4])) = 3:175M – P(dupe(qp[2,3])).

    So, P(dupe(qp[n])) = (n-1):175M – P(dupe(qp[2…n-1])).

    As we buy more and more QP tickets, the chance that the next one we buy will be a dupe increases, unless the last one we bought was a dupe, e.g., if P(dupe(qp[500])) = x, and we buy qp[500] and it *is* a dupe, then P(dupe(qp[501])) = x, also. Then we buy qp[501], and it’s *not* a dupe, and that means that P(dupe(qp[502])) > x.

    Given the purchase of t QP tickets, what are the chances of winning? The answer has to take into account the dupe problem. But in general we can see that the more tickets we buy, the lower the expectation of the next or marginal ticket. (Although, in the real world, you split the pot with anybody else who also happens to get the winning number, so a dupe ticket may increase your winnings, e.g., if you have two tickets for the winning combination, and somebody else also has the winning combination, then you get 2/3 of the pot instead of 1/2.)

    It’s interesting to think about the case in which we are using the QuickPick machine to try to buy *all* the numbers to make sure we win. As we buy more QP tickets, the chances of duping increase, so that by the time we have covered all but one of the 175M possible combinations, the chance that the next ticket we buy will complete our set is back to 1:175M – a nice symmetry. An interesting variation on the question is: If you have purchased (175M + t) QP tickets, what are the chances that you have covered all the numbers?

    Or, if you buy exactly 175M QP tickets, what are the chances that you have covered all the numbers? Unless I am mistaken, it would be 1 in (175M)^2.

    Rocky’s question is: “What is the OPTIMAL number of Quick-Pick tickets to buy? (The optimal number should maximize the chance of getting the winning combination, and minimize the chance of getting a duplicate combination.)”

    I don’t really see that there is an obvious “optimal” solution. If you want to maximize your chances of winning, you have to buy a large number of tickets. Each additional ticket either increases your chances of winning, or increases your share of the pot at a specific combination, and so somehow increases your expectation, though that increase in expectation steadily declines.

    If you want to minimize your chances of getting a dupe, then you buy either 1 ticket or no tickets; qp[2] has some chance of being a dupe; qp[3] a larger chance, and so on. The “optimal” balance between P(winning) and P(duping) would seem to be a judgement call.

    Perhaps there is some very clean, simple mathematical solution. It will be interesting to see it.

    In the real world, one should probably choose between zero (stingy realist) and 1 (max[entertainment_value], min[cost]).

  7. January 3, 2011 at 12:29 pm

    Update: Rocky has not finished his math homework, so it should come as little surprise that NO ONE won the jackpot on 12/31/10!!!

    Hopefully, Rocky and friends will figure out the “optimal” solution before the next drawing on 1/4/11. The jackpot is now worth: $290 Million.

  8. January 3, 2011 at 2:08 pm

    This lottery seems to be fulfilling its’ purpose: keeping us entertained while raising cash for the state to spend on, well, whatever they spend it on.

    If I were playing this game, I would like to know how many winners used Quick Picks and how many picked their own numbers.

    The other thing I would want to know is which numbers have turned up most often in the winning combination and which ones turned up the least often. Also, how often are the numbered balls replaced?

    One theory is that due to miniscule physical differences, some numbers have a slight edge of being picked and therefor should be part of your pick. The flip side is that these differences are too small to matter, and numbers that have a history of not being are therefor more likely to be picked and you should pick them.

    I don’t play the lottery. I won $200 in a football pool a long time ago and I figure that used up all my lottery luck.

  9. January 5, 2011 at 6:18 pm

    The following was emailed to Rocky from a famous Quantum Mathematician/Physicist on the West Coast. He’s already won two unique prizes of dubious monetary value, and in order to qualify for a third, he needs to unmask himself by commenting below. He wrote:

    That’s a fun problem.

    Okay so my first approach would be to ignore risk and just try to optimize my expected return.

    Suppose I play k times, the payout is P, and the number of lotto combos is n. Then my expected return is E=Pr(win given k plays) P – k since each play always costs 1 dollar. So the challenge now is to calculate that probability. There are two ways I know to do this: a hard way and an easy way. I’ll do the hard way first as it will convinced you the easy way is right, but if you want you can skip to the easy way. The hard way involves one of my favorite probability formulas.


    Let x1, x2, …. , xk denote the quick picks and y the winning lotto number. Note that the probability won’t depend on y, so we can just assume a fixed y. Then Pr(win given k plays) = Pr(x1=y OR x2=y OR …. OR xk=y) There is a cool formula for the probability of a bunch of ORs like this. For k equals 2 it is Pr(A OR B)=Pr(A)+Pr(B)-Pr(A AND B) which one can understand by noting that Pr(A)+Pr(B) counts twice the events where both A and B occur. More generally
    Pr(A1 OR A2 OR … OR Ak) = – Sum_{r=1}^k (-1)^k Sum_{Subsets
    (s1,s2,…,sr) of {1,…,k}} Pr ( As1 AND As2 AND … Asr) This is known as the inclusion exclusion formula. For our problem it says Pr(win give k plays)=Pr(1 of the k wins)-Pr(2 of the k wins)+Pr(3 of the k wins)+…+(-1)^k Pr(all k of the k win) This is then Pr(win given k plays)=k (1/N) – (k choose 2) (1/N^2) + … + (-1)^k 1/N^k Or Pr(win given k plays) = -Sum_{j=1}^k (k choose j) (-1/N)^j = 1-Sum_{j=0}^k (k choose j) (-1/N)^j = 1 – (1-1/N)^k where I’ve used the binomial theorem to perform the sum. So Pr(win given k plays) = 1-(1-1/N)^k


    Well since the hard way gave such an elegant answer there must be an easy way to calculate it. And indeed there is. First note that Pr(win given k plays) = 1 – Pr(no win given k plays) Now in order to not win, every single draw must not equal the lotto number, y. And this is independent of whether previous numbers drawn were the same or different. The probability of not winning is thus just Pr(no win given k plays) = Pr(no win for 1 play)^k From which it follows, since Pr(no win for 1 play)=(N-1)/N that Pr(win given k plays) = 1-(1-1/N)^k


    Okay so back to the problem of optimizing the expected value, which we now know to be E= [1-(1-1/N)^k] P -k optimizing for k (dE/dk=0) gives P ln(1-1/N) (1-1/N)^k = -1 where ln is the natural log. Or, solving for k, k= ln(-1/P ln(1-1/n)) / ln(1-1/n) which looks prettier if I define c = 1/ln(1-1/n) k = c ln(-c/P)

    For n = 175711536 and P=237000000, this occurs at (rounding a bit) k = 52,575,790 for which the expected return is (round a bit) E=8,712,5760 Note that at this point the probability of winning is about 25.9 percent.

    Of course this all ignores the question of the risk involved (plus multiple winners, lesser prizes, etc.)

  1. No trackbacks yet.
Comments are closed.
%d bloggers like this: