Checking to see if I am counting the functions correctly 
Assume that $S$ and $T$ are finite sets containing $m$ and $n$ elements, respectively.
(a) How many mappings are there from $S$ to $T$?
(b) How many one-to-one mappings are there from $S$ to $T$?

(a). Let $S = \{a, b, c\}$ and $T = \{1, 2, 3, 4\}$. Then for each one of $a, b, c$, there are four choices: $4 \cdot 4 \cdot  4 = 4^3.$ The same analysis holds for when $S$ and $T$ contain $m$ and $n$ elements, respectively: $n^m$.
(b). If $m > n$, then there are no one-to-one mapping from $S$ to $T$. Let $m \le n, S = \{1, 2, 3, \ldots, m\}$ and $T = \{1_a, 2_a, 3_a, \ldots, n\}$. Then for $1$, there are $n$ elements, for $2$, there are $n - 1$ elements since no two elements in $S$ can hit the same element in $T$; for $3$, there are $n - 2$ elements and so on: $n \cdot (n - 1)(n - 2) \cdot \ldots \cdot (n - m + 1)$ one-to-one mappings in total.

(a) How many mappings are there from a two-element set onto a two-element set?
(b) from a three-element set onto a two-element set?
(c) from an n-element set onto a two-element set?

(a). Let $A = \{a, b\}$ and $B = \{c, d\}$. There are two choices for $c$ and one choice for $d$ since we can't have two choices for $d$ because then we'd have a situation like $\{(a, c)(a, d)\}$ which is not a mapping. So there are two mappings from $A$ to $B$.
(b). The same analysis as in (a) applies here. There are $6$ mappings between the given sets.
(c). If $n < 2$, then there are no onto mappings. If $n > 2$, then we have the generalization of (b) above: $n \cdot (n - 1)$ onto elements between the given sets.
Please, see if that makes sense.
 A: Your answers to the first question are fine; note that you can simplify the second answer to $\frac{n!}{(n-m)!}$ or $\binom{n}mm!$. The latter can be understood as the number of ways to select $m$ targets and then choose a specific permutation of them.
For the second question, your answer to (a) is fine, but you have to work a little harder for (b) and (c). I’ll get you started on the general case, (c), when $n>2$. Let the domain be $A$ and the codomain be $\{0,1\}$. You can choose any non-empty proper subset $S$ of $A$ to be the set of points of $A$ mapped to $0$; $A\setminus S$ will then be a non-empty proper subset of $A$ that will be mapped to $1$. Once $S$ is chosen, the function is completely determined. Thus, the answer is the number of non-empty proper subsets of $A$. How many is that?
A: The number 6 for b is correct, but the logic in c is not and I suspect you followed the same in b.  Go back to the first problem where you found the number of mappings from S to T.  How many of these are not onto?
