8

True or false: The number of functions from $[5]$ to $[5]$ such that $f(f(i)) \neq i $ for $ i=1, \ldots 5$ is $44.$

(Here $[5] = \{1,2,3,4,5\}.)$

The number of derangements on $5$ elements is $44$ but the functions in question are clearly not just derangements, since the existence of $x, y$ such that $f(x)=y$ and $f(y)=x$ is also prohibited. Further, there is no restriction on $f$ to be bijective.

My attempt: for each function $f,$ define $g= f^2$ and count functions $g: [5] \to [5]$ such that $g(i) \neq i$ by inclusion-exclusion as follows: $5^5 -\binom{5}{1}(4^4) + \binom{5}{2}(3^3)- \ldots $ and so on. The problem though is that the set of $g's$ aren't in bijective correspondence with the set of $f's$ and I'm not convinced that the expression I have above is right because the resultant answer is too large.

Any help would be appreciated.

Aryaman Jal
  • 1,533

2 Answers2

6

According to OEIS's A134362, for $[5]$ it should be $444$. A general formula for the number of functions $f:[n]\to[n]$ such that for every $x\in[n]$, $f(f(x)) \not =x$ is $$n!\sum_{k=0}^{\lfloor n/2\rfloor}(-1)^k\cdot\frac{(n-1)^{n-2k}}{2^k k!(n-2k)!}.$$

P.S. Note that such $f$ are not necessarily injective: $$[1,2,3,4,5]\stackrel{f}{\to} [2, 3, 1, 1, 1]\stackrel{f}{\to} [3, 1, 2, 2, 2]$$

A proof for this formula by Marco Riedl is alredy published at math.stackoverflow.

miracle173
  • 11,049
Robert Z
  • 145,942
4

The condition $f(f(i)) \neq i$ will imply bijectivity. There are indeed $44$ derrangements of $[5]$, there are $24$ of the "flavour" $(abcde)$ and $20$ of the "flavour" $(ab)(cde)$. The latter "flavour" will not satisfy the condtion $f(f(i)) \neq i$. So there are $\color{blue}{24}$ functions on $[5]$ whose second iterated map also has no fixed points.

Edit : Double functions with no fixed points.

On a three element set there are $2$ functions of the form $ a \rightarrow b \rightarrow c \rightarrow a $. ($a \neq b \neq c \neq a$)

On $[4]$, there are $6$ of the form $ a \rightarrow b \rightarrow c \rightarrow d \rightarrow a$ & there are $24$ of the form $ a \rightarrow b \rightarrow c \rightarrow d \rightarrow b$. So $30$ in toto.

On $[5]$,

There are $24$ of the form $ a \rightarrow b \rightarrow c \rightarrow d \rightarrow e \rightarrow a$

There are $120$ of the form $ a \rightarrow b \rightarrow c \rightarrow d \rightarrow e \rightarrow b$

There are $120$ of the form $ a \rightarrow b \rightarrow c \rightarrow d \rightarrow e \rightarrow c$

There are $60$ of the form $ a \text{ and } b \rightarrow c \rightarrow d \rightarrow e \rightarrow c$

There are $120$ of the form $ a \rightarrow c , b \text{ and } c \rightarrow d \rightarrow e \rightarrow c$

So there are $444$ in toto.

Donald Splutterwit
  • 36,613
  • 2
  • 26
  • 73