Pigeonholes and onto functions 
I've been scratching my head at this problem for a while and can't seem to figure out why the number of pigeonholes is

$3^5 - C(3, 2)2^5 + C(3, 1)1^5$ 

and not 

$3^5 - C(3, 2)2^5 - C(3, 1)1^5$ 

Could my profs answer key be wrong or is there something that I am missing. Because I believe that you have to subtract $3$ in the end since there is a case in which only $1$ is selected from the target as range. 
 A: We want to count the number of surjective (onto) functions from a set with five elements to a set with three elements.
If there were no restrictions, each of the five elements in the domain could be mapped to one of the three elements in the codomain, so there are $3^5$ possible functions.  From these, we must exclude those with fewer than three elements in their range.
There are $\binom{3}{1}$ ways to exclude an element of the codomain from the range and $2^5$ ways to map the five elements of the domain to the remaining elements in the codomain.  Hence, there are $\binom{3}{1}2^5$ functions that exclude an element of the codomain from the range.
However, if we subtract these functions from the total, we will have subtracted each function that excludes two elements of the codomain from the range twice, once for each way we could have designated one of those elements as the excluded element.  We only want to subtract them once, so we must add them back.
There are $\binom{3}{2}$ ways to exclude two elements of the codomain from the range and $1^5$ ways to map the five elements of the domain to the remaining element of the codomain.  Hence, there are $\binom{3}{2}1^5$ functions that exclude two elements of the codomain from the range.
Hence, by the Inclusion-Exclusion Principle, the number of surjective 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$$
