1

What is the number of surjective (onto) functions from the set [3] to the set [3].

Alison
  • 21
  • See also http://math.stackexchange.com/questions/284674/special-case-of-combinatorial-onto-functions also http://math.stackexchange.com/questions/284387/numbers-of-different-type-of-function and also http://math.stackexchange.com/questions/264799/calculating-the-total-number-of-surjective-functions – Gerry Myerson Feb 09 '13 at 05:07

1 Answers1

0

We first count the complement. There are $2^5$ functions that "miss" $1$, also $2^5$ that miss $2$, and $2^5$ that miss $3$. Add. We get $3\cdot 2^5$.

But we have double-counted the functions that miss both $1$ and $2$, also the functions that miss $2$ and $3$, also the functions that miss $3$ and $1$. There is $1$ (or if you prefer, $1^5$) of each kind, so we subtract $3\cdot 1^5$.

Thus the total number of onto functions is $3^5-3\cdot 2^5+3\cdot 1^5$.

André Nicolas
  • 514,336