# How many permutations of [9] are there in which exactly 5 numbers are in their original position?

How many permutations of [9] are there in which exactly 5 numbers are in their original position?

My professor does not mean equivalence class, she means the set of positive integers less than or equal to 9: so {${1,2,3,4,5,6,7,8,9}$}.

This looks like a derangement problem. So my first intuition is to count the number of possible permutations of all 9 numbers, which is simply $9!$, then subtract the number of derangements which would be $D_5$. So my answer would be $9!-D_5$.

Am I thinking of this the correct way? What's a better way of going about solving problems like this Any tips?

• $D_5$ is rather small, so you are claiming that almost every permutation qualifies. That is clearly not the case. – Ross Millikan Jul 16 '17 at 17:12

• So, let's suppose all the odd numbers stay in their original position. There's only one way to do that. That means, we need to derange the remaining 4. So there are 9 derangements total for those 4 numbers ($D_4$)? – John Locke Jul 16 '17 at 17:14
• Cool that makes sense. When do we use complementary counting, to subtract $D_4$ from $9!$? Because the answer to this problem is just $D_4$? – John Locke Jul 16 '17 at 17:29