We’ve all been to a barbecue and gone to the ice bucket filled with beers, grabbed a can of whatever cheap beer the host bought, popped it open and gulped a mouthful of warm, disgusting liquid. Turns out all the ice is melted and now all the beers are undrinkable. How could this situation be avoided?

Like most problems, Science has an answer. It’s all explained in this formula:

∆Ethermal = mC∆T

There you go. Now you know how much ice you need. Have fun!

Ok, here’s a more detailed explanation. All objects have thermal energy. If you put two objects into contact, thermal energy transfers from the hotter object to the cooler one. Duh, obviously. So let’s assume that a drink starts a room temperature at 72°F or 22°C (celsius is better for math, in case you didn’t know). And let’s assume the ice is at freezing temperature of 32°F or 0°C. Now the average can of beer consist of 355 ml which is the same as 355 grams.

So we know the temperature of the ice and the beer and how much beer we want. We can now plug these numbers into the above equation to see what temperature our beers will get depending on how much ice we put in. We get a graph that looks like this:

Geek Physics

Geek Physics

In order to get our beer to the same temperature as the ice, we need 250 grams of ice. So if you have a six-pack, you’ll bee 1.5 kg of ice to effectively keep it cold.

By the way, we did none of the calculations for this. All math above was done by physics professor Rhett Allain for his new book Geek Physics: Surprising Answers to the Planet’s Most Interesting Questions. The book can be purchased on Amazon.

After all this math, you’ll probably need a beer to keep your head from exploding.

(h/t Business Insider)

Joseph Misulonas is an editorial assistant for Playboy.com. He got an A in high school physics, so he’s barely qualified to write about this. He can be found on Twitter at @jmisulonas.