0

I have a question that goes:

Find the number of functions $f:A \longrightarrow B$, such that the range contains exactly $3$ elements. Given that $n(A)= 4$ and $n(B)= 5$

Here's what I tried. Range has to have $3$ elements. So the way to choose $3$ elements out of $5$ is ${5 \choose 3} = 10$

Now, I faced a problem while trying to order the choices. What I tried to do was, use the stars and bars method to find the solutions to $$x_1+x_2+x_3=4$$ where,

$x_1=$ Number of elements in the domain mapped to 1st element in range

$x_2=$ Number of elements in the domain mapped to 2nd element in range

$x_3=$ Number of elements in the domain mapped to 3rd element in range

And the Answer would have been $10\times $(The number of solutions obtained for the above equation)

But the answer is said to be $360$ and my method doesn't work out, can someone point out where I went wrong?

Techie5879
  • 1,454

4 Answers4

1

Your approach is correct; you forgot that the three elements in the range can be arranged in $3!$ ways as first, second, third.

Hence answer should be $$\binom{5}{3} \times 3! \times \binom{4}{2}=360$$

Note that you're not looking for number of solutions to $x_1+x_2+x_3=4$. Rather the positive integral solutions of this equation : $(2,1,1)$ and its permutations; indicate the type of mapping. $(2,1,1)$ means exactly one element in the range maps to $2$ elements of the domain. Hence $\binom{4}{2}$ (onto) functions on any range.

cosmo5
  • 10,629
  • Yes I forgot to write positive integral solutions. In the equation $x_1+x_2+x_3=4$, we have $x_1 \geq 1$, $x_2 \geq 1$, $x_3 \geq 1$ Correct? – Techie5879 Mar 06 '21 at 15:44
  • Yes. But the point is we don't have to count the solutions. Please read the last paragraph. – cosmo5 Mar 06 '21 at 15:46
  • Yes I read it. Your ${4 \choose 2}$ comes as the number of positive integral solutions right? But I think thats the number of non-negative solutions, not positive, is it not? – Techie5879 Mar 06 '21 at 15:50
  • @Techie We understand that all mappings from A (say {1,2,3,4}) to B (say {a,b,c}) can be done in only one way namely, two elements in A map to single element in B while other two map to one each e.g., $1 \to a$, $2 \to b$, $3 \to c$, $4 \to a$. So number of maps is number of ways we can choose two elements of A to map to one element in B. ie, $\binom{4}{2}$. – cosmo5 Mar 06 '21 at 15:57
0

As you said, we first choose any three elements, which can be done in $\binom{5}{3}$ ways.

Now, you need to apply inclusion-exclusion principle, for mapping a set of $4$ elements to a set of $3$ elements. Basically, you only need to count the number of onto functions from a set of $4$ elements to a set of $3$ elements, which can be given by $$\sum_{k=0}^3 (-1)^k \binom{3}{k}(3-k)^4$$

Which evaluates to $36$, now multiplying this by $10$ gives $360$.

For calculating the number of onto functions from a set of $m$ elements to a set of $n$ elements, you may see this nice post.

V.G
  • 4,196
  • Why do we need the principle of inclusion exclusion here? – Techie5879 Mar 06 '21 at 15:29
  • Because, you have first fixed the three elements in the range. Now, you need to map all the four elements in the first set to all the three elements in the second set. Think about it, if you just said the number of ways would be $3^4$, would it be correct? No, because this includes the case when a particular element in the second set (from the choosen $3$) wasn't mapped. @Techie5879 – V.G Mar 06 '21 at 15:31
0

The solutions to the equation (with $x_1,x_2,x_3\geq 1$) are $(2,1,1)$, $(1,2,1)$, $(1,1,2)$, i.e. exactly one range element has two preimages.

  • choose range: $\binom{5}{3}$ choices
  • choose range element that has $2$ preimages: $3$ choices
  • choose two preimages for that element: $\binom{4}{2}$ choices
  • choose one preimage for second range element: $\binom{2}{1}$ choices

$$\binom{5}{3} \cdot 3 \cdot \binom{4}{2} \cdot \binom{2}{1} = 360$$

hgmath
  • 1,830
0

You cannot use stars and bars here, because the objects to be placed are assumed there to be indistinguishable. You should use the Stirling number of the second kind instead: $$ N=\binom53{4 \brace 3}3!=360, $$ where the factor $3!$ accounts for the fact that our "boxes" are also distinguishable.

user
  • 26,272