---
tag: 08QQH9F7G0
kind: statement
role: theorem
name: Number of functions between finite sets
msc: [05A05]
uses: [05099E1NMJ, 0VPK4X73Q0]
sources:
  - url: https://en.wikipedia.org/wiki/Exponentiation
    locator: Combinatorial interpretation
---

## Statement

Let $A$ and $B$ be finite sets with $|A| = m$ and $|B| = n$.
Let $B^A$ be the set of all functions from $A$ to $B$.
Then $|B^A| = n^m$.

## Remarks

The case $m = 0$ gives $n^0 = 1$: there is exactly one function from the empty set to $B$, also when $B$ is empty.
A function from $A$ to $B$ is a choice of one value in $B$ for each of the $m$ elements of $A$. The [[rule of product|0VPK4X73Q0]] then gives $n^m$.
For a subset count, take $B = \{0, 1\}$. This gives the [[number of subsets of a finite set|0C5RDJE73X]].

## Explanations

### L1 human

Each element of $A$ independently chooses its image among the $n$ elements of $B$.
For example, there are $3^2 = 9$ functions from $\{1, 2\}$ to $\{a, b, c\}$, because $1$ has 3 choices and $2$ has 3 choices.
