0

How many surjective functions $f:\{0,1,2,3,4\} \rightarrow \{0,1,2,3\}$ are there?

So as I understand it I need to determine how many functions map from the set $\{0,\ldots,4\}$ to the set $\{0,\ldots,3\}$ such that for every element in $\{0,\ldots,3\}$ there is at least one element in $\{0,\ldots,4\}$.

My guess is that the total number of functions is $4^5$.

nmasanta
  • 9,222
  • 3
    HINT: If $f$ is a surjective function from ${0,1,2,3,4}$ to ${0,1,2,3}$, there must be exactly one element of ${0,1,2,3}$ that is the image under $f$ of two different elements of ${0,1,2,3,4}$. – Brian M. Scott Oct 01 '20 at 00:25
  • @OliverDiaz Follow Brian M. Scott's suggestion. Choose which element of the codomain is the image of two elements of the domain. Choose which two elements of the domain map to that element. Map the remaining three elements to the remaining three elements of the codomain so that each of the remaining elements in the codomain is the image of exactly one element of the domain. – N. F. Taussig Oct 01 '20 at 00:44
  • Precisely one pair of elements in the domain will map to the same element, so you need to choose which pair, and then choose a bijection between sets of size $4$ (e.g. ${0,1,{2,3},4}\to {0,1,2,3}$). Each combination of a pair and a bijection gives you a different surjection, so you just need to multiply the number of pairs by the number of bijections. – tkf Oct 01 '20 at 01:12
  • 1
  • This is a related posting – Mittens Oct 01 '20 at 01:56

1 Answers1

0

Rule: If A and B are two sets having $m$ and $n$ elements respectively such that $1≤n≤m$, then $$\text{number of surjection} ~=\sum_{r=1}^n(-1)^{n-r}~ {}^{n}\text{C}_r ~r^m~.$$

Here A$=\{0,1,2,3,4\}~$ B$=\{0,1,2,3\}~,$ hence $~m=5~,~ ~n=4~$ and clearly, $~1≤n≤m~.$

Therefore the number of surjection from A to B
$=\sum_{r=1}^4(-1)^{4-r}~ {}^{4}\text{C}_r ~r^5\\=(-1)^{3}~ {}^{4}\text{C}_1 ~1^5+(-1)^{2}~ {}^{4}\text{C}_2 ~2^5+(-1)^{1}~ {}^{4}\text{C}_3 ~3^5+(-1)^{0}~ {}^{4}\text{C}_4 ~4^5\\=-4+192-972+1024\\=240$

nmasanta
  • 9,222