Definition:Derangement

Definition
A derangement is a permutation $f: S \to S$ from a set $S$ to itself where $f \left({s}\right) \ne s$ for any $s \in S$.

If $S$ is finite, the number of derangements is denoted by $D_n$ where $n = \left|{S}\right|$ (the cardinality of $S$.)

Also see

 * Recurrence Relation for the Number of Derangements on a Finite Set

which is shown to be:


 * $D_n = \begin{cases}

0 & : n = 1 \\ 1 & : n = 2 \\ n \left({D_{n-1} + D_{n-2}}\right) & : n > 2 \end{cases}$