Number of ways to rearrange $ n $ books so that exactly $ m $ of them stay at the same spot

39 Views Asked by At

If there are $ n $ books, then the number of ways to rearrange them so that at least $ m $ of them stay in the same spot is $ \binom{n}{m}(n - m)! $. If the question is changed to the number of ways to rearrange $ n $ books so that exactly $ m $ of them stay in the same spot, then I currently stuck. My approach is to count the number of rearrangements of the $ n - m $ books so that none of the book belong to its original position. Then substract that number from $ (n - m)! $, but I don't know how to compute that number. Can someone give me an approach?

1

There are 1 best solutions below

0
On

You can select $\binom{n}{m}$ of the elements to be fixed points and you want the other $n-m$ elements to form a derangement. The number of derangements of $t$ elements is $$t!\cdot \sum_{k=0}^{t}\frac{(-1)^k}{k!}.$$ This formula can be derived by the principle of inclusion-exclusion. Thus, the answer is $$\binom{n}{m}\cdot (n-m)!\cdot \sum_{k=0}^{n-m}\frac{(-1)^k}{k!}.$$

EDIT: This formula will not work for $m=n$ but the answer should be obvious in that case. It's $1$ because the identity map is the only possibility.