# probability of pairs in a stack

I have a set of 12 dinner plates in 6 colors, 2 of each color. (red, orange, yellow, green, blue, and purple; I'm sure the manufacturer has fancier names for them). I've noticed that when I return them to the cabinet from the dishwasher, there is usually at least one color where the 2 plates are next to each other. So this raises a pair of questions:

1. If the plates are stacked in random order, what is the probability of at least one pair of matching plates in the stack?
2. If my perception is correct that there is "usually" at least one pair, is that an expected result, or am I biasing the stacking to a less-random result by picking the same colors consecutively without realizing I am doing so?

For the first question, the answer should be $$\frac{\text{orderings with a pair}}{\text{total orderings}}$$

Total orderings is $$\frac{12!}{2 ^ 6}$$ because each of the pairs of plates is indistinguishable from each other.

I'm stuck on how to calculate the number of orderings with a pair. I think it would be easiest to count the number of orderings without a pair, by observing that as the plates are stacked, there is always at most 1 choice for the next item in the stack that would result in a pair, so $$12 \times 10 \times 9 \times 8 \dots$$ or $$n \times (n-2)!$$ but that will be undercounting because if the potential partner to the plate on top of the stack has already been buried then all the remaining plates are valid at that point.

For a small problem like this I can enumerate the whole sequence of 12 terms, but it seems like there is a more general solution here that I'm overlooking.

For the second question about if I'm being truly random or not, I don't even know where to begin.

Edit: fixed total ordering count

• Total orderings is probably $12!/2^6$ Commented Jul 18 at 18:50
• You could divide the stack into pairs in two ways and see the chances of having any matches, using math.stackexchange.com/a/4045055/889261. First say that the pairs are first-second, third-fourth, fifth-sixth, etc. Find how many of those pairings result in a match. Then say that the pairs are second-third, fourth-fifth, sixth-seventh, etc and see how many of those pairings result in a match (same number as before, but subtract off all instances where first-twelfth is a match) Commented Jul 18 at 18:54
• Note that the probability of a given pair of adjacent plates being the same color is just $1/11$, so you might guess the overall probability of no pairs to be about $(10/11)^{11} \approx 35.05\%$ (treating all the pairs as roughly independent). An exact enumeration gives the result as $731/2079 \approx 35.16\%$, so that back-of-the-envelope guess is extremely close. Commented Jul 18 at 19:56

In order to solve the counting problem, it is easiest to use the principle of inclusion exclusion. I will solve the complementary problem, of counting orderings without any adjacent same-colored plates.

As you said, the number of total orderings is $$12!/2^6$$. From this count, for each color, we will subtract the orderings where the plates of that color are adjacent. For example, to count the orderings where the two blue plates are together, you treat those two blue plates as a single unit, then you permute the eleven units in $$11!$$ ways, and finally divide by $$2^5$$ to account for each of the other colors having two identical plates. So, there are $$11!/2^5$$ ways for the blue plates to be together; we must subtract this for each color, so we subtract $$6\times 11!/2^5$$.

However, stacks with two same-colored adjacent plates will be doubly subtracted in the last paragraph, so we must add back in the number of such doubly counted arrangements to compensate. There are $$\binom 62$$ pairs of colors, and each pair has $$10!/2^4$$ arrangements where both colors have their plates together, so we add in $$\binom 62\times 10!/2^4$$. The principle of inclusion exclusion says we must continue in this fashion, next subtracting the stacks where three colors are together, then adding in the stacks where four colors are together, etc.

The final answer for the number of arrangements where no colors are together is $$\frac{12!}{2^6}-\binom 61\frac{11!}{2^5} +\binom 62\frac{10!}{2^4}-\binom 63\frac{9!}{2^3} +\binom 64\frac{8!}{2^2}-\binom 65\frac{7!}{2^1} +\binom 66 6!\\=2631600.$$ Therefore, the probability of no same-colored pairs is $$\frac{2631600}{12!/2^6}\approx 0.3516$$. In particular, about $$65\%$$ of the time, you should see at least one same-colored adjacent pair. This agrees with your observations.

Generalizing this logic, when you have $$n$$ pairs of plates stacked in a random order, the probability that there are no same-colored adjacent plates is $$\sum_{k=0}^n (-1)^k\binom nk \frac{(2n-k)!\cdot 2^k}{(2n)!}.$$ As $$n$$ approaches infinity, this probability approaches $$1/e\approx 0.367879.$$

#### Poisson Approximation

A powerful tool for many combinatorial problems is Poisson approximation. The general idea is that when you have lots of rare events, and those events are approximately independent*, then the number of events which occur which be approximately Poisson distributed.

Specifically, suppose there $$n$$ events $$E_1,\dots,E_n$$, with probabilities given by $$\mathbb P(E_i)=p_i$$ for each $$i$$. Let $$X$$ be the random variable equal to number of events which occur. Let $$\lambda=\mathbb E[X]=\sum_{i=1}^n p_i$$, and let $$Z$$ be Poisson distributed with parameter $$\lambda$$. If Poisson approximation works, then $$X$$ will be approximately distributed like $$Z$$.

In your case, we have six events, one for each color, corresponding to that pair of plates of that color being adjacent. The probability of each event is $$11/\binom{12}2=1/6$$, so Poisson approximation requires $$\lambda=6\times 1/6=1$$. Then, we conclude as follows: $$\mathbb P(\text{no colors together})=P(X=0)\approx P(Z=0)=e^{-\lambda}=e^{-1}\approx 0.367879.$$ This explains the appearance of $$1/e$$. The exact answer was $$P(X=0)\approx 0.3516$$, so Poisson approximation provided an answer with a $$5\%$$ relative error, which is not too bad for a back-of-the-envelope calculation. Notice how much time this saves compared to doing the full inclusion-exclusion method.

Following the same reasoning when there are $$n$$ pairs of plates, you get the same approximation of $$1/e$$ for the probability of no plates being together.

*When I say "approximately independent", I am being vague. See Two Moments Suffice by Arratia, Goldstein, and Gordon for a precise formulation of approximate independence. https://projecteuclid.org/journals/annals-of-probability/volume-17/issue-1/Two-Moments-Suffice-for-Poisson-Approximations--The-Chen-Stein/10.1214/aop/1176991491.full.

• I obtained the same result through brute force computation; I counted the desired probability with the Mathematica command Length[Select[#, MemberQ[Rest[# - RotateRight[#]], 0] &]]/Length[#] &[Permutations[Ceiling[Range[12]/2]]] which returns $1348/2079$, which is the complement of your complementary probability. Commented Jul 18 at 21:50
• Is there a quick way of seeing why the probability should approach $1/e$ without writing down the inclusion-exclusion formula? Very cool Commented Jul 19 at 0:37
• Ahh, fantastic! And I guess that formalizes the earlier comment on the question, where the probability of no pairs is approximately $((n-1)/n)^n$, which also yields $1/e$ Commented Jul 19 at 1:25
• "The probability of each of these events is 2/11" I'm not so sure about that, to me it seems to be 1/6 = $\frac{\frac{11!}{2^5}}{\frac{12!}{2^{6}}}$ is this wrong?
– Otis
Commented Jul 19 at 1:49
• Thanks for catching that error. This is what happens when I don't show my work! (> <') Commented Jul 19 at 1:57