3

Consider functions from a set with $5$ elements to a set with $3$ elements.
(a) How many functions are there?
(b) How many are one-to-one?
(c) How many are onto?

a) Each element mapped to $3$ images.
$3 \cdot 3 \cdot 3 \cdot 3 \cdot 3$

b) $0$

c) How do I do this?

Edit: I tried doing this way.

EDIT: There can be a set of cardinality {3,1,1} or {2,2,1}.

For {3,1,1}: 5C3 * 2C1 * 1C1 * 3!

For {2,2,1}: 5C2 * 3C2 * 1C1 * 3!

And i realized my 3! is wrong. Should be * 3 only. Why is that so?

RStyle
  • 607
  • 1
    Possible duplicate of Number of onto functions –  Apr 28 '16 at 10:55
  • The number of partitions of the form $3, 1, 1$ is $\binom{5}{3}$ since a partition is completely determined by selecting which three of the five elements will be in the set of three elements. Notice that ${1, 2, 3}, {4}, {5}$ is the same partition as ${1, 2, 3}, {5}, {4}$ since we do not care about the order of the sets, just what is in them. The number of partitions of the form 2, 2, 1 is $\frac{1}{2} \binom{5}{2}\binom{3}{2}\binom{1}{1}$ since it does matter in which order we pick the two sets with two elements. You can verify these calculations by listing the partitions. – N. F. Taussig Apr 28 '16 at 12:16
  • As for the $3!$, it is correct. Once, we have a particular partition, such as ${1, 2}, {3, 4}, {5}$, we have three choices where to map the elements in ${1, 2}$, two remaining choices where to map the elements in ${3, 4}$, which leaves us with only one choice to which we can map $5$. – N. F. Taussig Apr 28 '16 at 12:21
  • I dont understand why {1,2,3}, {4},{5} is the same as {1,2,3}, {5},{4}. Doesn't this mean they are 2 different onto functions? {123} mapped to 1st image. {4} mapped to second image. {5} mapped to third is different from {123} mapped to 1st image. {5} mapped to second image. {4} mapped to third – RStyle Apr 28 '16 at 12:45
  • 1
    ${{1,2,3},{4},{5}}$ and ${{1,2,3},{5},{4}}$ are distinct notations for the same set, which is a partition of ${1,2,3,4,5}$. And $3!=6$ surjective functions ${1,2,3,4,5}\to{1,2,3}$ exist such that ${{1,2,3},{4},{5}}={{1,2,3},{5},{4}}={f^{-1}(\left{ 1\right} ),f^{-1}(\left{ 2\right} ),f^{-1}(\left{ 3\right} )}$. – drhab Apr 28 '16 at 18:55

2 Answers2

5

You correctly found that there are $3^5$ functions from a set with five elements to a set with three elements. However, this counts functions with fewer than three elements in the range. We must exclude those functions. To do so, we can use the Inclusion-Exclusion Principle.

There are $\binom{3}{1}$ ways of excluding one element in the codomain from the range and $2^5$ functions from a set with five elements to the remaining two elements in the codomain.

There are $\binom{3}{2}$ ways of excluding two elements in the codomain from the range and $1^5$ functions from a set with five elements to the remaining element in the codomain.

By the Inclusion-Exclusion Principle, the number of surjective (onto) functions from a set with five elements to a set with three elements is

$$3^5 - \binom{3}{1}2^5 + \binom{3}{2}1^5$$

N. F. Taussig
  • 76,571
3

Hint on c)

The "onto"-function will induce a partition of its domain (as any function) and this partition (actually the fibres of the function) will - because it is onto - have exactly $3$ elements. So to be found is in the first place how many such partitions exist. A fixed partition gives room for $3\times2\times1=6$ functions.

So you end up with: $$6\times\text{number of partitions on }\{1,2,3,4,5\}\text{ that have exactly }3\text{ elements}$$

Also have a look here (especially the counting of partitions).


A general formula for the number of onto-functions $\{1,\dots,n\}\to\{1,\dots,k\}$ is: $$k!S(n,k)$$where $S(n,k)$ stands for the Stirling number of the second kind.

drhab
  • 151,093
  • 1
    I had not thought of doing the problem this way until I read your solution. Once I got past the unfamiliar terminology (my knowledge is less sophisticated than yours) and counted the partitions, it made sense. Thanks for providing it. (+1) – N. F. Taussig Apr 28 '16 at 09:33