## Egg carton theory

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.

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 *P _{bad}* that each egg in a carton is broken. Let's say

*P*=1/100. The probability that an egg is not broken is

_{bad}*P*= 1-

_{good}*P*.

_{bad}If everyone is buying cartons without inspecting their contents, then *P _{bad}* 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

*c*of a non-broken egg to you:

_{adj}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 *P _{N-good}* (assuming that egg breakings are independent events):

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:

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:

This approximation holds for low values of *P _{bad}*. 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.

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