*6. ( $k-$ derangement problem)
If a permutation of the set $\{1,2, \cdots, n\}$ without repetition satisfies the following conditions:
$$a_{1} a_{2} \cdots a_{n}$$
(1) For $k$ indices $i$, $a_{i} \neq i$,
(2) For the remaining $n-k$ indices $j$, $a_{j}=j$, then this permutation is called a $k$ - derangement of $\{1,2, \cdots, n\}$. The number of all $k$ - derangements of the set $\{1,2, \cdots, n\}$ is denoted by $D_{n}(k)$, try to find the value of $D_{n}(k)$.
6. Solution: Let $S$ denote the set of all permutations of $\{1,2, \cdots, n\}$ without repetition, then $|S|=n!$. Let
$$a_{1} a_{2} \cdots a_{n}$$

be a permutation in $S$. If for some $i(1 \leqslant i \leqslant n)$, $a_{i}=i$, then the permutation (7) is said to have property $p_{i}$, and $A_{i}$ denotes the subset of $S$ consisting of all permutations with property $P_{i}$. Thus, the problem requires the number of permutations in $S$ that have exactly $n-k$ properties. From the result of the previous problem (taking $r=n-k$ there),
$$\begin{aligned}
D_{n}(k) & =\binom{n-k}{n-k}\binom{n}{n-k} k!-\binom{n-k+1}{n-k} \\
& \cdot\binom{n}{n-k+1}(k-1)!+\cdots+(-1)^{k}\binom{n}{n-k}\binom{n}{n} 0! \\
& =\sum_{s=n-k}^{n}(-1)^{s-(n-k)}\binom{s}{n-k}\binom{n}{s}(n-s)! \\
& =\sum_{s=n-k}^{n}(-1)^{s-n+k} \frac{s!}{(n-k)!(s-n+k)!} \frac{n!}{s!(n-s)!}(n-s)! \\
& =\frac{n!}{(n-k)!} \sum_{s=n-k}^{n}(-1)^{s-n+k} \frac{1}{(s-n+k)!}
\end{aligned}$$

Note: In formula (8), by setting $k=n$, we get
$$D_{n}=D_{n}(n)=n!\sum_{s=0}^{n}(-1)^{s} \frac{1}{s!}$$

which is precisely the result from Problem 3.