-4

Let $A=\{1,2,3,4\}$
Let $B= \{a,b\}$
Let $C= \{ \text{hiking, baseball, hockey} \}$

a) How many onto functions from A to B $(1,a) (1,b) (2,a) (2,b) (3,a) (3,b) (4,a) (4,b)$ Thus 8.

b) How many onto functions are there from A to C? This is where I am lost. Would I just count the non-onto functions???

skyking
  • 17,080
  • How many things can 1 be mapped to. How may things can 2 be mapped to? 3? 4? How many total combinations. – fleablood Jul 18 '16 at 05:49

2 Answers2

2

First of all your answer to (a) is incorrect. The correct answer there is $14$, there are $16$ functions from $A$ to $B$, but two of these (the one that maps everything to $a$ and the one that maps everything to $b$) are not onto.

For the second you do similar. The number of maps from $A$ to $C$ is $3^4 = 81$, but from this you have to exclude mappings that is not onto. These are those that are mapping from $A$ to a proper subset of $C$.

Now of course counting mapping to proper subsets of $C$ means counting the same mapping twice as the mappings to $\{hiking, baseball\}$ and $\{baseball, hockey\}$ both include mappings to $\{baseball\}$ which means you're going to use exclusion-inclusion principle.

So the mappings to each subset containing two elements are $2^4 = 16$ and there's three of these and the mappings to each subset containing one element are each $1^4=1$ and there's three of theese.

So the number of mappings are $3^4 - 3\cdot 2^4 + 3\cdot 1^4 =36$

skyking
  • 17,080
2

a) This amounts to sampling from the set $\{a,b\}$, 4 times with replacement and with ordering. Thus, there are $2\times2\times2\times2=2^4=16$ possible functions. The 16 possibilities are:

$\{(1,a),(2,a),(3,a),(4,a)\},\\ \{(1,b),(2,a),(3,a),(4,a)\},\\ \{(1,a),(2,b),(3,a),(4,a)\},\\ \{(1,a),(2,a),(3,b),(4,a)\},\\ \{(1,a),(2,a),(3,a),(4,b)\},\\ \{(1,b),(2,b),(3,a),(4,a)\},\\ \{(1,a),(2,b),(3,b),(4,a)\},\\ \{(1,a),(2,a),(3,b),(4,b)\},\\ \{(1,b),(2,a),(3,b),(4,a)\},\\ \{(1,a),(2,b),(3,a),(4,b)\},\\ \{(1,b),(2,a),(3,a),(4,b)\},\\ \{(1,b),(2,b),(3,b),(4,a)\},\\ \{(1,a),(2,b),(3,b),(4,b)\},\\ \{(1,b),(2,a),(3,b),(4,b)\},\\ \{(1,b),(2,b),(3,a),(4,b)\},\\ \{(1,b),(2,b),(3,b),(4,b)\}$

However, there are two mappings that are not onto - the first and last in the list. So, there are 14 possible onto functions.

(b) The second case is similar. Note that the set B has three elements.

The required number of mappings = Total number of possibilities - functions that are not onto

= Total number of functions from A to C - (onto functions from A to C, considering only two elements of C at a time)

= Total number of functions from A to C - (total number of functions from A to C, considering only two elements of C, at a time - functions that are not onto)

= $3^4 - {3\choose2}({2^4}-1)=81-3(16-1)=36$

Quasar
  • 5,644
  • 1
    Observe that for the first case divide $4$ into two partitions such as $4 = 3 + 1 = 2 + 2 = 1 + 3$.Then according to the partition first choose any $3$ elements from $A$ and maps it to $a$, then choose remaining element and maps it to $b$ which is possible in $4C3$ ways.Then choose any two elements from $A$ and maps it to $a$ and remaining two elements to $b$ which is possible in $4C2$ ways and at last choose anyone element from $A$ randomly and maps it to $a$, then remaining elements to $b$ which is possible in $4C1$ ways.So, the total number of ways are $4C1 + 4C2 +4C3 = 2^4 - 2 = 14$ –  Jul 18 '16 at 15:54
  • 1
    For the second part divide $4$ into $3$ partitions such as $4 = 2 + 1 + 1 = 1 + 2 + 1 = 1 –  Jul 18 '16 at 16:02
  • 1
    For the second part divide $4$ into $3$ partitions such as $4 = 2 + 1 + 1 = 1 + 2 + 1 = 1 + 1 + 2$ and try accordingly. In this case the total number of mapping should be $4C2 \times 2C1 + 4C1 \times 3C1 + 4C1 \times 3C1 = 3 \times 12 = 36$. –  Jul 18 '16 at 16:12
  • That's brilliant, I never thought that way, you know! – Quasar Jul 19 '16 at 00:50