Egg carton theory

07.11.2015 21:30

Waiting in line at a grocery store is a common opportunity for random thoughts inspired by that particular locale. The other day I was buying some eggs and I saw someone in front of me opening up the cartons and inspecting them for broken eggs before taking them from the shelf. The cartons don't have seals on them, so this appears to be a pretty benign, if somewhat selfish behavior.

Having been tangentially involved in some game theory work recently at the Institute, it made me think about this in a bit more analytic way.

A half-empty carton of eggs.

Let's say that the price of one egg is c=1 and that each carton contains N=10 eggs. There is some fixed probability Pbad that each egg in a carton is broken. Let's say Pbad=1/100. The probability that an egg is not broken is Pgood = 1-Pbad.

If everyone is buying cartons without inspecting their contents, then Pbad is also the probability that an egg you've bought is broken, regardless of the size of the carton. You can calculate the adjusted cost cadj of a non-broken egg to you:

c_{adj} = c \cdot \frac{1}{P_{good}} = c \cdot \frac{1}{1-P_{bad}} \approx 1.01

In other words, for every 100 eggs you buy, you would have to buy one extra on average to make up for the broken one you unknowingly bought.

How would that change if everyone would inspect cartons before buying them? In that case, nobody would buy a carton if at least one egg is broken. These cartons would be left on the shelves and, assuming the shop doesn't reshuffle the contents of their cartons, thrown away when their best-before date passes. Of course, the shop would then raise the price of egg cartons to make up for those cartons it could not sell.

The probability that none of the eggs in the carton are broken is PN-good (assuming that egg breakings are independent events):

P_{N-good} = P_{good}^N = (1 - P_{bad})^N

The cost of a non-broken egg for you is now the same as the price you pay in the shop, since you make sure that you buy only good ones. However, the cost of an egg for the shop, and hence what you pay, is now:

c_{adj} = c \cdot \frac{1}{P_{N-good}} = c \cdot \frac{1}{(1 - P_{bad})^N} \approx 1.11

The difference with an unadjusted cost is now approximately 10 times higher. Again, this makes sense - instead of one extra egg for every 100 you buy, the shop must now buy an extra 10 to make up for the broken one and 9 good ones they threw away. In other words, 1% of broken eggs now make the final cost of an unbroken egg more than 10% higher. It doesn't seem so benign now, does it?

By the way, this is an interesting result also from the mathematical point of view. Notice, how the difference is approximately a multiple of N, even though N in the formula is in the exponent? This is the consequence of the following first order Taylor series approximation:

P_{N-good} = (1 - P_{bad})^N \approx 1 - N\cdot P_{bad}

This approximation holds for low values of Pbad. An intuitive explanation for it would be that it ignores the cases where multiple eggs in a single carton are broken.

Anyway, you can look at this as an example where selfish behavior makes things worse for everyone in the long term. Or you can think of it as a lesson in engineering. When a failure of any single individual component causes the whole system to fail, even low probabilities can quickly add up. In any case, calculating probabilities makes time waiting in lines pass faster.

Posted by Tomaž | Categories: Ideas

Comments

Other than watching Beautiful Mind, I have no experience with game theory. However, I do have a lot of experience buying eggs, and that experience would argue your initial assumptions are over simplistic. Most all egg cartons I have purchased contain 12 perfectly good (well, usually 18) eggs. They are almost never are broken (say 1 in 500 at least). When they are, I usually find more than half are broken!

This is either because customers repackage the eggs (I've done this, to combine bad cartons and to make a good one) or because the store employs careless self-stocker's who drop the hole carton or more likely is due to careless irresponsible customers... The point being, my cost isn't going to be one broken egg in 12, but rather 6 of 12, effectively doubling the price - or worse if you include the price of returning to the store for more (since breakfast for four kids and two parents takes ~12 eggs).

So I guess I'm arguing that egg-carton-checkers aren't making things worse for everyone in the long run... rather careless people who are selfish are (if they knowingly break an egg and don't buy it, or stock the shelves with it anyway).

As I final comment, I have never had a broken egg form the local big warehouse store, where I buy them in double 18 pack cartons, probably because the are packaged well... and when I shopped at a small local store, they gained a loyal customer when the checkout clerk found a broken egg in a carton I was buying and insisted on swapping out my carton.

Glenn

Glenn, thanks for sharing your experience. Of course I'm greatly oversimplifying things. Lines at the cash registers are not that long, after all.

I guess the pattern of broken eggs depends on how the shop and suppliers handle the cartons. I'm not a big consumer of eggs, but thinking back, 1 in 100 seems like a good estimate from my experience. I also never got more than one broken egg in a carton, which is why I assumed that broken eggs are independent events (it also makes calculation simper). It might be that the cartons that were dropped are removed from the shelves in the shops I frequent.

Posted by Tomaž

Add a new comment


(No HTML tags allowed. Separate paragraphs with a blank line.)