Q:

Total number of functions $f\colon S\to S$ where $S=\{1,2,3,4\}$

I missed a lecture on this topic and I'm having a hard time figuring out how this discrete function works. I'm given $S=\{1,2,3,4\}$ and $F =$ all functions from $S$ to $S$.
What does this mean?
I get that the domain and codomain must be $\{1,2,3,4\}$ but how do I define/figure out every function that goes from $S \to S\,$?

A:

The general idea is that we're absolutely free to choose where to send each element element of $S = \{1,2,3,4\}$. So, we can "build up" any function $f: S \to S$ starting by choosing where to send $1$.
$$1\ \overset{f}{\longmapsto}\ ??\quad (\text{four choices})$$
Now, once we've chosen where to send $1$, we get to choose where to send $2$:
$$2\ \overset{f}{\longmapsto}\ ??\quad (\text{four choices}),$$
and we would continue on, choosing where to send $3$ and $4$ as well.
In fact, if you think for a bit, you should decide that any list $(a_1, a_2, a_3, a_4)$ of four things in $S$ determines a function:
$$\begin{pmatrix}1 &2&3&4\\a_1&a_2&a_3&a_4\end{pmatrix},$$
where writing $a_1$ below $1$ means that $f(1) = a_1$.

