Definition
Basic Formula
For two sets and :
For three sets , , and :
General Formula
For sets :
Application
The Number of Onto Functions
Let and be positive integers with . Then, there are
onto (surjective) functions from set with elements to a set with elements.
Solution: There are functions of all kind from to . If , there are functions of all kinds from to . We need to subtract these from the original , and we need to do it for each of the members of , so this concludes
Unfortunately, a function whose range misses two members of gets subtracted twice in that computation. So we have to add is back
By this way we can get the formula at first.
Additionally, an onto function from a set with elements to a set with elements corresponds to a way to distribute the elements in the domain to indistinguishable boxed so that no box is empty, and then apply a permutation of these elements. Consequently, the number of onto functions from a set with elements to a set with elements equals to , where is the Stirling number of the second kind.
Derangement
A derangement is a permutation of objects that leaves no object in its original position. Te number of derangements of a set with elements is
or in recursive form