I’m spending Christmas with my girlfriend’s family this year, and her mom reaches into a Costco-sized bag of M&Ms and pulls out 9 M&Ms: 3 browns, 3 yellows and 3 greens. “What are the odds of that?” she asked. Secretly, I thought: ONE. It happened, after all.

But the question sparked quite a debate: how often does it happen that you could get exactly three browns, yellows and greens when selecting nine? What a terrific moment to have a high school math teacher around, everyone thought.

Yet the question, which seemed like a standard combinatorics problem straight out of a high school textbook, puzzled me. It puzzled the whole family, including folks with degrees in STEM fields. Folks took multiple approaches and tried different sets of constraints. Chicken scratch started appearing on the backs of envelopes, then on corners of wrapping paper, then on full sheets of paper. I resisted transitioning to a spreadsheet as long as I could, which wasn’t very long.

After many instances of blurting out “I’ve got it!” only to find out that I didn’t, in fact, get it, the solution came to me as I was laying in bed at night. My girlfriend was not nearly as excited as I was when I woke her up to tell her I solved it.

In truth, it was the most fun I’d had working on a math problem in a while. I hope you’ll give it a try, and tell me how you did it!

### Like this:

Like Loading...

*Related*

Leyna Bernstein

said:You can be guaranteed that the odds are zero that I will ever wake up in the middle of the night and excitedly exclaim that I’ve solved a math problem. Merry Festivus!

a.

said:I think there are many factorials at play here…

jacquelinemauro

said:Then you had to turn around and unleash this evil on your sister. Who spent 1 minute trying to do math and then gave up and used R. Here is a quick and dirty simulation, using the proportions of m&m colors claimed by this guy: http://joshmadison.com/2007/12/02/mms-color-distribution-analysis/

#list your colors

all <- c("g","r","bl","br","y","o")

#proportion of each color in bag

props <- c(.16,.13,.24,.13,.14,.2)

#very inefficient loop – w/e

n = 100000

result = NULL

for(i in 1:n){

samp <- sample(all, replace = T, size = 9, prob = props)

result[i] <- ifelse(length(which(samp == "br")) == 3 &

length(which(samp == "y")) == 3 &

length(which(samp == "g")) == 3, 1, 0)

}

#make r tell you the answer

mean(result)

6e-05

Turns out, pretty unlikely, especially those colors.

Anna Wills

said:Do we know how many M&Ms are in the bag (n), and how many of them are brown (b), how many are yellow (y), and how many are green (g)? If so, shouldn’t it just be

[(bC3)(yC3)(gC3)] / (nC9) ?