Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my discrete mathematics class our notes say that between set A (having 6 elements) and set b (having 8 elements), there are $8^6$ distinct functions that can be formed, in other words: $|b|^{|a|}$ distinct functions. But no explanation is offered and I can't seem to figure out why this is true. Can anyone elaborate?

share|cite|improve this question
up vote 14 down vote accepted

Let set $A$ have $a$ elements and set $B$ have $b$ elements. Each element in $A$ has $b$ choices to be mapped to. Each such choice gives you a unique function. Since each element has $b$ choices, the total number of functions from $A$ to $B$ is $$\underbrace{b \times b \times b \times \cdots b}_{a \text{ times}} = b^a$$

share|cite|improve this answer

A function on a set involves running the function on every element of the set A, each one producing some result in the set B. So, for the first run, every element of A gets mapped to an element in B. The question becomes, how many different mappings, all using every element of the set A, can we come up with? Take this example, mapping a 2 element set A, to a 3 element set B. There are 9 different ways, all beginning with both 1 and 2, that result in some different combination of mappings over to B.

enter image description here

The number of functions from A to B is |B|^|A|, or $3^2$ = 9.

share|cite|improve this answer
Very thorough. Sadly I doubt the original poster will see it though. – Simon S Nov 8 '14 at 23:54
Very good graphical approach. Helped me understand that the number of functions from set A is the number of functions counted silmutanuously – DoubleOseven Mar 7 at 8:38

Let's say for concreteness that $A$ is the set $\{p,q,r,s,t,u\}$. Let's try to define a function $f:A\to B$.

What is $f(p)$? It could be any element of $B$, so we have 8 choices.

What is $f(q)$? It could be any element of $B$, so we have 8 choices.


What is $f(u)$? It could be any element of $B$, so we have 8 choices.

So there are $8\cdot8\cdot8\cdot8\cdot8\cdot8 = 8^6$ ways to choose values for $f$, and each possible set of choices defines a different function $f$. So that's how many functions there are.

share|cite|improve this answer

You know that a function gives a unique value for each entry, if the fuction $f\colon A\to B$ where $|A|=n, ~|B|=m$, then for $a\in A$, you have $m$ values to assign. then for every $a\in A$, you can take |B| values, since $|A|$ have $n$ elements, then you have $|B|^{|A|}$ choices.

share|cite|improve this answer

protected by Community Dec 10 '14 at 20:19

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.