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.
Let $F$ denote the set of all functions $\{1,2,3,4,5\}\to\{1,2,3\}$. 

For $i=1,2,3$ let $F\_i\subset F$ denote the functions in $F$ that have not $i$ in their image. 

Then you are looking for: $$|F|-|F\_1\cup F\_2\cup F\_3|=3^5-|F\_1\cup F\_2\cup F\_3|$$

Term $|F\_1\cup F\_2\cup F\_3|$ can be found by means of [inclusion/exclusion](https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle) combined with symmetry:$$|F\_1\cup F\_2\cup F\_3|=\binom31|F\_1|-\binom32|F\_1\cap F\_2|=3\cdot2^5-3\cdot1^5$$