TITLE: Number of one-one function from sets $A$ to $B$.
QUESTION [2 upvotes]: Let $A=\{1,2,3,4,5\}$ and $B=\{0,1,2,3,4,5\}$. Number of one-one function from $A$ to $B$ such that $f(1) \neq 0$ and $f(i)\neq i$ for $i={1,2,3,4,5}$ is _______ .
So I know one one function means for each $x$ there will be only one $y$. 
But here if I take for $1$ from $A$ then total number of functions $=480$ as ${{4_C}_1}×{{5_P}_4}$
But for every for every other $i$ from $A$ it will be ${{5_C}_1}×{{5_P}_4}$  so total cases will be $480+2400=2880$. 
But I don't know how to further proceed.

REPLY [1 votes]: Definition.  A number $c$ is said to be a fixed point of a function if $f(c) = c$.
Let $A = \{1, 2, 3, 4, 5\}$; let $B = \{0, 1, 2, 3, 4, 5\}$.
If there were no restrictions, we would have $6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 = 6!$ ways to map the elements in the domain to distinct elements in the codomain.  Hence, there are $6!$ injective functions $f: A \to B$.  From these, we must exclude those that violate the restrictions that $f(0) \neq 1$ and that $f(i) \neq i, 1 \leq i \leq 5$.
We will use the Inclusion-Exclusion Principle.
A number in the domain is mapped to a prohibited value of the codomain:  We consider two cases, depending on whether or not that number is $1$.  
The number $1$ is mapped to $0$ or $1$:  There are two ways to choose the image of $1$.  That leaves five elements in the codomain to which the remaining four numbers in the domain can be mapped.  The remaining numbers in the domain can be mapped to distinct elements of that subset of the codomain in $5 \cdot 4 \cdot 3 \cdot 2 = 5!$ ways.  Hence, there are 
$$\binom{2}{1}5!$$
such injective functions.
A number other than $1$ is a fixed point:  There are four ways to choose which of the four numbers larger than $1$ is a fixed point.  That leaves five numbers in the codomain to which the remaining four elements in the domain can be mapped. The remaining numbers in the domain can be mapped to distinct elements of that subset of the codomain in $5!$ ways.  Hence, there are 
$$\binom{4}{1}5!$$
such injective functions.
Hence, there are 
$$\binom{2}{1}5! + \binom{4}{1}5!$$
injective functions in which a number in the codomain is mapped to a prohibited element of the codomain.
Two numbers in the domain are mapped to probibited values of the codomain:  We again have to consider two cases, depending on whether or not $1$ is one of the numbers that is mapped to a prohibited value.
The number $1$ is mapped to $0$ or $1$ and another number is a fixed point:  There are $2$ ways to choose the image of $1$ and four ways to pick which of the other four numbers in the codomain is a fixed point.  That leaves four numbers in the codomain to which the remaining three elements in the codomain can be mapped.  The remaining numbers in the domain can be mapped to distinct elements of that subset of the codomain in $4 \cdot 3 \cdot 2 = 4!$ ways.  Hence, there are 
$$\binom{2}{1}\binom{4}{1}4!$$
such injective functions.
Two numbers larger than $1$ are fixed points:  There are $\binom{4}{2}$ ways to choose the two fixed points.  That leaves four numbers in the codomain to which the remaining three elements in the domain can be mapped.  The remaining numbers in the domain can be mapped to distinct elements that subset of the codomain in $4!$ ways.  Hence, there are 
$$\binom{4}{2}4!$$
such injective functions.
Three numbers in the domain are mapped to prohibited values of the codomain:  As above, we have two cases.
The number $1$ is mapped to $0$ or $1$ and two other numbers are fixed points:  We choose the image of $1$ and which two of the other four numbers are fixed points.  That leaves three elements in the codomain to which the remaining two elements in the domain can be mapped.  We choose how to map those two elements to distinct elements of that subset of the codomain.  There are 

 $$\binom{2}{1}\binom{4}{2}3!$$

such injective functions.
Three numbers larger than $1$ are fixed points:  We choose which three of those four numbers are fixed points.  That leaves three elements in the codomain to which the remaining two elements in the domain can be mapped.  We choose how to map those two elements to distinct elements of that subset of the codomain.  There are 

 $$\binom{4}{3}3!$$

such injective functions.    
Hence, there are 

 $$\binom{2}{1}\binom{4}{2}3! + \binom{4}{3}3!$$

injective functions in which three numbers in the domain are mapped to prohibited elements in the codomain.
Four elements in the domain are mapped to prohibited values in the codomain:  Again, there are two cases.  
The number $1$ is mapped to $0$ or $1$ and three of the other four numbers are fixed points:  Choose the image of $1$ and which three of the other four numbers are fixed points.  Assign the remaining number in the domain to one of the two remaining numbers in the codomain.  There are 

 $$\binom{2}{1}\binom{4}{3}2!$$

such injective functions.
All four numbers larger than $1$ are fixed points:  That leaves two ways to assign $1$ to one of the remaining elements in the codomain (yes, we have already counted this case, but the Inclusion-Exclusion Principle compensates for that).  There are

 $$\binom{4}{4}2!$$

such injective functions.
Hence, there are

 $$\binom{2}{1}\binom{4}{3}2! + \binom{4}{4}2!$$

injective functions in which four elements of the domain are mapped to probibited elements of the codomain.
All five elements of the domain are mapped to prohibited values in the codomain: There are two possibilities.  Either $1$ is mapped to $0$ and the other four numbers are fixed points or all five numbers are fixed points.  There are 

 $$\binom{2}{1}\binom{4}{4}$$

such functions.
By the Inclusion-Exclusion Principle, the number of injective functions $f: A \to B$ such that $f(1) \neq 0$ and $f(i) \neq i, 1 \leq i \leq 5$, is 

 $$6! - \binom{2}{1}5! - \binom{4}{1}5! + \binom{2}{1}\binom{4}{1}4! + \binom{4}{2}4! - \binom{2}{1}\binom{4}{2}3! - \binom{4}{3}3! + \binom{2}{1}\binom{4}{3}2! + \binom{4}{4}2! - \binom{2}{1}\binom{4}{4}$$
{"set_name": "stack_exchange", "score": 2, "question_id": 3028709}