Closed Form for Number of Derangements on Finite Set

Theorem
The number of derangements $D_n$ on a finite set $S$ of cardinality $n$ is:
 * $D_n = n! \paren {1 - \dfrac 1 {1!} + \dfrac 1 {2!} - \dfrac 1 {3!} + \cdots + \dfrac {\paren {-1}^n} {n!} }$

Also see

 * Definition:Subfactorial