Let $A= { x_1 , x_2 , x_3 , x_4 ,x_5 }$ , $B = { y_1 , y_2 , y_3 , y_4 , y_5 }$ , then find the number of one-one functions from $A$ to $B$ such that Let $A= \{ x_1 , x_2 , x_3 , x_4 ,x_5 \}$ , $B = \{ y_1 , y_2 , y_3 , y_4 , y_5 \}$ , then find the number of one-one functions from $A$ to $B$ such that $f(x_i) \ne {y_i}$ where $i = 1,2,3,4,5$ .
So we know that number of one-one functions are $nPm$ where $m$ and $n$ elements are in sets $A$ and $B$ . But in this question $f(x_i) \ne {y_i}$ so i tried to exclude them from total number of one-one function . But this will go very lengthy . I know we can do this by permutation and combination but i studied it a long time ago and do not remember all the concepts clearly . 
 A: Let $K(n)$ be the number of one-to-one maps  $ m: \{ 1, 2, \ldots n \} \leftrightarrow
\{ 1, 2, \ldots n \}$ such that for all $i\leq n$, $m(i) \neq i$.  
(The question wishes to find $K(5)$.)
Let  $J(n)$ be the number of one-to-one maps  $ m: \{ 1, 2, \ldots n \} \leftrightarrow
\{ 1, 2, \ldots n \}$ such that for some (at least one) $i\leq n$, $m(i) = i$. 
And let $P(n)$ be the number of one-to-one maps  $ m: \{ 1, 2, \ldots n \} \leftrightarrow
\{ 1, 2, \ldots n \}$.
$$
P(n) = n! =  K(n) + J(n) $$
Then $K(1) = 0$, $J(1) = 1$, and for all $n>1$:
$$ J(n) = \sum_{k=1}^{n-1} \binom{n}{k} K(n-k) +1\\
K(n) = n! - J(n)
$$
To explain that first equation in words, "to end up with one or more matches, you pick the number of matches ($k$) you want to have, then pick the identities of those $k$ matches among the $n$ possibilities, then find some arrangement of the remaining $n-k$ numbers that gives you no more matches."  The one at the end corresponds to choosing to match all $n$ numbers (the identity map); we could equally well instead have extended the sum to $k=n$ if we defined $K(0) = 1$.
Then $$
\begin{array}{ccc}
n&J(n) & K(n) \\ 
\hline
1 & 1 & 1!-1 = 0\\
2 & \binom{2}{1} 0 + 1 = 1 & 2!-1 = 1 \\
3 & \binom{3}{1} 2 + \binom{3}{2} 0+ 1 = 4 & 3!-4 = 2 \\
4 & \binom{4}{1} 2 + \binom{4}{2} 1+ \binom{4}{3} 0+ 1 = 15 & 4!-15 = 9 \\
5 & \binom{5}{1} 9 + \binom{5}{2} 2+ \binom{5}{3} 1+ 1 = 76 & 5!-76 = 44 \\
\end{array}
$$
THe $K(n)$ are called derangement numbers, and as you see, $K(5) = 44$.
A: 
 44 mappings

Begin with $5!$ possible mappings.
Now, subtract out all mappings with at least one fixed point. There will be $5 \cdot 4!$ of these.
In doing this, mappings with two fixed points were subtracted twice, so we add them back in. There are $ \binom{5}{2} \cdot 3!$ options here.
Similarly, we've now added in mappings with 3 fixed points too many times, so we subtract those back out. There are $ \binom{5}{3} \cdot 2!$ of those.
We continue this addition and subtraction (formally, the Principle of Inclusion-Exclusion - similar to counting cases in Venn diagrams) until finally we have the correct number of mappings:

$$ 5! - 5 \cdot 4! + 10 \cdot 3! - 10 \cdot 2! + 5 \cdot 1! - 1 = 120 - 120 + 60 - 20 + 5 - 1 = \textbf{44}.$$

A: I think you are on the right track. Exclude from the permutation the following:


*

*Maps that fix five elements, or maps fix four elements and permute one; We can see these are just the identity. 


Let's say we map each element $12345$ from $A$ to $B$ in the order: $12345$. This is the only way for this case.


*Maps that fix three elements and permute two; How many are there?


For example, the order of set $B$ could be: 
$$12354 (\text{ fix }123), 15342 (\text{ fix } 134), \dots$$


*Maps that fix two elements and permute three; These have to be cycles on the three; How many are there?


For example, fix $12$, cycle on $345$, you can get
$$12453, 12534$$
If they are not cycle, you will have to fix another element, which will be the same as case 2 or 1. 
Continue with this pattern, you should be able to find the numbers.
A: Permutations without fixed points are called derangements. The number of derangements of an $n$-element set is also called the subfactorial of $n$, written $!n$, and this wikipedia link gives recursion equations for $!n$, using which you will find that $!5 = 44$. See also http://oeis.org/A000166.
