top of page
  • Writer's picturehenryfarleyjohnson

Coca-Cola and Combinatorics

This post is inspired by a conversation with friends D. and N.

As a kid, few things were more electrifying than ordering a fountain drink and being handed an empty cup-- this meant that you got to go to the fountain and pour your own drink! This was fantastic for two reasons: 1) Free refills 2) Custom combinations.

And like so many of you, I would abuse my pouring privilege by concocting a "suicide," the crassly named combination of all spigots in the pop fountain. Why mix Coke with orange Hi-C?? Because we could, god damn it! I haven't drunk this swill in years, but I recall lemonade and root beer being the flavors that screamed just a bit louder than the rest.

So how does this relate to math? Well, during my freshman year of college, I was eating lunch with my friend W. when I challenged him with the following question: Ignoring different amounts of mixtures, how many unique drink combinations could you make using the fountain in our dining hall?

Without hesitation, W. had an answer: using our fountain of 10 drinks, you could make 1023 combinations. This blew my mind. It turns out this question is right in the wheelhouse of a subfield of math called combinatorics. And the thinking underpinning W.'s answer is that for a set of n elements, there are 2^n subsets.

He explained it to me like this: imagine that each drink in the fountain has an on/off switch. If the switch is on, the drink will be included in the combination. If the switch is off, the drink won't be included. So the number of combinations of on/off switches would be 2^10 because there are 10 switches, each of which has 2 options. 2^10 = 1024, so why was his answer 1023? Because one of those combinations would have every switch turned off, meaning no drink is being poured.

For example, suppose a machine only had Coke, Sprite, and Fanta. We know from W.'s thinking that there should be 7 options (2^3 minus the empty one). Let's write them out: Coke, Sprite, Fanta, Coke + Sprite, Coke + Fanta, Coke + Sprite + Fanta, Sprite + Fanta. Woohoo, 7 options!!!

But here's where things get fun: if you, like me, are well acquainted with fast food establishments and movie theaters, you've probably seen the mesmerizing Coca-Cola Freestyle machine. (So enchanting is this contraption that in middle school, when my friend C. had heard a burger shop in Geneva, IL had one, we biked 20 miles each way just to get lunch and chug pop until our guts hurt.)

According to Wikipedia, the Coke Freestyle machine has 165 different drinks, meaning there are (2^165)-1 unique combinations to be concocted. (Again, we're ignoring drink ratios and assuming that a Cherry Coke + Sprite is different from a Coke + Cherry Sprite...)

This is an insanely, almost incomprehensibly high number! It's around 4.68 x 10^49. How huge is that? Take the number 1 with 30 zeroes. Now multiply it by the number of grains of sand on Earth. There are still more drink combinations in a Coke Freestyle.

An equally fun fact: there's also a Pepsi version of the Freestyle machine.


bottom of page