## By Matthew Allen

### We’ve all been to a fair or fete and played the game ‘Guess how many sweets in the jar’ one of my favorite ones besides Dream Jackpot. Maybe your technique is to try to count as many as you can see or perhaps you’re just a wild guesser. Whatever your technique, chances are that you later found out that your guess was nowhere near to the correct answer – but, could maths help you guess more accurately?

There are two things I really like – sweets and maths. So, using maths to win a big jar of sweets would be my dream! The task we face is to guess how many sweets in a large transparent jar – if we guess correctly, we win all the sweets. Simple right? Well, the problem is that you can see the sweets around the outside of the jar, which you could painstakingly count, but what about the ones on the middle. How would you count those? Well, maths offers us two different methods for counting sweets (or any other object) in a jar.

## Wisdom of the crowd

One single person estimating the number of sweets in a jar is unlikely to be very accurate. They are likely to over estimate or under estimate the number. But what about if you add another person’s guess and find the average of them. Then, if one person over estimates and the other person under estimates by the same amount, then the average of the two guesses will be the correct answer. However, it’s unlikely that two people will over and under estimate by the same amount. So what do we do? We get even more people to guess and find the average of all their estimates.

The theory is that by combining a lot of reasonable guesses together and finding the average of them all will give a good estimate of the number of objects in the jar. It’s still unlikely that we guess the number exactly, but we’ll probably get very close.

Like all science, the best way to test a theory is to perform an experiment. I half filled this see through cup with chickpeas, took it around my office and asked people to guess how many chickpeas in the jar. I had 15 guesses, ranging from 86 to 921, but which had a mean average value of 369. After several minutes of counting, I found that there are… 442 chickpeas in the jar!

Our average value of 369 was clearly very different from the real value of 442. So what went wrong? Well, it could be that we didn’t get enough guesses. 15 guesses is relatively low, so perhaps our average would have been better if we got more guesses. Perhaps it’s just that the method isn’t very accurate. 369 is at least in the right ball park, so perhaps we should count this as a relative success?

The wisdom of the crowd method clearly isn’t that accurate, but maths does offer us another method for guessing how many sweets in the jar…

## Packing Density

There is a value in maths called the **packing density**. This is the fraction of the space taken up by an object packed inside some container that is filled with the object and not with wasted space. Imagine you had a large square box, which was exactly 50 centimetres wide and 50 centimetres long. You also have lot’s of smaller boxes which are 10 centimetres wide and long. How many of the smaller boxes could you fit inside the larger one? If you guessed 25, you would be correct. You can fit exactly 5×5 smaller boxes inside the larger one, because the larger box is exactly 5 times wider and longer than the smaller boxes.

In our box case above, the packing density of the boxes would be **1.0**, the maximum value, because there is no leftover space between the boxes. You can see this in the image here with the red boxes. But, let’s imagine the smaller boxes are actually circular. Look at the image here with the red circles; see how there is lot’s of white space between them? This means their packing density is less than one – in fact, the packing density of a circle is only **0.79** if you pack them in rows and columns (as seen in the image with the red circles).

This is a big problem for guessing sweets in a jar. It’s why you can’t just divide the volume of a jar by the volume of a sweet to get the number of sweets in the jar. Because there is empty space in the jar (because the packing density of sweets is less than 1.0), the maths is unfortunately not that simple.

So, what does all this mean? Well, if you can estimate the volume of the jar, the volume of a sweet and you know it’s packing density value, you can very accurately estimate the number of sweets in a jar.

*Imagine a cylinder shaped jar which is 10cm in diameter and 50cm high in size. The sweets inside are gobstoppers! They are spherical (so have a packing density of 0.74) and have a radius of 2cm.*

The volume of the cylinder container is worked out by multiplying the area of the end of the cylinder (πr^{2}) by the height, which comes to 15708 cm^{3}

The volume of the spherical sweets are worked out using V = ⁴⁄₃πr³ which comes to 33cm^{3}

The number of sweets in the jar is therefore equal to **(15708/33)*0.74 = 352 sweets**!

This is of course the theoretical maximum value, as not all sweets might be lined up perfectly, but it does give us a very good estimate of the number of sweets in a jar!

Depending on what shaped sweets you have, you might need to know the maximum packing density of a cylinder is 0.9. If you’re really interested and want an even more accurate estimate, check out this article which looks at random packing densities (because there’s no way sweets order themselves perfectly!)

## In conclusion…

We therefore have two different methods for estimating the number of sweets in a jar. One of them isn’t very accurate and requires you to have a lot of friends who can also make a guess, whilst the other involves a lot of maths to work it out. Whilst it’s unlikely you will be doing complex sums at your local fete to calculate the number of sweets in a jar, it’s very important for companies that have to ship items around the world. They spend lot’s of time working out how to fit as much in a box as possible to save on shipping costs.

You now know how to accurately guess the number of sweets in a jar, just don’t let this new found power go to your head!

## About the Blogger – Matthew AllenMatthew is an astrophysicist who has been working at |
---|

We are *science made simple*, a social enterprise who perform science, maths and engineering shows to schools, festivals and public audiences.