# The Math of Shopping

It’s easy to identify people who can’t count to ten. They’re in front of you in the supermarket express lane.

M. Grundler

Let’s set the scene, shall we? You keep a list of household items that you need and about once a week or so you head out to the supermarket to stock up. Also, since you’re probably not independently wealthy, you probably have a budget for how much you want to spend on these items so let’s say you don’t want to go over \$100.

Now you’re at your local supermarket and your goal is to get the items on the list without exceeding your grocery budget for the week.

In other words, you’re doing math.

There’s a field of mathematics known as operations research which, simply put, is the math of decision-making. Specifically, what you’re doing is solving what is known as the Knapsack Problem:

“A tourist wants to make a good trip at the weekend with his friends. They will go to the mountains to see the wonders of nature, so he needs to pack well for the trip. He has a good knapsack for carrying things, but knows that he can carry a maximum of only 4kg in it and it will have to last the whole day. He creates a list of what he wants to bring for the trip but the total weight of all items is too much. He then decides to add columns to his initial list detailing their weights and a numerical value representing how important the item is for the trip.

The tourist can choose to take any combination of items from the list, but only one of each item is available. He may not cut or diminish the items, so he can only take whole units of any item.

Which items does the tourist carry in his knapsack so that their total weight does not exceed 400 dag [4 kg], and their total value is maximised?”

The use of the metric system aside, this is exactly what we do whenever we go grocery shopping. Operations research is the mathematics of minimizing the stuff that you don’t want (don’t spend more than \$100) and maximizing the things you do want (getting as many items on your shopping list as possible).

But consider this: Operations research has only been around since the second World War but humans have been (metaphorically) grocery-shopping for centuries. So math is not this Other that is separate from our daily lives but instead comes directly from who we are and what we do as humans.