How many functions from $\{0,1\} \times \{0,1\}$ to $\{0,1,2\}$ are there? The question in my homework is: 

How many functions from $\{0,1\} \times \{0,1\}$ to $\{0,1,2\}$ are there? How many are one-to-one? How many are onto?

My first step was to take the Cartesian Product of $\{0,1\} \times \{0,1\}$ in order to get a set
$$A = \{(0,0),(0,1),(1,0),(1,1)\}$$
However I am unsure what to do next. Any help would be greatly appreciated
 A: There's a very very easy way to count how many functions exist from A to B - how many elements does A have? For each element of A, how many different elements of B are there it could map to? Thus, how many total different mappings are there from A to B?
For one-to-one functions, what does that imply? Is it possible to take every element in A and map it to a different element of B?
For onto functions, I can't offhand think of a good way to enumerate them other than to just list all the functions and mark off which ones are onto. You could possibly do it in the other direction by counting how many functions there are such that a given element of B isn't in the image of the function, but then you risk double-counting. Thankfully, the number of possible functions is pretty small.
A: We count the onto functions. In general, one would use an Inclusion/Exclusion argument, but in our case we can get away with a simpler approach.
If our function is onto, it must map two of the four elements of $A$ to the same thing, and the other two to different things.
The two elements that will be mapped to the same thing can be chosen in $\binom{4}{2}$ ways. The object that they are mapped to can  be chosen in $3$ ways, for a total of $\binom{4}{2}\cdot 3$. 
For each of these ways, there are $2$ ways to choose where one of the remaining elements of $A$ goes, and now the function is determined. So there are $\binom{4}{2}\cdot 3\cdot 2$ onto functions.
