Originally Posted by

**Plato** Let’s say that $\displaystyle \left| A \right| = 5\;\& \;\left| B \right| = 9$ so there are $\displaystyle 9^5\ = 59049$ possible mappings $\displaystyle A\mapsto B$.

The set $\displaystyle B^A$, the set of all mappings $\displaystyle A\mapsto B$, has cardinality $\displaystyle \left| {B^A } \right| = \left| B \right|^{\left| A \right|}$. (The notation makes it easy to remember.)

Now the number of injections $\displaystyle A\mapsto B$ is $\displaystyle P(9,5) = \frac{{9!}}{{\left[ {9 - 5} \right]!}} = \left( 9 \right)\left( 8 \right)\left( 7 \right)\left( 6 \right)\left( 5 \right) = 15120$.

So the probability of randomly selecting an injection is $\displaystyle \frac {15120}{59049}$.