How many injective functions from $\{5,6,7,8,9\}$ to itself map $5$ and $6$ to another number?

226 Views Asked by At

How many injective functions from $\{5,6,7,8,9\}$ to itself map $5$ to any number other than $5$ and $6$ to any other number than $6$?

Let $B=\{5,6,7,8,9\}, f:B\to B$.

I think we can solve this by inverting the problem, that is counting the number of injective functions where $5$ maps to $5$ and $6$ maps to $6$.

First there're $5!$ injective functions without restrictions. There're $4!$ functions where either $5\to 5$ or $6\to 6$ so there're $2\cdot 4!$ such functions in total. Lastly, there're $3!$ functions where both $5\to 5$ and $6\to 6$.

Therefore with restrictions the number of functions is: $$ 5! - 2\cdot 4! + 3! $$

I'm not sure whether I'm using the inclusion/exclusion principle correctly here.

2

There are 2 best solutions below

0
On BEST ANSWER

Your answer $$ 5! - 2\cdot 4! + 3! = 78$$ is correct.

You have counted all the permutations and applied the inclusion exclusion principle correctly.

0
On

Although I agree that using inclusion exclusion is the better approach here but i think it is still instructive if we try to count the number of desired injections directly.

Solution. We represent an injection by the ordered $5$-tuple $\left(f(5),f(6),f(7),f(8),f(9)\right)$ and let $S$ denote the set of all desired injections. Then we can partition the set $S$ as follows so that $$S = A_1\cup A_2\cup A_3\cup A_4 $$ where
$$A_1 = \{x\in S|f(5)\in\{7,8,9\}\text{ and }f(6)\in\{7,8,9\}\}$$ $$A_2 = \{x\in S|f(5)\in\{7,8,9\}\text{ and }f(6)\not\in\{7,8,9\}\}$$ $$A_3 = \{x\in S|f(5)\not\in\{7,8,9\}\text{ and }f(6)\in\{7,8,9\}\}$$ $$A_4 = \{x\in S|f(5)\not\in\{7,8,9\}\text{ and }f(6)\not\in\{7,8,9\}\}\text{}$$ then after a little thought it is not difficult to see that $$|S| = |A_1|+|A_2|+|A_3|+|A_4| = \binom{3}{2}\cdot(3!+3!)+\binom{3}{1}\cdot 3!+\binom{3}{1}\cdot 3!+3! = 78$$

and yes your solution is quite correct!