Why does $B^A$, not $B\cdot A$, define set of all functions from set $A$ to set $B$? Let $A$ and $B$ be sets. Define $A = \{a, b\}$ and $B = \{x, y, z\}$.
According to my readings, the set of all functions from $A$ to $B$ can be defined by $|B|^{|A|}$. This would dictate that there are $3^2$ possible functions, or $9$ functions, from my example.
I do not understand why it would not instead be $|B| \cdot |A|$, or 6 functions. I do recognize that for a set $A$ of $n$ elements and a set $B$ of $m$ elements, each element from $A$ can be linked to $m$ elements from $B$.
For my above example, I am thinking the resultant functions would be defined by the following sequences:
$(a, x), (a, y), (a, z), (b, x), (b, y), (b, z)$
As I see it, there are $6$ possible sequences. Can someone explain to me what I am misunderstanding?
EDIT: beautiful, makes much more sense now. Thank you all.
 A: A function is a mapping from each of the domain set to a range set.
Therefore a function can be defined as a set of pairs which matches each domain element to a range element (i.e a single pair is not a function).
For each element in the domain (n elements) you are free to choose one of the elements in the range (m elements) and therefore there are that much functions:
$n*n*...*n = n^m$
In your example the different functions would be:
$\{(a,x),(b,x)\}$,
$\{(a,x),(b,y)\}$,
$\{(a,x),(b,z)\}$,
$\{(a,y),(b,x)\}$,
$\{(a,y),(b,y)\}$,
$\{(a,y),(b,z)\}$,
$\{(a,z),(b,x)\}$,
$\{(a,z),(b,y)\}$,
$\{(a,z),(b,z)\}$.
A: A function will tell you  which value of $B$ the function gives for each element of $A$. Nine examples of functions:
$$f_1(a)=x, \; f_1(b)=x$$
$$f_2(a)=x, \; f_2(b)=y$$
$$f_3(a)=x, \; f_3(b)=z$$
$$f_4(a)=y, \; f_4(b)=x$$
$$f_5(a)=y, \; f_5(b)=y$$
$$f_6(a)=y, \; f_6(b)=z$$
$$f_7(a)=z, \; f_7(b)=x$$
$$f_8(a)=z, \; f_8(b)=y$$
$$f_9(a)=z, \; f_9(b)=z$$
A: There are $9$ functions from $A$ to $B$ as that is the number $|B|^{|A|}$. Here they are:


*

*$a\mapsto x$, $b\mapsto x$

*$a\mapsto x$, $b\mapsto y$

*$a\mapsto x$, $b\mapsto z$

*$a\mapsto y$, $b\mapsto x$

*$a\mapsto y$, $b\mapsto y$

*$a\mapsto y$, $b\mapsto z$

*$a\mapsto z$, $b\mapsto x$

*$a\mapsto z$, $b\mapsto y$

*$a\mapsto z$, $b\mapsto z$ 

A: In your example, for each element in $A$ there are three choices for it's image under the function. There are two elements in $A$. So the total number of choices is $3 \cdot 3 = 3^2$. Maybe you are assuming the functions are injective, which need not be the case. 
