Let $S = \{1,2,3,4,5\}$ How many bijective functions $f:S \to S$ do we have such that $f(x) \neq x$ for all $x\in S$?
I was trying to solve by taking the total number of such functions and subtract all the cases where $f(x) = x$.
$5!$ is all cases
$4!$ is where one $f(x)=x$ and rest are not
$3!$ is where two $f(x)=x$ and rest are not
$2!$ is where three $f(x)=x$ and rest are not
$1!$ is where all five $f(x)=x$
so $5!-(4!-3!-2!-1)$.
But then I realized that, for example, $4!$ contains also the case where all $f(x)=x$ which mean I am subtracting too much.