Never tell me the odds!

M&Ms are yummy. At work we have ginormous bags of M&Ms to snack on. One day I reached into the bag and pulled out a handful (about 8 M&Ms). I happily munched until there were 4 left. Lo and behold! The remaining 4 were all blue. “What are the odds,” I asked myself. So I set out to find the answer.

I started by figuring out how many different M&M colors there were. My bag had 6:

  • red
  • green
  • blue
  • brown
  • yellow
  • orange

Then I assumed that there were an equal number of each color in the bag (that may not actually be true, but it makes the problem a tad easier to solve).

Armed with this information, I started up the wayback machine to go back to Computer Science 235, when, back in my college days, I studied probability. This is when I realized that I had forgotten pretty much everything I knew about probability, except dice rolling odds (which I use in Risk to conquer the world). So it turned out that memory lane wasn’t that helpful after all.

At this point I decided that I should compute the odds of choosing a handful of 8 M&Ms at random with at least 4 blue ones, this being a prerequisite of having 4 blue ones left in my hand after eating the other 4. To do this, I first drew 8 boxes on my white board, to represent the 8 M&Ms I could draw at random. This helped me reason about the problem. For any given box, I have a 1 in 6 chance of drawing a blue M&M. If I draw a blue one for a given box, that leaves 3 more I would need to also randomly draw. So I started enumerating a few permutations that could make this happen:

1 2 3 4 5 6 7 8

And so on. I realized pretty quick that there were too many permutations to enumerate so it was time to get analytical. I started to reason this way:

In position 1, I have a 1 in 6 chance of choosing blue, but I don’t really care which position the blue M&M lands in. I also know that, if I get lucky and chose blue in position 1, that does not impact my odds of choosing blue in position 2. So each position is independent. What that means is I have a 1 in 6 chance of choosing blue the first time, and again the second time, and the third time, and the fourth time. But, and this is the kicker, I don’t have to choose blue for the first 4. It just has to be any 4.

So if I were to compute the odds of choosing all 8 blue, it would look something like this:

1/6 x 1/6 x 1/6 x 1/6 x 1/6 x 1/6 x 1/6 x 1/6.

That’s a good starting point. Since we don’t have to choose all 8, but only 4, blue M&Ms, we can just throw out 4 of the terms, so we end up with this:

1/6 x 1/6 x 1/6 x 1/6

This is when I started getting confused. I started to wonder if maybe the 8 don’t have anything to do with the problem at all. Maybe the odds of choosing 8 at random, eating 4, and being left with only blue are the same odds as just randomly choosing 4 blue M&Ms.

This is when I ditched the analytical in favor of the empirical. As much as I wanted to eat 10,000 M&Ms to prove my hypothesis, I decided to write a small computer program to randomly choose 8 M&Ms from a virtual bag, randomly eat 4 of the virtual M&Ms, and then see if the remaining M&Ms were all blue. This I did, and ran it 5,000,000 times. The result: 0.077% of the time, I had 4 blue M&Ms left. That’s right, 0.077% is the same as 1/6 x 1/6 x 1/6 x 1/6. So I conclude that the odds are the same, and the problems are, in fact, equivalent.

So I beat the odds that day when I had 4 blue M&Ms left. Without even trying, I did something whose odds were 1,296 to 1, against. I should have gone to Vegas that afternoon.

P.S. The odds of having 4 M&Ms left that are all the same color (any color) are 6 times easier: 1 in 216.

P.P.S. If you want to see the source code (warning: it’s C++), just ask.

7 comments to “Never tell me the odds!”

You can leave a reply or Trackback this post.
  1. I must be lucky too. I just finished a bag of M&Ms and the last 4 M&Ms were green, yellow, yellow, red. There is only 0.0077% chance that I would have gotten this combination! I think I’ll skip work and go to Vegas! Viva Las Vegas.

  2. Not as lucky! There are many more ways to get green, yellow, yellow, red than all a single color (assuming order doesn’t matter).

  3. I realize you were being tongue in cheek, but I’ll still point out that you didn’t “beat the odds”. That’s because you didn’t predict the result *before* you did the experiment. The chances that you drew at least 4 M&Ms was exactly 1 since it already happened. It’s like hitting a hole-in-one and then wondering what the odds are of hitting another. Well since you already hit the one, it’s probability is 1 and it factors out. The remaining probability is whatever your chances are of hitting a single hole-in-one.

  4. I thought you were eating healthy at work now?!?

  5. I was eating pretty healthy until I had to eat 5,000,000 M&Ms to verify my results. They were good, but really, 5,000,000 is about 4,990,000 too many for one sitting. Hey, all in the name of math.

  6. This is rad! LOL

  7. I just had a “fun size” pack of m&ms from Halloween…6 peanut m&ms to a pack…..all six were yellow….I’m sure the probability is extremely thin on that…

Write a Reply or Comment

Your email address will not be published.