# The Pigeonhole Principle

Flash and JavaScript are required for this feature.

ALBERT MEYER: The pigeonhole principle is accounting principle. It's so obvious that you may not have noticed that you're using it. In simple form, it says that if there are more pigeons than pigeonholes, then you have to have at least two pigeons in the same hole. OK. We'll get some mileage out of that shortly. But let's remember that this is actually just an informal way of saying something that we've formally seen already.

One of the mapping rules is that if you have a total injection from a set A to a set B, that implies that the size of A is less than or equal to the size of B. And taking the contrapositive of that, it means that if the size of A is greater than the size of B, then no total injection from A to B is possible. No total injection means that there's no relation that has an arrow out of everything in A and at most one arrow into B. If everything out of A has an arrow out of it, there have to be at least two arrows, two pigeons, coming to the same pigeonhole in B.

So we know this rule already. And the only thing that's surprising about it is how you make use of it. We're not going to make elaborate uses of it in this little video. You can read in the text about some amusing applications about proving that there have to be 3 people in the Boston area with more than 10,000 hairs in their heads. But the exact same number, or that there have to be two different subsets of 90 numbers, of 25 digits, that have the same sum. But we will take a much more modest application of the pigeonholing principle.

Namely, if I have a set of five cards that I have to have at least two cards with the same suit, why? Well, there are four suits-- spades hearts, diamonds, clubs-- indicated here. And if you have five cards, there's more pigeons cards than suits holes. So if you're going to assign a pigeon to a hole, again, the pigeons are going to have to crowd up. There are going to have to be at least two pigeons in the same hole, at least two cards of the same suit, maybe more.

OK. Slight generalizations. Suppose I have 10 cards. How many cards must I have of the same suit? What number of cards of the same suit am I guaranteed to have no matter what the 10 cards are? Well, now, if I have the four slots and I'm trying to distribute 10 cards, is it possible that I had less than three cards in every hole? No, because if I have only two cards in every hole, then I have at most 8 elements and I got 10 to distribute in the four slots.

I have to bunch them up and have at least three cards of the same suit. You could check that I needn't have any more of course. So the reasoning here is that the number of cards with the same suit is going to be what you get by dividing up the 10 cards that you have by the four slots. And argue that at least one of the slots has to have an average number of cards, namely, 10 over 4. They can't all be below average. And of course since there are an integer number of cards, you could round up this-- remember, these corner braces mean round up to the nearest integer. So 10 divided by 4 rounded up is 3, and that's a lower bound on the number of cards that you have to bunch up in one slot.

More generally, if I have n pigeons, and I'm going to be assigning pigeons to unique holes, and if I have H holes, then some hole has to have n divided by H rounded up. Again, n divided by H can be understood as the average number of pigeons per hole. And the pigeonhole principle can be formulated as saying at least one whole has to have greater than or equal to the average number. And that is the generalized pigeonhole principle.