1-to-1 and onto functions What is the number of 1-to-1 functions: 


*

*mapping from the set $\{a, b, c, d\}$ to the set $\{0, 1, 2\}$? I got 6.

*mapping from the set $\{a, b, c, d\}$ to the set $\{0, 1, 2, 3\}$? I got 24.


What is the number of onto functions: 


*

*mapping from the set $\{a, b, c, d\}$ to the set $\{0, 1, 2\}$? I got 0.

*mapping from the set $\{a, b, c, d\}$ to the set $\{0, 1, 2, 3\}$? I got 24.


Are my answers correct? Thanks!
 A: There are no $1$-to-$1$ functions from $\{a,b,c,d\}$ to $\{0,1,2\}$: the pigeonhole principle tells you that if $f:A\to B$, where $A$ has $4$ elements and $B$ has $3$, there must be two different $x,y\in A$ such that $f(x)=f(y)$. Your answer to the second part of that question is correct, however: there are $4$ choices for $f(a)$, then $3$ remaining choices for $f(b)$, and so on, so that there are $4!=24$ possible functions altogether.
Your count of $4!=24$ functions from $\{a,b,c,d\}$ onto $\{0,1,2,3\}$ is also correct, but there are certainly functions from $\{a,b,c,d\}$ onto $\{0,1,2\}$. Such a function must send two elements of $\{a,b,c,d\}$ to the same element of $\{0,1,2\}$, and must send each of the remaining elements of $\{a,b,c,d\}$ to a different one of the two remaining elements of $\{0,1,2\}$. There are $\binom42=6$ ways to choose which two element of $\{a,b,c,d\}$ will have the same image under $f$, and $3$ ways to choose which element of $\{0,1,2\}$ will be that image. Then there are $2$ ways to assign values to the two remaining elements of $\{a,b,c,d\}$. Thus, there are altogether $6\cdot3\cdot2=36$ functiosn from $\{a,b,c,d\}$ onto $\{0,1,2\}$.
A: You first answer is wrong. There cannot be any 1-1 map from the a set with 4 elements into a set with 3 elements. The second is correct. i.e $4P_4=24$.
