1

For my combinatorics homework I have the following problem:

Let $A = \{a_1, a_2, ..., a_m\}$ and $B = \{b_1, b_2, ... , b_n\}$ with $m \geq n$. Show that the amount of surjective functions $f$ from $A$ to $B$ is equal to: \begin{equation} \sum_{i=0}^n (-1)^i {n \choose i} (n-i)^m \end{equation}

My first thought was that, because these functions must be surjective, for every element $b \in B$ there must be a unique $a \in A$ such that $f(a) = b$. Therefore we must choose $n$ elements in $A$ that have a unique image on $B$ and the rest of the elements in $A$ can be sent to a random element in $B$. So i was thinking about: \begin{equation} {m \choose n} \cdot n! \cdot n^{m-n} \end{equation} as the amount of all possible surjective functions $f$ from $A$ to $B$.

My second thought was that the combination is unnecessary and therefore the formula must be:

\begin{equation} n! \cdot n^{m-n} \end{equation} Is this correct? If so, how can i prove that this is the same as the summation given at the beginning?

I hope anybody can help me with this problem.

Thanks in advance!

MrTheOwl
  • 634
  • 1
    Do you know the principle of inclusion-exclusion? That will explain the formula given to you. Your first argument doesn't work because, if $m>n$, then you won't have $n$ elements in $A$ that have a unique image in $B$, since the other $m-n$ elements will share their image with some of them. Also note that your first formula will be $0$ whenever $m>n$, and your second formula will often fail to be an integer. – Kevin Long Feb 17 '21 at 15:44
  • 1
    As an aside... it is always worth performing a "sanity check", comparing the answer you get from the proposed formula you come up with against an easily verifiable case. Here, consider the case where $n=1$ and $m\gg 1$. It is plain to see that there is exactly one function from $[m]\to[1]$ but your first attempt would have you think there are $m$ different such surjective functions, many more than the total number of possible functions ignoring the surjectivity requirement. – JMoravitz Feb 17 '21 at 16:27
  • 1
    As for a sanity check which disproves your second attempt, consider where $m=n+1$. It is plain to see that there will be exactly one number in the range who is mapped to by exactly two numbers from the domain and all other numbers are mapped to by exactly one. You should be able to solve this special case by elementary methods as being $\binom{m}{2}n!$ which you should see is not equal to $n!\cdot n^{m-n}$ noting that $\binom{n+1}{2}\neq n$ for most $n$. – JMoravitz Feb 17 '21 at 16:31
  • What is going wrong is, again, that you are incorrectly applying some sort of "significance" to whether a number is the "designated representative" of the preimage for an element in the range and for these designated representatives to be treated as distinct from other elements in the preimage. In the first attempt, you allowed those designated representatives to come from anywhere in the domain. Your second attempt, you specifically made it so these designated representatives all came from the first $n$ elements of the domain. You must avoid applying such unnecessary significance. – JMoravitz Feb 17 '21 at 16:33

1 Answers1

1

The first formula follows from the inclusion-exclusion principle in the following way: denote by $F_i,$ $1 \leq i \leq n$ the set of all functions from $A$ to $B$ such that the cardinal of their images is exactly $n - i.$ Let us count these. Let $1 \leq i \leq n.$ We must first choose $i$ of the $n$ elements of $B$ that are not in the range of $f \in F_i.$ This ammounts to $\binom{n}{i}$ choices. Moreover, once we have chosen the range of $f$, we have exactly $(n - i)^m$ choices for $f,$ so that the total number is equal to $\binom{n}{i} (n - i)^m.$ Note that the surjective functions are exactly the complement of the union of the $F_i'$s. This cardinal is easily computed with the inclusion-exclusion principle and it is equal to $\sum_{1 \leq i \leq n} \binom{n}{i} (-1)^{i - 1} (n - i)^m.$ Thus the number of surjective functions is $$n^m - \sum_{1 \leq i \leq n} \binom{n}{i} (-1)^{i - 1} (n - i)^m = \sum_{0 \leq i \leq n} (-1)^i \binom{n}{i} (n - i)^m.$$

The number of surjective functions from $A$ to $B$ can also be approximated directly in a similar manner to the one you were trying to use. The method you described is more or less precisely correct. Let $f: A \rightarrow B$ be surjective. We go through the elements of $B$ one by one, starting with $b_1.$ Since $f$ is surjective, there must be $a_j \in A$ such that $f(a_j) = b_1,$ so we have $m$ choices of $a$ for $b_1.$ Similarly, for $b_2$ we will have $m - 1$ choices and so on. We get $\binom{m}{n} n!$ so far. The other elements in $A$ can be mapped to anything in $B,$ so we have another $n^{m - n}$ choices, for a total of $\binom{m}{n} n! n^{n - m}$ so far. The thing is we may allow for repetitions if we use this method, so this will not be our final answer. I hope this helps. :)

  • I forgot to add in the connection with your result, I shall add it in right now. – Actually Fritz Feb 17 '21 at 15:46
  • "The number of surjective functions from $A$ to $B$ can also be approximated directly in a similar manner to the one you were trying to use..." I disagree. The expression is quite incorrect and can be off by several orders of magnitude and is not easily fixed. – JMoravitz Feb 17 '21 at 16:36
  • By "approximated" I meant that that number is an upper bound, which is obviously true. – Actually Fritz Feb 17 '21 at 16:45