I'd like to find the number of permutations of the set
$$\{x_1, x_2, ... , x_n, y_1, y_2, ... y_n\}$$ where that $x_i, y_i$ are not consecutively located for each $i \in[n]$
solution
Let $A_i$ be the collection of cases where $x_i$ and $y_i$ are "next to" each other for given $i$.
Then through the principle of inclusion and exclusion :
$$\mid\cup_{j\in[n]} A_j\mid = \sum_{\emptyset\ne J\subseteq[n]}(-1)^{\mid J \mid-1} \mid\cap_{j\in J} A_j\mid$$
Then our desired number of permutation is its complementary which is :
$$(2n)!-\sum_{\emptyset\ne J\subseteq[n]}(-1)^{\mid J \mid-1} \mid\cap_{j\in J} A_j\mid$$
Additionally, since
$$\mid\cap_{j\in J} A_j\mid = (2n-\mid J \mid)!\cdot 2^{\mid J \mid}$$
The number we want is :
$$(2n)!-\sum_{\emptyset\ne J\subseteq[n]}(-1)^{\mid J \mid-1}(2n-\mid J \mid)!\cdot 2^{\mid J \mid}$$
Hereby the Question is:
Is there any margins to be more generalized?