M&M Packing


Determine how efficiently you can pack M&Ms (or some other shape) into a box (or some other container?) Is there an arrangement of the candy that can be used to increase the number of M&Ms? What is the comparison between M&Ms randomly dropped in and M&Ms carefully ordered?


Procedure: Easy

Concept: Easy


Go to your candy jar and find an M&M, or a Reese's Pieces, or a Mike and Ike (are those still around?), or any kind of candy. Don't have any M&Ms easily accessible? Well here's a picture of one:

If your mom used to pack your lunch for you like my mom did, she probably put some candy in your lunch box as a treat. You may have wondered, “Why didn't she put more M&Ms in?”, which is an important question at lunch time. The answer to this question may be mathematical; maybe she couldn't put any more M&Ms in than she did. This project will help you find out if that is true.


If we look down at an M&M, its two dimensional projection is just a circle. So what if we tried to simplify the problem of packing M&Ms in a box to packing circles in a square. Does the number of circles which can be squeezed in change as we change the arrangement? One possible arrangement is:

Square Lattice

but is this the optimal packing? How can we be sure that there is not a better arrangement? Consider the following:

Triagular Lattice

This certainly seems like a less efficient packing because of the wasted space at the top, but there are 5 more circles here than in the first picture. In fact the German mathematician Carl Friedrich Gauss proved that this latter arrangement (see Wolfram Mathworld Circle Packing) is the best for circles in two dimensions.

This sort of problem also has many theoretical implications as well, just look at packomania.com.

Like so many things in mathematics, the problem becomes much more complicated in three dimensions. There is no longer a perfect proof that shows what the best arrangement is, and it is up to you to experiment.



There are three parts to this experiment: finding the volume of an M&M, arranging the M&Ms in order and arranging the M&Ms randomly.

Volume of an M&M

First we must determine the volume of an M&M; however, since each one is slightly different, this must be done experimentally. Fill a 100ml-graduated cylinder to 80ml with water. Drop M&Ms into the cylinder one at a time while keeping count of how many you have used, until the water level rises to 100ml.

The final amount of M&Ms, let's call this amount m, occupies 20ml of space. Hence each M&M occupies 20/m, or 20÷m, ml of volume. Repeat the above experiment several times and average the results (can be done in Excel) to help guarantee accuracy. Your result is the experimental volume of an M&M, which we call VM&M. Now take your empty rectangular box and measure the height h, width w and depth d of it. Multiply these together to find the volume of the box, called Vbox = hwd.

Ordered Arrangement

Start ordering M&Ms into a first layer in the box. You can use either of the two arrangements suggested on the last page, or any other arrangement you have thought up. After the first layer is complete, it may look like this:

Make sure to keep track of the number of M&Ms used; it may help to have several piles of 50 M&Ms set aside and then count how many are left afterwards. Now continue placing M&Ms in a similar arrangement in the second layer. It may not be possible to stack them exactly the same, but try and be as close as possible. Your second layer may look something like this if each M&M is placed in the space between 4 first layer M&Ms:

Continue filling your box with M&Ms until no more can fit. Remember how many M&Ms you have put into the box, and call it N. We will now compute the proportion r of space in the box taken up by the M&Ms:

r =

You should repeat this experiment several times with the same packing and average the results (perhaps using Excel Statistics Formulas) to help guarantee accuracy. Also experiment with other orderings and compare those results to these. A higher r value should indicate a tighter packing, whereas a lower r value indicates more wasted space.

Random Arrangement

Now that you have considered several ordered arrangements, you should also consider random arrangements. To do this, use the same box as you used before so that these random results can be compared to your ordered results. First, put aside as many M&Ms as you needed when you did the ordered packing, and make sure you know exactly how many there are; call that number Mi. Now simply pour M&Ms into the box until it is full, but not overflowing. Your box should look something like this:

Count the number of M&Ms left over in the pile that originally had Mi; the number that are left is Mf. Subtract these two numbers we find the number of M&Ms in the box Mbox = Mi - Mf. You can compute the ratio of space taken up by the M&Ms to total space in the box, called r, using this formula

r =

This random ordering experiment should be repeated many times (at least 40) and the results should be averaged (Again, Excel is suggested) because of something called the Law of Large Numbers. Basically it states that the more times you try a random event (packing M&Ms), the closer your average gets to the true outcome (the real r value).


Compare your r values for each of the orderings you considered. Is there a best ordering among them? Is there a significant difference between the results, as there was in the circle packing example earlier? How do your results for an ordered arrangement compare to the ratio for the random arrangement? Just as a reference, when placing spheres in a box, the best arrangement gives r ≈ .7405, and a random arrangement should average out near r ≈ .64. Of course you're not using spheres so your value will be different.