[Math] Number of permutations where only odd elements must be deranged

combinatorics

I am practicing exclusion/ inclusion principle and trying to solve the following problem:

How many permutations of $1,2,3,…,n$ are there in which only the odd integers must be deranged (even integers may be in their own positions)?

My answer is:

$\sum_{j=0}^{n/2} (-1)^j\binom{n/2}{j}(n-j)!$ if $n$ is even

$\sum_{j=0}^{(n-1)/2+1} (-1)^j\binom{(n-1)/2+1}{j}(n-j)!$ if $n$ is odd

Am I right?

Best Answer

Your answers are correct. Ignoring the alternating sign, in each summation the $j$ term is the number of ways to choose a set $F$ of $j$ odd numbers from $[n]$ and form a permutation of $[n]$ that fixes $F$ pointwise, so the alternating sum is exactly what the inclusion-exclusion argument requires: $j=0$ starts it off with all possible permutations of $[n]$, $j=1$ subtracts those with at least one specified fixed point, $j=2$ restores those that were subtracted twice, and so on.