0

Consider sets $A=\left\{a,\:b,\:c,\:d\right\}$ and $B=\left\{1,\:2,\:3\right\}$. How many functions can be defined with domain $A$ and codomain $B$?

How would guess it is the cardinality of the power set of $A$ x $B$, but I'm lost on this one...

J. W. Tanner
  • 63,683
  • 4
  • 43
  • 88
  • Let $f:A\rightarrow B$ be one such map. Then you have either all points in A landing in just one point in B, or all points in A landing in any 2 points in B, and so on... – Soby Feb 22 '19 at 01:30
  • @thedilated No need for cases. For each element of the domain $A$, there are $|B|$ choices for its image, so we get $|B|^{|A|}$ functions total. – Austin Mohr Feb 22 '19 at 01:55

1 Answers1

2

Your guess is not correct. There are $3$ choices for $f(a)$, $3$ choices for $f(b)$, and so on. These choices are completely independent of one another, so there are a total of $3^4 = 81$ functions from $A$ into $B$. But if I correctly understand your question, you want the number of surjections.

So you have to subtract the number of functions that aren't surjections. There is one way to map a $4$-element set into a $1$-element set and you have three elements to choose from, so there are $3$ functions that map $A$ onto a single element of $B$.

There are $2^4=16$ ways to map a $4$-element set into a $2$-element set, but $2$ of those don't hit both elements, so there are $14$ ways to map a $4$-element set onto a $2$-element set. There are $3$ ways to choose a $2$-element subset of $B$ so there are $42$ functions from $A$ into $B$ that map into exactly $2$ elements of $B$.

Thus, of the $81$ total functions from $A$ into $B$, $45$ of them are not surjective. That means there are $36$ functions from $A$ onto $B$.

Robert Shore
  • 26,056
  • 3
  • 21
  • 49