Number of Functions Between Finite Sets
Each of the elements of can be sent to any of the elements of , giving functions; requiring distinct images gives the injective functions. These counts are used in combinatorics, probability (the birthday problem) and computer science.
LaTeX
\#\{f:A\to B\}=n^{m},\qquad \#\{\text{injective}\}=\frac{n!}{(n-m)!}\quad(|A|=m,\ |B|=n)Variables
- size of the domain A
- size of the codomain B
Example
Count all functions and the injective ones from a -element set to a -element set.
- All functions: .
- Injective: .
Answer: functions, of them injective.