# Thread: Error in thought:How many onto functions there from a set of 4 element to 2 elements?

1. ## Error in thought:How many onto functions there from a set of 4 element to 2 elements?

There's a math problem in the book Discrete Mathematics with Applications(2nd Edition) by Susanna S. Epp is something like this:

How many onto functions are there from a set with four elements to a set with two elements?

Definition of onto function is:

Let $F$ be a function from a set $X$ to a set $Y$. $F$ is onto(or surjective) if, and only if, given any element $y$ in
$Y$ it is possible to find an element $x$ in $X$ with the property that $y = F(x)$.

Symbolically:

$F:X\to Y\; is\; onto\; \Leftrightarrow \forall y\in Y,\; \exists x\in X\; such\; that\; F(x)\; =\; y.$

Now back to the math problem. I did this.

Let the element of the domain be called $M = \{a,b,c,d\}$ and the elements of the co-domain be called
$N = \{u,v\}$ Now there $\binom{4}{2} + \binom{4}{2} = 6 + 6 = 12$ ways to select 2 elements of $M$ and and associate with set $N$. I added twice because there are two elements in $N$ and 1 for each element of $N$

Also there are $\binom{4}{3}+\binom{4}{3} = 4 + 4 = 8$ ways to select 3 elements of $M$ and associate with set $N$. Again because there are two elements in $N$ and added twice.

So the total number of onto function from a set with four elements to a set with two elements is: $12 + 8 = 20$. But the answer in the book is $14$.

What am i doing wrong? Is it possible for someone to kindly look into the problem and figure out the error in my thinking?

2. ## Re: Error in thought:How many onto functions there from a set of 4 element to 2 eleme

Originally Posted by x3bnm
So the total number of onto function from a set with four elements to a set with two elements is: $12 + 8 = 20$. But the answer in the book is $14$.
Consider $A=\{1,2,3,4\},\;B=\{a,b\}$ then, any map $f:A\to B$ can be considered as an arrangement , for example $aaaa,\;aaab,\ldots, \;baab,\ldots,bbbb$ . All are onto except $aaaa$ and $bbbb$ . Hence, we have $2^4-2=14$ onto maps.

3. ## Re: Error in thought:How many onto functions there from a set of 4 element to 2 eleme

You are over counting by repeating some selections.

If $N\ge K$ then the number of surjection from a set of $N$ elements to a set of $K$ is:
${\text{Surj}}(N,K) = \sum\limits_{j = 0}^K {\left( { - 1} \right)^j \binom{K}{j}\left( {K - j} \right)^N }.$

So $\text{Surj}(4,2)=14$.

4. ## Re: Error in thought:How many onto functions there from a set of 4 element to 2 eleme

Thanks FernandoRevilla and Plato for explanation.

Plato you're right i'm counting some selection multiple times. My mistake. Sorry. Thanks again.

5. ## Re: Error in thought:How many onto functions there from a set of 4 element to 2 eleme

Originally Posted by Plato
You are over counting by repeating some selections.

If $N\ge K$ then the number of surjection from a set of $N$ elements to a set of $K$ is:
${\text{Surj}}(N,K) = \sum\limits_{j = 0}^K {\left( { - 1} \right)^j \binom{K}{j}\left( {K - j} \right)^N }.$

So $\text{Surj}(4,2)=14$.
Sorry for reopening this thread but Plato how did you come up with this formula?

I can't find this formula in my book. Is there a proof somewhere?

I like to know it. My curious mind can't help it.

6. ## Re: Error in thought:How many onto functions there from a set of 4 element to 2 eleme

Originally Posted by x3bnm
I like to know it. My curious mind can't help it.
This is an example of using the inclusion/exclusion principle. I know that it is in Epp's book. Count the function that leave out one of the final set, the two of the final set, then three ETC. So we end up adding and subtracting each of those. I no longer have a copy of her book. But I am positive this idea is in that text.

7. ## Re: Error in thought:How many onto functions there from a set of 4 element to 2 eleme

Originally Posted by Plato
This is an example of using the inclusion/exclusion principle. I know that it is in Epp's book. Count the function that leave out one of the final set, the two of the final set, then three ETC. So we end up adding and subtracting each of those. I no longer have a copy of her book. But I am positive this idea is in that text.
Thanks Plato. It's on page 299-300 of Epp's book for those who are interested.