Fuck scratch tickets, slot machines, sports betting or table games — the ultimate gambling thrill is in raffles. The experience of perusing the prize options — restaurant gift cards, movie night baskets, a handcrafted rocking chair donated by the local Mennonite community — and deciding where to try your luck is, in a word, bliss. And when the local PTA mom or whoever lists off your matching numbers and you get to walk up there in front of everyone and haul away your gorgeous new rocking chair… name a better moment.

I want to experience it as many times as possible. While Lady Luck may be the dictator of this realm, there is some strategy one can employ, but it takes some calculus to figure out. If I were any good at calculus, I wouldn’t be here, so, I asked Matt Zaremsky, an assistant professor of mathematics at the University at Albany — and our resident Dwayne Johnson expert — for some help.

“The first mathematically interesting case is when there are 2 prizes, you have 2 tickets and each prize’s basket has just 1 other ticket in it from someone else,” says Zaremsky. “For simplicity, let’s say the prizes are equally desirable. Your options are, put both tickets in one basket, or put one ticket in each basket.”

In the first strategy, if you utilized both of your tickets on one prize, you would have a 2 out of 3 chance of winning that prize, and no chance of winning the other prize. In the other scenario, where you put 1 ticket in each basket where there is already 1 other ticket, it would seem that you’d have a 1 out of 2 chance of winning. But that doesn’t actually represent your odds for winning something overall.

For the second strategy of placing one ticket in each basket, “You have a 1 out of 2 chance of winning the first drawing and a 1 out of 2 chance of winning the second drawing. Clearly, the chance that you win both drawings is 1 out of 4. But what are your odds of winning at least 1 drawing? This is hard to compute directly,” says Zaremsky.

“The easiest approach is to compute the odds of the exact opposite outcome, and then subtract that from 100 percent. So, you have a 1 out of 2 chance of losing the first drawing and a 1 out of 2 chance of losing the second drawing, which yields a 1 out of 4 chance of losing both. This means you have a 3 out of 4 chance of winning at least 1 drawing,” he says. “So in this case, it’s smarter to put 1 ticket in each basket than it is to put both tickets in 1 basket, since three out of four is better than 2 out of 3.”

Of course, most raffles are a bit more complicated than this — there could be any number of baskets, with any number of tickets already in them. However, Zaremsky says there’s a strategy for this, too. “This is a type of problem from multivariable calculus that requires the method of Lagrange multipliers,” he says (something I personally have never even heard of).

The actual math is nearly gibberish to me, but according to Zaremsky, it looks something like this:

“Say there are

kbaskets and thei’thbasket hasn_itickets from other people in it. If you have m tickets and putm_iof your tickets in thei’thbasket then you have anm_i/(m_i+n_i) chance of winning thei’thdrawing, and ann_i/(m_i+n_i) chance of losing. The chance of losing every drawing is therefore the product of all of these:(n_1….n_k)/(m_1+n_1)…(m_k+n_k). The goal is to minimize this value, or equivalently to maximize the denominator(m_1+n_1)…(m_k+n_k), subject to the constraint thatm_1+…+m_k=m.”

Or, in English, “Add your tickets to the baskets in such a way as to try and get the same number of total tickets in every basket (or as close to that as you can). For example, if you show up with 8 tickets, and the 3 baskets have 6, 7 and 9 tickets respectively already in them, then you should add 4 to the first, 3 to the second, and 1 to the third, so now they each have 10. This will maximize your chances of winning a prize.”

Basically, while your odds of winning will be different for each basket, this strategy ensures that you’re maximizing your odds of winning one of the lower-ticket baskets, while also maximizing the number of opportunities to win overall by playing the higher-ticket baskets, as well. Distributing your tickets so that each basket has equal tickets is the simplest way to calculate this.

Though you won’t know *which* prize you’ll win, this method at least enhances the prospects of winning *something.* And of course, as everyone knows, raffles aren’t about the prizes themselves, but the sheer thrill of triumph.