## The Perfect Pack – My Solution

*September 4, 2010 at 11:57 pm* *
8 comments *

Here’s a question I posted a few days ago:

A standard pack of M&M’s contains pieces of six different colors. What is the probability that there will be an even number of M&M’s of each of the six colors?

As far as I’m concerned, the type of pack you select is irrelevant, as is the proportion of the colors within the pack. Even though MARS^{®} claims a certain proportion for the mixtures at the factory, the proportion of colors varies from bag to bag. Therefore, my solution is independent of the number of M&M’s.

For each color, the number of M&M’s will be either even or odd. Consequently, the probability of having an even number of one specific color is 1/2. Since there are six different colors, then the combined probability of having an even number of every color is (1/2)^{6} = **1/64**.

I’ve eaten way more than 64 packs of M&M’s in my life, so I’m surprised that I’ve never encountered a “perfect pack.”

Entry filed under: Uncategorized. Tags: M&M's, pack, perfect, solution.

1.Shirley | September 5, 2010 at 5:48 amyes, but remember, when testing M&Ms you are a winner just for participating ~

Seems like a bigger “problem” might be that if you actually encounter a “perfect pack” then

a) how can you prove it? (you’ve just consumed the evidence unless your OCD is really kicking in and you have actually done the sorting up front)…

and

b) would that make you give up being able to encounter another in your life? Given [y]our bent toward OCD, could you continue to eat them knowing you would likely never encounter another “perfect pack”?

2.venneblock | September 5, 2010 at 6:37 amShirley, I *always* do the sorting up front. (My coworkers laugh at me for this. One describes my process as “lining up the soldiers.”)

With a probability of 1/64, and given the frequency with which I eat M&M’s, I’m likely to encounter more than one perfect pack before the end of my days.

3.Joshua | September 5, 2010 at 9:46 amThe 1/64 is a good estimate for large packs, but for small packs it’s somewhat suspect. For instance, I’m sure that it’s never going to happen with a pack of 1. With a pack of 2, well, seems like the chances should be 1/6, or actually a bit better since the colors aren’t equally frequent, and you get the sum of the squares of the probabilities of each color, which should be more than 1/6 then. With a pack of 3, probability 0 again.

No, wait, even for large packs it’s somewhat suspect. These totals are not independent. If the total number in the pack is odd, you have no chance at all! But then maybe when you have an even number in the pack the chances are closer to 1/32?

Maybe I am convinced after all by your argument that with large packs you can just figure they dump some of each color in, and the likelihood of an odd or even number of each color is about the same, treating a priori the pack as having some distribution of number of each color rather than a fixed total number.

I’d like to see the machines they actually use for filling them! I know from exercises we did in my stats classes that neither individual (large) packs nor averages of many packs seem to match the numbers they give on the web site. But of course that doesn’t mean much – maybe Californian packs are heavy in some colors and Virginian in another, or maybe the particular shipment to the particular store on the particular day is different than other shipments. Who knows. But I do think the procedure the machine uses to fill them might matter here. Among other things, it might guarantee a total number that’s always odd, in which case your probability is 0!

I think you need to start recording the number of each color in each pack and after a few dozen packs you can share the data with us.

Or maybe I’m hungry enough to go and do that myself. Only nowadays I usually buy the multi-pound costco packs.

4.The Perfect Pack – Redux « Math Jokes 4 Mathy Folks | September 5, 2010 at 5:45 pm[…] encountered a perfect pack of M&M’s, and just one day after showing that, on average, only 1 in 64 packs will contain an even number of each color, it finally happened. I bought a pack of M&M’s at the 7-11 (which reminds me of another […]

5.A random man | September 18, 2010 at 5:48 pmYour solution is too simplified. Consider a large container filled with huge amount of M&M’s divided into blue,brown,green,yellow,orange and red M&M’s in the proportion

0.24:0.13:0.16:0.14:0.20:0.13 correspondingly.

0.24+0.13+0.16+0.14+0.20+0.13=1

To fill a pack of M&M’s a random sample of size n is taken from the container. The probability that blue occurs k1 times, brown k2 times,…, and red k6 times follows multinomial distribution.

k1+k2+…+k6=n

You will need to sum all probabilities with k1,k2,… being even numbers.

6.Joshua | September 18, 2010 at 9:24 pm@A random man: I’m pretty convinced by the argument that for large n (but not fixed n, since if n is fixed to an odd number we have quite a different case for when it is an even number!), we can treat P(k_i is even) as being 1/2, independently of all the other probabilities.

I agree with you that for small n, we’ll need to do a very large multinomial calculation.

What I wonder is whether, for the typical size of packs, n is large enough for the approximation of (1/2)^6 to be good enough.

I also wonder whether the model of a pack being a random sample from the large container is good enough. Data I’ve collected in teaching statistics classes suggests that if you buy a large number of M&Ms from a given store on a given day, the proportions don’t match those that are announced by the company, and the deviation is far too large to be explained by random sampling.

7.A random man | September 20, 2010 at 2:54 pm@Joshua

Of course, we need to consider only case when n is an even number.

A priori, we take the probability of this event equal to 1/2

I did a numerical calculation with the n=54 and for simplify assumed only 3 colors in a pack (in this case the Excel spreadsheet serves ideally).

Let proportions be p1=p2=p3=1/3.

Because n is large and n*pi (i=1,2,3) are moderate (n*p1=n*p2=n*p3=18) the multinomial distribution (trinomial in given case) can be approximated by the multiple poisson distribution:

e^[-(p1+p2)*n] * [(n*p1)^k1*(n*p2)^k2]/(k1!*k2!)

Summing over all possible even numbers k1,k2 gives the probability P, that there will be an even number of M&M’s of each of the three colors

P is approximately 0.25

I hope i did not make any mistake. You may want to verify or disprove this result.

Honestly, i expected that in this case (p1=p2=p3), P=0.5 and differs from this only when p1,p2,p3 are all different from each other.

My hypothesis is that in case of 4 and more color P < 0.25

8.venneblock | September 20, 2010 at 5:29 pmYour calculations seem to lend credence to my solution.

With c=3 colors, you got p(n=54) = 0.25. And since it’s not possible to have an even number of M&M’s for every color if n is odd, then p(n=53) = 0. So p(n=53,54) = (0.25 + 0)/2 = 0.125. Since p(n=53,54) = 1/8 = (1/2)^3 for c=3 colors, then I think it stands to reason that p(53,54) = (1/2)^6 when there are c=6 colors.

I’m sure the numbers would differ slightly for larger/smaller values of n, but I think it’s insightful to consider a pair fo consecutive n where one is odd and one is even. I think your calculations seem to support rather than refute my contention.

On the other hand, I’m glad this problem is leading to such great discussion! It highlights why I love probability: Doing the calculations for a specific case can be quite onerous; but considering the general case, if you think about it correctly, can be enlightening as well as require simple calculations.

Good times!