# Inclusion and exclusion rule for complement of a set

Every natural number in the set {${1, 2, 3, ..., n}$} occurs exactly twice in an array. How many such permutations are there in which no two same numbers are neighbours?

I know the problem should be solved by using principle of inclusion and exclusion and I've determined the number of all elements and those in sets without intersections. But, when counting elements in, e.g. $A_1 \cap A_2$ (where $A_i$ contains $i$ as neighbours), I can obtain correct number, but I had to count them by "chasing" cases.

Solution to this problem is: $\sum_{k = 0}^n(-1)^k\frac{(2n-k)!}{2^{n-k}}$ What is "smart" way to count this, without checking for cases? Thank you in advance.

• You have everything you need. $A_i$ is the set for which $(ii)$ is a single object so $|A_i|=(2n-1)!/2^{n-1}$ because there are $2n-1$ objects of which $n-1$ are pairs, hence the division by $2^{n-1}$. For $A_i\cap A_j$ treat $(ii)$ and $(jj)$ (for $i\ne j$) each as single objects, there are now $2n-2$ objects, $n-2$ pairs giving $|A_i\cap A_j|=(2n-2)!/2^{n-2}$ and so forth. Applying PIE gives the summation $$\sum_{k=0}^{n}(-1)^k\binom{n}{k}\frac{(2n-k)!}{2^{n-k}}$$ which is not quite what you have. – N. Shales Aug 23 '17 at 14:53
• Just to clarify: where I wrote "$n-1$ are pairs" this means that the $2n-2$ remaining objects (excluding $(ii)$) are divided into $n-1$ pairs, each pair containing identical elements. – N. Shales Aug 23 '17 at 15:04
• Yes, I forgot to multiply it by the number of k-subsets during summation. – Nemanja Beric Aug 23 '17 at 15:08
• I understand it now. Thank you – Nemanja Beric Aug 23 '17 at 15:12
• You're most welcome :) – N. Shales Aug 23 '17 at 15:26