Question: > 
> In class we learned the number of functions from an $m$-element set to an $n$-element set is $n^{m}$. So this answer should be $5^{3}$? 
> 
> 
> 

I just need confirmation if my answer is correct, if not explain to me why it's not.

Answer: 
**hint**

From the total number of functions $3^5$ subtract the number of functions which are NOT onto. Suppose your target set is $\{a,b,c\}$. Then 

1. There are only $3$ functions with range as singletons, for example everything mapping to $a$.
2. Now count the number of functions whose range is **of the form** $\{a,b\}$. This will be $3(2^5-2)=90$ (Think why?).

In general, inclusion-exclusion principle is used for such problems.
First split $[5]$ into $3$ nonempty blocks, then assign values from $[3]$ to these blocks in $3!=6$ ways. The number of splittings is the *[Stirling number of the second kind](https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind)* $S(5,3)$. It is obtained as follows:

The blocks can have sizes (a) $3,1,1$ or (b) $2,2,1$. In case (a) the large block can be formed in ${5\choose 3}=10$ ways. In case (b) the singleton can be chosen in $5$ ways, and the remaining four elements can then be paired in $3$ ways, makes $15$ splittings. 

It follows that $S(5,3)=25$, so that there are $25\cdot6=150$ surjective mappings $f:\>[5]\to[3]$.